incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bdelacre...@apache.org
Subject svn commit: r1074212 - in /sling/trunk/testing: junit/core/src/main/java/org/apache/sling/junit/ junit/core/src/main/java/org/apache/sling/junit/impl/ junit/core/src/main/java/org/apache/sling/junit/impl/servlet/ junit/core/src/test/java/org/apache/sli...
Date Thu, 24 Feb 2011 16:55:00 GMT
Author: bdelacretaz
Date: Thu Feb 24 16:54:59 2011
New Revision: 1074212

URL: http://svn.apache.org/viewvc?rev=1074212&view=rev
Log:
SLING-1981 - support running single tests methods using JUnit servlet paths like /system/sling/junit/TEST_CLASS_NAME.json/TEST_METHOD_NAME

Added:
    sling/trunk/testing/samples/test-tools/src/test/java/org/apache/sling/testing/samples/testtools/serverside/ServerSideSampleTest.java
      - copied, changed from r1074080, sling/trunk/testing/samples/test-tools/src/test/java/org/apache/sling/testing/samples/testtools/serverside/ServerSideTest.java
    sling/trunk/testing/samples/test-tools/src/test/java/org/apache/sling/testing/samples/testtools/serverside/SingleServerSideMethodTest.java
  (with props)
Removed:
    sling/trunk/testing/samples/test-tools/src/test/java/org/apache/sling/testing/samples/testtools/serverside/ServerSideTest.java
Modified:
    sling/trunk/testing/junit/core/src/main/java/org/apache/sling/junit/RequestParser.java
    sling/trunk/testing/junit/core/src/main/java/org/apache/sling/junit/TestsManager.java
    sling/trunk/testing/junit/core/src/main/java/org/apache/sling/junit/impl/TestsManagerImpl.java
    sling/trunk/testing/junit/core/src/main/java/org/apache/sling/junit/impl/servlet/JUnitServlet.java
    sling/trunk/testing/junit/core/src/test/java/org/apache/sling/junit/RequestParserTest.java
    sling/trunk/testing/junit/remote/src/main/java/org/apache/sling/junit/remote/testrunner/SlingRemoteTestParameters.java
    sling/trunk/testing/junit/remote/src/main/java/org/apache/sling/junit/remote/testrunner/SlingRemoteTestRunner.java
    sling/trunk/testing/samples/test-tools/src/test/java/org/apache/sling/testing/samples/testtools/SlingTestBase.java
    sling/trunk/testing/samples/test-tools/src/test/java/org/apache/sling/testing/samples/testtools/serverside/ServerSideTestsBase.java

