http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/internal/filter/CommonTests.java ---------------------------------------------------------------------- diff --git a/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/internal/filter/CommonTests.java b/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/internal/filter/CommonTests.java index c1677a1..c31afc6 100644 --- a/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/internal/filter/CommonTests.java +++ b/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/internal/filter/CommonTests.java @@ -1,19 +1,17 @@ /* -* 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. -*/ + * 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.geode.modules.session.internal.filter; import static org.junit.Assert.*; @@ -42,8 +40,8 @@ import org.junit.Ignore; import org.junit.Test; /** - * This servlet tests the effects of the downstream SessionCachingFilter filter. - * When these tests are performed, the filter would already have taken effect. + * This servlet tests the effects of the downstream SessionCachingFilter filter. When these tests + * are performed, the filter would already have taken effect. */ public abstract class CommonTests extends BasicServletTestCaseAdapter { @@ -52,10 +50,8 @@ public abstract class CommonTests extends BasicServletTestCaseAdapter { @Test public void testGetSession1() throws Exception { doFilter(); - HttpSession session1 = - ((HttpServletRequest) getFilteredRequest()).getSession(); - HttpSession session2 = - ((HttpServletRequest) getFilteredRequest()).getSession(); + HttpSession session1 = ((HttpServletRequest) getFilteredRequest()).getSession(); + HttpSession session2 = ((HttpServletRequest) getFilteredRequest()).getSession(); assertSame("Session should be the same", session1, session2); } @@ -84,8 +80,7 @@ public abstract class CommonTests extends BasicServletTestCaseAdapter { getFilteredRequest().setAttribute("foo", "bar"); assertEquals("bar", getFilteredRequest().getAttribute("foo")); - assertNull("Unknown attribute should be null", - getFilteredRequest().getAttribute("baz")); + assertNull("Unknown attribute should be null", getFilteredRequest().getAttribute("baz")); } @Test @@ -101,8 +96,7 @@ public abstract class CommonTests extends BasicServletTestCaseAdapter { doFilter(); assertEquals("bar", getFilteredRequest().getAttribute("foo")); - assertNull("Unknown attribute should be null", - getFilteredRequest().getAttribute("baz")); + assertNull("Unknown attribute should be null", getFilteredRequest().getAttribute("baz")); } @Test @@ -166,8 +160,7 @@ public abstract class CommonTests extends BasicServletTestCaseAdapter { /** - * Test that various methods throw the appropriate exception when the session is - * invalid. + * Test that various methods throw the appropriate exception when the session is invalid. */ @Test public void testInvalidate1() throws Exception { @@ -342,7 +335,9 @@ public abstract class CommonTests extends BasicServletTestCaseAdapter { doFilter(); // Ugh - MockHttpSession session = (MockHttpSession) ((GemfireHttpSession) ((HttpServletRequest) getFilteredRequest()).getSession()).getNativeSession(); + MockHttpSession session = + (MockHttpSession) ((GemfireHttpSession) ((HttpServletRequest) getFilteredRequest()) + .getSession()).getNativeSession(); session.addAttributeListener((HttpSessionAttributeListener) listener); session.setAttribute("foo", "bar"); session.setAttribute("foo", "baz"); @@ -350,10 +345,8 @@ public abstract class CommonTests extends BasicServletTestCaseAdapter { assertTrue("Event timeout", listener.await(1, TimeUnit.SECONDS)); assertEquals(ListenerEventType.SESSION_ATTRIBUTE_ADDED, listener.getEvents().get(0)); - assertEquals(ListenerEventType.SESSION_ATTRIBUTE_REPLACED, - listener.getEvents().get(1)); - assertEquals(ListenerEventType.SESSION_ATTRIBUTE_REMOVED, - listener.getEvents().get(2)); + assertEquals(ListenerEventType.SESSION_ATTRIBUTE_REPLACED, listener.getEvents().get(1)); + assertEquals(ListenerEventType.SESSION_ATTRIBUTE_REMOVED, listener.getEvents().get(2)); } /** @@ -363,13 +356,10 @@ public abstract class CommonTests extends BasicServletTestCaseAdapter { public void testHttpSessionBindingListener1() throws Exception { doFilter(); - HttpSession session = - ((HttpServletRequest) getFilteredRequest()).getSession(); + HttpSession session = ((HttpServletRequest) getFilteredRequest()).getSession(); - HttpSessionBindingListenerImpl listener1 = - new HttpSessionBindingListenerImpl(2); - HttpSessionBindingListenerImpl listener2 = - new HttpSessionBindingListenerImpl(2); + HttpSessionBindingListenerImpl listener1 = new HttpSessionBindingListenerImpl(2); + HttpSessionBindingListenerImpl listener2 = new HttpSessionBindingListenerImpl(2); session.setAttribute("foo", listener1); session.setAttribute("foo", listener2); @@ -381,11 +371,9 @@ public abstract class CommonTests extends BasicServletTestCaseAdapter { assertEquals("Event list size incorrect", 2, listener1.getEvents().size()); assertEquals("Event list size incorrect", 2, listener2.getEvents().size()); assertEquals(ListenerEventType.SESSION_VALUE_BOUND, listener1.getEvents().get(0)); - assertEquals(ListenerEventType.SESSION_VALUE_UNBOUND, - listener1.getEvents().get(1)); + assertEquals(ListenerEventType.SESSION_VALUE_UNBOUND, listener1.getEvents().get(1)); assertEquals(ListenerEventType.SESSION_VALUE_BOUND, listener2.getEvents().get(0)); - assertEquals(ListenerEventType.SESSION_VALUE_UNBOUND, - listener2.getEvents().get(1)); + assertEquals(ListenerEventType.SESSION_VALUE_UNBOUND, listener2.getEvents().get(1)); } @Test @@ -581,8 +569,7 @@ public abstract class CommonTests extends BasicServletTestCaseAdapter { HttpServletRequest request = (HttpServletRequest) getFilteredRequest(); request.getSession(); - assertFalse("Session ID should not be from cookie", - request.isRequestedSessionIdFromCookie()); + assertFalse("Session ID should not be from cookie", request.isRequestedSessionIdFromCookie()); assertTrue("Session ID should be from URL", request.isRequestedSessionIdFromURL()); } @@ -598,14 +585,14 @@ public abstract class CommonTests extends BasicServletTestCaseAdapter { public static class RequestWrappingFilter implements Filter { - @Override public void init(final FilterConfig filterConfig) throws ServletException { + @Override + public void init(final FilterConfig filterConfig) throws ServletException { } @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) - throws IOException, ServletException - { + throws IOException, ServletException { final HttpServletRequest httpRequest = (HttpServletRequest) request; httpRequest.getSession(); httpRequest.setAttribute("original_session", httpRequest.getSession()); @@ -614,7 +601,8 @@ public abstract class CommonTests extends BasicServletTestCaseAdapter { } - @Override public void destroy() { + @Override + public void destroy() { } }
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/internal/filter/HttpSessionAttributeListenerImpl.java ---------------------------------------------------------------------- diff --git a/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/internal/filter/HttpSessionAttributeListenerImpl.java b/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/internal/filter/HttpSessionAttributeListenerImpl.java index e2f268f..ce688c3 100644 --- a/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/internal/filter/HttpSessionAttributeListenerImpl.java +++ b/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/internal/filter/HttpSessionAttributeListenerImpl.java @@ -1,19 +1,17 @@ /* -* 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. -*/ + * 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.geode.modules.session.internal.filter; http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/internal/filter/HttpSessionBindingListenerImpl.java ---------------------------------------------------------------------- diff --git a/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/internal/filter/HttpSessionBindingListenerImpl.java b/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/internal/filter/HttpSessionBindingListenerImpl.java index 0aedcbb..092cf08 100644 --- a/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/internal/filter/HttpSessionBindingListenerImpl.java +++ b/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/internal/filter/HttpSessionBindingListenerImpl.java @@ -1,19 +1,17 @@ /* -* 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. -*/ + * 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.geode.modules.session.internal.filter; @@ -21,8 +19,8 @@ import java.io.Serializable; import javax.servlet.http.HttpSessionBindingEvent; import javax.servlet.http.HttpSessionBindingListener; -public class HttpSessionBindingListenerImpl extends AbstractListener implements - HttpSessionBindingListener, Serializable { +public class HttpSessionBindingListenerImpl extends AbstractListener + implements HttpSessionBindingListener, Serializable { public HttpSessionBindingListenerImpl(int i) { super(i); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/internal/filter/HttpSessionListenerImpl.java ---------------------------------------------------------------------- diff --git a/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/internal/filter/HttpSessionListenerImpl.java b/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/internal/filter/HttpSessionListenerImpl.java index 08eacfb..fbf0d13 100644 --- a/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/internal/filter/HttpSessionListenerImpl.java +++ b/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/internal/filter/HttpSessionListenerImpl.java @@ -1,19 +1,17 @@ /* -* 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. -*/ + * 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.geode.modules.session.internal.filter; @@ -23,12 +21,10 @@ import javax.servlet.http.HttpSession; import javax.servlet.http.HttpSessionEvent; import javax.servlet.http.HttpSessionListener; -public class HttpSessionListenerImpl extends AbstractListener - implements HttpSessionListener { +public class HttpSessionListenerImpl extends AbstractListener implements HttpSessionListener { public synchronized void sessionCreated(HttpSessionEvent se) { - HttpSession gfeSession = SessionCachingFilter.getWrappingSession( - se.getSession()); + HttpSession gfeSession = SessionCachingFilter.getWrappingSession(se.getSession()); gfeSession.setAttribute("gemfire-session-id", gfeSession.getId()); events.add(ListenerEventType.SESSION_CREATED); latch.countDown(); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/internal/filter/HttpSessionListenerImpl2.java ---------------------------------------------------------------------- diff --git a/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/internal/filter/HttpSessionListenerImpl2.java b/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/internal/filter/HttpSessionListenerImpl2.java index fbe68b1..5fd2c27 100644 --- a/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/internal/filter/HttpSessionListenerImpl2.java +++ b/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/internal/filter/HttpSessionListenerImpl2.java @@ -1,19 +1,17 @@ /* -* 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. -*/ + * 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.geode.modules.session.internal.filter; @@ -23,8 +21,7 @@ import javax.servlet.http.HttpSession; import javax.servlet.http.HttpSessionEvent; import javax.servlet.http.HttpSessionListener; -public class HttpSessionListenerImpl2 extends AbstractListener - implements HttpSessionListener { +public class HttpSessionListenerImpl2 extends AbstractListener implements HttpSessionListener { @Override public void sessionCreated(HttpSessionEvent se) { @@ -34,8 +31,7 @@ public class HttpSessionListenerImpl2 extends AbstractListener @Override public void sessionDestroyed(HttpSessionEvent se) { - HttpSession gfeSession = SessionCachingFilter.getWrappingSession( - se.getSession()); + HttpSession gfeSession = SessionCachingFilter.getWrappingSession(se.getSession()); assert (gfeSession != null); events.add(ListenerEventType.SESSION_DESTROYED); latch.countDown(); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/internal/filter/MyServletTester.java ---------------------------------------------------------------------- diff --git a/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/internal/filter/MyServletTester.java b/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/internal/filter/MyServletTester.java index 294df73..65d931e 100644 --- a/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/internal/filter/MyServletTester.java +++ b/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/internal/filter/MyServletTester.java @@ -1,38 +1,35 @@ /* -* Licensed to the Apache Software Foundation (ASF) under one or more -* contributor license agreements. See the NOTICE file distributed with -* this work for additional information regarding copyright ownership. -* The ASF licenses this file to You under the Apache License, Version 2.0 -* (the "License"); you may not use this file except in compliance with -* the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * 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.geode.modules.session.internal.filter; import org.eclipse.jetty.servlet.ServletTester; /** - * Extend the base ServletTester class with a couple of helper methods. This - * depends on a patched ServletTester class which exposes the _server variable - * as package-private. + * Extend the base ServletTester class with a couple of helper methods. This depends on a patched + * ServletTester class which exposes the _server variable as package-private. */ public class MyServletTester extends ServletTester { public boolean isStarted() { -// return _server.isStarted(); + // return _server.isStarted(); return false; } public boolean isStopped() { -// return _server.isStopped(); + // return _server.isStopped(); return false; } } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/internal/filter/RendezvousManager.java ---------------------------------------------------------------------- diff --git a/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/internal/filter/RendezvousManager.java b/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/internal/filter/RendezvousManager.java index 39e00f9..e3b6c61 100644 --- a/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/internal/filter/RendezvousManager.java +++ b/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/internal/filter/RendezvousManager.java @@ -1,19 +1,17 @@ /* -* 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. -*/ + * 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.geode.modules.session.internal.filter; http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/internal/filter/ServletRequestAttributeListenerImpl.java ---------------------------------------------------------------------- diff --git a/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/internal/filter/ServletRequestAttributeListenerImpl.java b/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/internal/filter/ServletRequestAttributeListenerImpl.java index 1f73df1..22d6842 100644 --- a/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/internal/filter/ServletRequestAttributeListenerImpl.java +++ b/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/internal/filter/ServletRequestAttributeListenerImpl.java @@ -1,19 +1,17 @@ /* -* 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. -*/ + * 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.geode.modules.session.internal.filter; @@ -35,8 +33,7 @@ public class ServletRequestAttributeListenerImpl extends AbstractListener latch.countDown(); } - public synchronized void attributeReplaced( - ServletRequestAttributeEvent srae) { + public synchronized void attributeReplaced(ServletRequestAttributeEvent srae) { events.add(ListenerEventType.SERVLET_REQUEST_ATTRIBUTE_REPLACED); latch.countDown(); } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/internal/filter/ServletRequestListenerImpl.java ---------------------------------------------------------------------- diff --git a/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/internal/filter/ServletRequestListenerImpl.java b/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/internal/filter/ServletRequestListenerImpl.java index a32793d..2e5076c 100644 --- a/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/internal/filter/ServletRequestListenerImpl.java +++ b/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/internal/filter/ServletRequestListenerImpl.java @@ -1,27 +1,24 @@ /* -* 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. -*/ + * 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.geode.modules.session.internal.filter; import javax.servlet.ServletRequestEvent; import javax.servlet.ServletRequestListener; -public class ServletRequestListenerImpl extends AbstractListener - implements ServletRequestListener { +public class ServletRequestListenerImpl extends AbstractListener implements ServletRequestListener { public synchronized void requestDestroyed(ServletRequestEvent sre) { events.add(ListenerEventType.SERVLET_REQUEST_DESTROYED); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/internal/filter/SessionReplicationIntegrationJUnitTest.java ---------------------------------------------------------------------- diff --git a/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/internal/filter/SessionReplicationIntegrationJUnitTest.java b/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/internal/filter/SessionReplicationIntegrationJUnitTest.java index bda2036..76ecab3 100644 --- a/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/internal/filter/SessionReplicationIntegrationJUnitTest.java +++ b/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/internal/filter/SessionReplicationIntegrationJUnitTest.java @@ -1,19 +1,17 @@ /* -* 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. -*/ + * 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.geode.modules.session.internal.filter; import org.apache.geode.cache.Region; @@ -50,8 +48,8 @@ import java.util.concurrent.TimeUnit; import static org.junit.Assert.*; /** - * In-container testing using Jetty. This allows us to test context listener - * events as well as dispatching actions. + * In-container testing using Jetty. This allows us to test context listener events as well as + * dispatching actions. */ @Category(IntegrationTest.class) @RunWith(PerTestClassLoaderRunner.class) @@ -80,17 +78,19 @@ public class SessionReplicationIntegrationJUnitTest { tester = new MyServletTester(); tester.setContextPath("/test"); - filterHolder = tester.addFilter(SessionCachingFilter.class, "/*", EnumSet.of(DispatcherType.REQUEST)); + filterHolder = + tester.addFilter(SessionCachingFilter.class, "/*", EnumSet.of(DispatcherType.REQUEST)); filterHolder.setInitParameter(DistributionConfig.GEMFIRE_PREFIX + "property.mcast-port", "0"); - filterHolder.setInitParameter(DistributionConfig.GEMFIRE_PREFIX + "property.log-file", gemfireLogFile.getAbsolutePath()); + filterHolder.setInitParameter(DistributionConfig.GEMFIRE_PREFIX + "property.log-file", + gemfireLogFile.getAbsolutePath()); 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. + * This starts the servlet. Our wrapped servlets *must* start immediately otherwise the + * ServletContext is not captured correctly. */ servletHolder.setInitOrder(0); } @@ -113,8 +113,8 @@ public class SessionReplicationIntegrationJUnitTest { tester.setAttribute("callback_1", c); tester.start(); -// ContextManager.getInstance().putContext( -// servletHolder.getServlet().getServletConfig().getServletContext()); + // ContextManager.getInstance().putContext( + // servletHolder.getServlet().getServletConfig().getServletContext()); request.setMethod("GET"); request.setURI("/test/hello"); @@ -140,8 +140,8 @@ public class SessionReplicationIntegrationJUnitTest { tester.setAttribute("callback_1", c); tester.start(); -// ContextManager.getInstance().putContext( -// servletHolder.getServlet().getServletConfig().getServletContext()); + // ContextManager.getInstance().putContext( + // servletHolder.getServlet().getServletConfig().getServletContext()); request.setMethod("GET"); request.setURI("/test/hello"); @@ -150,16 +150,14 @@ public class SessionReplicationIntegrationJUnitTest { response = HttpTester.parseResponse(tester.getResponses(request.generate())); - assertTrue("Not a correctly generated session id", - response.getContent().endsWith("-GF")); + 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()); + 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())); + assertNotNull("Session not found in region", r.get(cookies.get(0).getValue())); } @@ -184,8 +182,8 @@ public class SessionReplicationIntegrationJUnitTest { tester.setAttribute("callback_1", c); tester.start(); -// ContextManager.getInstance().putContext( -// servletHolder.getServlet().getServletConfig().getServletContext()); + // ContextManager.getInstance().putContext( + // servletHolder.getServlet().getServletConfig().getServletContext()); request.setMethod("GET"); request.setURI("/test/hello"); @@ -194,8 +192,7 @@ public class SessionReplicationIntegrationJUnitTest { response = HttpTester.parseResponse(tester.getResponses(request.generate())); - assertEquals("Session should not have been created", "OK", - response.getContent()); + assertEquals("Session should not have been created", "OK", response.getContent()); } @@ -217,8 +214,8 @@ public class SessionReplicationIntegrationJUnitTest { tester.setAttribute("callback_1", c); tester.start(); -// ContextManager.getInstance().putContext( -// servletHolder.getServlet().getServletConfig().getServletContext()); + // ContextManager.getInstance().putContext( + // servletHolder.getServlet().getServletConfig().getServletContext()); request.setMethod("GET"); request.setURI("/test/hello"); @@ -227,8 +224,7 @@ public class SessionReplicationIntegrationJUnitTest { response = HttpTester.parseResponse(tester.getResponses(request.generate())); - assertEquals("Unknown attribute should be null", "null", - response.getContent()); + assertEquals("Unknown attribute should be null", "null", response.getContent()); } @@ -256,8 +252,8 @@ public class SessionReplicationIntegrationJUnitTest { tester.setAttribute("callback_1", c); tester.start(); -// ContextManager.getInstance().putContext( -// servletHolder.getServlet().getServletConfig().getServletContext()); + // ContextManager.getInstance().putContext( + // servletHolder.getServlet().getServletConfig().getServletContext()); request.setMethod("GET"); request.setURI("/test/hello"); @@ -280,8 +276,7 @@ public class SessionReplicationIntegrationJUnitTest { cookies2.get(0).getValue()); Region r = getRegion(); - assertNotNull("Session object should exist in region", - r.get(cookies.get(0).getValue())); + assertNotNull("Session object should exist in region", r.get(cookies.get(0).getValue())); } /** @@ -315,8 +310,8 @@ public class SessionReplicationIntegrationJUnitTest { sh2.setInitParameter("test.callback", "callback_2"); tester.start(); -// ContextManager.getInstance().putContext( -// servletHolder.getServlet().getServletConfig().getServletContext()); + // ContextManager.getInstance().putContext( + // servletHolder.getServlet().getServletConfig().getServletContext()); request.setMethod("GET"); request.setURI("/test/hello"); @@ -327,22 +322,21 @@ public class SessionReplicationIntegrationJUnitTest { List<Cookie> cookies = getCookies(response); Region r = getRegion(); - assertEquals("bar", - ((HttpSession) r.get(cookies.get(0).getValue())).getAttribute("foo")); + 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")); + assertEquals("baz", ((HttpSession) r.get(cookies.get(0).getValue())).getAttribute("foo")); } /** * Test setting an attribute to null deletes it - */ - @Category(FlakyTest.class) // GEODE-1015: uses Jetty HttpTester, uses static vars with class loader isolation, TODO: rewrite test with JUnit 4 rules including TemporaryFolder + */ + @Category(FlakyTest.class) // GEODE-1015: uses Jetty HttpTester, uses static vars with class + // loader isolation, TODO: rewrite test with JUnit 4 rules including + // TemporaryFolder @Test public void testSetAttributeNullDeletesIt() throws Exception { Callback c_1 = new Callback() { @@ -371,8 +365,8 @@ public class SessionReplicationIntegrationJUnitTest { sh2.setInitParameter("test.callback", "callback_2"); tester.start(); -// ContextManager.getInstance().putContext( -// servletHolder.getServlet().getServletConfig().getServletContext()); + // ContextManager.getInstance().putContext( + // servletHolder.getServlet().getServletConfig().getServletContext()); request.setMethod("GET"); request.setURI("/test/hello"); @@ -383,96 +377,93 @@ public class SessionReplicationIntegrationJUnitTest { List<Cookie> cookies = getCookies(response); Region r = getRegion(); - assertEquals("bar", - ((HttpSession) r.get(cookies.get(0).getValue())).getAttribute( - "foo")); + 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")); + 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())); -// -// assertIndexDetailsEquals("null", response.getContent()); -// -// Region r = getRegion(); -// assertNull("Region should not contain session", r.get(id)); -// } + // 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())); + // + // assertIndexDetailsEquals("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 that invalidating a session destroys it as well as the backend object. */ - @Category(FlakyTest.class) // GEODE-1015: uses Jetty HttpTester, uses static vars with class loader isolation, TODO: rewrite test with JUnit 4 rules including TemporaryFolder + @Category(FlakyTest.class) // GEODE-1015: uses Jetty HttpTester, uses static vars with class + // loader isolation, TODO: rewrite test with JUnit 4 rules including + // TemporaryFolder @Test public void testInvalidateSession1() throws Exception { Callback c_1 = new Callback() { @@ -501,8 +492,8 @@ public class SessionReplicationIntegrationJUnitTest { sh2.setInitParameter("test.callback", "callback_2"); tester.start(); -// ContextManager.getInstance().putContext( -// servletHolder.getServlet().getServletConfig().getServletContext()); + // ContextManager.getInstance().putContext( + // servletHolder.getServlet().getServletConfig().getServletContext()); request.setMethod("GET"); request.setURI("/test/hello"); @@ -512,15 +503,13 @@ public class SessionReplicationIntegrationJUnitTest { List<Cookie> cookies = getCookies(response); Region r = getRegion(); - assertEquals("bar", - ((HttpSession) r.get(cookies.get(0).getValue())).getAttribute("foo")); + 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())); + assertNull("Region should not contain session", r.get(cookies.get(0).getValue())); } /** @@ -548,8 +537,8 @@ public class SessionReplicationIntegrationJUnitTest { servletHolder.setInitParameter("test.callback", "callback_1"); tester.start(); -// ContextManager.getInstance().putContext( -// servletHolder.getServlet().getServletConfig().getServletContext()); + // ContextManager.getInstance().putContext( + // servletHolder.getServlet().getServletConfig().getServletContext()); request.setMethod("GET"); request.setURI("/test/hello"); @@ -563,7 +552,9 @@ public class SessionReplicationIntegrationJUnitTest { /** * Test that invalidating a session throws an exception on subsequent access. */ - @Category(FlakyTest.class) // GEODE-1015: uses Jetty HttpTester, uses static vars with class loader isolation, TODO: rewrite test with JUnit 4 rules including TemporaryFolder + @Category(FlakyTest.class) // GEODE-1015: uses Jetty HttpTester, uses static vars with class + // loader isolation, TODO: rewrite test with JUnit 4 rules including + // TemporaryFolder @Test public void testInvalidateSession3() throws Exception { Callback c_1 = new Callback() { @@ -586,8 +577,8 @@ public class SessionReplicationIntegrationJUnitTest { servletHolder.setInitParameter("test.callback", "callback_1"); tester.start(); -// ContextManager.getInstance().putContext( -// servletHolder.getServlet().getServletConfig().getServletContext()); + // ContextManager.getInstance().putContext( + // servletHolder.getServlet().getServletConfig().getServletContext()); request.setMethod("GET"); request.setURI("/test/hello"); @@ -623,8 +614,8 @@ public class SessionReplicationIntegrationJUnitTest { servletHolder.setInitParameter("test.callback", "callback_1"); tester.start(); -// ContextManager.getInstance().putContext( -// servletHolder.getServlet().getServletConfig().getServletContext()); + // ContextManager.getInstance().putContext( + // servletHolder.getServlet().getServletConfig().getServletContext()); request.setMethod("GET"); request.setURI("/test/hello"); @@ -636,8 +627,7 @@ public class SessionReplicationIntegrationJUnitTest { } /** - * Test that invalidating a session does not throw an exception for subsequent - * getId calls. + * Test that invalidating a session does not throw an exception for subsequent getId calls. */ @Test public void testInvalidateSession5() throws Exception { @@ -658,8 +648,8 @@ public class SessionReplicationIntegrationJUnitTest { servletHolder.setInitParameter("test.callback", "callback_1"); tester.start(); -// ContextManager.getInstance().putContext( -// servletHolder.getServlet().getServletConfig().getServletContext()); + // ContextManager.getInstance().putContext( + // servletHolder.getServlet().getServletConfig().getServletContext()); request.setMethod("GET"); request.setURI("/test/hello"); @@ -695,8 +685,8 @@ public class SessionReplicationIntegrationJUnitTest { servletHolder.setInitParameter("test.callback", "callback_1"); tester.start(); -// ContextManager.getInstance().putContext( -// servletHolder.getServlet().getServletConfig().getServletContext()); + // ContextManager.getInstance().putContext( + // servletHolder.getServlet().getServletConfig().getServletContext()); request.setMethod("GET"); request.setURI("/test/hello"); @@ -708,18 +698,18 @@ public class SessionReplicationIntegrationJUnitTest { } /** - * Test that invalidating a session does not throw an exception for - * subsequent getMaxInactiveInterval calls. + * 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. + // 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 { + public void call(HttpServletRequest request, HttpServletResponse response) + throws IOException { HttpSession s = request.getSession(); s.invalidate(); s.getMaxInactiveInterval(); @@ -733,8 +723,8 @@ public class SessionReplicationIntegrationJUnitTest { servletHolder.setInitParameter("test.callback", "callback_1"); tester.start(); -// ContextManager.getInstance().putContext( -// servletHolder.getServlet().getServletConfig().getServletContext()); + // ContextManager.getInstance().putContext( + // servletHolder.getServlet().getServletConfig().getServletContext()); request.setMethod("GET"); request.setURI("/test/hello"); @@ -746,8 +736,8 @@ public class SessionReplicationIntegrationJUnitTest { } /** - * Test that invalidating a session does not throw an exception for subsequent - * getServletContext calls. + * Test that invalidating a session does not throw an exception for subsequent getServletContext + * calls. */ @Test public void testInvalidateSession8() throws Exception { @@ -768,8 +758,8 @@ public class SessionReplicationIntegrationJUnitTest { servletHolder.setInitParameter("test.callback", "callback_1"); tester.start(); -// ContextManager.getInstance().putContext( -// servletHolder.getServlet().getServletConfig().getServletContext()); + // ContextManager.getInstance().putContext( + // servletHolder.getServlet().getServletConfig().getServletContext()); request.setMethod("GET"); request.setURI("/test/hello"); @@ -806,8 +796,8 @@ public class SessionReplicationIntegrationJUnitTest { servletHolder.setInitParameter("test.callback", "callback_1"); tester.start(); -// ContextManager.getInstance().putContext( -// servletHolder.getServlet().getServletConfig().getServletContext()); + // ContextManager.getInstance().putContext( + // servletHolder.getServlet().getServletConfig().getServletContext()); request.setMethod("GET"); request.setURI("/test/hello"); @@ -843,8 +833,8 @@ public class SessionReplicationIntegrationJUnitTest { servletHolder.setInitParameter("test.callback", "callback_1"); tester.start(); -// ContextManager.getInstance().putContext( -// servletHolder.getServlet().getServletConfig().getServletContext()); + // ContextManager.getInstance().putContext( + // servletHolder.getServlet().getServletConfig().getServletContext()); request.setMethod("GET"); request.setURI("/test/hello"); @@ -880,8 +870,8 @@ public class SessionReplicationIntegrationJUnitTest { servletHolder.setInitParameter("test.callback", "callback_1"); tester.start(); -// ContextManager.getInstance().putContext( -// servletHolder.getServlet().getServletConfig().getServletContext()); + // ContextManager.getInstance().putContext( + // servletHolder.getServlet().getServletConfig().getServletContext()); request.setMethod("GET"); request.setURI("/test/hello"); @@ -915,8 +905,8 @@ public class SessionReplicationIntegrationJUnitTest { servletHolder.setInitParameter("test.callback", "callback_1"); tester.start(); -// ContextManager.getInstance().putContext( -// servletHolder.getServlet().getServletConfig().getServletContext()); + // ContextManager.getInstance().putContext( + // servletHolder.getServlet().getServletConfig().getServletContext()); request.setMethod("GET"); request.setURI("/test/hello"); @@ -928,8 +918,8 @@ public class SessionReplicationIntegrationJUnitTest { } /** - * Test that invalidating a session results in null being returned on - * subsequent getSession(false) calls. + * Test that invalidating a session results in null being returned on subsequent getSession(false) + * calls. */ @Test public void testInvalidateSession13() throws Exception { @@ -954,8 +944,8 @@ public class SessionReplicationIntegrationJUnitTest { servletHolder.setInitParameter("test.callback", "callback_1"); tester.start(); -// ContextManager.getInstance().putContext( -// servletHolder.getServlet().getServletConfig().getServletContext()); + // ContextManager.getInstance().putContext( + // servletHolder.getServlet().getServletConfig().getServletContext()); request.setMethod("GET"); request.setURI("/test/hello"); @@ -1001,8 +991,8 @@ public class SessionReplicationIntegrationJUnitTest { sh.setInitParameter("test.callback", "callback_2"); tester.start(); -// ContextManager.getInstance().putContext( -// sh.getServlet().getServletConfig().getServletContext()); + // ContextManager.getInstance().putContext( + // sh.getServlet().getServletConfig().getServletContext()); request.setMethod("GET"); request.setURI("/test/hello"); @@ -1039,8 +1029,8 @@ public class SessionReplicationIntegrationJUnitTest { tester.setAttribute("callback_1", c); tester.start(); -// ContextManager.getInstance().putContext( -// servletHolder.getServlet().getServletConfig().getServletContext()); + // ContextManager.getInstance().putContext( + // servletHolder.getServlet().getServletConfig().getServletContext()); request.setMethod("GET"); request.setURI("/test/hello"); @@ -1062,8 +1052,7 @@ public class SessionReplicationIntegrationJUnitTest { response = HttpTester.parseResponse(tester.getResponses(request.generate())); long time2 = Long.parseLong(response.getContent()); - assertTrue("Creation time should be the same across requests", - time1 == time2); + assertTrue("Creation time should be the same across requests", time1 == time2); } /** @@ -1083,8 +1072,8 @@ public class SessionReplicationIntegrationJUnitTest { tester.setAttribute("callback_1", c); tester.start(); -// ContextManager.getInstance().putContext( -// servletHolder.getServlet().getServletConfig().getServletContext()); + // ContextManager.getInstance().putContext( + // servletHolder.getServlet().getServletConfig().getServletContext()); request.setMethod("GET"); request.setURI("/test/hello"); @@ -1094,7 +1083,7 @@ public class SessionReplicationIntegrationJUnitTest { response = HttpTester.parseResponse(tester.getResponses(request.generate())); long time1 = Long.parseLong(response.getContent()); -// assertTrue("Last accessed time should be positive", time1 > 0); + // assertTrue("Last accessed time should be positive", time1 > 0); List<Cookie> cookies = getCookies(response); request.setHeader("Cookie", "JSESSIONID=" + cookies.get(0).getValue()); @@ -1103,8 +1092,7 @@ public class SessionReplicationIntegrationJUnitTest { response = HttpTester.parseResponse(tester.getResponses(request.generate())); long time2 = Long.parseLong(response.getContent()); - assertTrue("Last accessed time should be increasing across requests", - time2 > time1); + assertTrue("Last accessed time should be increasing across requests", time2 > time1); } /** @@ -1124,8 +1112,8 @@ public class SessionReplicationIntegrationJUnitTest { tester.setAttribute("callback_1", c); tester.start(); -// ContextManager.getInstance().putContext( -// servletHolder.getServlet().getServletConfig().getServletContext()); + // ContextManager.getInstance().putContext( + // servletHolder.getServlet().getServletConfig().getServletContext()); request.setMethod("GET"); request.setURI("/test/hello"); @@ -1139,17 +1127,13 @@ public class SessionReplicationIntegrationJUnitTest { 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()); + 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, + assertEquals("Underlying native sessions must remain the same across requests", nativeSessionId, ((GemfireHttpSession) r.get(sessionId)).getNativeSession().getId()); } @@ -1170,8 +1154,8 @@ public class SessionReplicationIntegrationJUnitTest { tester.setAttribute("callback_1", c); tester.start(); -// ContextManager.getInstance().putContext( -// servletHolder.getServlet().getServletConfig().getServletContext()); + // ContextManager.getInstance().putContext( + // servletHolder.getServlet().getServletConfig().getServletContext()); request.setMethod("GET"); request.setURI("/test/hello"); @@ -1181,22 +1165,22 @@ public class SessionReplicationIntegrationJUnitTest { 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()); + 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()); + assertEquals("Session ids should be the same", sessionId, cookies.get(0).getValue()); } /** * Test that request forward dispatching works */ - @Category(FlakyTest.class) // GEODE-1015: uses Jetty HttpTester, uses static vars with class loader isolation, TODO: rewrite test with JUnit 4 rules including TemporaryFolder + @Category(FlakyTest.class) // GEODE-1015: uses Jetty HttpTester, uses static vars with class + // loader isolation, TODO: rewrite test with JUnit 4 rules including + // TemporaryFolder @Test public void testDispatchingForward1() throws Exception { Callback c_1 = new Callback() { @@ -1229,8 +1213,8 @@ public class SessionReplicationIntegrationJUnitTest { sh.setInitParameter("test.callback", "callback_2"); tester.start(); -// ContextManager.getInstance().putContext( -// sh.getServlet().getServletConfig().getServletContext()); + // ContextManager.getInstance().putContext( + // sh.getServlet().getServletConfig().getServletContext()); request.setMethod("GET"); request.setURI("/test/hello"); @@ -1240,8 +1224,8 @@ public class SessionReplicationIntegrationJUnitTest { response = HttpTester.parseResponse(tester.getResponses(request.generate())); assertEquals("dispatched", response.getContent()); -// ContextManager.getInstance().removeContext( -// sh.getServlet().getServletConfig().getServletContext()); + // ContextManager.getInstance().removeContext( + // sh.getServlet().getServletConfig().getServletContext()); } @@ -1280,8 +1264,8 @@ public class SessionReplicationIntegrationJUnitTest { sh.setInitParameter("test.callback", "callback_2"); tester.start(); -// ContextManager.getInstance().putContext( -// sh.getServlet().getServletConfig().getServletContext()); + // ContextManager.getInstance().putContext( + // sh.getServlet().getServletConfig().getServletContext()); request.setMethod("GET"); request.setURI("/test/hello"); @@ -1291,8 +1275,8 @@ public class SessionReplicationIntegrationJUnitTest { response = HttpTester.parseResponse(tester.getResponses(request.generate())); assertEquals("dispatched_bang", response.getContent()); -// ContextManager.getInstance().removeContext( -// sh.getServlet().getServletConfig().getServletContext()); + // ContextManager.getInstance().removeContext( + // sh.getServlet().getServletConfig().getServletContext()); } @@ -1331,8 +1315,8 @@ public class SessionReplicationIntegrationJUnitTest { sh.setInitParameter("test.callback", "callback_2"); tester.start(); -// ContextManager.getInstance().putContext( -// sh.getServlet().getServletConfig().getServletContext()); + // ContextManager.getInstance().putContext( + // sh.getServlet().getServletConfig().getServletContext()); request.setMethod("GET"); request.setURI("/test/hello"); @@ -1375,8 +1359,8 @@ public class SessionReplicationIntegrationJUnitTest { tester.setAttribute("callback_1", c); tester.start(); -// ContextManager.getInstance().putContext( -// servletHolder.getServlet().getServletConfig().getServletContext()); + // ContextManager.getInstance().putContext( + // servletHolder.getServlet().getServletConfig().getServletContext()); request.setMethod("GET"); request.setURI("/test/hello"); @@ -1389,15 +1373,12 @@ public class SessionReplicationIntegrationJUnitTest { List<Cookie> cookies = getCookies(response); -// AbstractListener listener = RendezvousManager.getListener(); + // 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)); + 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()); } @@ -1420,8 +1401,8 @@ public class SessionReplicationIntegrationJUnitTest { tester.setAttribute("callback_1", c); tester.start(); -// ContextManager.getInstance().putContext( -// servletHolder.getServlet().getServletConfig().getServletContext()); + // ContextManager.getInstance().putContext( + // servletHolder.getServlet().getServletConfig().getServletContext()); request.setMethod("GET"); request.setURI("/test/hello"); @@ -1436,19 +1417,15 @@ public class SessionReplicationIntegrationJUnitTest { 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)); + 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 + // @Test public void testJsp() throws Exception { tester.setResourceBase("target/test-classes"); ServletHolder jspHolder = tester.addServlet(JspServlet.class, "/test/*"); @@ -1462,8 +1439,7 @@ public class SessionReplicationIntegrationJUnitTest { throws IOException, ServletException { request.getSession().setAttribute("foo", "bar"); request.setAttribute("foo", "baz"); - RequestDispatcher dispatcher = request.getRequestDispatcher( - "pagecontext.jsp"); + RequestDispatcher dispatcher = request.getRequestDispatcher("pagecontext.jsp"); dispatcher.forward(request, response); } }; @@ -1543,7 +1519,7 @@ public class SessionReplicationIntegrationJUnitTest { private Region getRegion() { // Yuck... - return ((GemfireSessionManager) ((SessionCachingFilter) filterHolder.getFilter()).getSessionManager()).getCache().getCache().getRegion( - "gemfire_modules_sessions"); + return ((GemfireSessionManager) ((SessionCachingFilter) filterHolder.getFilter()) + .getSessionManager()).getCache().getCache().getRegion("gemfire_modules_sessions"); } } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/internal/filter/SessionReplicationJUnitTest.java ---------------------------------------------------------------------- diff --git a/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/internal/filter/SessionReplicationJUnitTest.java b/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/internal/filter/SessionReplicationJUnitTest.java index 1d60795..4db3849 100644 --- a/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/internal/filter/SessionReplicationJUnitTest.java +++ b/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/internal/filter/SessionReplicationJUnitTest.java @@ -1,19 +1,17 @@ /* -* 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. -*/ + * 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.geode.modules.session.internal.filter; http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/internal/filter/SessionReplicationLocalCacheJUnitTest.java ---------------------------------------------------------------------- diff --git a/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/internal/filter/SessionReplicationLocalCacheJUnitTest.java b/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/internal/filter/SessionReplicationLocalCacheJUnitTest.java index 8f24459..cb072da 100644 --- a/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/internal/filter/SessionReplicationLocalCacheJUnitTest.java +++ b/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/internal/filter/SessionReplicationLocalCacheJUnitTest.java @@ -1,19 +1,17 @@ /* -* 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. -*/ + * 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.geode.modules.session.internal.filter; http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/junit/ChildFirstClassLoader.java ---------------------------------------------------------------------- diff --git a/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/junit/ChildFirstClassLoader.java b/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/junit/ChildFirstClassLoader.java index 95ca509..723ce44 100644 --- a/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/junit/ChildFirstClassLoader.java +++ b/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/junit/ChildFirstClassLoader.java @@ -1,19 +1,17 @@ /* -* 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. -*/ + * 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.geode.modules.session.junit; @@ -23,7 +21,7 @@ import java.net.URLClassLoader; public class ChildFirstClassLoader extends URLClassLoader { public ChildFirstClassLoader() { - super(new URL[]{}); + super(new URL[] {}); } public ChildFirstClassLoader(URL[] urls) { @@ -45,12 +43,10 @@ public class ChildFirstClassLoader extends URLClassLoader { } /** - * We override the parent-first behavior established by - * java.lang.Classloader. + * We override the parent-first behavior established by java.lang.Classloader. */ @Override - protected Class loadClass(String name, boolean resolve) - throws ClassNotFoundException { + protected Class loadClass(String name, boolean resolve) throws ClassNotFoundException { Class c = null; if (name.startsWith("org.apache")) { http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/junit/NamedRunner.java ---------------------------------------------------------------------- diff --git a/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/junit/NamedRunner.java b/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/junit/NamedRunner.java index fea9833..87e43c1 100644 --- a/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/junit/NamedRunner.java +++ b/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/junit/NamedRunner.java @@ -1,19 +1,17 @@ /* -* 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. -*/ + * 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.geode.modules.session.junit; @@ -23,9 +21,8 @@ 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. + * 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 */ @@ -75,7 +72,8 @@ public class NamedRunner extends BlockJUnit4ClassRunner { * @return the string */ private static String retrieveTestMethodName() { - // We can't use a ThreadLocal variable in the case the TestPerClassLoader runner is used. Then this + // 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()); @@ -89,7 +87,8 @@ public class NamedRunner extends BlockJUnit4ClassRunner { * 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 + // 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); @@ -102,7 +101,8 @@ public class NamedRunner extends BlockJUnit4ClassRunner { */ private static void storeTestMethodName(String name) { - // We can't use a ThreadLocal variable in the case the TestPerClassLoader runner is used. Then this + // 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); }
