You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by re...@apache.org on 2015/02/03 01:39:38 UTC

cxf git commit: CXF-6132: Provide JAX-RS ServletContextInitializer. Adding Jetty-based test cases. Minor fixes.

Repository: cxf
Updated Branches:
  refs/heads/master 5e919271e -> 799c5389f


CXF-6132: Provide JAX-RS ServletContextInitializer. Adding Jetty-based test cases. Minor fixes.


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/799c5389
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/799c5389
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/799c5389

Branch: refs/heads/master
Commit: 799c5389f754eb588f023b646b8983b50dde00be
Parents: 5e91927
Author: reta <dr...@gmail.com>
Authored: Mon Feb 2 19:39:16 2015 -0500
Committer: reta <dr...@gmail.com>
Committed: Mon Feb 2 19:39:16 2015 -0500

----------------------------------------------------------------------
 .../JaxrsServletContainerInitializer.java       |   5 +-
 systests/pom.xml                                |   1 +
 systests/rs-http-sci/pom.xml                    | 156 +++++++++++++++++++
 .../cxf/jaxrs/servlet/AbstractSciTest.java      |  61 ++++++++
 .../servlet/jetty/AbstractJettyServer.java      |  84 ++++++++++
 .../servlet/jetty/JettyNoApplicationTest.java   |  68 ++++++++
 .../JettySingleApplicationOnlyClassesTest.java  |  60 +++++++
 ...ettySingleApplicationOnlySingletonsTest.java |  60 +++++++
 .../jetty/JettySingleApplicationTest.java       |  60 +++++++
 .../applications/classes/BookApplication.java   |  40 +++++
 .../applications/complete/BookApplication.java  |  44 ++++++
 .../singletons/BookApplication.java             |  39 +++++
 .../java/org/apache/demo/resources/Book.java    |  52 +++++++
 .../org/apache/demo/resources/BookStore.java    |  35 +++++
 .../javax.servlet.ServletContainerInitializer   |   1 +
 .../src/test/resources/WEB-INF/web.xml          |  10 ++
 16 files changed, 774 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/799c5389/rt/rs/http-sci/src/main/java/org/apache/cxf/jaxrs/servlet/JaxrsServletContainerInitializer.java
----------------------------------------------------------------------
diff --git a/rt/rs/http-sci/src/main/java/org/apache/cxf/jaxrs/servlet/JaxrsServletContainerInitializer.java b/rt/rs/http-sci/src/main/java/org/apache/cxf/jaxrs/servlet/JaxrsServletContainerInitializer.java
index 4f7f42b..89c6b39 100644
--- a/rt/rs/http-sci/src/main/java/org/apache/cxf/jaxrs/servlet/JaxrsServletContainerInitializer.java
+++ b/rt/rs/http-sci/src/main/java/org/apache/cxf/jaxrs/servlet/JaxrsServletContainerInitializer.java
@@ -45,6 +45,7 @@ public class JaxrsServletContainerInitializer implements ServletContainerInitial
     private static final Logger LOG = LogUtils.getL7dLogger(JaxrsServletContainerInitializer.class);
     private static final String IGNORE_PACKAGE = "org.apache.cxf";
     
+    private static final String JAXRS_APPLICATION_SERVLET_NAME = "javax.ws.rs.core.Application";
     private static final String JAXRS_APPLICATION_PARAM = "javax.ws.rs.Application";
     private static final String CXF_JAXRS_APPLICATION_PARAM = "jaxrs.application";
     private static final String CXF_JAXRS_CLASSES_PARAM = "jaxrs.classes";