Modified: sling/trunk/testing/junit/core/src/main/java/org/apache/sling/junit/RequestParser.java
URL: http://svn.apache.org/viewvc/sling/trunk/testing/junit/core/src/main/java/org/apache/sling/junit/RequestParser.java?rev=1074212&r1=1074211&r2=1074212&view=diff
==============================================================================
--- sling/trunk/testing/junit/core/src/main/java/org/apache/sling/junit/RequestParser.java
(original)
+++ sling/trunk/testing/junit/core/src/main/java/org/apache/sling/junit/RequestParser.java
Thu Feb 24 16:54:59 2011
@@ -27,15 +27,20 @@ import javax.servlet.http.HttpServletReq
  */
 public class RequestParser {
     private final String testSelector;
+    private final String methodName;
     private final String extension;
     private final HttpServletRequest request;
     private static final String EMPTY_STRING = "";
 
     public RequestParser(HttpServletRequest request) {
+        this(parsePathInfo(request.getPathInfo()), request);
+    }
+    
+    RequestParser(String [] s, HttpServletRequest request) {
         this.request = request;
-        final String [] s = parsePathInfo(request.getPathInfo());
         testSelector = s[0];
         extension = s[1];
+        methodName = s[2];
     }
     
     static String [] parsePathInfo(String pathInfo) {
@@ -46,12 +51,25 @@ public class RequestParser {
                 pathInfo = pathInfo.substring(1);
             }
             
-            final int pos = pathInfo.lastIndexOf('.');
-            if (pos >= 0) {
-                result[0] = pathInfo.substring(0, pos);
-                result[1] = pathInfo.substring(pos+1);
-            } else {
-                result[0] = pathInfo;
+            // Split at last dot to find extension
+            {
+                final int pos = pathInfo.lastIndexOf('.');
+                if (pos >= 0) {
+                    result[0] = pathInfo.substring(0, pos);
+                    result[1] = pathInfo.substring(pos+1);
+                } else {
+                    result[0] = pathInfo;
+                }
+            }
+            
+            // And if extension contains a /, what follows is test method selector
+            final String ext = result[1];
+            if(ext != null) {
+                final int pos = ext.indexOf('/');
+                if(pos >= 0) {
+                    result[1] = ext.substring(0, pos);
+                    result[2] = ext.substring(pos+1);
+                }
             }
         }
         
@@ -65,8 +83,11 @@ public class RequestParser {
     }
 
     public String toString() {
-        return getClass().getSimpleName() + ": testSelector=[" + testSelector
-                + "], extension=[" + extension + "]";
+        return getClass().getSimpleName() 
+                + ", testSelector [" + testSelector + "]"
+                + ", methodName [" + methodName + "]"
+                + ", extension [" + extension + "]"
+                ;
     }
 
     public String getTestSelector() {
@@ -77,8 +98,11 @@ public class RequestParser {
         return extension;
     }
     
-    public HttpServletRequest getRequest() {
-        return request;
+    public String getMethodName() {
+        return methodName;
     }
     
+    public HttpServletRequest getRequest() {
+        return request;
+    }   
 }
\ No newline at end of file

Modified: sling/trunk/testing/junit/core/src/main/java/org/apache/sling/junit/TestsManager.java
URL: http://svn.apache.org/viewvc/sling/trunk/testing/junit/core/src/main/java/org/apache/sling/junit/TestsManager.java?rev=1074212&r1=1074211&r2=1074212&view=diff
==============================================================================
--- sling/trunk/testing/junit/core/src/main/java/org/apache/sling/junit/TestsManager.java
(original)
+++ sling/trunk/testing/junit/core/src/main/java/org/apache/sling/junit/TestsManager.java
Thu Feb 24 16:54:59 2011
@@ -33,6 +33,7 @@ public interface TestsManager {
     
     /** Execute tests and report results using supplied Renderer - does NOT call setup or
cleanup
      *  on renderer.
+     *  @param testMethodName if not empty, only test methods that have this name are executed
      */ 
-    public void executeTests(Collection<String> testNames, Renderer renderer) throws
Exception;
+    public void executeTests(Collection<String> testNames, Renderer renderer, String
testMethodName) throws Exception;
 }

Modified: sling/trunk/testing/junit/core/src/main/java/org/apache/sling/junit/impl/TestsManagerImpl.java
URL: http://svn.apache.org/viewvc/sling/trunk/testing/junit/core/src/main/java/org/apache/sling/junit/impl/TestsManagerImpl.java?rev=1074212&r1=1074211&r2=1074212&view=diff
==============================================================================
--- sling/trunk/testing/junit/core/src/main/java/org/apache/sling/junit/impl/TestsManagerImpl.java
(original)
+++ sling/trunk/testing/junit/core/src/main/java/org/apache/sling/junit/impl/TestsManagerImpl.java
Thu Feb 24 16:54:59 2011
@@ -16,7 +16,6 @@
  */
 package org.apache.sling.junit.impl;
 
-import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
@@ -29,6 +28,7 @@ import org.apache.sling.junit.Renderer;
 import org.apache.sling.junit.TestsManager;
 import org.apache.sling.junit.TestsProvider;
 import org.junit.runner.JUnitCore;
+import org.junit.runner.Request;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceReference;
 import org.osgi.service.component.ComponentContext;
@@ -148,13 +148,19 @@ public class TestsManagerImpl implements
     }
 
     /** @inheritDoc */
-    public void executeTests(Collection<String> testNames, Renderer renderer) throws
Exception {
+    public void executeTests(Collection<String> testNames, Renderer renderer, String
testMethodName) throws Exception {
         renderer.title(2, "Running tests");
         final JUnitCore junit = new JUnitCore();
         junit.addListener(renderer.getRunListener());
         for(String className : testNames) {
             renderer.title(3, className);
-            junit.run(getTestClass(className));
+            if(testMethodName != null && testMethodName.length() > 0) {
+                log.debug("Running test method {} from test class {}", testMethodName, className);
+                junit.run(Request.method(getTestClass(className), testMethodName));
+            } else {
+                log.debug("Running test class {}", className);
+                junit.run(getTestClass(className));
+            }
         }
     }
 

Modified: sling/trunk/testing/junit/core/src/main/java/org/apache/sling/junit/impl/servlet/JUnitServlet.java
URL: http://svn.apache.org/viewvc/sling/trunk/testing/junit/core/src/main/java/org/apache/sling/junit/impl/servlet/JUnitServlet.java?rev=1074212&r1=1074211&r2=1074212&view=diff
==============================================================================
--- sling/trunk/testing/junit/core/src/main/java/org/apache/sling/junit/impl/servlet/JUnitServlet.java
(original)
+++ sling/trunk/testing/junit/core/src/main/java/org/apache/sling/junit/impl/servlet/JUnitServlet.java
Thu Feb 24 16:54:59 2011
@@ -189,6 +189,7 @@ public class JUnitServlet extends HttpSe
     protected void doPost(HttpServletRequest request, HttpServletResponse response) 
     throws ServletException, IOException {
         final RequestParser requestParser = new RequestParser(request);
+        log.info("POST request, executing tests: {}", requestParser);
         
         final Renderer renderer = rendererSelector.getRenderer(request);
         if(renderer == null) {
@@ -203,7 +204,7 @@ public class JUnitServlet extends HttpSe
                     "No tests found for " + requestParser);
         }
         try {
-            testsManager.executeTests(testNames, renderer);
+            testsManager.executeTests(testNames, renderer, requestParser.getMethodName());
         } catch(Exception e) {
             throw new ServletException(e);
         }

Modified: sling/trunk/testing/junit/core/src/test/java/org/apache/sling/junit/RequestParserTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/testing/junit/core/src/test/java/org/apache/sling/junit/RequestParserTest.java?rev=1074212&r1=1074211&r2=1074212&view=diff
==============================================================================
--- sling/trunk/testing/junit/core/src/test/java/org/apache/sling/junit/RequestParserTest.java
(original)
+++ sling/trunk/testing/junit/core/src/test/java/org/apache/sling/junit/RequestParserTest.java
Thu Feb 24 16:54:59 2011
@@ -31,16 +31,14 @@ public class RequestParserTest {
     final String expectedTestSelector;
     final String expectedExtension;
     final String expectedMethodSelector;
-    final String [] parseResult;
+    final RequestParser parser;
     
     public RequestParserTest(String pathInfo, String expectedTestSelector, String expectedExtension,
String expectedMethodSelector) {
         this.pathInfo = pathInfo;
         this.expectedTestSelector = expectedTestSelector;
         this.expectedExtension = expectedExtension;
         this.expectedMethodSelector = expectedMethodSelector;
-        this.parseResult = RequestParser.parsePathInfo(pathInfo);
-        
-        assertEquals(3, parseResult.length);
+        parser = new RequestParser(RequestParser.parsePathInfo(pathInfo), null);
     }
 
     @Override
@@ -50,17 +48,17 @@ public class RequestParserTest {
     
     @Test
     public void testSelector() {
-        assertEquals(toString(), expectedTestSelector, parseResult[0]);
+        assertEquals(toString(), expectedTestSelector, parser.getTestSelector());
     }
     
     @Test
     public void testExtension() {
-        assertEquals(toString(), expectedExtension, parseResult[1]);
+        assertEquals(toString(), expectedExtension, parser.getExtension());
     }
     
     @Test
-    public void testMethodSelector() {
-        assertEquals(toString(), expectedMethodSelector, parseResult[2]);
+    public void testMethodName() {
+        assertEquals(toString(), expectedMethodSelector, parser.getMethodName());
     }
     
     @Parameters
@@ -73,6 +71,10 @@ public class RequestParserTest {
                 { "/someTests.here.html", "someTests.here", "html", EMPTY },
                 { "someTests.here.html", "someTests.here", "html", EMPTY },
                 { "someTests.here.html.json", "someTests.here.html", "json", EMPTY },
+                { "someTests.here.html.json/TEST_METHOD_NAME", "someTests.here.html", "json",
"TEST_METHOD_NAME" },
+                { ".json/TEST_METHOD_NAME", "", "json", "TEST_METHOD_NAME" },
+                { "/.json/TEST_METHOD_NAME", "", "json", "TEST_METHOD_NAME" },
+                { "/.html.json/TEST_METHOD_NAME", ".html", "json", "TEST_METHOD_NAME" },
         };
         
         return Arrays.asList(data);

Modified: sling/trunk/testing/junit/remote/src/main/java/org/apache/sling/junit/remote/testrunner/SlingRemoteTestParameters.java
URL: http://svn.apache.org/viewvc/sling/trunk/testing/junit/remote/src/main/java/org/apache/sling/junit/remote/testrunner/SlingRemoteTestParameters.java?rev=1074212&r1=1074211&r2=1074212&view=diff
==============================================================================
--- sling/trunk/testing/junit/remote/src/main/java/org/apache/sling/junit/remote/testrunner/SlingRemoteTestParameters.java
(original)
+++ sling/trunk/testing/junit/remote/src/main/java/org/apache/sling/junit/remote/testrunner/SlingRemoteTestParameters.java
Thu Feb 24 16:54:59 2011
@@ -20,7 +20,21 @@ package org.apache.sling.junit.remote.te
  *  run the tests.
  */
 public interface SlingRemoteTestParameters {
+    /** Return the URL of the JUnit servlet */
+    String getJunitServletUrl();
+    
+    /** Return the optional selector for the test classes to run,
+     *  for example "org.apache.sling.testing.samples.sampletests.JUnit4Test"
+     */
+    String getTestClassesSelector();
+    
+    /** Return the optional selector for the test methods to run,
+     *  for example "someMethodName"
+     */
+    String getTestMethodSelector();
+    
+    /** Return the expected number of tests - if zero, no check
+     *  is done.
+     */
     int getExpectedNumberOfTests();
-    String getServerBaseUrl();
-    String getJunitServletPath();
 }

Modified: sling/trunk/testing/junit/remote/src/main/java/org/apache/sling/junit/remote/testrunner/SlingRemoteTestRunner.java
URL: http://svn.apache.org/viewvc/sling/trunk/testing/junit/remote/src/main/java/org/apache/sling/junit/remote/testrunner/SlingRemoteTestRunner.java?rev=1074212&r1=1074211&r2=1074212&view=diff
==============================================================================
--- sling/trunk/testing/junit/remote/src/main/java/org/apache/sling/junit/remote/testrunner/SlingRemoteTestRunner.java
(original)
+++ sling/trunk/testing/junit/remote/src/main/java/org/apache/sling/junit/remote/testrunner/SlingRemoteTestRunner.java
Thu Feb 24 16:54:59 2011
@@ -78,13 +78,22 @@ public class SlingRemoteTestRunner exten
         
         // Setup request execution
         executor = new RequestExecutor(new DefaultHttpClient());
-        if(testParameters.getServerBaseUrl() == null) {
+        if(testParameters.getJunitServletUrl() == null) {
             throw new IllegalStateException("Server base URL is null, cannot run tests");
         }
-        builder = new RequestBuilder(testParameters.getServerBaseUrl());
+        builder = new RequestBuilder(testParameters.getJunitServletUrl());
         
         // POST request executes the tests
-        final Request r = builder.buildPostRequest(testParameters.getJunitServletPath() +
".json");
+        final StringBuilder subpath = new StringBuilder();
+        subpath.append("/");
+        subpath.append(testParameters.getTestClassesSelector());
+        subpath.append(".json");
+        final String testMethodSelector = testParameters.getTestMethodSelector();
+        if(testMethodSelector != null && testMethodSelector.length() > 0) {
+            subpath.append("/");
+            subpath.append(testMethodSelector);
+        }
+        final Request r = builder.buildPostRequest(subpath.toString());
         executor.execute(r)
         .assertStatus(200)
         .assertContentType("application/json");
@@ -101,8 +110,8 @@ public class SlingRemoteTestRunner exten
             }
         }
         
-        log.info("{} server-side tests executed at {}", 
-                children.size(), testParameters.getJunitServletPath());
+        log.info("Server-side tests executed at {} with path {}", 
+                testParameters.getJunitServletUrl(), subpath);
         
         // Check that number of tests is as expected
         assertEquals("Expecting " + testParameters.getExpectedNumberOfTests() + " tests",

Modified: sling/trunk/testing/samples/test-tools/src/test/java/org/apache/sling/testing/samples/testtools/SlingTestBase.java
URL: http://svn.apache.org/viewvc/sling/trunk/testing/samples/test-tools/src/test/java/org/apache/sling/testing/samples/testtools/SlingTestBase.java?rev=1074212&r1=1074211&r2=1074212&view=diff
==============================================================================
--- sling/trunk/testing/samples/test-tools/src/test/java/org/apache/sling/testing/samples/testtools/SlingTestBase.java
(original)
+++ sling/trunk/testing/samples/test-tools/src/test/java/org/apache/sling/testing/samples/testtools/SlingTestBase.java
Thu Feb 24 16:54:59 2011
@@ -30,8 +30,6 @@ import org.apache.http.impl.client.Defau
 import org.apache.sling.testing.tools.http.RequestBuilder;
 import org.apache.sling.testing.tools.http.RequestExecutor;
 import org.apache.sling.testing.tools.jarexec.JarExecutor;
-import org.junit.Before;
-import org.junit.BeforeClass;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -56,7 +54,15 @@ public class SlingTestBase {
     private static boolean serverReadyTestFailed;
     private static final Logger log = LoggerFactory.getLogger(SlingTestBase.class);
     
-    @BeforeClass
+    protected SlingTestBase() {
+        try {
+            startRunnableJar();
+            waitForServerReady();
+        } catch(Exception e) {
+            throw new IllegalStateException("JUnit Servlet not ready: ", e);
+        }
+    }
+    
     public static synchronized void startRunnableJar() throws Exception {
         if(serverStarted) {
             return;
@@ -87,7 +93,6 @@ public class SlingTestBase {
         builder = new RequestBuilder(serverBaseUrl);
     }
     
-    @Before
     public void waitForServerReady() throws Exception {
         if(serverReady) {
             return;

Copied: sling/trunk/testing/samples/test-tools/src/test/java/org/apache/sling/testing/samples/testtools/serverside/ServerSideSampleTest.java
(from r1074080, sling/trunk/testing/samples/test-tools/src/test/java/org/apache/sling/testing/samples/testtools/serverside/ServerSideTest.java)
URL: http://svn.apache.org/viewvc/sling/trunk/testing/samples/test-tools/src/test/java/org/apache/sling/testing/samples/testtools/serverside/ServerSideSampleTest.java?p2=sling/trunk/testing/samples/test-tools/src/test/java/org/apache/sling/testing/samples/testtools/serverside/ServerSideSampleTest.java&p1=sling/trunk/testing/samples/test-tools/src/test/java/org/apache/sling/testing/samples/testtools/serverside/ServerSideTest.java&r1=1074080&r2=1074212&rev=1074212&view=diff
==============================================================================
--- sling/trunk/testing/samples/test-tools/src/test/java/org/apache/sling/testing/samples/testtools/serverside/ServerSideTest.java
(original)
+++ sling/trunk/testing/samples/test-tools/src/test/java/org/apache/sling/testing/samples/testtools/serverside/ServerSideSampleTest.java
Thu Feb 24 16:54:59 2011
@@ -18,12 +18,11 @@ package org.apache.sling.testing.samples
 
 import org.apache.sling.junit.remote.testrunner.SlingRemoteTestParameters;
 import org.apache.sling.junit.remote.testrunner.SlingRemoteTestRunner;
-import org.junit.Test;
 import org.junit.runner.RunWith;
 
-/** Run all server-side tests */
+/** Run server-side tests from the sampletests bundle */
 @RunWith(SlingRemoteTestRunner.class)
-public class ServerSideTest extends ServerSideTestsBase implements SlingRemoteTestParameters
{
+public class ServerSideSampleTest extends ServerSideTestsBase implements SlingRemoteTestParameters
{
     
     public static final String TEST_SELECTOR = "org.apache.sling.testing.samples.sampletests";
     public static final int TESTS_AT_THIS_PATH = 5;
@@ -31,24 +30,16 @@ public class ServerSideTest extends Serv
     public int getExpectedNumberOfTests() {
         return TESTS_AT_THIS_PATH;
     }
-
-    public String getJunitServletPath() {
-        return JUNIT_SERVLET_PATH + "/" + TEST_SELECTOR;
+    
+    public String getJunitServletUrl() {
+        return serverBaseUrl + JUNIT_SERVLET_PATH;
     }
 
-    public String getServerBaseUrl() {
-        try {
-            // TODO do those really belong here??
-            // Needed to init serverBaseUrl
-            startRunnableJar();
-            checkJunitServletPresent();
-        } catch (Exception e) {
-            throw new IllegalStateException("checkJunitServletPresent failed", e);
-        }
-        return serverBaseUrl;
+    public String getTestClassesSelector() {
+        return TEST_SELECTOR;
     }
 
-    @Test
-    public void dummyTest() {
+    public String getTestMethodSelector() {
+        return null;
     }
 }
\ No newline at end of file

Modified: sling/trunk/testing/samples/test-tools/src/test/java/org/apache/sling/testing/samples/testtools/serverside/ServerSideTestsBase.java
URL: http://svn.apache.org/viewvc/sling/trunk/testing/samples/test-tools/src/test/java/org/apache/sling/testing/samples/testtools/serverside/ServerSideTestsBase.java?rev=1074212&r1=1074211&r2=1074212&view=diff
==============================================================================
--- sling/trunk/testing/samples/test-tools/src/test/java/org/apache/sling/testing/samples/testtools/serverside/ServerSideTestsBase.java
(original)
+++ sling/trunk/testing/samples/test-tools/src/test/java/org/apache/sling/testing/samples/testtools/serverside/ServerSideTestsBase.java
Thu Feb 24 16:54:59 2011
@@ -18,7 +18,6 @@ package org.apache.sling.testing.samples
 
 import org.apache.sling.testing.samples.testtools.SlingTestBase;
 import org.apache.sling.testing.tools.retry.RetryLoop;
-import org.junit.Before;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -35,8 +34,15 @@ public class ServerSideTestsBase extends
     // to cope with slower testing systems??
     public static final int JUNIT_SERVLET_TIMEOUT_SECONDS = 60;
 
-    @Before
-    public void checkJunitServletPresent() throws Exception {
+    protected ServerSideTestsBase() {
+        try {
+            checkJunitServletPresent();
+        } catch(Exception e) {
+            throw new IllegalStateException("JUnit Servlet not ready: ", e);
+        }
+    }
+    
+    private void checkJunitServletPresent() throws Exception {
         if(junitServletOk) {
             return;
         }

Added: sling/trunk/testing/samples/test-tools/src/test/java/org/apache/sling/testing/samples/testtools/serverside/SingleServerSideMethodTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/testing/samples/test-tools/src/test/java/org/apache/sling/testing/samples/testtools/serverside/SingleServerSideMethodTest.java?rev=1074212&view=auto
==============================================================================
--- sling/trunk/testing/samples/test-tools/src/test/java/org/apache/sling/testing/samples/testtools/serverside/SingleServerSideMethodTest.java
(added)
+++ sling/trunk/testing/samples/test-tools/src/test/java/org/apache/sling/testing/samples/testtools/serverside/SingleServerSideMethodTest.java
Thu Feb 24 16:54:59 2011
@@ -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 org.apache.sling.testing.samples.testtools.serverside;
+
+import org.apache.sling.junit.remote.testrunner.SlingRemoteTestParameters;
+import org.apache.sling.junit.remote.testrunner.SlingRemoteTestRunner;
+import org.junit.runner.RunWith;
+
+/** Run a single test method from a servet-side test */ 
+@RunWith(SlingRemoteTestRunner.class)
+public class SingleServerSideMethodTest extends ServerSideTestsBase implements SlingRemoteTestParameters
{
+    
+    public static final String TEST_CLASS = "org.apache.sling.testing.samples.sampletests.JUnit4Test";
+    public static final String TEST_METHOD = "testRequiresBefore";
+    public static final int TESTS_AT_THIS_PATH = 1;
+
+    public int getExpectedNumberOfTests() {
+        return TESTS_AT_THIS_PATH;
+    }
+
+    public String getJunitServletUrl() {
+        return serverBaseUrl + JUNIT_SERVLET_PATH;
+    }
+
+    public String getTestClassesSelector() {
+        return TEST_CLASS;
+    }
+
+    public String getTestMethodSelector() {
+        return TEST_METHOD;
+    }
+}
\ No newline at end of file

Propchange: sling/trunk/testing/samples/test-tools/src/test/java/org/apache/sling/testing/samples/testtools/serverside/SingleServerSideMethodTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/trunk/testing/samples/test-tools/src/test/java/org/apache/sling/testing/samples/testtools/serverside/SingleServerSideMethodTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL



Mime
View raw message