View Javadoc

1   package org.ogf.saga.job.run;
2   
3   import org.apache.log4j.Logger;
4   import org.junit.Assert;
5   import org.junit.Test;
6   import org.ogf.saga.job.Job;
7   import org.ogf.saga.job.JobDescription;
8   import org.ogf.saga.job.base.JobBaseTest;
9   import org.ogf.saga.task.State;
10  
11  public class MinimalTest extends JobBaseTest {
12  	    private Logger logger = Logger.getLogger(this.getClass());
13  	    
14  	    public MinimalTest(String jobprotocol) throws Exception {
15  	        super(jobprotocol);
16  	    }
17  
18  	    /**
19  	     * Runs simple job and expects done status
20  	     */
21  	    @Test
22  	    public void test_run() throws Exception {
23  	        
24  	    	// prepare
25  	    	JobDescription desc = createSimpleJob();
26  	    	
27  	        // submit
28  	        Job job = runJob(desc);
29  	        logger.info(job.getAttribute(Job.JOBID));   // for detecting hang in run()
30  
31  	        // wait for the END
32  	        job.waitFor();
33  	        logger.info("Job finished.");               // for detecting hang in waitFor()
34  
35  	        // check job status
36  	        Assert.assertEquals(
37  	                State.DONE,
38  	                job.getState());
39  	    }
40  	
41  	
42  }