You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by ab...@apache.org on 2016/02/17 19:23:48 UTC
[44/51] [partial] incubator-geode git commit: GEODE-917: rename
gemfire subprojects to geode
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f6c4c2f9/extensions/gemfire-modules-session/src/test/java/com/gemstone/gemfire/modules/session/internal/filter/SessionReplicationIntegrationJUnitTest.java
----------------------------------------------------------------------
diff --git a/extensions/gemfire-modules-session/src/test/java/com/gemstone/gemfire/modules/session/internal/filter/SessionReplicationIntegrationJUnitTest.java b/extensions/gemfire-modules-session/src/test/java/com/gemstone/gemfire/modules/session/internal/filter/SessionReplicationIntegrationJUnitTest.java
deleted file mode 100644
index 0abd85e..0000000
--- a/extensions/gemfire-modules-session/src/test/java/com/gemstone/gemfire/modules/session/internal/filter/SessionReplicationIntegrationJUnitTest.java
+++ /dev/null
@@ -1,1558 +0,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.
-*/
-
-package com.gemstone.gemfire.modules.session.internal.filter;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.ArrayList;
-import java.util.EnumSet;
-import java.util.Enumeration;
-import java.util.List;
-import java.util.StringTokenizer;
-import java.util.concurrent.TimeUnit;
-import javax.servlet.DispatcherType;
-import javax.servlet.RequestDispatcher;
-import javax.servlet.ServletException;
-import javax.servlet.http.Cookie;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-
-import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.modules.session.junit.PerTestClassLoaderRunner;
-import com.gemstone.gemfire.modules.session.filter.SessionCachingFilter;
-import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
-import org.apache.jasper.servlet.JspServlet;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.junit.runner.RunWith;
-import org.eclipse.jetty.servlet.FilterHolder;
-import org.eclipse.jetty.servlet.ServletHolder;
-import org.eclipse.jetty.http.HttpTester;
-
-import static org.junit.Assert.*;
-
-/**
- * In-container testing using Jetty. This allows us to test context listener
- * events as well as dispatching actions.
- */
-@Category(IntegrationTest.class)
-@RunWith(PerTestClassLoaderRunner.class)
-public class SessionReplicationIntegrationJUnitTest {
-
- private MyServletTester tester;
-
- private HttpTester.Request request;
-
- private HttpTester.Response response;
-
- private ServletHolder servletHolder;
-
- private FilterHolder filterHolder;
-
- private static final File tmpdir;
-
- private static final String gemfire_log;
-
- static {
- // Create a per-user scratch directory
- tmpdir = new File(System.getProperty("java.io.tmpdir"),
- "gemfire_modules-" + System.getProperty("user.name"));
- tmpdir.mkdirs();
- tmpdir.deleteOnExit();
-
- gemfire_log = tmpdir.getPath() +
- System.getProperty("file.separator") + "gemfire_modules.log";
- }
-
- @Before
- public void setUp() throws Exception {
- request = HttpTester.newRequest();
-
- tester = new MyServletTester();
- tester.setContextPath("/test");
-
- filterHolder = tester.addFilter(SessionCachingFilter.class, "/*", EnumSet.of(DispatcherType.REQUEST));
- filterHolder.setInitParameter("gemfire.property.mcast-port", "0");
- filterHolder.setInitParameter("gemfire.property.log-file", gemfire_log);
- filterHolder.setInitParameter("cache-type", "peer-to-peer");
-
- servletHolder = tester.addServlet(BasicServlet.class, "/hello");
- servletHolder.setInitParameter("test.callback", "callback_1");
-
- /**
- * This starts the servlet. Our wrapped servlets *must* start
- * immediately otherwise the ServletContext is not captured correctly.
- */
- servletHolder.setInitOrder(0);
- }
-
- @After
- public void tearDown() throws Exception {
-// if (tester.isStarted()) {
-// ContextManager.getInstance().removeContext(
-// servletHolder.getServlet().getServletConfig().getServletContext());
-// }
- tester.stop();
- }
-
- @Test
- public void testSanity() throws Exception {
- Callback c = new Callback() {
- @Override
- public void call(HttpServletRequest request, HttpServletResponse response)
- throws IOException {
- PrintWriter out = response.getWriter();
- out.write("Hello World");
- }
- };
-
- tester.setAttribute("callback_1", c);
- tester.start();
-// ContextManager.getInstance().putContext(
-// servletHolder.getServlet().getServletConfig().getServletContext());
-
- request.setMethod("GET");
- request.setURI("/test/hello");
- request.setHeader("Host", "tester");
- request.setVersion("HTTP/1.0");
-
- response = HttpTester.parseResponse(tester.getResponses(request.generate()));
-
- assertEquals(200, response.getStatus());
- assertEquals("Hello World", response.getContent());
- }
-
- @Test
- public void testSessionGenerated() throws Exception {
- Callback c = new Callback() {
- @Override
- public void call(HttpServletRequest request, HttpServletResponse response)
- throws IOException {
- PrintWriter out = response.getWriter();
- out.write(request.getSession().getId());
- }
- };
-
- tester.setAttribute("callback_1", c);
- tester.start();
-// ContextManager.getInstance().putContext(
-// servletHolder.getServlet().getServletConfig().getServletContext());
-
- request.setMethod("GET");
- request.setURI("/test/hello");
- request.setHeader("Host", "tester");
- request.setVersion("HTTP/1.0");
-
- response = HttpTester.parseResponse(tester.getResponses(request.generate()));
-
- assertTrue("Not a correctly generated session id",
- response.getContent().endsWith("-GF"));
-
- List<Cookie> cookies = getCookies(response);
- assertEquals("Session id != JSESSIONID from cookie",
- response.getContent(), cookies.get(0).getValue());
-
- Region r = getRegion();
- assertNotNull("Session not found in region",
- r.get(cookies.get(0).getValue()));
- }
-
-
- /**
- * Test that getSession(false) does not create a new session
- */
- @Test
- public void testSessionNotGenerated() throws Exception {
- Callback c = new Callback() {
- @Override
- public void call(HttpServletRequest request, HttpServletResponse response)
- throws IOException {
- String output = "OK";
- HttpSession s = request.getSession(false);
- if (s != null) {
- output = s.getId();
- }
- PrintWriter out = response.getWriter();
- out.write(output);
- }
- };
-
- tester.setAttribute("callback_1", c);
- tester.start();
-// ContextManager.getInstance().putContext(
-// servletHolder.getServlet().getServletConfig().getServletContext());
-
- request.setMethod("GET");
- request.setURI("/test/hello");
- request.setHeader("Host", "tester");
- request.setVersion("HTTP/1.0");
-
- response = HttpTester.parseResponse(tester.getResponses(request.generate()));
-
- assertEquals("Session should not have been created", "OK",
- response.getContent());
- }
-
-
- @Test
- public void testUnknownAttributeIsNull() throws Exception {
- Callback c = new Callback() {
- @Override
- public void call(HttpServletRequest request, HttpServletResponse response)
- throws IOException {
- Object o = request.getSession().getAttribute("unknown");
- PrintWriter out = response.getWriter();
- if (o == null) {
- out.write("null");
- } else {
- out.write(o.toString());
- }
- }
- };
-
- tester.setAttribute("callback_1", c);
- tester.start();
-// ContextManager.getInstance().putContext(
-// servletHolder.getServlet().getServletConfig().getServletContext());
-
- request.setMethod("GET");
- request.setURI("/test/hello");
- request.setHeader("Host", "tester");
- request.setVersion("HTTP/1.0");
-
- response = HttpTester.parseResponse(tester.getResponses(request.generate()));
-
- assertEquals("Unknown attribute should be null", "null",
- response.getContent());
- }
-
-
- @Test
- public void testSessionRemains1() throws Exception {
- Callback c = new Callback() {
- @Override
- public void call(HttpServletRequest request, HttpServletResponse response)
- throws IOException {
- String output = "null";
- HttpSession session = request.getSession();
- if (session.isNew()) {
- output = "new";
- session.setAttribute("foo", output);
- } else {
- output = (String) session.getAttribute("foo");
- if (output != null) {
- output = "old";
- }
- }
- PrintWriter out = response.getWriter();
- out.write(output);
- }
- };
-
- tester.setAttribute("callback_1", c);
- tester.start();
-// ContextManager.getInstance().putContext(
-// servletHolder.getServlet().getServletConfig().getServletContext());
-
- request.setMethod("GET");
- request.setURI("/test/hello");
- request.setHeader("Host", "tester");
- request.setVersion("HTTP/1.0");
-
- response = HttpTester.parseResponse(tester.getResponses(request.generate()));
-
- assertEquals("Session should be new", "new", response.getContent());
-
- List<Cookie> cookies = getCookies(response);
- request.setHeader("Cookie", "JSESSIONID=" + cookies.get(0).getValue());
-
- response = HttpTester.parseResponse(tester.getResponses(request.generate()));
-
- assertEquals("Session should be old", "old", response.getContent());
-
- List<Cookie> cookies2 = getCookies(response);
- assertEquals("Session IDs should be the same", cookies.get(0).getValue(),
- cookies2.get(0).getValue());
-
- Region r = getRegion();
- assertNotNull("Session object should exist in region",
- r.get(cookies.get(0).getValue()));
- }
-
- /**
- * Test that attributes are updated on the backend
- */
- @Test
- public void testAttributesUpdatedInRegion() throws Exception {
- Callback c_1 = new Callback() {
- @Override
- public void call(HttpServletRequest request, HttpServletResponse response)
- throws IOException {
- request.getSession().setAttribute("foo", "bar");
- }
- };
-
- // This is the callback used to invalidate the session
- Callback c_2 = new Callback() {
- @Override
- public void call(HttpServletRequest request, HttpServletResponse response)
- throws IOException {
- request.getSession().setAttribute("foo", "baz");
- }
- };
-
- tester.setAttribute("callback_1", c_1);
- tester.setAttribute("callback_2", c_2);
-
- servletHolder.setInitParameter("test.callback", "callback_1");
-
- ServletHolder sh2 = tester.addServlet(BasicServlet.class, "/request2");
- sh2.setInitParameter("test.callback", "callback_2");
-
- tester.start();
-// ContextManager.getInstance().putContext(
-// servletHolder.getServlet().getServletConfig().getServletContext());
-
- request.setMethod("GET");
- request.setURI("/test/hello");
- request.setHeader("Host", "tester");
- request.setVersion("HTTP/1.0");
- response = HttpTester.parseResponse(tester.getResponses(request.generate()));
-
- List<Cookie> cookies = getCookies(response);
-
- Region r = getRegion();
- assertEquals("bar",
- ((HttpSession) r.get(cookies.get(0).getValue())).getAttribute("foo"));
-
- request.setHeader("Cookie", "JSESSIONID=" + cookies.get(0).getValue());
- request.setURI("/test/request2");
- response = HttpTester.parseResponse(tester.getResponses(request.generate()));
-
- assertEquals("baz",
- ((HttpSession) r.get(cookies.get(0).getValue())).getAttribute(
- "foo"));
- }
-
- /**
- * Test setting an attribute to null deletes it
- */
- @Test
- public void testSetAttributeNullDeletesIt() throws Exception {
- Callback c_1 = new Callback() {
- @Override
- public void call(HttpServletRequest request, HttpServletResponse response)
- throws IOException {
- request.getSession().setAttribute("foo", "bar");
- }
- };
-
- // This is the callback used to invalidate the session
- Callback c_2 = new Callback() {
- @Override
- public void call(HttpServletRequest request, HttpServletResponse response)
- throws IOException {
- request.getSession().setAttribute("foo", null);
- }
- };
-
- tester.setAttribute("callback_1", c_1);
- tester.setAttribute("callback_2", c_2);
-
- servletHolder.setInitParameter("test.callback", "callback_1");
-
- ServletHolder sh2 = tester.addServlet(BasicServlet.class, "/request2");
- sh2.setInitParameter("test.callback", "callback_2");
-
- tester.start();
-// ContextManager.getInstance().putContext(
-// servletHolder.getServlet().getServletConfig().getServletContext());
-
- request.setMethod("GET");
- request.setURI("/test/hello");
- request.setHeader("Host", "tester");
- request.setVersion("HTTP/1.0");
- response = HttpTester.parseResponse(tester.getResponses(request.generate()));
-
- List<Cookie> cookies = getCookies(response);
-
- Region r = getRegion();
- assertEquals("bar",
- ((HttpSession) r.get(cookies.get(0).getValue())).getAttribute(
- "foo"));
-
- request.setHeader("Cookie", "JSESSIONID=" + cookies.get(0).getValue());
- request.setURI("/test/request2");
- response = HttpTester.parseResponse(tester.getResponses(request.generate()));
-
- assertNull(
- ((HttpSession) r.get(cookies.get(0).getValue())).getAttribute(
- "foo"));
- }
-
-// Don't see how to do this currently as the SessionListener needs a full
-// web context to work in.
-
-// /**
-// * Test that sessions expire correctly
-// */
-// public void testSessionExpiration() throws Exception {
-// Callback c_1 = new Callback() {
-// @Override
-// public void call(HttpServletRequest request, HttpServletResponse response)
-// throws IOException, ServletException {
-// HttpSession s = request.getSession();
-// s.setAttribute("foo", "bar");
-// s.setMaxInactiveInterval(1);
-//
-// PrintWriter out = response.getWriter();
-// out.write(s.getId());
-// }
-// };
-//
-// // This is the callback used to check if the session is still there
-// Callback c_2 = new Callback() {
-// @Override
-// public void call(HttpServletRequest request, HttpServletResponse response)
-// throws IOException, ServletException {
-// HttpSession s = request.getSession(false);
-// String output;
-// if (s == null) {
-// output = "null";
-// } else {
-// output = s.getId();
-// }
-//
-// PrintWriter out = response.getWriter();
-// out.write(output);
-// }
-// };
-//
-// tester.addEventListener(new SessionListener());
-// tester.setAttribute("callback_1", c_1);
-// tester.setAttribute("callback_2", c_2);
-//
-// servletHolder.setInitParameter("test.callback", "callback_1");
-//
-// ServletHolder sh2 = tester.addServlet(BasicServlet.class, "/request2");
-// sh2.setInitParameter("test.callback", "callback_2");
-//
-// tester.start();
-// ContextManager.getInstance().putContext(
-// servletHolder.getServlet().getServletConfig().getServletContext());
-//
-// request.setMethod("GET");
-// request.setURI("/test/hello");
-// request.setHeader("Host", "tester");
-// request.setVersion("HTTP/1.0");
-// response.parse(tester.getResponses(request.generate()));
-//
-// String id = response.getContent();
-//
-// // Wait for the session to expire
-// Thread.sleep(2000);
-//
-// request.setHeader("Cookie", "JSESSIONID=" + id);
-// request.setURI("/test/request2");
-// response.parse(tester.getResponses(request.generate()));
-//
-// assertEquals("null", response.getContent());
-//
-// Region r = getRegion();
-// assertNull("Region should not contain session", r.get(id));
-// }
-
- /**
- * Test that invalidating a session destroys it as well as the backend
- * object.
- */
- @Test
- public void testInvalidateSession1() throws Exception {
- Callback c_1 = new Callback() {
- @Override
- public void call(HttpServletRequest request, HttpServletResponse response)
- throws IOException {
- request.getSession().setAttribute("foo", "bar");
- }
- };
-
- // This is the callback used to invalidate the session
- Callback c_2 = new Callback() {
- @Override
- public void call(HttpServletRequest request, HttpServletResponse response)
- throws IOException {
- request.getSession(false).invalidate();
- }
- };
-
- tester.setAttribute("callback_1", c_1);
- tester.setAttribute("callback_2", c_2);
-
- servletHolder.setInitParameter("test.callback", "callback_1");
-
- ServletHolder sh2 = tester.addServlet(BasicServlet.class, "/request2");
- sh2.setInitParameter("test.callback", "callback_2");
-
- tester.start();
-// ContextManager.getInstance().putContext(
-// servletHolder.getServlet().getServletConfig().getServletContext());
-
- request.setMethod("GET");
- request.setURI("/test/hello");
- request.setHeader("Host", "tester");
- request.setVersion("HTTP/1.0");
- response = HttpTester.parseResponse(tester.getResponses(request.generate()));
-
- List<Cookie> cookies = getCookies(response);
- Region r = getRegion();
- assertEquals("bar",
- ((HttpSession) r.get(cookies.get(0).getValue())).getAttribute("foo"));
-
- request.setHeader("Cookie", "JSESSIONID=" + cookies.get(0).getValue());
- request.setURI("/test/request2");
- response = HttpTester.parseResponse(tester.getResponses(request.generate()));
-
- assertNull("Region should not contain session",
- r.get(cookies.get(0).getValue()));
- }
-
- /**
- * Test that invalidating a session throws an exception on subsequent access.
- */
- @Test
- public void testInvalidateSession2() throws Exception {
- Callback c_1 = new Callback() {
- @Override
- public void call(HttpServletRequest request, HttpServletResponse response)
- throws IOException {
- HttpSession s = request.getSession();
- s.invalidate();
- PrintWriter out = response.getWriter();
- try {
- s.getAttribute("foo");
- } catch (IllegalStateException iex) {
- out.write("OK");
- }
- }
- };
-
- tester.setAttribute("callback_1", c_1);
-
- servletHolder.setInitParameter("test.callback", "callback_1");
-
- tester.start();
-// ContextManager.getInstance().putContext(
-// servletHolder.getServlet().getServletConfig().getServletContext());
-
- request.setMethod("GET");
- request.setURI("/test/hello");
- request.setHeader("Host", "tester");
- request.setVersion("HTTP/1.0");
- response = HttpTester.parseResponse(tester.getResponses(request.generate()));
-
- assertEquals("OK", response.getContent());
- }
-
- /**
- * Test that invalidating a session throws an exception on subsequent access.
- */
- @Test
- public void testInvalidateSession3() throws Exception {
- Callback c_1 = new Callback() {
- @Override
- public void call(HttpServletRequest request, HttpServletResponse response)
- throws IOException {
- HttpSession s = request.getSession();
- s.invalidate();
- PrintWriter out = response.getWriter();
- try {
- s.getAttributeNames();
- } catch (IllegalStateException iex) {
- out.write("OK");
- }
- }
- };
-
- tester.setAttribute("callback_1", c_1);
-
- servletHolder.setInitParameter("test.callback", "callback_1");
-
- tester.start();
-// ContextManager.getInstance().putContext(
-// servletHolder.getServlet().getServletConfig().getServletContext());
-
- request.setMethod("GET");
- request.setURI("/test/hello");
- request.setHeader("Host", "tester");
- request.setVersion("HTTP/1.0");
- response = HttpTester.parseResponse(tester.getResponses(request.generate()));
-
- assertEquals("OK", response.getContent());
- }
-
- /**
- * Test that invalidating a session throws an exception on subsequent access.
- */
- @Test
- public void testInvalidateSession4() throws Exception {
- Callback c_1 = new Callback() {
- @Override
- public void call(HttpServletRequest request, HttpServletResponse response)
- throws IOException {
- HttpSession s = request.getSession();
- s.invalidate();
- PrintWriter out = response.getWriter();
- try {
- s.getCreationTime();
- } catch (IllegalStateException iex) {
- out.write("OK");
- }
- }
- };
-
- tester.setAttribute("callback_1", c_1);
-
- servletHolder.setInitParameter("test.callback", "callback_1");
-
- tester.start();
-// ContextManager.getInstance().putContext(
-// servletHolder.getServlet().getServletConfig().getServletContext());
-
- request.setMethod("GET");
- request.setURI("/test/hello");
- request.setHeader("Host", "tester");
- request.setVersion("HTTP/1.0");
- response = HttpTester.parseResponse(tester.getResponses(request.generate()));
-
- assertEquals("OK", response.getContent());
- }
-
- /**
- * Test that invalidating a session does not throw an exception for subsequent
- * getId calls.
- */
- @Test
- public void testInvalidateSession5() throws Exception {
- Callback c_1 = new Callback() {
- @Override
- public void call(HttpServletRequest request, HttpServletResponse response)
- throws IOException {
- HttpSession s = request.getSession();
- s.invalidate();
- s.getId();
- PrintWriter out = response.getWriter();
- out.write("OK");
- }
- };
-
- tester.setAttribute("callback_1", c_1);
-
- servletHolder.setInitParameter("test.callback", "callback_1");
-
- tester.start();
-// ContextManager.getInstance().putContext(
-// servletHolder.getServlet().getServletConfig().getServletContext());
-
- request.setMethod("GET");
- request.setURI("/test/hello");
- request.setHeader("Host", "tester");
- request.setVersion("HTTP/1.0");
- response = HttpTester.parseResponse(tester.getResponses(request.generate()));
-
- assertEquals("OK", response.getContent());
- }
-
- /**
- * Test that invalidating a session throws an exception on subsequent access.
- */
- @Test
- public void testInvalidateSession6() throws Exception {
- Callback c_1 = new Callback() {
- @Override
- public void call(HttpServletRequest request, HttpServletResponse response)
- throws IOException {
- HttpSession s = request.getSession();
- s.invalidate();
- PrintWriter out = response.getWriter();
- try {
- s.getLastAccessedTime();
- } catch (IllegalStateException iex) {
- out.write("OK");
- }
- }
- };
-
- tester.setAttribute("callback_1", c_1);
-
- servletHolder.setInitParameter("test.callback", "callback_1");
-
- tester.start();
-// ContextManager.getInstance().putContext(
-// servletHolder.getServlet().getServletConfig().getServletContext());
-
- request.setMethod("GET");
- request.setURI("/test/hello");
- request.setHeader("Host", "tester");
- request.setVersion("HTTP/1.0");
- response = HttpTester.parseResponse(tester.getResponses(request.generate()));
-
- assertEquals("OK", response.getContent());
- }
-
- /**
- * Test that invalidating a session does not throw an exception for
- * subsequent getMaxInactiveInterval calls.
- */
-
-// I've commented this out for now as Jetty seems to want to throw an
-// Exception here where the HttpServlet api doesn't specify that.
- @Test
- public void testInvalidateSession7() throws Exception {
- Callback c_1 = new Callback() {
- @Override
- public void call(HttpServletRequest request,
- HttpServletResponse response) throws IOException {
- HttpSession s = request.getSession();
- s.invalidate();
- s.getMaxInactiveInterval();
- PrintWriter out = response.getWriter();
- out.write("OK");
- }
- };
-
- tester.setAttribute("callback_1", c_1);
-
- servletHolder.setInitParameter("test.callback", "callback_1");
-
- tester.start();
-// ContextManager.getInstance().putContext(
-// servletHolder.getServlet().getServletConfig().getServletContext());
-
- request.setMethod("GET");
- request.setURI("/test/hello");
- request.setHeader("Host", "tester");
- request.setVersion("HTTP/1.0");
- response = HttpTester.parseResponse(tester.getResponses(request.generate()));
-
- assertEquals("OK", response.getContent());
- }
-
- /**
- * Test that invalidating a session does not throw an exception for subsequent
- * getServletContext calls.
- */
- @Test
- public void testInvalidateSession8() throws Exception {
- Callback c_1 = new Callback() {
- @Override
- public void call(HttpServletRequest request, HttpServletResponse response)
- throws IOException {
- HttpSession s = request.getSession();
- s.invalidate();
- s.getServletContext();
- PrintWriter out = response.getWriter();
- out.write("OK");
- }
- };
-
- tester.setAttribute("callback_1", c_1);
-
- servletHolder.setInitParameter("test.callback", "callback_1");
-
- tester.start();
-// ContextManager.getInstance().putContext(
-// servletHolder.getServlet().getServletConfig().getServletContext());
-
- request.setMethod("GET");
- request.setURI("/test/hello");
- request.setHeader("Host", "tester");
- request.setVersion("HTTP/1.0");
- response = HttpTester.parseResponse(tester.getResponses(request.generate()));
-
- assertEquals("OK", response.getContent());
- }
-
- /**
- * Test that invalidating a session throws an exception on subsequent access.
- */
- @Test
- public void testInvalidateSession9() throws Exception {
- Callback c_1 = new Callback() {
- @Override
- public void call(HttpServletRequest request, HttpServletResponse response)
- throws IOException {
- HttpSession s = request.getSession();
- s.invalidate();
- PrintWriter out = response.getWriter();
- try {
- s.isNew();
- } catch (IllegalStateException iex) {
- out.write("OK");
- }
- }
- };
-
- tester.setAttribute("callback_1", c_1);
-
- servletHolder.setInitParameter("test.callback", "callback_1");
-
- tester.start();
-// ContextManager.getInstance().putContext(
-// servletHolder.getServlet().getServletConfig().getServletContext());
-
- request.setMethod("GET");
- request.setURI("/test/hello");
- request.setHeader("Host", "tester");
- request.setVersion("HTTP/1.0");
- response = HttpTester.parseResponse(tester.getResponses(request.generate()));
-
- assertEquals("OK", response.getContent());
- }
-
- /**
- * Test that invalidating a session throws an exception on subsequent access.
- */
- @Test
- public void testInvalidateSession10() throws Exception {
- Callback c_1 = new Callback() {
- @Override
- public void call(HttpServletRequest request, HttpServletResponse response)
- throws IOException {
- HttpSession s = request.getSession();
- s.invalidate();
- PrintWriter out = response.getWriter();
- try {
- s.removeAttribute("foo");
- } catch (IllegalStateException iex) {
- out.write("OK");
- }
- }
- };
-
- tester.setAttribute("callback_1", c_1);
-
- servletHolder.setInitParameter("test.callback", "callback_1");
-
- tester.start();
-// ContextManager.getInstance().putContext(
-// servletHolder.getServlet().getServletConfig().getServletContext());
-
- request.setMethod("GET");
- request.setURI("/test/hello");
- request.setHeader("Host", "tester");
- request.setVersion("HTTP/1.0");
- response = HttpTester.parseResponse(tester.getResponses(request.generate()));
-
- assertEquals("OK", response.getContent());
- }
-
- /**
- * Test that invalidating a session throws an exception on subsequent access.
- */
- @Test
- public void testInvalidateSession11() throws Exception {
- Callback c_1 = new Callback() {
- @Override
- public void call(HttpServletRequest request, HttpServletResponse response)
- throws IOException {
- HttpSession s = request.getSession();
- s.invalidate();
- PrintWriter out = response.getWriter();
- try {
- s.setAttribute("foo", "bar");
- } catch (IllegalStateException iex) {
- out.write("OK");
- }
- }
- };
-
- tester.setAttribute("callback_1", c_1);
-
- servletHolder.setInitParameter("test.callback", "callback_1");
-
- tester.start();
-// ContextManager.getInstance().putContext(
-// servletHolder.getServlet().getServletConfig().getServletContext());
-
- request.setMethod("GET");
- request.setURI("/test/hello");
- request.setHeader("Host", "tester");
- request.setVersion("HTTP/1.0");
- response = HttpTester.parseResponse(tester.getResponses(request.generate()));
-
- assertEquals("OK", response.getContent());
- }
-
- /**
- * Test that invalidating a session does not throw an exception for subsequent
- * setMaxInactiveInterval calls.
- */
- @Test
- public void testInvalidateSession12() throws Exception {
- Callback c_1 = new Callback() {
- @Override
- public void call(HttpServletRequest request, HttpServletResponse response)
- throws IOException {
- HttpSession s = request.getSession();
- s.invalidate();
- s.setMaxInactiveInterval(1);
- PrintWriter out = response.getWriter();
- out.write("OK");
- }
- };
-
- tester.setAttribute("callback_1", c_1);
-
- servletHolder.setInitParameter("test.callback", "callback_1");
-
- tester.start();
-// ContextManager.getInstance().putContext(
-// servletHolder.getServlet().getServletConfig().getServletContext());
-
- request.setMethod("GET");
- request.setURI("/test/hello");
- request.setHeader("Host", "tester");
- request.setVersion("HTTP/1.0");
- response = HttpTester.parseResponse(tester.getResponses(request.generate()));
-
- assertEquals("OK", response.getContent());
- }
-
- /**
- * Test that invalidating a session results in null being returned on
- * subsequent getSession(false) calls.
- */
- @Test
- public void testInvalidateSession13() throws Exception {
- Callback c_1 = new Callback() {
- @Override
- public void call(HttpServletRequest request, HttpServletResponse response)
- throws IOException {
- HttpSession s = request.getSession();
- s.invalidate();
- s = request.getSession(false);
- PrintWriter out = response.getWriter();
- if (s == null) {
- out.write("OK");
- } else {
- out.write(s.toString());
- }
- }
- };
-
- tester.setAttribute("callback_1", c_1);
-
- servletHolder.setInitParameter("test.callback", "callback_1");
-
- tester.start();
-// ContextManager.getInstance().putContext(
-// servletHolder.getServlet().getServletConfig().getServletContext());
-
- request.setMethod("GET");
- request.setURI("/test/hello");
- request.setHeader("Host", "tester");
- request.setVersion("HTTP/1.0");
- response = HttpTester.parseResponse(tester.getResponses(request.generate()));
-
- assertEquals("OK", response.getContent());
- }
-
-
- /**
- * Test that we can invalidate and then recreate a new session
- */
- @Test
- public void testInvalidateAndRecreateSession() throws Exception {
- Callback c_1 = new Callback() {
- @Override
- public void call(HttpServletRequest request, HttpServletResponse response)
- throws IOException {
-
- PrintWriter out = response.getWriter();
- out.write(request.getSession().getId());
- }
- };
-
- Callback c_2 = new Callback() {
- @Override
- public void call(HttpServletRequest request, HttpServletResponse response)
- throws IOException {
- HttpSession s = request.getSession();
- s.invalidate();
-
- PrintWriter out = response.getWriter();
- out.write(request.getSession().getId());
- }
- };
-
- tester.setAttribute("callback_1", c_1);
- tester.setAttribute("callback_2", c_2);
-
- ServletHolder sh = tester.addServlet(BasicServlet.class, "/dispatch");
- sh.setInitParameter("test.callback", "callback_2");
-
- tester.start();
-// ContextManager.getInstance().putContext(
-// sh.getServlet().getServletConfig().getServletContext());
-
- request.setMethod("GET");
- request.setURI("/test/hello");
- request.setHeader("Host", "tester");
- request.setVersion("HTTP/1.0");
-
- response = HttpTester.parseResponse(tester.getResponses(request.generate()));
- String session1 = response.getContent();
-
- request.setHeader("Cookie", "JSESSIONID=" + session1);
- request.setURI("/test/request2");
- response = HttpTester.parseResponse(tester.getResponses(request.generate()));
-
- String session12 = response.getContent();
- assertFalse("First and subsequent session ids must not be the same",
- session1.equals(session12));
- }
-
-
- /**
- * Test that creation time does not change on subsequent access
- */
- @Test
- public void testGetCreationTime() throws Exception {
- Callback c = new Callback() {
- @Override
- public void call(HttpServletRequest request, HttpServletResponse response)
- throws IOException {
- HttpSession session = request.getSession();
- PrintWriter out = response.getWriter();
- out.write(Long.toString(session.getCreationTime()));
- }
- };
-
- tester.setAttribute("callback_1", c);
- tester.start();
-// ContextManager.getInstance().putContext(
-// servletHolder.getServlet().getServletConfig().getServletContext());
-
- request.setMethod("GET");
- request.setURI("/test/hello");
- request.setHeader("Host", "tester");
- request.setVersion("HTTP/1.0");
-
- response = HttpTester.parseResponse(tester.getResponses(request.generate()));
-
- long time1 = Long.parseLong(response.getContent());
- assertTrue("Creation time should be positive", time1 > 0);
-
- List<Cookie> cookies = getCookies(response);
- request.setHeader("Cookie", "JSESSIONID=" + cookies.get(0).getValue());
-
- try {
- Thread.sleep(1000);
- } catch (Exception ex) {
- }
-
- response = HttpTester.parseResponse(tester.getResponses(request.generate()));
- long time2 = Long.parseLong(response.getContent());
- assertTrue("Creation time should be the same across requests",
- time1 == time2);
- }
-
- /**
- * Test that the last accessed time is updated on subsequent access
- */
- @Test
- public void testGetLastAccessedTime() throws Exception {
- Callback c = new Callback() {
- @Override
- public void call(HttpServletRequest request, HttpServletResponse response)
- throws IOException {
- HttpSession session = request.getSession();
- PrintWriter out = response.getWriter();
- out.write(Long.toString(session.getLastAccessedTime()));
- }
- };
-
- tester.setAttribute("callback_1", c);
- tester.start();
-// ContextManager.getInstance().putContext(
-// servletHolder.getServlet().getServletConfig().getServletContext());
-
- request.setMethod("GET");
- request.setURI("/test/hello");
- request.setHeader("Host", "tester");
- request.setVersion("HTTP/1.0");
-
- response = HttpTester.parseResponse(tester.getResponses(request.generate()));
-
- long time1 = Long.parseLong(response.getContent());
-// assertTrue("Last accessed time should be positive", time1 > 0);
-
- List<Cookie> cookies = getCookies(response);
- request.setHeader("Cookie", "JSESSIONID=" + cookies.get(0).getValue());
-
- Thread.sleep(1000);
-
- response = HttpTester.parseResponse(tester.getResponses(request.generate()));
- long time2 = Long.parseLong(response.getContent());
- assertTrue("Last accessed time should be increasing across requests",
- time2 > time1);
- }
-
- /**
- * Test that the underlying native session remains the same across requests
- */
- @Test
- public void testNativeSessionRemainsUnchanged() throws Exception {
- Callback c = new Callback() {
- @Override
- public void call(HttpServletRequest request, HttpServletResponse response)
- throws IOException {
- GemfireHttpSession session = (GemfireHttpSession) request.getSession();
- PrintWriter out = response.getWriter();
- out.write(session.getNativeSession().getId());
- }
- };
-
- tester.setAttribute("callback_1", c);
- tester.start();
-// ContextManager.getInstance().putContext(
-// servletHolder.getServlet().getServletConfig().getServletContext());
-
- request.setMethod("GET");
- request.setURI("/test/hello");
- request.setHeader("Host", "tester");
- request.setVersion("HTTP/1.0");
-
- response = HttpTester.parseResponse(tester.getResponses(request.generate()));
- String nativeSessionId = response.getContent();
-
- List<Cookie> cookies = getCookies(response);
- String sessionId = cookies.get(0).getValue();
- Region r = getRegion();
-
- assertEquals(
- "Cached native session id does not match servlet returned native session id",
- nativeSessionId,
- ((GemfireHttpSession) r.get(sessionId)).getNativeSession().getId());
-
- request.setHeader("Cookie", "JSESSIONID=" + cookies.get(0).getValue());
- response = HttpTester.parseResponse(tester.getResponses(request.generate()));
-
- assertEquals(
- "Underlying native sessions must remain the same across requests",
- nativeSessionId,
- ((GemfireHttpSession) r.get(sessionId)).getNativeSession().getId());
- }
-
- /**
- * Test session id embedded in the URL
- */
- @Test
- public void testSessionIdEmbeddedInUrl() throws Exception {
- Callback c = new Callback() {
- @Override
- public void call(HttpServletRequest request, HttpServletResponse response)
- throws IOException {
- GemfireHttpSession session = (GemfireHttpSession) request.getSession();
- PrintWriter out = response.getWriter();
- out.write(session.getId());
- }
- };
-
- tester.setAttribute("callback_1", c);
- tester.start();
-// ContextManager.getInstance().putContext(
-// servletHolder.getServlet().getServletConfig().getServletContext());
-
- request.setMethod("GET");
- request.setURI("/test/hello");
- request.setHeader("Host", "tester");
- request.setVersion("HTTP/1.0");
-
- response = HttpTester.parseResponse(tester.getResponses(request.generate()));
- List<Cookie> cookies = getCookies(response);
- String sessionId = response.getContent();
- assertEquals("Session ids should be the same", sessionId,
- cookies.get(0).getValue());
-
- request.setURI("/test/hello;jsessionid=" + sessionId);
- response = HttpTester.parseResponse(tester.getResponses(request.generate()));
- cookies = getCookies(response);
-
- assertEquals("Session ids should be the same", sessionId,
- cookies.get(0).getValue());
- }
-
-
- /**
- * Test that request forward dispatching works
- */
- @Test
- public void testDispatchingForward1() throws Exception {
- Callback c_1 = new Callback() {
- @Override
- public void call(HttpServletRequest request, HttpServletResponse response)
- throws IOException, ServletException {
- RequestDispatcher dispatcher = request.getRequestDispatcher("dispatch");
- dispatcher.forward(request, response);
-
- // This should not appear in the output
- PrintWriter out = response.getWriter();
- out.write("bang");
- }
- };
-
- // This is the callback used by the forward servlet
- Callback c_2 = new Callback() {
- @Override
- public void call(HttpServletRequest request, HttpServletResponse response)
- throws IOException, ServletException {
- PrintWriter out = response.getWriter();
- out.write("dispatched");
- }
- };
-
- tester.setAttribute("callback_1", c_1);
- tester.setAttribute("callback_2", c_2);
-
- ServletHolder sh = tester.addServlet(BasicServlet.class, "/dispatch");
- sh.setInitParameter("test.callback", "callback_2");
-
- tester.start();
-// ContextManager.getInstance().putContext(
-// sh.getServlet().getServletConfig().getServletContext());
-
- request.setMethod("GET");
- request.setURI("/test/hello");
- request.setHeader("Host", "tester");
- request.setVersion("HTTP/1.0");
-
- response = HttpTester.parseResponse(tester.getResponses(request.generate()));
- assertEquals("dispatched", response.getContent());
-
-// ContextManager.getInstance().removeContext(
-// sh.getServlet().getServletConfig().getServletContext());
- }
-
-
- /**
- * Test that request include dispatching works
- */
- @Test
- public void testDispatchingInclude() throws Exception {
- Callback c_1 = new Callback() {
- @Override
- public void call(HttpServletRequest request, HttpServletResponse response)
- throws IOException, ServletException {
- RequestDispatcher dispatcher = request.getRequestDispatcher("dispatch");
- dispatcher.include(request, response);
-
- // This *should* appear in the output
- PrintWriter out = response.getWriter();
- out.write("_bang");
- }
- };
-
- // This is the callback used by the include servlet
- Callback c_2 = new Callback() {
- @Override
- public void call(HttpServletRequest request, HttpServletResponse response)
- throws IOException, ServletException {
- PrintWriter out = response.getWriter();
- out.write("dispatched");
- }
- };
-
- tester.setAttribute("callback_1", c_1);
- tester.setAttribute("callback_2", c_2);
-
- ServletHolder sh = tester.addServlet(BasicServlet.class, "/dispatch");
- sh.setInitParameter("test.callback", "callback_2");
-
- tester.start();
-// ContextManager.getInstance().putContext(
-// sh.getServlet().getServletConfig().getServletContext());
-
- request.setMethod("GET");
- request.setURI("/test/hello");
- request.setHeader("Host", "tester");
- request.setVersion("HTTP/1.0");
-
- response = HttpTester.parseResponse(tester.getResponses(request.generate()));
- assertEquals("dispatched_bang", response.getContent());
-
-// ContextManager.getInstance().removeContext(
-// sh.getServlet().getServletConfig().getServletContext());
- }
-
-
- /**
- * Test to try and simulate a failover scenario
- */
- @Test
- public void testFailover1() throws Exception {
- Callback c_1 = new Callback() {
- @Override
- public void call(HttpServletRequest request, HttpServletResponse response)
- throws IOException, ServletException {
- HttpSession s = request.getSession();
- s.setAttribute("foo", "bar");
-
- PrintWriter out = response.getWriter();
- out.write(request.getSession().getId());
- }
- };
-
- Callback c_2 = new Callback() {
- @Override
- public void call(HttpServletRequest request, HttpServletResponse response)
- throws IOException, ServletException {
- HttpSession s = request.getSession();
-
- PrintWriter out = response.getWriter();
- out.write((String) s.getAttribute("foo"));
- }
- };
-
- tester.setAttribute("callback_1", c_1);
- tester.setAttribute("callback_2", c_2);
-
- ServletHolder sh = tester.addServlet(BasicServlet.class, "/request2");
- sh.setInitParameter("test.callback", "callback_2");
-
- tester.start();
-// ContextManager.getInstance().putContext(
-// sh.getServlet().getServletConfig().getServletContext());
-
- request.setMethod("GET");
- request.setURI("/test/hello");
- request.setHeader("Host", "tester");
- request.setVersion("HTTP/1.0");
-
- response = HttpTester.parseResponse(tester.getResponses(request.generate()));
- String id = response.getContent();
-
- // Now we simulate the failover by removing the native session from
- // the stored session
- Region r = getRegion();
- GemfireHttpSession sessObj = (GemfireHttpSession) r.get(id);
- sessObj.setNativeSession(null);
-
- r.put(id, sessObj);
-
- request.setHeader("Cookie", "JSESSIONID=" + id);
- request.setURI("/test/request2");
- response = HttpTester.parseResponse(tester.getResponses(request.generate()));
-
- assertEquals("bar", response.getContent());
- }
-
- @Test
- public void testHttpSessionListener1() throws Exception {
- HttpSessionListenerImpl listener = new HttpSessionListenerImpl();
- tester.getContext().getSessionHandler().addEventListener(listener);
-
- Callback c = new Callback() {
- @Override
- public void call(HttpServletRequest request, HttpServletResponse response)
- throws IOException {
- HttpSession s = request.getSession();
- // This is set in HttpSessionListenerImpl
- String result = (String) s.getAttribute("gemfire-session-id");
- response.getWriter().write(result);
- }
- };
-
- tester.setAttribute("callback_1", c);
- tester.start();
-// ContextManager.getInstance().putContext(
-// servletHolder.getServlet().getServletConfig().getServletContext());
-
- request.setMethod("GET");
- request.setURI("/test/hello");
- request.setHeader("Host", "tester");
- request.setVersion("HTTP/1.0");
-
- response = HttpTester.parseResponse(tester.getResponses(request.generate()));
-
- assertEquals(200, response.getStatus());
-
- List<Cookie> cookies = getCookies(response);
-
-// AbstractListener listener = RendezvousManager.getListener();
- tester.stop();
-
- assertTrue("Timeout waiting for events",
- listener.await(1, TimeUnit.SECONDS));
- assertEquals(ListenerEventType.SESSION_CREATED,
- listener.events.get(0));
- assertEquals(ListenerEventType.SESSION_DESTROYED,
- listener.events.get(1));
- assertEquals(cookies.get(0).getValue(), response.getContent());
- }
-
- @Test
- public void testHttpSessionListener2() throws Exception {
- HttpSessionListenerImpl2 listener = new HttpSessionListenerImpl2();
- tester.getContext().getSessionHandler().addEventListener(listener);
-
- Callback c = new Callback() {
- @Override
- public void call(HttpServletRequest request, HttpServletResponse response)
- throws IOException {
- HttpSession s = request.getSession();
- s.setAttribute("test01", "test01");
- s = request.getSession(false);
- s.invalidate();
- response.getWriter().write(s.getId());
- }
- };
-
- tester.setAttribute("callback_1", c);
- tester.start();
-// ContextManager.getInstance().putContext(
-// servletHolder.getServlet().getServletConfig().getServletContext());
-
- request.setMethod("GET");
- request.setURI("/test/hello");
- request.setHeader("Host", "tester");
- request.setVersion("HTTP/1.0");
-
- response = HttpTester.parseResponse(tester.getResponses(request.generate()));
-
- assertEquals(200, response.getStatus());
-
- List<Cookie> cookies = getCookies(response);
-
- tester.stop();
-
- assertTrue("Timeout waiting for events",
- listener.await(1, TimeUnit.SECONDS));
- assertEquals(ListenerEventType.SESSION_CREATED,
- listener.events.get(0));
- assertEquals(ListenerEventType.SESSION_DESTROYED,
- listener.events.get(1));
- assertEquals(cookies.get(0).getValue(), response.getContent());
- }
-
-
-
-
-// @Test
- public void testJsp() throws Exception {
- tester.setResourceBase("target/test-classes");
- ServletHolder jspHolder = tester.addServlet(JspServlet.class, "/test/*");
- jspHolder.setInitOrder(1);
-
- jspHolder.setInitParameter("scratchdir", tmpdir.getPath());
-
- Callback c_1 = new Callback() {
- @Override
- public void call(HttpServletRequest request, HttpServletResponse response)
- throws IOException, ServletException {
- request.getSession().setAttribute("foo", "bar");
- request.setAttribute("foo", "baz");
- RequestDispatcher dispatcher = request.getRequestDispatcher(
- "pagecontext.jsp");
- dispatcher.forward(request, response);
- }
- };
-
- tester.getContext().setClassLoader(Thread.currentThread().getContextClassLoader());
- tester.setAttribute("callback_1", c_1);
-
- tester.start();
-
- request.setMethod("GET");
- request.setURI("/test/hello");
- request.setHeader("Host", "tester");
- request.setVersion("HTTP/1.0");
-
- response = HttpTester.parseResponse(tester.getResponses(request.generate()));
-
- assertEquals(200, response.getStatus());
- assertEquals("baz", response.getContent().trim());
- }
-
-
- ////////////////////////////////////////////////////////////////////
- // Private methods
-
- /**
- * Why doesn't HttpTester do this already??
- */
- private List<Cookie> getCookies(HttpTester.Response response) {
- List<Cookie> cookies = new ArrayList<Cookie>();
-
- Enumeration e = response.getValues("Set-Cookie");
-
- while (e != null && e.hasMoreElements()) {
- String header = (String) e.nextElement();
- Cookie c = null;
-
- StringTokenizer st = new StringTokenizer(header, ";");
- while (st.hasMoreTokens()) {
- String[] split = st.nextToken().split("=");
- String param = split[0].trim();
- String value = null;
- if (split.length > 1) {
- value = split[1].trim();
- }
- if ("version".equalsIgnoreCase(param)) {
- c.setVersion(Integer.parseInt(value));
- } else if ("comment".equalsIgnoreCase(param)) {
- c.setComment(value);
- } else if ("domain".equalsIgnoreCase(param)) {
- c.setDomain(value);
- } else if ("max-age".equalsIgnoreCase(param)) {
- c.setMaxAge(Integer.parseInt(value));
- } else if ("discard".equalsIgnoreCase(param)) {
- c.setMaxAge(-1);
- } else if ("path".equalsIgnoreCase(param)) {
- c.setPath(value);
- } else if ("secure".equalsIgnoreCase(param)) {
- c.setSecure(true);
- } else if ("httponly".equalsIgnoreCase(param)) {
- // Ignored??
- } else {
- if (c == null) {
- c = new Cookie(param, value);
- } else {
- throw new IllegalStateException("Unknown cookie param: " + param);
- }
- }
- }
-
- if (c != null) {
- cookies.add(c);
- }
- }
-
- return cookies;
- }
-
- private Region getRegion() {
- // Yuck...
- return ((GemfireSessionManager) ((SessionCachingFilter) filterHolder.getFilter()).getSessionManager()).getCache().getCache().getRegion(
- "gemfire_modules_sessions");
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f6c4c2f9/extensions/gemfire-modules-session/src/test/java/com/gemstone/gemfire/modules/session/internal/filter/SessionReplicationJUnitTest.java
----------------------------------------------------------------------
diff --git a/extensions/gemfire-modules-session/src/test/java/com/gemstone/gemfire/modules/session/internal/filter/SessionReplicationJUnitTest.java b/extensions/gemfire-modules-session/src/test/java/com/gemstone/gemfire/modules/session/internal/filter/SessionReplicationJUnitTest.java
deleted file mode 100644
index ba4cbd9..0000000
--- a/extensions/gemfire-modules-session/src/test/java/com/gemstone/gemfire/modules/session/internal/filter/SessionReplicationJUnitTest.java
+++ /dev/null
@@ -1,53 +0,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.
-*/
-
-package com.gemstone.gemfire.modules.session.internal.filter;
-
-import com.gemstone.gemfire.modules.session.filter.SessionCachingFilter;
-import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
-import com.mockrunner.mock.web.MockFilterConfig;
-import com.mockrunner.mock.web.WebMockObjectFactory;
-import org.junit.Before;
-import org.junit.experimental.categories.Category;
-
-/**
- * This runs all tests with a local cache disabled
- */
-@Category(IntegrationTest.class)
-public class SessionReplicationJUnitTest extends CommonTests {
-
- @Before
- public void setUp() throws Exception {
- super.setUp();
-
- WebMockObjectFactory factory = getWebMockObjectFactory();
- MockFilterConfig config = factory.getMockFilterConfig();
-
- config.setInitParameter("gemfire.property.mcast-port", "0");
- config.setInitParameter("cache-type", "peer-to-peer");
-
- factory.getMockServletContext().setContextPath(CONTEXT_PATH);
-
- factory.getMockRequest().setRequestURL("/test/foo/bar");
- factory.getMockRequest().setContextPath(CONTEXT_PATH);
-
- createFilter(SessionCachingFilter.class);
- createServlet(CallbackServlet.class);
-
- setDoChain(true);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f6c4c2f9/extensions/gemfire-modules-session/src/test/java/com/gemstone/gemfire/modules/session/internal/filter/SessionReplicationLocalCacheJUnitTest.java
----------------------------------------------------------------------
diff --git a/extensions/gemfire-modules-session/src/test/java/com/gemstone/gemfire/modules/session/internal/filter/SessionReplicationLocalCacheJUnitTest.java b/extensions/gemfire-modules-session/src/test/java/com/gemstone/gemfire/modules/session/internal/filter/SessionReplicationLocalCacheJUnitTest.java
deleted file mode 100644
index 4016c7c..0000000
--- a/extensions/gemfire-modules-session/src/test/java/com/gemstone/gemfire/modules/session/internal/filter/SessionReplicationLocalCacheJUnitTest.java
+++ /dev/null
@@ -1,54 +0,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.
-*/
-
-package com.gemstone.gemfire.modules.session.internal.filter;
-
-import com.gemstone.gemfire.modules.session.filter.SessionCachingFilter;
-import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
-import com.mockrunner.mock.web.MockFilterConfig;
-import com.mockrunner.mock.web.WebMockObjectFactory;
-import org.junit.Before;
-import org.junit.experimental.categories.Category;
-
-/**
- * This runs all tests with a local cache enabled
- */
-@Category(IntegrationTest.class)
-public class SessionReplicationLocalCacheJUnitTest extends CommonTests {
-
- @Before
- public void setUp() throws Exception {
- super.setUp();
-
- WebMockObjectFactory factory = getWebMockObjectFactory();
- MockFilterConfig config = factory.getMockFilterConfig();
-
- config.setInitParameter("gemfire.property.mcast-port", "0");
- config.setInitParameter("cache-type", "peer-to-peer");
- config.setInitParameter("gemfire.cache.enable_local_cache", "true");
-
- factory.getMockServletContext().setContextPath(CONTEXT_PATH);
-
- factory.getMockRequest().setRequestURL("/test/foo/bar");
- factory.getMockRequest().setContextPath(CONTEXT_PATH);
-
- createFilter(SessionCachingFilter.class);
- createServlet(CallbackServlet.class);
-
- setDoChain(true);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f6c4c2f9/extensions/gemfire-modules-session/src/test/java/com/gemstone/gemfire/modules/session/junit/ChildFirstClassLoader.java
----------------------------------------------------------------------
diff --git a/extensions/gemfire-modules-session/src/test/java/com/gemstone/gemfire/modules/session/junit/ChildFirstClassLoader.java b/extensions/gemfire-modules-session/src/test/java/com/gemstone/gemfire/modules/session/junit/ChildFirstClassLoader.java
deleted file mode 100644
index dd4441b..0000000
--- a/extensions/gemfire-modules-session/src/test/java/com/gemstone/gemfire/modules/session/junit/ChildFirstClassLoader.java
+++ /dev/null
@@ -1,86 +0,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.
-*/
-
-package com.gemstone.gemfire.modules.session.junit;
-
-import java.net.URL;
-import java.net.URLClassLoader;
-
-public class ChildFirstClassLoader extends URLClassLoader {
-
- public ChildFirstClassLoader() {
- super(new URL[]{});
- }
-
- public ChildFirstClassLoader(URL[] urls) {
- super(urls);
- }
-
- public ChildFirstClassLoader(URL[] urls, ClassLoader parent) {
- super(urls, parent);
- }
-
- @Override
- public void addURL(URL url) {
- super.addURL(url);
- }
-
- @Override
- public Class loadClass(String name) throws ClassNotFoundException {
- return loadClass(name, false);
- }
-
- /**
- * We override the parent-first behavior established by
- * java.lang.Classloader.
- */
- @Override
- protected Class loadClass(String name, boolean resolve)
- throws ClassNotFoundException {
- Class c = null;
-
- if (name.startsWith("com.gemstone")) {
- // First, check if the class has already been loaded
- c = findLoadedClass(name);
-
- // if not loaded, search the local (child) resources
- if (c == null) {
- try {
- c = findClass(name);
- } catch (ClassNotFoundException cnfe) {
- // ignore
- }
- }
- }
-
- // if we could not find it, delegate to parent
- // Note that we don't attempt to catch any ClassNotFoundException
- if (c == null) {
- if (getParent() != null) {
- c = getParent().loadClass(name);
- } else {
- c = getSystemClassLoader().loadClass(name);
- }
- }
-
- if (resolve) {
- resolveClass(c);
- }
-
- return c;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f6c4c2f9/extensions/gemfire-modules-session/src/test/java/com/gemstone/gemfire/modules/session/junit/NamedRunner.java
----------------------------------------------------------------------
diff --git a/extensions/gemfire-modules-session/src/test/java/com/gemstone/gemfire/modules/session/junit/NamedRunner.java b/extensions/gemfire-modules-session/src/test/java/com/gemstone/gemfire/modules/session/junit/NamedRunner.java
deleted file mode 100644
index e717c9a..0000000
--- a/extensions/gemfire-modules-session/src/test/java/com/gemstone/gemfire/modules/session/junit/NamedRunner.java
+++ /dev/null
@@ -1,120 +0,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.
-*/
-
-package com.gemstone.gemfire.modules.session.junit;
-
-import org.junit.runner.notification.RunNotifier;
-import org.junit.runners.BlockJUnit4ClassRunner;
-import org.junit.runners.model.FrameworkMethod;
-import org.junit.runners.model.InitializationError;
-
-/**
- * A Junit 4 runner that stores the name of the method that runs. The methods
- * marked with @After and @Before (but also the Test method itself) can request
- * this name for which it is running.
- *
- * @author Rudy De Busscher
- */
-public class NamedRunner extends BlockJUnit4ClassRunner {
-
- /**
- * The Constant PREFIX_KEY.
- */
- private static final String PREFIX_KEY = "ClassLoaderRunner_TestMethodName_";
-
- /**
- * The Constant NO_NAME.
- */
- private static final String NO_NAME = "null";
-
- /**
- * Instantiates a new named runner.
- *
- * @param klass the klass
- * @throws InitializationError the initialization error
- */
- public NamedRunner(Class<?> klass) throws InitializationError {
- super(klass);
- }
-
- @Override
- protected void runChild(FrameworkMethod method, RunNotifier notifier)
-
- {
- storeTestMethodName(method.getName());
- super.runChild(method, notifier);
- removeTestMethodName();
- }
-
- /**
- * Gets the test method name.
- *
- * @return the test method name
- */
- public static String getTestMethodName() {
- return retrieveTestMethodName();
- }
-
- /**
- * Retrieve test method name.
- *
- * @return the string
- */
- private static String retrieveTestMethodName() {
- // We can't use a ThreadLocal variable in the case the TestPerClassLoader runner is used. Then this
- // Method is accessed from another classloader and thus reinitialized variables.
- String result = null;
- String storedName = System.getProperty(getKey());
- if (!NO_NAME.equals(storedName)) {
- result = storedName;
- }
- return result;
- }
-
- /**
- * Removes the test method name.
- */
- private static void removeTestMethodName() {
- // We can't use a ThreadLocal variable in the case the TestPerClassLoader runner is used. Then this
- // Method is accessed from another classloader and thus reinitialized variables.
- System.setProperty(getKey(), NO_NAME);
-
- }
-
- /**
- * Store test method name.
- *
- * @param name the name
- */
- private static void storeTestMethodName(String name) {
-
- // We can't use a ThreadLocal variable in the case the TestPerClassLoader runner is used. Then this
- // Method is accessed from another classloader and thus reinitialized variables.
- System.setProperty(getKey(), name);
- }
-
- /**
- * Gets the key.
- *
- * @return the key
- */
- private static String getKey() {
- StringBuffer buffer = new StringBuffer();
- buffer.append(PREFIX_KEY).append(Thread.currentThread().getName());
- return buffer.toString();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f6c4c2f9/extensions/gemfire-modules-session/src/test/java/com/gemstone/gemfire/modules/session/junit/PerTestClassLoaderRunner.java
----------------------------------------------------------------------
diff --git a/extensions/gemfire-modules-session/src/test/java/com/gemstone/gemfire/modules/session/junit/PerTestClassLoaderRunner.java b/extensions/gemfire-modules-session/src/test/java/com/gemstone/gemfire/modules/session/junit/PerTestClassLoaderRunner.java
deleted file mode 100644
index 3e5c998..0000000
--- a/extensions/gemfire-modules-session/src/test/java/com/gemstone/gemfire/modules/session/junit/PerTestClassLoaderRunner.java
+++ /dev/null
@@ -1,283 +0,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.
-*/
-
-package com.gemstone.gemfire.modules.session.junit;
-
-/**
- * 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
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * 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.
- */
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.internal.runners.statements.Fail;
-import org.junit.internal.runners.statements.RunAfters;
-import org.junit.internal.runners.statements.RunBefores;
-import org.junit.runners.model.FrameworkMethod;
-import org.junit.runners.model.InitializationError;
-import org.junit.runners.model.Statement;
-import org.junit.runners.model.TestClass;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Method;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.StringTokenizer;
-import java.util.logging.Logger;
-
-public class PerTestClassLoaderRunner extends NamedRunner {
- private static final Logger LOGGER = Logger
- .getLogger(PerTestClassLoaderRunner.class.getName());
-
- // The classpath is needed because the custom class loader looks there to find the classes.
- private static String classPath;
- private static boolean classPathDetermined = false;
-
- // Some data related to the class from the custom class loader.
- private TestClass testClassFromClassLoader;
- private Object beforeFromClassLoader;
- private Object afterFromClassLoader;
-
- /**
- * Instantiates a new test per class loader runner.
- *
- * @param klass the klass
- * @throws InitializationError the initialization error
- */
- public PerTestClassLoaderRunner(Class<?> klass) throws InitializationError {
- super(klass);
- }
-
- @Override
- protected Object createTest() throws Exception {
- // Need an instance now from the class loaded by the custom loader.
- return testClassFromClassLoader.getJavaClass().newInstance();
- }
-
- /**
- * Load classes (TestCase, @Before and @After with custom class loader.
- *
- * @throws ClassNotFoundException the class not found exception
- */
- private void loadClassesWithCustomClassLoader()
- throws ClassNotFoundException {
- String classPath = System.getProperty("java.class.path");
- StringTokenizer st = new StringTokenizer(classPath, ":");
- List<URL> urls = new ArrayList<URL>();
- while (st.hasMoreTokens()) {
- String u = st.nextToken();
- try {
- if (!u.endsWith(".jar")) {
- u += "/";
- }
- URL url = new URL("file://" + u);
- urls.add(url);
- } catch (MalformedURLException e) {
- e.printStackTrace();
- }
- }
-
- ClassLoader classLoader = new ChildFirstClassLoader(
- urls.toArray(new URL[]{}),
- Thread.currentThread().getContextClassLoader()
- );
-
- Thread.currentThread().setContextClassLoader(classLoader);
-
- testClassFromClassLoader = new TestClass(classLoader
- .loadClass(getTestClass().getJavaClass().getName()));
- // See withAfters and withBefores for the reason.
- beforeFromClassLoader = classLoader.loadClass(Before.class.getName());
- afterFromClassLoader = classLoader.loadClass(After.class.getName());
- }
-
- @Override
- protected Statement methodBlock(FrameworkMethod method) {
- FrameworkMethod newMethod = null;
- try {
- // Need the class from the custom loader now, so lets load the class.
- loadClassesWithCustomClassLoader();
- // The method as parameter is from the original class and thus not found in our
- // class loaded by the custom name (reflection is class loader sensitive)
- // So find the same method but now in the class from the class Loader.
- Method methodFromNewlyLoadedClass = testClassFromClassLoader
- .getJavaClass().getMethod(method.getName());
- newMethod = new FrameworkMethod(methodFromNewlyLoadedClass);
- } catch (ClassNotFoundException e) {
- // Show any problem nicely as a JUnit Test failure.
- return new Fail(e);
- } catch (SecurityException e) {
- return new Fail(e);
- } catch (NoSuchMethodException e) {
- return new Fail(e);
- }
-
- // We can carry out the normal JUnit functionality with our newly discovered method now.
- return super.methodBlock(newMethod);
- }
-
- @SuppressWarnings("unchecked")
- @Override
- protected Statement withAfters(FrameworkMethod method, Object target,
- Statement statement) {
- // We now to need to search in the class from the custom loader.
- // We also need to search with the annotation loaded by the custom
- // class loader or otherwise we don't find any method.
- List<FrameworkMethod> afters = testClassFromClassLoader
- .getAnnotatedMethods(
- (Class<? extends Annotation>) afterFromClassLoader);
- return new RunAfters(statement, afters, target);
- }
-
- @SuppressWarnings("unchecked")
- @Override
- protected Statement withBefores(FrameworkMethod method, Object target,
- Statement statement) {
- // We now to need to search in the class from the custom loader.
- // We also need to search with the annotation loaded by the custom
- // class loader or otherwise we don't find any method.
- List<FrameworkMethod> befores = testClassFromClassLoader
- .getAnnotatedMethods(
- (Class<? extends Annotation>) beforeFromClassLoader);
- return new RunBefores(statement, befores, target);
- }
-
-// /**
-// * Gets the class path. This value is cached in a static variable for performance reasons.
-// *
-// * @return the class path
-// */
-// private static String getClassPath()
-// {
-// if (classPathDetermined)
-// {
-// return classPath;
-// }
-//
-// classPathDetermined = true;
-// // running from maven, we have the classpath in this property.
-// classPath = System.getProperty("surefire.test.class.path");
-// if (classPath != null)
-// {
-// return classPath;
-// }
-//
-// // For a multi module project, running it from the top we have to find it using another way.
-// // We also need to set useSystemClassLoader=true in the POM so that we gets a jar with the classpath in it.
-// String booterClassPath = System.getProperty("java.class.path");
-// Vector<String> pathItems = null;
-// if (booterClassPath != null)
-// {
-// pathItems = scanPath(booterClassPath);
-// }
-// // Do we have just 1 entry as classpath which is a jar?
-// if (pathItems != null && pathItems.size() == 1
-// && isJar((String) pathItems.get(0)))
-// {
-// classPath = loadJarManifestClassPath((String) pathItems.get(0),
-// "META-INF/MANIFEST.MF");
-// }
-// return classPath;
-//
-// }
-
-// /**
-// * Load jar manifest class path.
-// *
-// * @param path the path
-// * @param fileName the file name
-// *
-// * @return the string
-// */
-// private static String loadJarManifestClassPath(String path, String fileName)
-// {
-// File archive = new File(path);
-// if (!archive.exists()) {
-// return null;
-// }
-// ZipFile zipFile = null;
-//
-// try {
-// zipFile = new ZipFile(archive);
-// } catch (IOException io) {
-// return null;
-// }
-//
-// ZipEntry entry = zipFile.getEntry(fileName);
-// if (entry == null) {
-// return null;
-// } try {
-// Manifest mf = new Manifest();
-// mf.read(zipFile.getInputStream(entry));
-//
-// return mf.getMainAttributes().getValue(Attributes.Name.CLASS_PATH)
-// .replaceAll(" ", System.getProperty("path.separator"))
-// .replaceAll("file:/", "");
-// } catch (MalformedURLException e) {
-// LOGGER.throwing("ClassLoaderTestSuite", "loadJarManifestClassPath", e);
-// } catch (IOException e) {
-// LOGGER.throwing("ClassLoaderTestSuite", "loadJarManifestClassPath", e);
-// }
-// return null;
-// }
-//
-// /**
-// * Checks if is jar.
-// *
-// * @param pathEntry the path entry
-// *
-// * @return true, if is jar
-// */
-// private static boolean isJar(String pathEntry)
-// {
-// return pathEntry.endsWith(".jar") || pathEntry.endsWith(".zip");
-// }
-//
-// /**
-// * Scan path for all directories.
-// *
-// * @param classPath the class path
-// *
-// * @return the vector< string>
-// */
-// private static Vector<String> scanPath(String classPath)
-// {
-// String separator = System.getProperty("path.separator");
-// Vector<String> pathItems = new Vector<String>(10);
-// StringTokenizer st = new StringTokenizer(classPath, separator);
-// while (st.hasMoreTokens())
-// {
-// pathItems.addElement(st.nextToken());
-// }
-// return pathItems;
-// }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f6c4c2f9/extensions/gemfire-modules-session/src/test/java/com/gemstone/gemfire/modules/session/junit/SeparateClassloaderTestRunner.java
----------------------------------------------------------------------
diff --git a/extensions/gemfire-modules-session/src/test/java/com/gemstone/gemfire/modules/session/junit/SeparateClassloaderTestRunner.java b/extensions/gemfire-modules-session/src/test/java/com/gemstone/gemfire/modules/session/junit/SeparateClassloaderTestRunner.java
deleted file mode 100644
index 4337f5a..0000000
--- a/extensions/gemfire-modules-session/src/test/java/com/gemstone/gemfire/modules/session/junit/SeparateClassloaderTestRunner.java
+++ /dev/null
@@ -1,56 +0,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.
-*/
-
-package com.gemstone.gemfire.modules.session.junit;
-
-import org.junit.runners.BlockJUnit4ClassRunner;
-import org.junit.runners.model.InitializationError;
-
-import java.net.URLClassLoader;
-
-/**
- * @author StackOverflow
- */
-public class SeparateClassloaderTestRunner extends BlockJUnit4ClassRunner {
-
- public SeparateClassloaderTestRunner(Class<?> clazz) throws InitializationError {
- super(getFromTestClassloader(clazz));
- }
-
- private static Class<?> getFromTestClassloader(Class<?> clazz) throws InitializationError {
- try {
- ClassLoader testClassLoader = new TestClassLoader();
- return Class.forName(clazz.getName(), true, testClassLoader);
- } catch (ClassNotFoundException e) {
- throw new InitializationError(e);
- }
- }
-
- public static class TestClassLoader extends URLClassLoader {
- public TestClassLoader() {
- super(((URLClassLoader)getSystemClassLoader()).getURLs());
- }
-
- @Override
- public Class<?> loadClass(String name) throws ClassNotFoundException {
- if (name.startsWith("com.gemstone.gemfire.modules.session.")) {
- return super.findClass(name);
- }
- return super.loadClass(name);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f6c4c2f9/extensions/gemfire-modules-session/src/test/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/extensions/gemfire-modules-session/src/test/resources/log4j.properties b/extensions/gemfire-modules-session/src/test/resources/log4j.properties
deleted file mode 100644
index b346714..0000000
--- a/extensions/gemfire-modules-session/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,12 +0,0 @@
-# To change this template, choose Tools | Templates
-# and open the template in the editor.
-
-# Set root logger level to DEBUG and its only appender to A1.
-log4j.rootLogger=DEBUG, A1
-
-# A1 is set to be a ConsoleAppender.
-log4j.appender.A1=org.apache.log4j.ConsoleAppender
-
-# A1 uses PatternLayout.
-log4j.appender.A1.layout=org.apache.log4j.PatternLayout
-log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f6c4c2f9/extensions/gemfire-modules-tomcat7/build.gradle
----------------------------------------------------------------------
diff --git a/extensions/gemfire-modules-tomcat7/build.gradle b/extensions/gemfire-modules-tomcat7/build.gradle
deleted file mode 100644
index edb070f..0000000
--- a/extensions/gemfire-modules-tomcat7/build.gradle
+++ /dev/null
@@ -1,54 +0,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.
- */
-
-test {
- doFirst {
- copy {
- from 'build/resources/test/tomcat'
- into 'build/test/tomcat/'
- }
- }
-}
-
-dependencies {
- compile(project(':extensions/gemfire-modules')) {
- // Remove everything related to Tomcat 6.x
- exclude group: 'org.apache.tomcat'
- }
-
- compile 'org.apache.tomcat:tomcat-api:' + project.'tomcat7.version'
- compile 'org.apache.tomcat:tomcat-catalina:' + project.'tomcat7.version'
- compile 'org.apache.tomcat:tomcat-coyote:' + project.'tomcat7.version'
- compile 'org.apache.tomcat:tomcat-util:' + project.'tomcat7.version'
- compile 'org.apache.tomcat:tomcat-juli:' + project.'tomcat7.version'
-
- testCompile 'org.httpunit:httpunit:' + project.'httpunit.version'
-
- testRuntime 'javax.annotation:jsr250-api:' + project.'javax.jsr250-api.version'
- testRuntime 'javax.ejb:ejb-api:' + project.'javax.ejb-api.version'
- testRuntime 'javax.servlet:javax.servlet-api:' + project.'javax.servlet-api.version'
- testRuntime 'org.eclipse.persistence:javax.persistence:' + project.'javax.persistence-api.version'
-
- provided(project(path: ':extensions/gemfire-modules', configuration: 'testOutput')) {
- // Remove everything related to Tomcat 6.x
- exclude group: 'org.apache.tomcat', module: 'catalina'
- exclude group: 'org.apache.tomcat', module: 'catalina-ha'
- exclude group: 'org.apache.tomcat', module: 'juli'
- }
- testCompile project(path: ':gemfire-junit')
- provided project(path: ':gemfire-core', configuration: 'testOutput')
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f6c4c2f9/extensions/gemfire-modules-tomcat7/src/main/java/com/gemstone/gemfire/modules/session/catalina/Tomcat7DeltaSessionManager.java
----------------------------------------------------------------------
diff --git a/extensions/gemfire-modules-tomcat7/src/main/java/com/gemstone/gemfire/modules/session/catalina/Tomcat7DeltaSessionManager.java b/extensions/gemfire-modules-tomcat7/src/main/java/com/gemstone/gemfire/modules/session/catalina/Tomcat7DeltaSessionManager.java
deleted file mode 100644
index d1f44bb..0000000
--- a/extensions/gemfire-modules-tomcat7/src/main/java/com/gemstone/gemfire/modules/session/catalina/Tomcat7DeltaSessionManager.java
+++ /dev/null
@@ -1,112 +0,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.
-*/
-package com.gemstone.gemfire.modules.session.catalina;
-
-import org.apache.catalina.LifecycleException;
-import org.apache.catalina.LifecycleState;
-
-import java.io.IOException;
-
-public class Tomcat7DeltaSessionManager extends DeltaSessionManager {
-
- /**
- * Prepare for the beginning of active use of the public methods of this component. This method should be called
- * after <code>configure()</code>, and before any of the public methods of the component are utilized.
- *
- * @throws LifecycleException if this component detects a fatal error that prevents this component from being used
- */
- @Override
- public void startInternal() throws LifecycleException {
- super.startInternal();
- if (getLogger().isDebugEnabled()) {
- getLogger().debug(this + ": Starting");
- }
- if (this.started.get()) {
- return;
- }
-
- this.lifecycle.fireLifecycleEvent(START_EVENT, null);
-
- // Register our various valves
- registerJvmRouteBinderValve();
-
- if (isCommitValveEnabled()) {
- registerCommitSessionValve();
- }
-
- // Initialize the appropriate session cache interface
- initializeSessionCache();
-
- try {
- load();
- } catch (ClassNotFoundException e) {
- throw new LifecycleException("Exception starting manager", e);
- } catch (IOException e) {
- throw new LifecycleException("Exception starting manager", e);
- }
-
- // Create the timer and schedule tasks
- scheduleTimerTasks();
-
- this.started.set(true);
- this.setState(LifecycleState.STARTING);
- }
-
- /**
- * Gracefully terminate the active use of the public methods of this component. This method should be the last one
- * called on a given instance of this component.
- *
- * @throws LifecycleException if this component detects a fatal error that needs to be reported
- */
- @Override
- public void stopInternal() throws LifecycleException {
- super.stopInternal();
- if (getLogger().isDebugEnabled()) {
- getLogger().debug(this + ": Stopping");
- }
-
- try {
- unload();
- } catch (IOException e) {
- getLogger().error("Unable to unload sessions", e);
- }
-
- this.started.set(false);
- this.lifecycle.fireLifecycleEvent(STOP_EVENT, null);
-
- // StandardManager expires all Sessions here.
- // All Sessions are not known by this Manager.
-
- super.destroyInternal();
-
- // Clear any sessions to be touched
- getSessionsToTouch().clear();
-
- // Cancel the timer
- cancelTimer();
-
- // Unregister the JVM route valve
- unregisterJvmRouteBinderValve();
-
- if (isCommitValveEnabled()) {
- unregisterCommitSessionValve();
- }
-
- this.setState(LifecycleState.STOPPING);
- }
-
-}