airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lah...@apache.org
Subject svn commit: r1189800 - in /incubator/airavata/trunk: ./ modules/test-suite/ modules/test-suite/src/ modules/test-suite/src/main/ modules/test-suite/src/main/java/ modules/test-suite/src/main/java/org/ modules/test-suite/src/main/java/org/apache/ module...
Date Thu, 27 Oct 2011 15:18:42 GMT
Author: lahiru
Date: Thu Oct 27 15:18:41 2011
New Revision: 1189800

URL: http://svn.apache.org/viewvc?rev=1189800&view=rev
Log:
adding test suite.

Added:
    incubator/airavata/trunk/modules/test-suite/
    incubator/airavata/trunk/modules/test-suite/pom.xml
    incubator/airavata/trunk/modules/test-suite/src/
    incubator/airavata/trunk/modules/test-suite/src/main/
    incubator/airavata/trunk/modules/test-suite/src/main/java/
    incubator/airavata/trunk/modules/test-suite/src/main/java/org/
    incubator/airavata/trunk/modules/test-suite/src/main/java/org/apache/
    incubator/airavata/trunk/modules/test-suite/src/main/java/org/apache/airavata/
    incubator/airavata/trunk/modules/test-suite/src/main/java/org/apache/airavata/test/
    incubator/airavata/trunk/modules/test-suite/src/main/java/org/apache/airavata/test/suite/
    incubator/airavata/trunk/modules/test-suite/src/main/resources/
    incubator/airavata/trunk/modules/test-suite/src/test/
    incubator/airavata/trunk/modules/test-suite/src/test/java/
    incubator/airavata/trunk/modules/test-suite/src/test/java/org/
    incubator/airavata/trunk/modules/test-suite/src/test/java/org/apache/
    incubator/airavata/trunk/modules/test-suite/src/test/java/org/apache/airavata/
    incubator/airavata/trunk/modules/test-suite/src/test/java/org/apache/airavata/test/
    incubator/airavata/trunk/modules/test-suite/src/test/java/org/apache/airavata/test/suite/
    incubator/airavata/trunk/modules/test-suite/src/test/java/org/apache/airavata/test/suite/gfac/
    incubator/airavata/trunk/modules/test-suite/src/test/java/org/apache/airavata/test/suite/gfac/GramProviderTest.java
    incubator/airavata/trunk/modules/test-suite/src/test/resources/
    incubator/airavata/trunk/modules/test-suite/src/test/resources/gram.properties
Modified:
    incubator/airavata/trunk/pom.xml

