diff options
3 files changed, 65 insertions, 5 deletions
diff --git a/sca-java-2.x/trunk/samples/webapps/helloworld-jaxrs/pom.xml b/sca-java-2.x/trunk/samples/webapps/helloworld-jaxrs/pom.xml index af3e44b784..441335b93f 100644 --- a/sca-java-2.x/trunk/samples/webapps/helloworld-jaxrs/pom.xml +++ b/sca-java-2.x/trunk/samples/webapps/helloworld-jaxrs/pom.xml @@ -35,7 +35,7 @@ <!-- Tuscany dependency -->
<dependency>
<groupId>org.apache.tuscany.sca.shades</groupId>
- <artifactId>tuscany-base</artifactId>
+ <artifactId>tuscany-base-nodep</artifactId>
<version>2.0-SNAPSHOT</version>
</dependency>
@@ -51,6 +51,20 @@ <version>1.0-incubating</version>
</dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.8.1</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>net.sourceforge.htmlunit</groupId>
+ <artifactId>htmlunit</artifactId>
+ <version>2.6</version>
+ <scope>test</scope>
+ </dependency>
+
</dependencies>
<build>
diff --git a/sca-java-2.x/trunk/samples/webapps/helloworld-jaxrs/src/main/java/sample/HelloWorldResource.java b/sca-java-2.x/trunk/samples/webapps/helloworld-jaxrs/src/main/java/sample/HelloWorldResource.java index 6a84a5775a..42625b8a78 100644 --- a/sca-java-2.x/trunk/samples/webapps/helloworld-jaxrs/src/main/java/sample/HelloWorldResource.java +++ b/sca-java-2.x/trunk/samples/webapps/helloworld-jaxrs/src/main/java/sample/HelloWorldResource.java @@ -32,12 +32,12 @@ import org.oasisopen.sca.annotation.Reference; * Simple example - Hello World!
* <p/>
* The SDK dispatches HTTP requests for URI
- * <code>http://[host]:[port]/HelloWorld/rest/world</code>, where
- * <code>HelloWorld</code> is the context root, to this class. A simple Atom
- * entry is returned in HTTP response.
+ * <code>http://[host]:[port]/helloworld-jaxrs/rest/world</code>, where
+ * <code>helloworld-jaxrs</code> is the context root, to this class. A simple
+ * plain text entry is returned in HTTP response.
* <p/>
* The service document is available at URI
- * <code>http://[host]:[port]/HelloWorld/rest</code> but it is empty because
+ * <code>http://[host]:[port]/helloworld-jaxrs/rest</code> but it is empty because
* this simple demo doesn't contain any collection of resources.
* <p/>
* This resource must be registered within a JAX-RS application, this example
diff --git a/sca-java-2.x/trunk/samples/webapps/helloworld-jaxrs/src/test/java/itest/HelloworldTestCase.java b/sca-java-2.x/trunk/samples/webapps/helloworld-jaxrs/src/test/java/itest/HelloworldTestCase.java new file mode 100644 index 0000000000..ffe5dd3b2b --- /dev/null +++ b/sca-java-2.x/trunk/samples/webapps/helloworld-jaxrs/src/test/java/itest/HelloworldTestCase.java @@ -0,0 +1,46 @@ +/*
+ * 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 itest;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.util.Iterator;
+
+import org.junit.Test;
+
+import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException;
+import com.gargoylesoftware.htmlunit.TextPage;
+import com.gargoylesoftware.htmlunit.WebClient;
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlParagraph;
+
+/**
+ */
+public class HelloworldTestCase {
+
+ @Test
+ public void testA() throws FailingHttpStatusCodeException, MalformedURLException, IOException {
+ TextPage page = (TextPage)new WebClient().getPage("http://localhost:8085/helloworld-jaxrs/rest/world");
+ assertEquals("Hello World", page.getContent());
+ }
+
+}
|