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 2016/09/16 01:37:03 UTC
[12/22] cxf git commit: CXF-5855: Introduce support for Server Sent
Events. Initial implementation based on Atmosphere
http://git-wip-us.apache.org/repos/asf/cxf/blob/41733786/systests/rs-sse/src/test/java/org/apache/cxf/systest/jaxrs/sse/Book.java
----------------------------------------------------------------------
diff --git a/systests/rs-sse/src/test/java/org/apache/cxf/systest/jaxrs/sse/Book.java b/systests/rs-sse/src/test/java/org/apache/cxf/systest/jaxrs/sse/Book.java
new file mode 100644
index 0000000..67322f8
--- /dev/null
+++ b/systests/rs-sse/src/test/java/org/apache/cxf/systest/jaxrs/sse/Book.java
@@ -0,0 +1,65 @@
+/**
+ * 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.systest.jaxrs.sse;
+
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+
+public class Book {
+ private String name;
+ private Integer id;
+
+ public Book() {
+ }
+
+ public Book(Integer id) {
+ this.id = id;
+ }
+
+ public Book(String name, Integer id) {
+ this.name = name;
+ this.id = id;
+ }
+
+ public void setName(String n) {
+ name = n;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setId(Integer i) {
+ id = i;
+ }
+
+ public Integer getId() {
+ return id;
+ }
+
+ @Override
+ public int hashCode() {
+ return HashCodeBuilder.reflectionHashCode(this);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ return EqualsBuilder.reflectionEquals(this, obj);
+ }
+}
http://git-wip-us.apache.org/repos/asf/cxf/blob/41733786/systests/rs-sse/src/test/java/org/apache/cxf/systest/jaxrs/sse/BookStore.java
----------------------------------------------------------------------
diff --git a/systests/rs-sse/src/test/java/org/apache/cxf/systest/jaxrs/sse/BookStore.java b/systests/rs-sse/src/test/java/org/apache/cxf/systest/jaxrs/sse/BookStore.java
new file mode 100644
index 0000000..6af5a1f
--- /dev/null
+++ b/systests/rs-sse/src/test/java/org/apache/cxf/systest/jaxrs/sse/BookStore.java
@@ -0,0 +1,128 @@
+/**
+ * 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.systest.jaxrs.sse;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicReference;
+
+import javax.ws.rs.DefaultValue;
+import javax.ws.rs.GET;
+import javax.ws.rs.HeaderParam;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.sse.OutboundSseEvent;
+import javax.ws.rs.sse.SseBroadcaster;
+import javax.ws.rs.sse.SseContext;
+import javax.ws.rs.sse.SseEventOutput;
+
+@Path("/api/bookstore")
+public class BookStore {
+ private final CountDownLatch latch = new CountDownLatch(2);
+ private final AtomicReference<SseBroadcaster> broadcaster =
+ new AtomicReference<SseBroadcaster>();
+
+ private static OutboundSseEvent createStatsEvent(final OutboundSseEvent.Builder builder, final int eventId) {
+ return builder
+ .id(Integer.toString(eventId))
+ .data(Book.class, new Book("New Book #" + eventId, eventId))
+ .mediaType(MediaType.APPLICATION_JSON_TYPE)
+ .build();
+ }
+
+ @GET
+ @Produces(MediaType.APPLICATION_JSON)
+ public Collection<Book> books() {
+ return Arrays.asList(
+ new Book("New Book #1", 1),
+ new Book("New Book #2", 2)
+ );
+ }
+
+ @GET
+ @Path("sse/{id}")
+ @Produces(MediaType.SERVER_SENT_EVENTS)
+ public SseEventOutput forBook(@Context SseContext sseContext, @PathParam("id") final String id,
+ @HeaderParam(HttpHeaders.LAST_EVENT_ID_HEADER) @DefaultValue("0") final String lastEventId) {
+ final SseEventOutput output = sseContext.newOutput();
+
+ new Thread() {
+ public void run() {
+ try {
+ final Integer id = Integer.valueOf(lastEventId);
+
+ output.write(createStatsEvent(sseContext.newEvent().name("book"), id + 1));
+ Thread.sleep(200);
+ output.write(createStatsEvent(sseContext.newEvent().name("book"), id + 2));
+ Thread.sleep(200);
+ output.write(createStatsEvent(sseContext.newEvent().name("book"), id + 3));
+ Thread.sleep(200);
+ output.write(createStatsEvent(sseContext.newEvent().name("book"), id + 4));
+ Thread.sleep(200);
+ output.close();
+ } catch (final InterruptedException | IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }.start();
+
+ return output;
+ }
+
+ @GET
+ @Path("broadcast/sse")
+ @Produces(MediaType.SERVER_SENT_EVENTS)
+ public SseEventOutput broadcast(@Context SseContext sseContext) {
+ final SseEventOutput output = sseContext.newOutput();
+
+ if (broadcaster.get() == null) {
+ broadcaster.compareAndSet(null, sseContext.newBroadcaster());
+ }
+
+ try {
+ broadcaster.get().register(output);
+
+ broadcaster.get().broadcast(createStatsEvent(sseContext.newEvent().name("book"), 1000));
+ broadcaster.get().broadcast(createStatsEvent(sseContext.newEvent().name("book"), 2000));
+
+ return output;
+ } finally {
+ latch.countDown();
+ }
+ }
+
+ @POST
+ @Path("broadcast/close")
+ public void stop() throws InterruptedException {
+ // Await a least 2 clients to be broadcasted over
+ latch.await(2, TimeUnit.SECONDS);
+
+ if (broadcaster.get() != null) {
+ broadcaster.get().close();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/cxf/blob/41733786/systests/rs-sse/src/test/java/org/apache/cxf/systest/jaxrs/sse/jetty/AbstractJettyServer.java
----------------------------------------------------------------------
diff --git a/systests/rs-sse/src/test/java/org/apache/cxf/systest/jaxrs/sse/jetty/AbstractJettyServer.java b/systests/rs-sse/src/test/java/org/apache/cxf/systest/jaxrs/sse/jetty/AbstractJettyServer.java
new file mode 100644
index 0000000..c0642e2
--- /dev/null
+++ b/systests/rs-sse/src/test/java/org/apache/cxf/systest/jaxrs/sse/jetty/AbstractJettyServer.java
@@ -0,0 +1,98 @@
+/**
+ * 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.systest.jaxrs.sse.jetty;
+
+import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
+
+import org.apache.cxf.jaxrs.servlet.CXFNonSpringJaxrsServlet;
+import org.apache.cxf.systest.jaxrs.sse.BookStore;
+import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
+import org.apache.cxf.transport.sse.SseHttpTransportFactory;
+import org.eclipse.jetty.server.Handler;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.server.handler.DefaultHandler;
+import org.eclipse.jetty.server.handler.HandlerCollection;
+import org.eclipse.jetty.servlet.ServletContextHandler;
+import org.eclipse.jetty.servlet.ServletHolder;
+import org.eclipse.jetty.webapp.WebAppContext;
+
+public abstract class AbstractJettyServer extends AbstractBusTestServerBase {
+
+ private org.eclipse.jetty.server.Server server;
+ private final String resourcePath;
+ private final String contextPath;
+ private final int port;
+
+ protected AbstractJettyServer(final String contextPath, int portNumber) {
+ this(null, contextPath, portNumber);
+ }
+
+ protected AbstractJettyServer(final String resourcePath, final String contextPath, int portNumber) {
+ this.resourcePath = resourcePath;
+ this.contextPath = contextPath;
+ this.port = portNumber;
+ }
+
+ protected void run() {
+ server = new Server(port);
+
+ try {
+ if (resourcePath == null) {
+ // Register and map the dispatcher servlet
+ final ServletHolder holder = new ServletHolder(new CXFNonSpringJaxrsServlet());
+ holder.setInitParameter(CXFNonSpringJaxrsServlet.TRANSPORT_ID, SseHttpTransportFactory.TRANSPORT_ID);
+ holder.setInitParameter("jaxrs.serviceClasses", BookStore.class.getName());
+ holder.setInitParameter("jaxrs.providers", JacksonJsonProvider.class.getName());
+ final ServletContextHandler context = new ServletContextHandler();
+ context.setContextPath(contextPath);
+ context.addServlet(holder, "/rest/*");
+ server.setHandler(context);
+ } else {
+ final WebAppContext context = new WebAppContext();
+ context.setContextPath(contextPath);
+ context.setWar(getClass().getResource(resourcePath).toURI().getPath());
+
+ HandlerCollection handlers = new HandlerCollection();
+ handlers.setHandlers(new Handler[] {context, new DefaultHandler()});
+ server.setHandler(handlers);
+ }
+
+ configureServer(server);
+ server.start();
+ } catch (final Exception ex) {
+ ex.printStackTrace();
+ fail(ex.getMessage());
+ }
+ }
+
+ protected void configureServer(org.eclipse.jetty.server.Server theserver) 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/41733786/systests/rs-sse/src/test/java/org/apache/cxf/systest/jaxrs/sse/jetty/JettyEmbeddedTest.java
----------------------------------------------------------------------
diff --git a/systests/rs-sse/src/test/java/org/apache/cxf/systest/jaxrs/sse/jetty/JettyEmbeddedTest.java b/systests/rs-sse/src/test/java/org/apache/cxf/systest/jaxrs/sse/jetty/JettyEmbeddedTest.java
new file mode 100644
index 0000000..975876a
--- /dev/null
+++ b/systests/rs-sse/src/test/java/org/apache/cxf/systest/jaxrs/sse/jetty/JettyEmbeddedTest.java
@@ -0,0 +1,49 @@
+/**
+ * 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.systest.jaxrs.sse.jetty;
+
+import org.apache.cxf.jaxrs.model.AbstractResourceInfo;
+import org.apache.cxf.systest.jaxrs.sse.AbstractSseTest;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+
+public class JettyEmbeddedTest extends AbstractSseTest {
+ @Ignore
+ public static class EmbeddedJettyServer extends AbstractJettyServer {
+ public static final int PORT = allocatePortAsInt(EmbeddedJettyServer.class);
+
+ public EmbeddedJettyServer() {
+ super("/", PORT);
+ }
+ }
+
+ @BeforeClass
+ public static void startServers() throws Exception {
+ AbstractResourceInfo.clearAllMaps();
+ //keep out of process due to stack traces testing failures
+ assertTrue("server did not launch correctly", launchServer(EmbeddedJettyServer.class, true));
+ createStaticBus();
+ }
+
+ @Override
+ protected int getPort() {
+ return EmbeddedJettyServer.PORT;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cxf/blob/41733786/systests/rs-sse/src/test/java/org/apache/cxf/systest/jaxrs/sse/jetty/JettyWarTest.java
----------------------------------------------------------------------
diff --git a/systests/rs-sse/src/test/java/org/apache/cxf/systest/jaxrs/sse/jetty/JettyWarTest.java b/systests/rs-sse/src/test/java/org/apache/cxf/systest/jaxrs/sse/jetty/JettyWarTest.java
new file mode 100644
index 0000000..8ea7a8a
--- /dev/null
+++ b/systests/rs-sse/src/test/java/org/apache/cxf/systest/jaxrs/sse/jetty/JettyWarTest.java
@@ -0,0 +1,48 @@
+/**
+ * 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.systest.jaxrs.sse.jetty;
+
+import org.apache.cxf.jaxrs.model.AbstractResourceInfo;
+import org.apache.cxf.systest.jaxrs.sse.AbstractSseTest;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+
+public class JettyWarTest extends AbstractSseTest {
+ @Ignore
+ public static class EmbeddedJettyServer extends AbstractJettyServer {
+ public static final int PORT = allocatePortAsInt(EmbeddedJettyServer.class);
+
+ public EmbeddedJettyServer() {
+ super("/jaxrs_sse", "/", 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;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cxf/blob/41733786/systests/rs-sse/src/test/java/org/apache/cxf/systest/jaxrs/sse/tomcat/AbstractTomcatServer.java
----------------------------------------------------------------------
diff --git a/systests/rs-sse/src/test/java/org/apache/cxf/systest/jaxrs/sse/tomcat/AbstractTomcatServer.java b/systests/rs-sse/src/test/java/org/apache/cxf/systest/jaxrs/sse/tomcat/AbstractTomcatServer.java
new file mode 100644
index 0000000..4e1e10f
--- /dev/null
+++ b/systests/rs-sse/src/test/java/org/apache/cxf/systest/jaxrs/sse/tomcat/AbstractTomcatServer.java
@@ -0,0 +1,111 @@
+/**
+ * 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.systest.jaxrs.sse.tomcat;
+
+import java.io.File;
+import java.io.IOException;
+
+import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
+
+import org.apache.catalina.Context;
+import org.apache.catalina.Wrapper;
+import org.apache.catalina.startup.Tomcat;
+import org.apache.cxf.jaxrs.servlet.CXFNonSpringJaxrsServlet;
+import org.apache.cxf.systest.jaxrs.sse.BookStore;
+import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
+import org.apache.cxf.transport.sse.SseHttpTransportFactory;
+
+public abstract class AbstractTomcatServer extends AbstractBusTestServerBase {
+
+ private Tomcat server;
+ private final String resourcePath;
+ private final String contextPath;
+ private final int port;
+
+ protected AbstractTomcatServer(final String contextPath, int portNumber) {
+ this(null, contextPath, portNumber);
+ }
+
+ protected AbstractTomcatServer(final String resourcePath, final String contextPath, int portNumber) {
+ this.resourcePath = resourcePath;
+ this.contextPath = contextPath;
+ this.port = portNumber;
+ }
+
+ protected void run() {
+ server = new Tomcat();
+ server.setPort(port);
+
+ try {
+ final File base = createTemporaryDirectory();
+ server.setBaseDir(base.getAbsolutePath());
+
+ if (resourcePath == null) {
+ final Context context = server.addContext("/", base.getAbsolutePath());
+ final Wrapper cxfServlet = Tomcat.addServlet(context, "cxfServlet", new CXFNonSpringJaxrsServlet());
+ cxfServlet.addInitParameter(CXFNonSpringJaxrsServlet.TRANSPORT_ID,
+ SseHttpTransportFactory.TRANSPORT_ID);
+ cxfServlet.addInitParameter("jaxrs.serviceClasses", BookStore.class.getName());
+ cxfServlet.addInitParameter("jaxrs.providers", JacksonJsonProvider.class.getName());
+ cxfServlet.setAsyncSupported(true);
+ context.addServletMapping("/rest/*", "cxfServlet");
+ } else {
+ server.getHost().setAppBase(base.getAbsolutePath());
+ server.getHost().setAutoDeploy(true);
+ server.getHost().setDeployOnStartup(true);
+ server.addWebapp(contextPath, getClass().getResource(resourcePath).toURI().getPath().toString());
+ }
+
+ server.start();
+ } catch (final Exception ex) {
+ ex.printStackTrace();
+ fail(ex.getMessage());
+ }
+ }
+
+ protected void configureServer(org.eclipse.jetty.server.Server theserver) throws Exception {
+
+ }
+
+ private static File createTemporaryDirectory() throws IOException {
+ final File base = File.createTempFile("tmp-", "");
+
+ if (!base.delete()) {
+ throw new IOException("Cannot (re)create base folder: " + base.getAbsolutePath());
+ }
+
+ if (!base.mkdir()) {
+ throw new IOException("Cannot create base folder: " + base.getAbsolutePath());
+ }
+
+ base.deleteOnExit();
+ return base;
+ }
+
+ 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/41733786/systests/rs-sse/src/test/java/org/apache/cxf/systest/jaxrs/sse/tomcat/TomcatEmbeddedTest.java
----------------------------------------------------------------------
diff --git a/systests/rs-sse/src/test/java/org/apache/cxf/systest/jaxrs/sse/tomcat/TomcatEmbeddedTest.java b/systests/rs-sse/src/test/java/org/apache/cxf/systest/jaxrs/sse/tomcat/TomcatEmbeddedTest.java
new file mode 100644
index 0000000..f3ddb9e
--- /dev/null
+++ b/systests/rs-sse/src/test/java/org/apache/cxf/systest/jaxrs/sse/tomcat/TomcatEmbeddedTest.java
@@ -0,0 +1,49 @@
+/**
+ * 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.systest.jaxrs.sse.tomcat;
+
+import org.apache.cxf.jaxrs.model.AbstractResourceInfo;
+import org.apache.cxf.systest.jaxrs.sse.AbstractSseTest;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+
+public class TomcatEmbeddedTest extends AbstractSseTest {
+ @Ignore
+ public static class EmbeddedTomcatServer extends AbstractTomcatServer {
+ public static final int PORT = allocatePortAsInt(EmbeddedTomcatServer.class);
+
+ public EmbeddedTomcatServer() {
+ super("/", PORT);
+ }
+ }
+
+ @BeforeClass
+ public static void startServers() throws Exception {
+ AbstractResourceInfo.clearAllMaps();
+ assertTrue("server did not launch correctly", launchServer(EmbeddedTomcatServer.class, true));
+ createStaticBus();
+ }
+
+ @Override
+ protected int getPort() {
+ return EmbeddedTomcatServer.PORT;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cxf/blob/41733786/systests/rs-sse/src/test/java/org/apache/cxf/systest/jaxrs/sse/tomcat/TomcatWarTest.java
----------------------------------------------------------------------
diff --git a/systests/rs-sse/src/test/java/org/apache/cxf/systest/jaxrs/sse/tomcat/TomcatWarTest.java b/systests/rs-sse/src/test/java/org/apache/cxf/systest/jaxrs/sse/tomcat/TomcatWarTest.java
new file mode 100644
index 0000000..b653940
--- /dev/null
+++ b/systests/rs-sse/src/test/java/org/apache/cxf/systest/jaxrs/sse/tomcat/TomcatWarTest.java
@@ -0,0 +1,49 @@
+/**
+ * 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.systest.jaxrs.sse.tomcat;
+
+import org.apache.cxf.jaxrs.model.AbstractResourceInfo;
+import org.apache.cxf.systest.jaxrs.sse.AbstractSseTest;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+
+public class TomcatWarTest extends AbstractSseTest {
+ @Ignore
+ public static class EmbeddedTomcatServer extends AbstractTomcatServer {
+ public static final int PORT = allocatePortAsInt(EmbeddedTomcatServer.class);
+
+ public EmbeddedTomcatServer() {
+ super("/jaxrs_sse", "/", PORT);
+ }
+ }
+
+ @BeforeClass
+ public static void startServers() throws Exception {
+ AbstractResourceInfo.clearAllMaps();
+ assertTrue("server did not launch correctly", launchServer(EmbeddedTomcatServer.class, true));
+ createStaticBus();
+ }
+
+ @Override
+ protected int getPort() {
+ return EmbeddedTomcatServer.PORT;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cxf/blob/41733786/systests/rs-sse/src/test/resources/jaxrs_sse/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/systests/rs-sse/src/test/resources/jaxrs_sse/WEB-INF/web.xml b/systests/rs-sse/src/test/resources/jaxrs_sse/WEB-INF/web.xml
new file mode 100644
index 0000000..d446f8ec
--- /dev/null
+++ b/systests/rs-sse/src/test/resources/jaxrs_sse/WEB-INF/web.xml
@@ -0,0 +1,28 @@
+<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <servlet>
+ <servlet-name>CXFServlet</servlet-name>
+ <display-name>CXF Servlet</display-name>
+ <servlet-class>org.apache.cxf.jaxrs.servlet.CXFNonSpringJaxrsServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ <async-supported>true</async-supported>
+ <init-param>
+ <param-name>transportId</param-name>
+ <param-value>http://cxf.apache.org/transports/http/sse</param-value>
+ </init-param>
+ <init-param>
+ <param-name>jaxrs.serviceClasses</param-name>
+ <param-value>org.apache.cxf.systest.jaxrs.sse.BookStore</param-value>
+ </init-param>
+ <init-param>
+ <param-name>jaxrs.providers</param-name>
+ <param-value>com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider</param-value>
+ </init-param>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>CXFServlet</servlet-name>
+ <url-pattern>/rest/*</url-pattern>
+ </servlet-mapping>
+</web-app>
\ No newline at end of file