Added: incubator/airavata/trunk/modules/test-suite/pom.xml
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/test-suite/pom.xml?rev=1189800&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/test-suite/pom.xml (added)
+++ incubator/airavata/trunk/modules/test-suite/pom.xml Thu Oct 27 15:18:41 2011
@@ -0,0 +1,154 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--Licensed to the Apache Software Foundation (ASF) under one or more contributor 
+    license agreements. See the NOTICE file distributed with this work for additional 
+    information regarding copyright ownership. The ASF licenses this file to 
+    you under the Apache License, Version 2.0 (theÏ "License"); you may not use 
+    this file except in compliance with the License. You may obtain a copy of 
+    the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required 
+    by applicable law or agreed to in writing, software distributed under the 
+    License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 
+    OF ANY ~ KIND, either express or implied. See the License for the specific 
+    language governing permissions and limitations under the License. -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <groupId>org.apache.airavata</groupId>
+        <artifactId>airavata</artifactId>
+        <version>0.0.1-SNAPSHOT</version>
+        <relativePath>../../pom.xml</relativePath>
+    </parent>
+
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.apache.airavata</groupId>
+    <artifactId>test-suite</artifactId>
+    <name>Test-Suite</name>
+    <description>Airavata Test Suite</description>
+
+    <dependencies>
+        <dependency>
+            <groupId>cog-jglobus</groupId>
+            <artifactId>cog-jglobus</artifactId>
+            <version>1.8.0_1</version>
+        </dependency>
+        <dependency>
+            <groupId>cog-4_1_6_rc2</groupId>
+            <artifactId>puretls</artifactId>
+            <type>jar</type>
+            <version>cog-4_1_6</version>
+        </dependency>
+        <dependency>
+            <groupId>cog-4_1_6_rc2</groupId>
+            <artifactId>cryptix32</artifactId>
+            <version>cog-4_1_6</version>
+        </dependency>
+        <dependency>
+            <groupId>cog-4_1_6_rc2</groupId>
+            <artifactId>cryptix-asn1</artifactId>
+            <version>cog-4_1_6</version>
+        </dependency>
+        <dependency>
+            <groupId>bouncycastle</groupId>
+            <artifactId>bcprov-jdk15</artifactId>
+            <version>143</version>
+        </dependency>
+        
+        <dependency>
+            <groupId>commons-configuration</groupId>
+            <artifactId>commons-configuration</artifactId>
+            <version>1.6</version>
+        </dependency>
+
+        <!-- Logging -->
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+        </dependency>
+
+        <!-- GFAC schemas -->
+        <dependency>
+            <groupId>org.apache.airavata</groupId>
+            <artifactId>gfac-schema-utils</artifactId>
+            <version>${airavata.version}</version>
+        </dependency>
+	 <dependency>
+            <groupId>org.apache.airavata</groupId>
+            <artifactId>gfac-core</artifactId>
+            <version>${airavata.version}</version>
+        </dependency>
+
+	<dependency>
+            <groupId>org.apache.airavata</groupId>
+            <artifactId>registry-api</artifactId>
+            <version>${airavata.version}</version>
+        </dependency>
+
+        <!-- Workflow Tracking -->
+        <dependency>
+            <groupId>org.apache.airavata</groupId>
+            <artifactId>workflowtracking</artifactId>
+            <version>${airavata.version}</version>
+        </dependency>
+
+        <!-- Xregistry jars -->
+        <!--dependency>
+            <groupId>xregistry</groupId>
+            <artifactId>xregistry-client</artifactId>
+            <version>1.2.2</version>
+        </dependency>
+        <dependency>
+            <groupId>xregistry</groupId>
+            <artifactId>xregistry_generated</artifactId>
+            <version>0.8.3</version>
+            <type>jar</type>
+        </dependency-->
+
+        <!-- SSH -->
+        <dependency>
+            <groupId>net.schmizz</groupId>
+            <artifactId>sshj</artifactId>
+            <version>0.5.0</version>
+        </dependency>
+
+        <!-- Amazon -->
+        <dependency>
+            <groupId>com.amazonaws</groupId>
+            <artifactId>aws-java-sdk</artifactId>
+            <version>1.1.8</version>
+        </dependency>
+
+        <!-- Test -->
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-simple</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.jackrabbit</groupId>
+            <artifactId>jackrabbit-core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.jackrabbit</groupId>
+            <artifactId>jackrabbit-jcr-rmi</artifactId>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <!-- Set working directory to test-class directory -->
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <configuration>
+                    <workingDirectory>${project.build.testOutputDirectory}</workingDirectory>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>

