airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sma...@apache.org
Subject svn commit: r1476707 [2/2] - in /airavata/trunk: modules/gfac-core/ modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/ modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/utils/ modules/gfac-core/src/test/java/org/apa...
Date Sun, 28 Apr 2013 02:20:37 GMT
Modified: airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/JSDLGeneratorTest.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/JSDLGeneratorTest.java?rev=1476707&r1=1476706&r2=1476707&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/JSDLGeneratorTest.java
(original)
+++ airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/JSDLGeneratorTest.java
Sun Apr 28 02:20:36 2013
@@ -54,253 +54,240 @@ import org.apache.airavata.schemas.gfac.
 import org.apache.airavata.schemas.gfac.URIParameterType;
 import org.apache.airavata.schemas.gfac.UnicoreHostType;
 import org.apache.log4j.PropertyConfigurator;
-import org.ggf.schemas.jsdl.x2005.x11.jsdl.JobDefinitionDocument;
 import org.junit.Before;
 import org.junit.Test;
+import org.ogf.schemas.jsdl.JobDefinitionDocument;
 
 public class JSDLGeneratorTest {
 
-	public static final String[] hostArray = new String[] { "https://zam1161v01.zam.kfa-juelich.de:8002/INTEROP1/services/BESFactory?res=default_bes_factory"
};
-	public static final String gridftpAddress = "gsiftp://gridftp.blacklight.psc.teragrid.org:2811";
-	public static final String hostAddress = "zam1161v01.zam.kfa-juelich.de";
-	public static final String hostName = "DEMO-INTEROP-SITE";
-	public static final String scratchDir = "/scratch/msmemon/airavata";
-	
-	protected JobExecutionContext jobExecutionContext;
-
-	
-	@Test
-	public void testSerialJSDL() throws Exception{
-
-		JobTypeType jobType = JobTypeType.Factory.newInstance();
-		jobType.set(JobTypeType.SERIAL);
-		ApplicationContext appContext = getApplicationContext();
-		appContext.setApplicationDeploymentDescription(getApplicationDesc(jobType));
-		jobExecutionContext.setApplicationContext(appContext);
-
-		JobDefinitionDocument jobDefDoc = JSDLGenerator.buildJSDLInstance(jobExecutionContext);
-		
-		assertTrue (jobDefDoc.getJobDefinition().getJobDescription().getApplication().toString().contains("/bin/cat"));
-		assertTrue(jobDefDoc.getJobDefinition().getJobDescription().getDataStagingArray().length
> 2);
-		
-		assertTrue(jobDefDoc.getJobDefinition().getJobDescription().getJobIdentification().getJobProjectArray().length
> 0);
-		
-		assertFalse(JSDLUtils.getPOSIXApplication(jobDefDoc.getJobDefinition())==null);
-		
-		assertEquals("jsdl_stdout", JSDLUtils.getOrCreatePOSIXApplication(jobDefDoc.getJobDefinition()).getOutput().getStringValue().toString());
-		
-	}
-	
-	@Test
-	public void testMPIJSDL() throws Exception{
-		
-		JobTypeType jobType = JobTypeType.Factory.newInstance();
-		jobType.set(JobTypeType.MPI);
-		ApplicationContext appContext = getApplicationContext();
-		appContext.setApplicationDeploymentDescription(getApplicationDesc(jobType));
-		jobExecutionContext.setApplicationContext(appContext);
-		
-		JobDefinitionDocument jobDefDoc = JSDLGenerator.buildJSDLInstance(jobExecutionContext);
-		
-		assertTrue (jobDefDoc.getJobDefinition().getJobDescription().getApplication().toString().contains("/bin/cat"));
-		assertTrue(jobDefDoc.getJobDefinition().getJobDescription().getDataStagingArray().length
> 2);
-		
-		assertTrue(jobDefDoc.getJobDefinition().getJobDescription().getJobIdentification().getJobProjectArray().length
> 0);
-		
-		assertEquals("jsdl_stdout", JSDLUtils.getOrCreateSPMDApplication(jobDefDoc.getJobDefinition()).getOutput().getStringValue().toString());
-		
-		assertFalse(JSDLUtils.getSPMDApplication(jobDefDoc.getJobDefinition())==null);
-		
-		
-	}
+    public static final String[] hostArray = new String[] { "https://zam1161v01.zam.kfa-juelich.de:8002/INTEROP1/services/BESFactory?res=default_bes_factory"
};
+    public static final String gridftpAddress = "gsiftp://gridftp.blacklight.psc.teragrid.org:2811";
+    public static final String hostAddress = "zam1161v01.zam.kfa-juelich.de";
+    public static final String hostName = "DEMO-INTEROP-SITE";
+    public static final String scratchDir = "/scratch/msmemon/airavata";
 
-	protected GFacConfiguration getGFACConfig() throws Exception{
+    protected JobExecutionContext jobExecutionContext;
+
+    @Test
+    public void testSerialJSDL() throws Exception {
+
+        JobTypeType jobType = JobTypeType.Factory.newInstance();
+        jobType.set(JobTypeType.SERIAL);
+        ApplicationContext appContext = getApplicationContext();
+        appContext.setApplicationDeploymentDescription(getApplicationDesc(jobType));
+        jobExecutionContext.setApplicationContext(appContext);
+
+        JobDefinitionDocument jobDefDoc = JSDLGenerator.buildJSDLInstance(jobExecutionContext);
+
+        assertTrue(jobDefDoc.getJobDefinition().getJobDescription().getApplication().toString().contains("/bin/cat"));
+        assertTrue(jobDefDoc.getJobDefinition().getJobDescription().getDataStagingArray().length
> 2);
+
+        assertTrue(jobDefDoc.getJobDefinition().getJobDescription().getJobIdentification().getJobProjectArray().length
> 0);
+
+        assertFalse(JSDLUtils.getPOSIXApplication(jobDefDoc.getJobDefinition()) == null);
+
+        assertEquals("jsdl_stdout", JSDLUtils.getOrCreatePOSIXApplication(jobDefDoc.getJobDefinition()).getOutput()
+                .getStringValue().toString());
+
+    }
+
+    @Test
+    public void testMPIJSDL() throws Exception {
+
+        JobTypeType jobType = JobTypeType.Factory.newInstance();
+        jobType.set(JobTypeType.MPI);
+        ApplicationContext appContext = getApplicationContext();
+        appContext.setApplicationDeploymentDescription(getApplicationDesc(jobType));
+        jobExecutionContext.setApplicationContext(appContext);
+
+        JobDefinitionDocument jobDefDoc = JSDLGenerator.buildJSDLInstance(jobExecutionContext);
+
+        assertTrue(jobDefDoc.getJobDefinition().getJobDescription().getApplication().toString().contains("/bin/cat"));
+        assertTrue(jobDefDoc.getJobDefinition().getJobDescription().getDataStagingArray().length
> 2);
+
+        assertTrue(jobDefDoc.getJobDefinition().getJobDescription().getJobIdentification().getJobProjectArray().length
> 0);
+
+        assertEquals("jsdl_stdout", JSDLUtils.getOrCreateSPMDApplication(jobDefDoc.getJobDefinition()).getOutput()
+                .getStringValue().toString());
+
+        assertFalse(JSDLUtils.getSPMDApplication(jobDefDoc.getJobDefinition()) == null);
+
+    }
+
+    protected GFacConfiguration getGFACConfig() throws Exception {
         URL resource = BESProviderTest.class.getClassLoader().getResource("gfac-config.xml");
         System.out.println(resource.getFile());
-        GFacConfiguration gFacConfiguration = GFacConfiguration.create(new File(resource.getPath()),null,null);
-		return gFacConfiguration;
-	}
-	
-	
-	protected ApplicationContext getApplicationContext() {
-		ApplicationContext applicationContext = new ApplicationContext();
-		applicationContext.setHostDescription(getHostDesc());
-		
-		applicationContext.setServiceDescription(getServiceDesc());
-		return applicationContext;
-	}
-
-	protected ApplicationDescription getApplicationDesc(JobTypeType jobType) {
-		ApplicationDescription appDesc = new ApplicationDescription(
-				HpcApplicationDeploymentType.type);
-		HpcApplicationDeploymentType app = (HpcApplicationDeploymentType) appDesc
-				.getType();
-		ApplicationDeploymentDescriptionType.ApplicationName name = ApplicationDeploymentDescriptionType.ApplicationName.Factory
-				.newInstance();
-		name.setStringValue("EchoLocal");
-		app.setApplicationName(name);
-		ProjectAccountType projectAccountType = app.addNewProjectAccount();
-		projectAccountType.setProjectAccountNumber("TG-AST110064");
-
-		QueueType queueType = app.addNewQueue();
-		queueType.setQueueName("development");
-
-		app.setCpuCount(1);
-		// TODO: also handle parallel jobs
-		if((jobType.enumValue() == JobTypeType.SERIAL) || (jobType.enumValue() == JobTypeType.SINGLE))
{
-			app.setJobType(JobTypeType.SERIAL);
-		}
-		else if (jobType.enumValue() == JobTypeType.MPI) {
-			app.setJobType(JobTypeType.MPI);
-		}
-		else {
-			app.setJobType(JobTypeType.OPEN_MP);
-		}
-		
-		app.setNodeCount(1);
-		app.setProcessorsPerNode(1);
-
-		/*
-		 * Use bat file if it is compiled on Windows
-		 */
-		app.setExecutableLocation("/bin/cat");
-
-		/*
-		 * Default tmp location
-		 */
-		String date = (new Date()).toString();
-		date = date.replaceAll(" ", "_");
-		date = date.replaceAll(":", "_");
-
-		String remoteTempDir = scratchDir + File.separator + "SimpleEcho" + "_" + date + "_"
-				+ UUID.randomUUID();
-
-		System.out.println(remoteTempDir);
-		
-		// no need of these parameters, as unicore manages by itself
-		app.setScratchWorkingDirectory(remoteTempDir);
-		app.setStaticWorkingDirectory(remoteTempDir);
-		app.setInputDataDirectory(remoteTempDir + File.separator + "inputData");
-		app.setOutputDataDirectory(remoteTempDir + File.separator + "outputData");
-		
-		app.setStandardOutput(app.getOutputDataDirectory()+"/jsdl_stdout");
-		
-		app.setStandardError(app.getOutputDataDirectory()+"/jsdl_stderr");
-
-		return appDesc;
-	}
-
-	protected HostDescription getHostDesc() {
-		HostDescription host = new HostDescription(UnicoreHostType.type);
-		host.getType().setHostAddress(hostAddress);
-		host.getType().setHostName(hostName);
-		((UnicoreHostType) host.getType()).setUnicoreHostAddressArray(hostArray);
-		((UnicoreHostType) host.getType()).setGridFTPEndPointArray(new String[]{gridftpAddress});
-		return host;
-	}
-
-	protected ServiceDescription getServiceDesc() {
-		ServiceDescription serv = new ServiceDescription();
-		serv.getType().setName("SimpleCat");
-
-		List<InputParameterType> inputList = new ArrayList<InputParameterType>();
-		InputParameterType input = InputParameterType.Factory.newInstance();
-		input.setParameterName("echo_input");
-		input.setParameterType(StringParameterType.Factory.newInstance());
-		inputList.add(input);
-		InputParameterType[] inputParamList = inputList
-				.toArray(new InputParameterType[inputList.size()]);
-
-		List<OutputParameterType> outputList = new ArrayList<OutputParameterType>();
-		OutputParameterType output = OutputParameterType.Factory.newInstance();
-		output.setParameterName("echo_output");
-		output.setParameterType(StringParameterType.Factory.newInstance());
-		outputList.add(output);
-		OutputParameterType[] outputParamList = outputList
-				.toArray(new OutputParameterType[outputList.size()]);
-
-		serv.getType().setInputParametersArray(inputParamList);
-		serv.getType().setOutputParametersArray(outputParamList);
-		
-		
-		return serv;
-	}
-
-	protected MessageContext getInMessageContext() {
-		MessageContext inMessage = new MessageContext();
-		
+        GFacConfiguration gFacConfiguration = GFacConfiguration.create(new File(resource.getPath()),
null, null);
+        return gFacConfiguration;
+    }
+
+    protected ApplicationContext getApplicationContext() {
+        ApplicationContext applicationContext = new ApplicationContext();
+        applicationContext.setHostDescription(getHostDesc());
+
+        applicationContext.setServiceDescription(getServiceDesc());
+        return applicationContext;
+    }
+
+    protected ApplicationDescription getApplicationDesc(JobTypeType jobType) {
+        ApplicationDescription appDesc = new ApplicationDescription(HpcApplicationDeploymentType.type);
+        HpcApplicationDeploymentType app = (HpcApplicationDeploymentType) appDesc.getType();
+        ApplicationDeploymentDescriptionType.ApplicationName name = ApplicationDeploymentDescriptionType.ApplicationName.Factory
+                .newInstance();
+        name.setStringValue("EchoLocal");
+        app.setApplicationName(name);
+        ProjectAccountType projectAccountType = app.addNewProjectAccount();
+        projectAccountType.setProjectAccountNumber("TG-AST110064");
+
+        QueueType queueType = app.addNewQueue();
+        queueType.setQueueName("development");
+
+        app.setCpuCount(1);
+        // TODO: also handle parallel jobs
+        if ((jobType.enumValue() == JobTypeType.SERIAL) || (jobType.enumValue() == JobTypeType.SINGLE))
{
+            app.setJobType(JobTypeType.SERIAL);
+        } else if (jobType.enumValue() == JobTypeType.MPI) {
+            app.setJobType(JobTypeType.MPI);
+        } else {
+            app.setJobType(JobTypeType.OPEN_MP);
+        }
+
+        app.setNodeCount(1);
+        app.setProcessorsPerNode(1);
+
+        /*
+         * Use bat file if it is compiled on Windows
+         */
+        app.setExecutableLocation("/bin/cat");
+
+        /*
+         * Default tmp location
+         */
+        String date = (new Date()).toString();
+        date = date.replaceAll(" ", "_");
+        date = date.replaceAll(":", "_");
+
+        String remoteTempDir = scratchDir + File.separator + "SimpleEcho" + "_" + date +
"_" + UUID.randomUUID();
+
+        System.out.println(remoteTempDir);
+
+        // no need of these parameters, as unicore manages by itself
+        app.setScratchWorkingDirectory(remoteTempDir);
+        app.setStaticWorkingDirectory(remoteTempDir);
+        app.setInputDataDirectory(remoteTempDir + File.separator + "inputData");
+        app.setOutputDataDirectory(remoteTempDir + File.separator + "outputData");
+
+        app.setStandardOutput(app.getOutputDataDirectory() + "/jsdl_stdout");
+
+        app.setStandardError(app.getOutputDataDirectory() + "/jsdl_stderr");
+
+        return appDesc;
+    }
+
+    protected HostDescription getHostDesc() {
+        HostDescription host = new HostDescription(UnicoreHostType.type);
+        host.getType().setHostAddress(hostAddress);
+        host.getType().setHostName(hostName);
+        ((UnicoreHostType) host.getType()).setUnicoreHostAddressArray(hostArray);
+        ((UnicoreHostType) host.getType()).setGridFTPEndPointArray(new String[] { gridftpAddress
});
+        return host;
+    }
+
+    protected ServiceDescription getServiceDesc() {
+        ServiceDescription serv = new ServiceDescription();
+        serv.getType().setName("SimpleCat");
+
+        List<InputParameterType> inputList = new ArrayList<InputParameterType>();
+        InputParameterType input = InputParameterType.Factory.newInstance();
+        input.setParameterName("echo_input");
+        input.setParameterType(StringParameterType.Factory.newInstance());
+        inputList.add(input);
+        InputParameterType[] inputParamList = inputList.toArray(new InputParameterType[inputList.size()]);
+
+        List<OutputParameterType> outputList = new ArrayList<OutputParameterType>();
+        OutputParameterType output = OutputParameterType.Factory.newInstance();
+        output.setParameterName("echo_output");
+        output.setParameterType(StringParameterType.Factory.newInstance());
+        outputList.add(output);
+        OutputParameterType[] outputParamList = outputList.toArray(new OutputParameterType[outputList.size()]);
+
+        serv.getType().setInputParametersArray(inputParamList);
+        serv.getType().setOutputParametersArray(outputParamList);
+
+        return serv;
+    }
+
+    protected MessageContext getInMessageContext() {
+        MessageContext inMessage = new MessageContext();
+
         ActualParameter i1 = new ActualParameter();
         i1.getType().changeType(URIParameterType.type);
-        ((URIParameterType)i1.getType()).setValue("file:///tmp/ifile1");
+        ((URIParameterType) i1.getType()).setValue("file:///tmp/ifile1");
         inMessage.addParameter("i1", i1);
-        
+
         ActualParameter i2 = new ActualParameter();
         i2.getType().changeType(URIParameterType.type);
-        ((URIParameterType)i2.getType()).setValue("file:///tmp/ifile2");
+        ((URIParameterType) i2.getType()).setValue("file:///tmp/ifile2");
         inMessage.addParameter("i2", i2);
-        
+
         ActualParameter i3 = new ActualParameter();
         i2.getType().changeType(URIParameterType.type);
-        ((URIParameterType)i2.getType()).setValue("///tmp/ifile2");
+        ((URIParameterType) i2.getType()).setValue("///tmp/ifile2");
         inMessage.addParameter("i3", i2);
 
         ActualParameter simpleArg = new ActualParameter();
         simpleArg.getType().changeType(StringParameterType.type);
-        ((StringParameterType)simpleArg.getType()).setValue("argument1");
+        ((StringParameterType) simpleArg.getType()).setValue("argument1");
         inMessage.addParameter("a1", simpleArg);
-        
+
         ActualParameter nameValueArg = new ActualParameter();
         nameValueArg.getType().changeType(StringParameterType.type);
-        ((StringParameterType)nameValueArg.getType()).setValue("name1=value1");
+        ((StringParameterType) nameValueArg.getType()).setValue("name1=value1");
         inMessage.addParameter("nameValueArg", nameValueArg);
-        
-		ActualParameter echo_input = new ActualParameter();
-		((StringParameterType) echo_input.getType())
-				.setValue("echo_output=hello");
-		inMessage.addParameter("echo_input", echo_input);
-        
-		return inMessage;
-	}
-
-	protected MessageContext getOutMessageContext() {
-		MessageContext om1 = new MessageContext();
-		
-		// TODO: Aint the output parameters are only the name of the files staged out to the gridftp
endpoint? 
-		ActualParameter o1 = new ActualParameter();
-		((StringParameterType) o1.getType())
-		.setValue("tempfile");
-		om1.addParameter("o1", o1);
-
-		ActualParameter o2 = new ActualParameter();
-		o2.getType().changeType(URIParameterType.type);
-		
-		((URIParameterType)o2.getType()).setValue("http://path/to/upload");
-		om1.addParameter("o2", o2);
-
-		
-		
-		return om1;
-	}
-	private GSISecurityContext getSecurityContext() {
-		GSISecurityContext context = new GSISecurityContext();
+
+        ActualParameter echo_input = new ActualParameter();
+        ((StringParameterType) echo_input.getType()).setValue("echo_output=hello");
+        inMessage.addParameter("echo_input", echo_input);
+
+        return inMessage;
+    }
+
+    protected MessageContext getOutMessageContext() {
+        MessageContext om1 = new MessageContext();
+
+        // TODO: Aint the output parameters are only the name of the files staged out to
the gridftp endpoint?
+        ActualParameter o1 = new ActualParameter();
+        ((StringParameterType) o1.getType()).setValue("tempfile");
+        om1.addParameter("o1", o1);
+
+        ActualParameter o2 = new ActualParameter();
+        o2.getType().changeType(URIParameterType.type);
+
+        ((URIParameterType) o2.getType()).setValue("http://path/to/upload");
+        om1.addParameter("o2", o2);
+
+        return om1;
+    }
+
+    private GSISecurityContext getSecurityContext() {
+        GSISecurityContext context = new GSISecurityContext();
         context.setMyproxyLifetime(3600);
         context.setMyproxyServer("myproxy.teragrid.org");
         context.setMyproxyUserName("******");
         context.setMyproxyPasswd("*********");
         context.setTrustedCertLoc("**********");
-		return context;
-	}
+        return context;
+    }
+
+    @Before
+    public void initJobContext() throws Exception {
+        PropertyConfigurator.configure("src/test/resources/logging.properties");
+        jobExecutionContext = new JobExecutionContext(getGFACConfig(), getServiceDesc().getType().getName());
+        jobExecutionContext.setApplicationContext(getApplicationContext());
+        jobExecutionContext.setInMessageContext(getInMessageContext());
+        jobExecutionContext.setOutMessageContext(getOutMessageContext());
+        jobExecutionContext.addSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT, getSecurityContext());
+
+    }
 
