protected void activate()

in src/main/java/org/apache/sling/junit/impl/servlet/SlingJUnitServlet.java [71:100]


    protected void activate(final ComponentContext ctx) {
        this.processor = new ServletProcessor(testsManager, rendererSelector) {
            @Override
            protected String getTestSelectionPath(HttpServletRequest request) {
                // PathInfo contains the path to our resource, followed
                // by the .junit extension - cut up to that
                String result = request.getPathInfo();
                final int pos = result.indexOf(EXTENSION);
                if(pos >= 0) {
                    result = result.substring(pos + EXTENSION.length());
                }
                return result;
            }

            /** Return path to which to POST to execute specified test */
            @Override
            protected String getTestExecutionPath(HttpServletRequest request, TestSelector selector, String extension) {
                String selectedTestMethodName = selector.getSelectedTestMethodName();
                String methodStr = "";
                if (selectedTestMethodName != null && !"".equals(selectedTestMethodName)) {
                    methodStr = "/" + selectedTestMethodName;
                }
                return  "./"
                + selector.getTestSelectorString()
                + methodStr
                + "."
                + extension;
            }
        };
    }