Added: incubator/airavata/trunk/modules/test-suite/src/test/java/org/apache/airavata/test/suite/gfac/GramProviderTest.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/test-suite/src/test/java/org/apache/airavata/test/suite/gfac/GramProviderTest.java?rev=1189800&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/test-suite/src/test/java/org/apache/airavata/test/suite/gfac/GramProviderTest.java
(added)
+++ incubator/airavata/trunk/modules/test-suite/src/test/java/org/apache/airavata/test/suite/gfac/GramProviderTest.java
Thu Oct 27 15:18:41 2011
@@ -0,0 +1,180 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+package org.apache.airavata.test.suite.gfac;
+
+import org.apache.airavata.commons.gfac.type.ActualParameter;
+import org.apache.airavata.commons.gfac.type.ApplicationDeploymentDescription;
+import org.apache.airavata.commons.gfac.type.HostDescription;
+import org.apache.airavata.commons.gfac.type.ServiceDescription;
+import org.apache.airavata.core.gfac.context.invocation.impl.DefaultExecutionContext;
+import org.apache.airavata.core.gfac.context.invocation.impl.DefaultInvocationContext;
+import org.apache.airavata.core.gfac.context.message.impl.ParameterContextImpl;
+import org.apache.airavata.core.gfac.context.security.impl.GSISecurityContext;
+import org.apache.airavata.core.gfac.notification.impl.LoggingNotification;
+import org.apache.airavata.core.gfac.services.impl.PropertiesBasedServiceImpl;
+import org.apache.airavata.registry.api.impl.JCRRegistry;
+import org.apache.airavata.schemas.gfac.*;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.io.File;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import static org.junit.Assert.fail;
+
+public class GramProviderTest {
+
+    public static final String MYPROXY = "myproxy";
+    public static final String GRAM_PROPERTIES = "gram.properties";
+
+    @Before
+	public void setUp() throws Exception {
+		/*
+		 * Create database
+		 */
+		JCRRegistry jcrRegistry = new JCRRegistry(null,
+				"org.apache.jackrabbit.core.RepositoryFactoryImpl", "admin",
+				"admin", null);
+
+		/*
+		 * Host
+		 */
+
+        URL url = this.getClass().getClassLoader().getResource(GRAM_PROPERTIES);
+        Properties properties = new Properties();
+        properties.load(url.openStream());
+		HostDescription host = new HostDescription();
+        host.getType().changeType(GlobusHostType.type);
+		host.getType().setName(properties.getProperty("gram.name"));
+		host.getType().setAddress(properties.getProperty("gram.host"));
+        ((GlobusHostType)host.getType()).setGridFTPEndPoint(properties.getProperty("gridftp.endpoint"));
+        ((GlobusHostType)host.getType()).setGlobusGateKeeperEndPoint(properties.getProperty("globus.endpoints"));
+
+
+            /*
+            * App
+            */
+		ApplicationDeploymentDescription appDesc = new ApplicationDeploymentDescription(GramApplicationDeploymentType.type);
+		GramApplicationDeploymentType app = (GramApplicationDeploymentType) appDesc.getType();
+		app.setName("EchoLocal");
+		app.setExecutable("/bin/echo");
+		app.setTmpDir("/scratch/01437/ogce/test");
+        ShellApplicationDeploymentType.Env env = app.addNewEnv();
+        app.setEnv(env);
+        app.setProjectName(properties.getProperty("project.name"));
+        app.setCpuCount(1);
+        app.setNodeCount(1);
+
+		/*
+		 * Service
+		 */
+		ServiceDescription serv = new ServiceDescription();
+		serv.getType().setName("SimpleEcho");
+
+        Parameter input = Parameter.Factory.newInstance();
+		input.setName("echo_input");
+		input.addNewType();
+		List<Parameter> inputList = new ArrayList<Parameter>();
+		inputList.add(input);
+		Parameter[] inputParamList = inputList.toArray(new Parameter[inputList
+				.size()]);
+
+		Parameter output = Parameter.Factory.newInstance();
+		output.setName("echo_output");
+		output.addNewType();
+		List<Parameter> outputList = new ArrayList<Parameter>();
+		outputList.add(output);
+		Parameter[] outputParamList = outputList
+				.toArray(new Parameter[outputList.size()]);
+		serv.getType().setInputParametersArray(inputParamList);
+		serv.getType().setOutputParametersArray(outputParamList);
+
+		/*
+		 * Save to registry
+		 */
+		jcrRegistry.saveHostDescription(host);
+		jcrRegistry.saveDeploymentDescription(serv.getType().getName(), host.getType().getName(),
appDesc);
+		jcrRegistry.saveServiceDescription(serv);
+		jcrRegistry.deployServiceOnHost(serv.getType().getName(), host.getType().getName());
+	}
+
+	@Test
+	public void testExecute() {
+		try {
+            URL url = this.getClass().getClassLoader().getResource(GRAM_PROPERTIES);
+        Properties properties = new Properties();
+        properties.load(url.openStream());
+
+			DefaultInvocationContext ct = new DefaultInvocationContext();
+			DefaultExecutionContext ec = new DefaultExecutionContext();
+			ec.addNotifiable(new LoggingNotification());
+			ct.setExecutionContext(ec);
+
+
+            GSISecurityContext gsiSecurityContext = new GSISecurityContext();
+            gsiSecurityContext.setMyproxyServer(properties.getProperty("myproxy.server"));
+            gsiSecurityContext.setMyproxyUserName(properties.getProperty("myproxy.username"));
+            gsiSecurityContext.setMyproxyPasswd(properties.getProperty("myproxy.password"));
+            gsiSecurityContext.setMyproxyLifetime(14400);
+            gsiSecurityContext.setTrustedCertLoc(properties.getProperty("certificate.path"));
+
+            ct.addSecurityContext(MYPROXY,gsiSecurityContext);
+
+            ct.setServiceName("SimpleEcho");
+/*
+			 * Input
+			 */
+            ParameterContextImpl input = new ParameterContextImpl();
+            ActualParameter echo_input = new ActualParameter(StringParameter.type);
+            ((StringParameter)echo_input.getType()).setValue("echo_output=hello");
+            input.add("echo_input", echo_input);
+
+            /*
+             * Output
+             */
+            ParameterContextImpl output = new ParameterContextImpl();
+            ActualParameter echo_output = new ActualParameter(StringParameter.type);
+            output.add("echo_output", echo_output);
+
+            // parameter
+            ct.setInput(input);
+            ct.setOutput(output);
+
+            PropertiesBasedServiceImpl service = new PropertiesBasedServiceImpl();
+            service.init();
+            service.execute(ct);
+
+            Assert.assertNotNull(ct.getOutput());
+            Assert.assertNotNull(ct.getOutput().getValue("echo_output"));
+            Assert.assertEquals("hello", ((StringParameter)((ActualParameter)ct.getOutput().getValue("echo_output")).getType()).getValue());
+
+
+
+		} catch (Exception e) {
+			e.printStackTrace();
+			fail("ERROR");
+		}
+	}
+}