-	@Before
-	public void initJobContext() throws Exception {
-		PropertyConfigurator.configure("src/test/resources/logging.properties");
-		jobExecutionContext = new JobExecutionContext(getGFACConfig(), getServiceDesc().getType().getName());
-		jobExecutionContext.setApplicationContext(getApplicationContext());
-		jobExecutionContext.setInMessageContext(getInMessageContext());
-		jobExecutionContext.setOutMessageContext(getOutMessageContext());
-	    jobExecutionContext.addSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT, getSecurityContext());
-          
-	}
-	
-	
 }

Modified: airavata/trunk/tools/registry-tool/pom.xml
URL: http://svn.apache.org/viewvc/airavata/trunk/tools/registry-tool/pom.xml?rev=1476707&r1=1476706&r2=1476707&view=diff
==============================================================================
--- airavata/trunk/tools/registry-tool/pom.xml (original)
+++ airavata/trunk/tools/registry-tool/pom.xml Sun Apr 28 02:20:36 2013
@@ -17,7 +17,6 @@
     </parent>
 
     <modelVersion>4.0.0</modelVersion>
-    <groupId>org.apache.airavata</groupId>
     <artifactId>registry-tool</artifactId>
     <packaging>jar</packaging>
     <name>registry-tool</name>



Mime
View raw message