diff options
author | dims <dims@13f79535-47bb-0310-9956-ffa450edef68> | 2008-06-17 00:23:01 +0000 |
---|---|---|
committer | dims <dims@13f79535-47bb-0310-9956-ffa450edef68> | 2008-06-17 00:23:01 +0000 |
commit | bdd0a41aed7edf21ec2a65cfa17a86af2ef8c48a (patch) | |
tree | 38a92061c0793434c4be189f1d70c3458b6bc41d /tags/java-stable-20060304/testing/tomcat/helloworldws |
Move Tuscany from Incubator to top level.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@668359 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'tags/java-stable-20060304/testing/tomcat/helloworldws')
2 files changed, 147 insertions, 0 deletions
diff --git a/tags/java-stable-20060304/testing/tomcat/helloworldws/pom.xml b/tags/java-stable-20060304/testing/tomcat/helloworldws/pom.xml new file mode 100644 index 0000000000..eb685ba57c --- /dev/null +++ b/tags/java-stable-20060304/testing/tomcat/helloworldws/pom.xml @@ -0,0 +1,83 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Copyright (c) 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed 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>
+ <parent>
+ <groupId>org.apache.tuscany</groupId>
+ <artifactId>tuscany-testing-tomcat</artifactId>
+ <version>SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>tuscany-testing-tomcat-helloworldws</artifactId>
+ <packaging>jar</packaging>
+ <name>Tuscany Testing Tomcat HelloWorld WS</name>
+ <description>Testing Tomcat HelloWorld WS end user test</description>
+ <version>SNAPSHOT</version>
+
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.samples.helloworld</groupId>
+ <artifactId>helloworldwsclient</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany</groupId>
+ <artifactId>tuscany-container-js</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>jakarta-regexp</groupId>
+ <artifactId>jakarta-regexp</artifactId>
+ <version>1.4</version>
+ </dependency>
+ <dependency>
+ <groupId>ant</groupId>
+ <artifactId>ant-jakarta-regexp</artifactId>
+ <version>1.6.1</version>
+ </dependency>
+ <dependency>
+ <groupId>ant</groupId>
+ <artifactId>ant-xslp</artifactId>
+ <version>1.6.5</version>
+ </dependency>
+ <dependency>
+ <groupId>ant</groupId>
+ <artifactId>ant-trax</artifactId>
+ <version>1.6.5</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/tags/java-stable-20060304/testing/tomcat/helloworldws/src/test/java/org/apache/tuscany/samples/helloworldws/TestHelloWorldWSTestCase.java b/tags/java-stable-20060304/testing/tomcat/helloworldws/src/test/java/org/apache/tuscany/samples/helloworldws/TestHelloWorldWSTestCase.java new file mode 100644 index 0000000000..58b7cfe2be --- /dev/null +++ b/tags/java-stable-20060304/testing/tomcat/helloworldws/src/test/java/org/apache/tuscany/samples/helloworldws/TestHelloWorldWSTestCase.java @@ -0,0 +1,64 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed 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.tuscany.samples.helloworldws; + +import junit.framework.TestCase; + +import org.apache.tuscany.core.client.TuscanyRuntime; +import org.apache.tuscany.core.config.ConfigurationException; +import org.apache.tuscany.samples.helloworldwsclient.HelloWorldService; +import org.osoa.sca.CurrentModuleContext; +import org.osoa.sca.ModuleContext; + + +public class TestHelloWorldWSTestCase extends TestCase { + + String getGreetings(String name) throws ConfigurationException { + // Obtain Tuscany runtime + TuscanyRuntime tuscany = new TuscanyRuntime("hello", null); + + // Start the runtime + tuscany.start(); + + // Obtain SCA module context. + ModuleContext moduleContext = CurrentModuleContext.getContext(); + + // Locate the HelloWorld service component and invoke it + HelloWorldService helloworldService = (HelloWorldService) moduleContext.locateService("HelloWorldServiceComponent"); + + String value = helloworldService.getGreetings(name); + + System.out.println(value); + + // Stop the runtime + tuscany.stop(); + + return value; + } + + public void testHelloWorldDefault() throws Exception { + final String name= "World"; + String greeting= getGreetings(name); + assertEquals(greeting, "Hello " + name); + + final String name2= "SCA World!"; + greeting= getGreetings(name2); + assertEquals(greeting, "Hello " + name2); + + } + +} |