Author: antelder
Date: Tue Mar 29 14:32:37 2011
New Revision: 1086597
URL: http://svn.apache.org/viewvc?rev=1086597&view=rev
Log:
Update the webapp sample to have the itest from the old helloworld-jsp sample
Added:
tuscany/sca-java-2.x/trunk/samples/getting-started/helloworld-webapp/src/test/java/itest/HelloworldTestCase.java
(with props)
Removed:
tuscany/sca-java-2.x/trunk/samples/getting-started/helloworld-webapp/src/test/java/itest/Helloworld.java
tuscany/sca-java-2.x/trunk/samples/getting-started/helloworld-webapp/src/test/java/itest/HelloworldTestCaseFIXME.java
Modified:
tuscany/sca-java-2.x/trunk/samples/getting-started/helloworld-webapp/README
tuscany/sca-java-2.x/trunk/samples/getting-started/helloworld-webapp/pom.xml
Modified:
tuscany/sca-java-2.x/trunk/samples/getting-started/helloworld-webapp/README
URL:
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/samples/getting-started/helloworld-webapp/README?rev=1086597&r1=1086596&r2=1086597&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/samples/getting-started/helloworld-webapp/README
(original)
+++ tuscany/sca-java-2.x/trunk/samples/getting-started/helloworld-webapp/README
Tue Mar 29 14:32:37 2011
@@ -15,13 +15,17 @@ Alternatively, you can run it by using t
mvn tomcat:run
+or if you prefer Jetty then:
+
+ mvn jetty:run
+
Once the web app is running use your browser to visit the following URL;
http://localhost:8080/helloworld-webapp
(The port and hostname will of course vary depending on your local
installation)
-You should then see web page return the following:
+You should then see the web page return the following:
Calling HelloworldService sayHello("world") returns:
Modified:
tuscany/sca-java-2.x/trunk/samples/getting-started/helloworld-webapp/pom.xml
URL:
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/samples/getting-started/helloworld-webapp/pom.xml?rev=1086597&r1=1086596&r2=1086597&view=diff
==============================================================================
---
tuscany/sca-java-2.x/trunk/samples/getting-started/helloworld-webapp/pom.xml
(original)
+++
tuscany/sca-java-2.x/trunk/samples/getting-started/helloworld-webapp/pom.xml
Tue Mar 29 14:32:37 2011
@@ -53,10 +53,19 @@
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>net.sourceforge.htmlunit</groupId>
+ <artifactId>htmlunit</artifactId>
+ <version>2.6</version>
+ <scope>test</scope>
+ </dependency>
+
</dependencies>
<build>
<plugins>
+
+ <!-- this copies the SCA contribution from the helloworld sample
into this webapp -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
@@ -82,6 +91,44 @@
</executions>
</plugin>
+ <!-- to support using mvn jetty:run and also to run the webapp for
the integration test -->
+ <plugin>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>maven-jetty-plugin</artifactId>
+ <version>6.1.26</version>
+ <configuration>
+ <contextPath>helloworld-webapp</contextPath>
+ <stopKey>foo</stopKey>
+ <stopPort>9999</stopPort>
+ </configuration>
+ <executions>
+ <execution>
+ <id>start-jetty</id>
+ <phase>process-test-classes</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <scanIntervalSeconds>0</scanIntervalSeconds>
+ <daemon>true</daemon>
+ <connectors>
+ <connector
implementation="org.mortbay.jetty.nio.SelectChannelConnector">
+ <port>8085</port>
+ </connector>
+ </connectors>
+ </configuration>
+ </execution>
+ <execution>
+ <id>stop-jetty</id>
+ <phase>prepare-package</phase>
+ <goals>
+ <goal>stop</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <!-- to support using mvn tomcat:run -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
Added:
tuscany/sca-java-2.x/trunk/samples/getting-started/helloworld-webapp/src/test/java/itest/HelloworldTestCase.java
URL:
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/samples/getting-started/helloworld-webapp/src/test/java/itest/HelloworldTestCase.java?rev=1086597&view=auto
==============================================================================
---
tuscany/sca-java-2.x/trunk/samples/getting-started/helloworld-webapp/src/test/java/itest/HelloworldTestCase.java
(added)
+++
tuscany/sca-java-2.x/trunk/samples/getting-started/helloworld-webapp/src/test/java/itest/HelloworldTestCase.java
Tue Mar 29 14:32:37 2011
@@ -0,0 +1,53 @@
+/*
+ * 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.WebClient;
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.html.HtmlParagraph;
+
+/**
+ */
+public class HelloworldTestCase {
+
+ @Test
+ public void testA() throws FailingHttpStatusCodeException,
MalformedURLException, IOException {
+ HtmlPage page = (HtmlPage)new
WebClient().getPage("http://localhost:8085/helloworld-webapp");
+ Iterator<?> ss = page.getAllHtmlChildElements().iterator();
+ while(ss.hasNext()) {
+ HtmlElement htmlElement = (HtmlElement) ss.next();
+ if( htmlElement instanceof HtmlParagraph) {
+ assertEquals("Hello world", htmlElement.asText());
+ break;
+ }
+ }
+ }
+
+}
Propchange:
tuscany/sca-java-2.x/trunk/samples/getting-started/helloworld-webapp/src/test/java/itest/HelloworldTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
tuscany/sca-java-2.x/trunk/samples/getting-started/helloworld-webapp/src/test/java/itest/HelloworldTestCase.java
------------------------------------------------------------------------------
svn:keywords = Rev Date