Added: incubator/airavata/trunk/modules/test-suite/src/test/resources/gram.properties
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/test-suite/src/test/resources/gram.properties?rev=1189800&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/test-suite/src/test/resources/gram.properties (added)
+++ incubator/airavata/trunk/modules/test-suite/src/test/resources/gram.properties Thu Oct
27 15:18:41 2011
@@ -0,0 +1,9 @@
+gram.name=
+gram.host=
+gridftp.endpoint=
+globus.endpoints=
+project.name=
+myproxy.server=
+myproxy.username=
+myproxy.password=
+certificate.path=

Modified: incubator/airavata/trunk/pom.xml
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/pom.xml?rev=1189800&r1=1189799&r2=1189800&view=diff
==============================================================================
--- incubator/airavata/trunk/pom.xml (original)
+++ incubator/airavata/trunk/pom.xml Thu Oct 27 15:18:41 2011
@@ -144,15 +144,15 @@
     </repositories>
     <profiles>
         <profile>
-            <id>profile-xregistry</id>
+            <id>profile-test-suite</id>
             <activation>
                 <property>
                     <name>module</name>
-                    <value>xregistry</value>
+                    <value>test-suite</value>
                 </property>
             </activation>
             <modules>
-                <module>modules/xregistry</module>
+                <module>modules/test-suite</module>
             </modules>
         </profile>
         <profile>



Mime
View raw message