@@ -93,10 +94,10 @@ public class JaxrsServletContainerInitializer implements ServletContainerInitial
                 || !providersAndResources.get(Provider.class).isEmpty()) {
                 if (app == null) {
                     // Servlet name is a JAX-RS Application class name
-                    servletName = JAXRS_APPLICATION_PARAM;
+                    servletName = JAXRS_APPLICATION_SERVLET_NAME;
                     // Servlet mapping is obtained from a servlet registration 
                     // with a JAX-RS Application class name
-                    servletMapping = getServletMapping(ctx, JAXRS_APPLICATION_PARAM);
+                    servletMapping = getServletMapping(ctx, servletName);
                 }
                 app = new Application() {
                     @Override

http://git-wip-us.apache.org/repos/asf/cxf/blob/799c5389/systests/pom.xml
----------------------------------------------------------------------
diff --git a/systests/pom.xml b/systests/pom.xml
index 016bec9..09d36ae 100644
--- a/systests/pom.xml
+++ b/systests/pom.xml
@@ -46,6 +46,7 @@
         <module>rs-security</module>
         <module>wsdl_maven</module>
         <module>cdi</module>
+        <module>rs-http-sci</module>
     </modules>
 
     <profiles>

http://git-wip-us.apache.org/repos/asf/cxf/blob/799c5389/systests/rs-http-sci/pom.xml
----------------------------------------------------------------------
diff --git a/systests/rs-http-sci/pom.xml b/systests/rs-http-sci/pom.xml
new file mode 100644
index 0000000..1214d41
--- /dev/null
+++ b/systests/rs-http-sci/pom.xml
@@ -0,0 +1,156 @@
+<?xml version="1.0"?>
+<!--
+  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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <artifactId>cxf-parent</artifactId>
+        <groupId>org.apache.cxf</groupId>
+        <version>3.1.0-SNAPSHOT</version>
+        <relativePath>../../parent/pom.xml</relativePath>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.apache.cxf.systests</groupId>
+    <artifactId>cxf-systests-http-sci</artifactId>
+    <name>Apache CXF Servlet Container Initializer Integration System Tests</name>
+    <description>Apache CXF Servlet Container Initializer Integration System Tests</description>
+    <url>http://cxf.apache.org</url>
+    <properties>
+        <cxf.surefire.fork.vmargs>-XX:MaxPermSize=192m</cxf.surefire.fork.vmargs>
+        <cxf.server.launcher.vmargs>-XX:MaxPermSize=192m</cxf.server.launcher.vmargs>
+        <cxf.tomcat.version>7.0.52</cxf.tomcat.version>
+    </properties>
+    <dependencies>
+        <dependency>
+            <groupId>org.eclipse.jetty</groupId>
+            <artifactId>jetty-annotations</artifactId>
+            <version>${cxf.jetty.version}</version>            
+        </dependency>    
+        <dependency>
+            <groupId>org.eclipse.jetty</groupId>
+            <artifactId>jetty-server</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.eclipse.jetty</groupId>
+            <artifactId>jetty-plus</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.eclipse.jetty</groupId>
+            <artifactId>jetty-webapp</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.eclipse.jetty</groupId>
+            <artifactId>jetty-jsp</artifactId>
+            <version>${cxf.jetty.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-jdk14</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-core</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-transports-http-jetty</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-frontend-jaxrs</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-rs-client</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-rs-http-sci</artifactId>
+            <version>${project.version}</version>
+        </dependency>                
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-testutils</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>javax.annotation</groupId>
+            <artifactId>jsr250-api</artifactId>
+            <version>1.0</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>com.fasterxml.jackson.jaxrs</groupId>
+            <artifactId>jackson-jaxrs-json-provider</artifactId>
+            <version>2.2.1</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpclient</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.tomcat.embed</groupId>
+            <artifactId>tomcat-embed-core</artifactId>
+            <version>${cxf.tomcat.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.tomcat.embed</groupId>
+            <artifactId>tomcat-embed-logging-juli</artifactId>
+            <version>${cxf.tomcat.version}</version>
+        </dependency>        
+        <dependency>
+            <groupId>com.ning</groupId>
+            <artifactId>async-http-client</artifactId>
+            <version>${cxf.ahc.version}</version>
+            <scope>test</scope>
+            <exclusions>
+                <exclusion>
+                    <groupId>io.netty</groupId>
+                    <artifactId>netty</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+    </dependencies>
+    <build>
+        <plugins>
+            <plugin>
+                <artifactId>maven-jar-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>attach-sources</id>
+                        <goals>
+                            <goal>test-jar</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+</project>

http://git-wip-us.apache.org/repos/asf/cxf/blob/799c5389/systests/rs-http-sci/src/test/java/org/apache/cxf/jaxrs/servlet/AbstractSciTest.java
----------------------------------------------------------------------
diff --git a/systests/rs-http-sci/src/test/java/org/apache/cxf/jaxrs/servlet/AbstractSciTest.java b/systests/rs-http-sci/src/test/java/org/apache/cxf/jaxrs/servlet/AbstractSciTest.java
new file mode 100644
index 0000000..e67f933
--- /dev/null
+++ b/systests/rs-http-sci/src/test/java/org/apache/cxf/jaxrs/servlet/AbstractSciTest.java
@@ -0,0 +1,61 @@
+/**
+ * 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.cxf.jaxrs.servlet;
+
+import java.util.Arrays;
+import java.util.List;
+
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status;
+
+import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
+
+import org.apache.cxf.jaxrs.client.WebClient;
+import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
+import org.apache.demo.resources.Book;
+import org.junit.Test;
+
+
+public abstract class AbstractSciTest extends AbstractBusClientServerTestBase {
+    @Test
+    public void testResponseHasBeenReceivedWhenQueringBook() {
+        Response r = createWebClient("/bookstore/books").path("1").get();
+        assertEquals(Status.OK.getStatusCode(), r.getStatus());
+        
+        Book book = r.readEntity(Book.class);
+        assertEquals("1", book.getId());
+    }
+
+    protected WebClient createWebClient(final String url) {
+        final List< ? > providers = Arrays.asList(new JacksonJsonProvider());
+        
+        final WebClient wc = WebClient
+            .create("http://localhost:" + getPort(), providers)
+            .path(getContextPath())
+            .path(url)
+            .accept(MediaType.APPLICATION_JSON);
+        
+        WebClient.getConfig(wc).getHttpConduit().getClient().setReceiveTimeout(10000000L);
+        return wc;
+    }
+    
+    protected abstract int getPort();
+    protected abstract String getContextPath();
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/799c5389/systests/rs-http-sci/src/test/java/org/apache/cxf/jaxrs/servlet/jetty/AbstractJettyServer.java
----------------------------------------------------------------------
diff --git a/systests/rs-http-sci/src/test/java/org/apache/cxf/jaxrs/servlet/jetty/AbstractJettyServer.java b/systests/rs-http-sci/src/test/java/org/apache/cxf/jaxrs/servlet/jetty/AbstractJettyServer.java
new file mode 100644
index 0000000..4f8517d
--- /dev/null
+++ b/systests/rs-http-sci/src/test/java/org/apache/cxf/jaxrs/servlet/jetty/AbstractJettyServer.java
@@ -0,0 +1,84 @@
+/**
+ * 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.cxf.jaxrs.servlet.jetty;
+
+import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
+import org.eclipse.jetty.annotations.AnnotationConfiguration;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.util.resource.Resource;
+import org.eclipse.jetty.webapp.Configuration;
+import org.eclipse.jetty.webapp.WebAppContext;
+import org.eclipse.jetty.webapp.WebXmlConfiguration;
+
+public abstract class AbstractJettyServer extends AbstractBusTestServerBase {
+    private org.eclipse.jetty.server.Server server;
+    private final Resource[] resources;
+    private final String contextPath;
+    private final int port;
+    
+    protected AbstractJettyServer(final String contextPath, final Resource[] resources, int portNumber) {
+        this.contextPath = contextPath;
+        this.resources = resources;
+        this.port = portNumber;
+    }
+    
+    protected void run() {
+        server = new Server(port);
+            
+        try {
+            final WebAppContext context = new WebAppContext();
+            context.setContextPath(contextPath);
+            
+            context.setConfigurations(new Configuration[] { 
+                new WebXmlConfiguration(), 
+                new AnnotationConfiguration()  
+            });            
+            
+            for (final Resource resource: resources) {
+                context.getMetaData().addContainerResource(resource);    
+            }
+            
+            configureContext(context);
+            server.setHandler(context);
+            
+            configureServer(server);
+            server.start();        
+        } catch (final Exception ex) {
+            ex.printStackTrace();
+            fail(ex.getMessage());
+        }
+    }
+    
+    protected void configureServer(final Server theserver) throws Exception {        
+    }
+    
+    protected void configureContext(final WebAppContext context) throws Exception {        
+    }
+        
+    public void tearDown() throws Exception {
+        super.tearDown();
+        
+        if (server != null) {
+            server.stop();
+            server.destroy();
+            server = null;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/799c5389/systests/rs-http-sci/src/test/java/org/apache/cxf/jaxrs/servlet/jetty/JettyNoApplicationTest.java
----------------------------------------------------------------------
diff --git a/systests/rs-http-sci/src/test/java/org/apache/cxf/jaxrs/servlet/jetty/JettyNoApplicationTest.java b/systests/rs-http-sci/src/test/java/org/apache/cxf/jaxrs/servlet/jetty/JettyNoApplicationTest.java
new file mode 100644
index 0000000..129f7ce
--- /dev/null
+++ b/systests/rs-http-sci/src/test/java/org/apache/cxf/jaxrs/servlet/jetty/JettyNoApplicationTest.java
@@ -0,0 +1,68 @@
+/**
+ * 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.cxf.jaxrs.servlet.jetty;
+
+import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
+
+import org.apache.cxf.jaxrs.model.AbstractResourceInfo;
+import org.apache.cxf.jaxrs.servlet.AbstractSciTest;
+import org.eclipse.jetty.util.resource.Resource;
+import org.eclipse.jetty.webapp.WebAppContext;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+
+public class JettyNoApplicationTest extends AbstractSciTest {  
+    @Ignore
+    public static class EmbeddedJettyServer extends AbstractJettyServer {
+        public static final int PORT = allocatePortAsInt(EmbeddedJettyServer.class);
+
+        public EmbeddedJettyServer() {
+            super("/",
+                new Resource[] {
+                    // Limit the classpath scanning to org.apache.demo.resources package
+                    Resource.newClassPathResource("/org/apache/demo/resources"),
+                    // Include Jackson @Providers into classpath scanning
+                    Resource.newResource(JacksonJsonProvider.class.getProtectionDomain().getCodeSource().getLocation())
+                }, PORT);
+        }
+        
+        @Override
+        protected void configureContext(final WebAppContext context) throws Exception {     
+            context.setDescriptor(Resource.newClassPathResource("/WEB-INF/web.xml").getFile().toURI().getPath());
+        }
+    }
+    
+    @BeforeClass
+    public static void startServers() throws Exception {
+        AbstractResourceInfo.clearAllMaps();
+        assertTrue("server did not launch correctly", launchServer(EmbeddedJettyServer.class, true));
+        createStaticBus();
+    }
+    
+    @Override
+    protected int getPort() {
+        return EmbeddedJettyServer.PORT;
+    }
+
+    @Override
+    protected String getContextPath() {
+        return "/";
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/799c5389/systests/rs-http-sci/src/test/java/org/apache/cxf/jaxrs/servlet/jetty/JettySingleApplicationOnlyClassesTest.java
----------------------------------------------------------------------
diff --git a/systests/rs-http-sci/src/test/java/org/apache/cxf/jaxrs/servlet/jetty/JettySingleApplicationOnlyClassesTest.java b/systests/rs-http-sci/src/test/java/org/apache/cxf/jaxrs/servlet/jetty/JettySingleApplicationOnlyClassesTest.java
new file mode 100644
index 0000000..6953de6
--- /dev/null
+++ b/systests/rs-http-sci/src/test/java/org/apache/cxf/jaxrs/servlet/jetty/JettySingleApplicationOnlyClassesTest.java
@@ -0,0 +1,60 @@
+/**
+ * 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.cxf.jaxrs.servlet.jetty;
+
+import org.apache.cxf.jaxrs.model.AbstractResourceInfo;
+import org.apache.cxf.jaxrs.servlet.AbstractSciTest;
+import org.eclipse.jetty.util.resource.Resource;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+
+public class JettySingleApplicationOnlyClassesTest extends AbstractSciTest {  
+    @Ignore
+    public static class EmbeddedJettyServer extends AbstractJettyServer {
+        public static final int PORT = allocatePortAsInt(EmbeddedJettyServer.class);
+
+        public EmbeddedJettyServer() {
+            super("/",
+                new Resource[] {
+                    // Limit the classpath scanning to org.apache.demo.resources package
+                    Resource.newClassPathResource("/org/apache/demo/resources"),
+                    // Include JAX-RS application from org.apache.applications.classes package
+                    Resource.newClassPathResource("/org/apache/demo/applications/classes")
+                }, PORT);
+        }
+    }
+    
+    @BeforeClass
+    public static void startServers() throws Exception {
+        AbstractResourceInfo.clearAllMaps();
+        assertTrue("server did not launch correctly", launchServer(EmbeddedJettyServer.class, true));
+        createStaticBus();
+    }
+    
+    @Override
+    protected int getPort() {
+        return EmbeddedJettyServer.PORT;
+    }
+
+    @Override
+    protected String getContextPath() {
+        return "/api";
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/799c5389/systests/rs-http-sci/src/test/java/org/apache/cxf/jaxrs/servlet/jetty/JettySingleApplicationOnlySingletonsTest.java
----------------------------------------------------------------------
diff --git a/systests/rs-http-sci/src/test/java/org/apache/cxf/jaxrs/servlet/jetty/JettySingleApplicationOnlySingletonsTest.java b/systests/rs-http-sci/src/test/java/org/apache/cxf/jaxrs/servlet/jetty/JettySingleApplicationOnlySingletonsTest.java
new file mode 100644
index 0000000..cdffd3a
--- /dev/null
+++ b/systests/rs-http-sci/src/test/java/org/apache/cxf/jaxrs/servlet/jetty/JettySingleApplicationOnlySingletonsTest.java
@@ -0,0 +1,60 @@
+/**
+ * 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.cxf.jaxrs.servlet.jetty;
+
+import org.apache.cxf.jaxrs.model.AbstractResourceInfo;
+import org.apache.cxf.jaxrs.servlet.AbstractSciTest;
+import org.eclipse.jetty.util.resource.Resource;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+
+public class JettySingleApplicationOnlySingletonsTest extends AbstractSciTest {  
+    @Ignore
+    public static class EmbeddedJettyServer extends AbstractJettyServer {
+        public static final int PORT = allocatePortAsInt(EmbeddedJettyServer.class);
+
+        public EmbeddedJettyServer() {
+            super("/",
+                new Resource[] {
+                    // Limit the classpath scanning to org.apache.demo.resources package
+                    Resource.newClassPathResource("/org/apache/demo/resources"),
+                    // Include JAX-RS application from org.apache.applications.singletons package
+                    Resource.newClassPathResource("/org/apache/demo/applications/singletons")
+                }, PORT);
+        }
+    }
+    
+    @BeforeClass
+    public static void startServers() throws Exception {
+        AbstractResourceInfo.clearAllMaps();
+        assertTrue("server did not launch correctly", launchServer(EmbeddedJettyServer.class, true));
+        createStaticBus();
+    }
+    
+    @Override
+    protected int getPort() {
+        return EmbeddedJettyServer.PORT;
+    }
+
+    @Override
+    protected String getContextPath() {
+        return "/api";
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/799c5389/systests/rs-http-sci/src/test/java/org/apache/cxf/jaxrs/servlet/jetty/JettySingleApplicationTest.java
----------------------------------------------------------------------
diff --git a/systests/rs-http-sci/src/test/java/org/apache/cxf/jaxrs/servlet/jetty/JettySingleApplicationTest.java b/systests/rs-http-sci/src/test/java/org/apache/cxf/jaxrs/servlet/jetty/JettySingleApplicationTest.java
new file mode 100644
index 0000000..2bc02e3
--- /dev/null
+++ b/systests/rs-http-sci/src/test/java/org/apache/cxf/jaxrs/servlet/jetty/JettySingleApplicationTest.java
@@ -0,0 +1,60 @@
+/**
+ * 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.cxf.jaxrs.servlet.jetty;
+
+import org.apache.cxf.jaxrs.model.AbstractResourceInfo;
+import org.apache.cxf.jaxrs.servlet.AbstractSciTest;
+import org.eclipse.jetty.util.resource.Resource;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+
+public class JettySingleApplicationTest extends AbstractSciTest {  
+    @Ignore
+    public static class EmbeddedJettyServer extends AbstractJettyServer {
+        public static final int PORT = allocatePortAsInt(EmbeddedJettyServer.class);
+
+        public EmbeddedJettyServer() {
+            super("/",
+                new Resource[] {
+                    // Limit the classpath scanning to org.apache.demo.resources package
+                    Resource.newClassPathResource("/org/apache/demo/resources"),
+                    // Limit the classpath scanning to org.apache.demo.complete package
+                    Resource.newClassPathResource("/org/apache/demo/applications/complete")
+                }, PORT);
+        }
+    }
+    
+    @BeforeClass
+    public static void startServers() throws Exception {
+        AbstractResourceInfo.clearAllMaps();
+        assertTrue("server did not launch correctly", launchServer(EmbeddedJettyServer.class, true));
+        createStaticBus();
+    }
+    
+    @Override
+    protected int getPort() {
+        return EmbeddedJettyServer.PORT;
+    }
+
+    @Override
+    protected String getContextPath() {
+        return "/api";
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/799c5389/systests/rs-http-sci/src/test/java/org/apache/demo/applications/classes/BookApplication.java
----------------------------------------------------------------------
diff --git a/systests/rs-http-sci/src/test/java/org/apache/demo/applications/classes/BookApplication.java b/systests/rs-http-sci/src/test/java/org/apache/demo/applications/classes/BookApplication.java
new file mode 100644
index 0000000..ced7d65
--- /dev/null
+++ b/systests/rs-http-sci/src/test/java/org/apache/demo/applications/classes/BookApplication.java
@@ -0,0 +1,40 @@
+/**
+ * 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.demo.applications.classes;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.ws.rs.ApplicationPath;
+import javax.ws.rs.core.Application;
+
+import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
+    
+
+import org.apache.demo.resources.BookStore;
+
+@ApplicationPath("/api")
+public class BookApplication extends Application {
+    @Override
+    public Set< Class< ? > > getClasses() {
+        return new HashSet< Class< ? > >(Arrays.asList(
+            BookStore.class, JacksonJsonProvider.class));
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/799c5389/systests/rs-http-sci/src/test/java/org/apache/demo/applications/complete/BookApplication.java
----------------------------------------------------------------------
diff --git a/systests/rs-http-sci/src/test/java/org/apache/demo/applications/complete/BookApplication.java b/systests/rs-http-sci/src/test/java/org/apache/demo/applications/complete/BookApplication.java
new file mode 100644
index 0000000..6b8b85e
--- /dev/null
+++ b/systests/rs-http-sci/src/test/java/org/apache/demo/applications/complete/BookApplication.java
@@ -0,0 +1,44 @@
+/**
+ * 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.demo.applications.complete;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.ws.rs.ApplicationPath;
+import javax.ws.rs.core.Application;
+
+import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
+    
+
+import org.apache.demo.resources.BookStore;
+
+@ApplicationPath("/api")
+public class BookApplication extends Application {
+    @Override
+    public Set< Class< ? > > getClasses() {
+        return new HashSet< Class< ? > >(Arrays.asList(JacksonJsonProvider.class));
+    }
+    
+    @Override
+    public Set< Object > getSingletons() {
+        return new HashSet< Object >(Arrays.asList(new BookStore()));
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/799c5389/systests/rs-http-sci/src/test/java/org/apache/demo/applications/singletons/BookApplication.java
----------------------------------------------------------------------
diff --git a/systests/rs-http-sci/src/test/java/org/apache/demo/applications/singletons/BookApplication.java b/systests/rs-http-sci/src/test/java/org/apache/demo/applications/singletons/BookApplication.java
new file mode 100644
index 0000000..abb5232
--- /dev/null
+++ b/systests/rs-http-sci/src/test/java/org/apache/demo/applications/singletons/BookApplication.java
@@ -0,0 +1,39 @@
+/**
+ * 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.demo.applications.singletons;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.ws.rs.ApplicationPath;
+import javax.ws.rs.core.Application;
+
+import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
+    
+import org.apache.demo.resources.BookStore;
+
+@ApplicationPath("/api")
+public class BookApplication extends Application {
+    @Override
+    public Set< Object > getSingletons() {
+        return new HashSet< Object >(Arrays.asList(
+            new BookStore(), new JacksonJsonProvider()));
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/799c5389/systests/rs-http-sci/src/test/java/org/apache/demo/resources/Book.java
----------------------------------------------------------------------
diff --git a/systests/rs-http-sci/src/test/java/org/apache/demo/resources/Book.java b/systests/rs-http-sci/src/test/java/org/apache/demo/resources/Book.java
new file mode 100644
index 0000000..e97bdb2
--- /dev/null
+++ b/systests/rs-http-sci/src/test/java/org/apache/demo/resources/Book.java
@@ -0,0 +1,52 @@
+/**
+ * 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.demo.resources;
+
+public class Book {
+    private String name;
+    private String id;
+    
+    public Book() {
+    }
+    
+    public Book(String id) {
+        this.id = id;
+    }
+    
+    public Book(String name, String id) {
+        this.name = name;
+        this.id = id;
+    }
+    
+    public void setName(String n) {
+        name = n;
+    }
+
+    public String getName() {
+        return name;
+    }
+    
+    public void setId(String i) {
+        id = i;
+    }
+ 
+    public String getId() {
+        return id;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/799c5389/systests/rs-http-sci/src/test/java/org/apache/demo/resources/BookStore.java
----------------------------------------------------------------------
diff --git a/systests/rs-http-sci/src/test/java/org/apache/demo/resources/BookStore.java b/systests/rs-http-sci/src/test/java/org/apache/demo/resources/BookStore.java
new file mode 100644
index 0000000..a0ed0dc
--- /dev/null
+++ b/systests/rs-http-sci/src/test/java/org/apache/demo/resources/BookStore.java
@@ -0,0 +1,35 @@
+/**
+ * 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.demo.resources;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+
+@Path("/bookstore/")
+public class BookStore {
+    @GET
+    @Path("/books/{bookId}")
+    @Produces(MediaType.APPLICATION_JSON)
+    public Book getBook(@PathParam("bookId") String id) {
+        return new Book("Book with id " + id, id);
+    }    
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/799c5389/systests/rs-http-sci/src/test/resources/META-INF/services/javax.servlet.ServletContainerInitializer
----------------------------------------------------------------------
diff --git a/systests/rs-http-sci/src/test/resources/META-INF/services/javax.servlet.ServletContainerInitializer b/systests/rs-http-sci/src/test/resources/META-INF/services/javax.servlet.ServletContainerInitializer
new file mode 100644
index 0000000..3d22cbc
--- /dev/null
+++ b/systests/rs-http-sci/src/test/resources/META-INF/services/javax.servlet.ServletContainerInitializer
@@ -0,0 +1 @@
+org.apache.cxf.jaxrs.servlet.JaxrsServletContainerInitializer
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cxf/blob/799c5389/systests/rs-http-sci/src/test/resources/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/systests/rs-http-sci/src/test/resources/WEB-INF/web.xml b/systests/rs-http-sci/src/test/resources/WEB-INF/web.xml
new file mode 100644
index 0000000..d4e5470
--- /dev/null
+++ b/systests/rs-http-sci/src/test/resources/WEB-INF/web.xml
@@ -0,0 +1,10 @@
+<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
+	<servlet>
+		<servlet-name>javax.ws.rs.core.Application</servlet-name>
+	</servlet>
+	<servlet-mapping>
+		<servlet-name>javax.ws.rs.core.Application</servlet-name>
+		<url-pattern>/*</url-pattern>
+	</servlet-mapping>
+</web-app>
\ No newline at end of file