You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2014/05/07 23:41:13 UTC

svn commit: r1593142 - in /sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl: ConnectionTest.java SimpleServlet.java.txt SimpleServlet.java.v1.txt SimpleServlet.java.v2.txt

Author: rombert
Date: Wed May  7 21:41:12 2014
New Revision: 1593142

URL: http://svn.apache.org/r1593142
Log:
SLING-3544 - Integration tests running against a live Sling Launchpad
instance

Verify that an java class change triggers a reload and replaces the
previously deployed bundles.

Added:
    sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/SimpleServlet.java.v1.txt
      - copied, changed from r1593141, sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/SimpleServlet.java.txt
    sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/SimpleServlet.java.v2.txt   (contents, props changed)
      - copied, changed from r1593141, sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/SimpleServlet.java.txt
Removed:
    sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/SimpleServlet.java.txt
Modified:
    sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/ConnectionTest.java

Modified: sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/ConnectionTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/ConnectionTest.java?rev=1593142&r1=1593141&r2=1593142&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/ConnectionTest.java (original)
+++ sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/ConnectionTest.java Wed May  7 21:41:12 2014
@@ -23,6 +23,8 @@ import java.io.IOException;
 import java.io.InputStream;
 
 import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.URIException;
 import org.apache.commons.httpclient.methods.GetMethod;
 import org.apache.commons.io.IOUtils;
 import org.apache.sling.ide.osgi.OsgiClientException;
@@ -83,7 +85,7 @@ public class ConnectionTest {
         // create DS component class
         InputStream simpleServlet = null;
         try {
-            simpleServlet = getClass().getResourceAsStream("SimpleServlet.java.txt");
+            simpleServlet = getClass().getResourceAsStream("SimpleServlet.java.v1.txt");
             project.createOrUpdateFile(Path.fromPortableString("src/example/SimpleServlet.java"), simpleServlet);
         } finally {
             IOUtils.closeQuietly(simpleServlet);
@@ -112,13 +114,30 @@ public class ConnectionTest {
 
         Thread.sleep(1000); // for good measure, make sure the output is there - TODO replace with polling
 
+        assertSimpleServletCallsSucceeds("Version 1");
+
+        // create DS component class
+        InputStream simpleServlet2 = null;
+        try {
+            simpleServlet2 = getClass().getResourceAsStream("SimpleServlet.java.v2.txt");
+            project.createOrUpdateFile(Path.fromPortableString("src/example/SimpleServlet.java"), simpleServlet2);
+        } finally {
+            IOUtils.closeQuietly(simpleServlet2);
+        }
+
+        Thread.sleep(1000); // for good measure, make sure the output is there - TODO replace with polling
+
+        assertSimpleServletCallsSucceeds("Version 2");
+    }
+
+    private void assertSimpleServletCallsSucceeds(String expectedOutput) throws IOException, HttpException, URIException {
         HttpClient c = new HttpClient();
         GetMethod gm = new GetMethod("http://localhost:" + LaunchpadUtils.getLaunchpadPort() + "/simple-servlet");
         try {
             int status = c.executeMethod(gm);
 
             assertThat("Unexpected status code for " + gm.getURI(), status, equalTo(200));
-            assertThat("Unexpected response for " + gm.getURI(), gm.getResponseBodyAsString(), equalTo("Version 1"));
+            assertThat("Unexpected response for " + gm.getURI(), gm.getResponseBodyAsString(), equalTo(expectedOutput));
 
         } finally {
             gm.releaseConnection();

Copied: sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/SimpleServlet.java.v1.txt (from r1593141, sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/SimpleServlet.java.txt)
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/SimpleServlet.java.v1.txt?p2=sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/SimpleServlet.java.v1.txt&p1=sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/SimpleServlet.java.txt&r1=1593141&r2=1593142&rev=1593142&view=diff
==============================================================================
    (empty)

Copied: sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/SimpleServlet.java.v2.txt (from r1593141, sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/SimpleServlet.java.txt)
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/SimpleServlet.java.v2.txt?p2=sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/SimpleServlet.java.v2.txt&p1=sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/SimpleServlet.java.txt&r1=1593141&r2=1593142&rev=1593142&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/SimpleServlet.java.txt (original)
+++ sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/SimpleServlet.java.v2.txt Wed May  7 21:41:12 2014
@@ -12,7 +12,7 @@ public class SimpleServlet extends Sling
             SlingHttpServletResponse response) throws ServletException,
             IOException {
         
-        response.getWriter().write("Version 1");
+        response.getWriter().write("Version 2");
     }
 
 }
\ No newline at end of file

Propchange: sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/SimpleServlet.java.v2.txt
------------------------------------------------------------------------------
    svn:eol-style = native