In short, code migration was trivial, except for the Wildfly/Arquillian
which required a lot of config  troubleshooting :-)

On Fri, May 18, 2018 at 12:32 PM, Andrea Del Bene <an.delb...@gmail.com>
wrote:

> I did that particular change because with the new Wildfly/Arquillian
> versions I got a NPE with MockHttpServletRequest#getSession(boolean b).
> In short this method returns null id the current session is temporary.
> According to Martin's commit (7ca927c) this was done  in order to comply
> with servlet spec. Later I decided to not change this behavior but rather
> make MockHttpServletRequestTest use permanent sessions.
>
> On Fri, May 18, 2018 at 12:15 PM, Maxim Solodovnik <solomax...@gmail.com>
> wrote:
>
>> Thanks Andrea,
>>
>> I have noticed that while looking through later commits
>> Should answer myself :(
>>
>> Was curious what changes were required to create java9 compatible build :)
>>
>> On Fri, May 18, 2018 at 5:13 PM, Andrea Del Bene <an.delb...@gmail.com>
>> wrote:
>>
>> > Hi,
>> >
>> > changes to MockHttpServletRequest and its test have been reverted in a
>> > later commit, so the final code doesn't contain the commented out code.
>> >
>> > On Fri, May 18, 2018 at 10:47 AM, Maxim Solodovnik <
>> solomax...@gmail.com>
>> > wrote:
>> >
>> > > Is this commented out code really necessary?
>> > > Or maybe it should be fixed?
>> > >
>> > > On Fri, May 18, 2018 at 3:30 PM, <adelb...@apache.org> wrote:
>> > >
>> > > > Added missing java 9 module
>> > > >
>> > > >
>> > > > Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
>> > > > Commit: http://git-wip-us.apache.org/r
>> epos/asf/wicket/commit/26557b35
>> > > > Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/26557b35
>> > > > Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/26557b35
>> > > >
>> > > > Branch: refs/heads/wicket-9.x
>> > > > Commit: 26557b352a31d9d0503065e18a3b48489fd066f1
>> > > > Parents: bfbdfe2
>> > > > Author: Andrea Del Bene <an.delb...@gmail.com>
>> > > > Authored: Sun May 13 21:25:43 2018 +0200
>> > > > Committer: Andrea Del Bene <an.delb...@gmail.com>
>> > > > Committed: Sun May 13 21:25:43 2018 +0200
>> > > >
>> > > > ------------------------------------------------------------
>> ----------
>> > > >  pom.xml                                         | 25
>> ++++++++++++++-
>> > > >  testing/wicket-arquillian/pom.xml               |  8 ++++-
>> > > >  wicket-cdi-1.1/pom.xml                          | 17 +++++++++++
>> > > >  .../org/apache/wicket/cdi/ContextManager.java   |  7 +++--
>> > > >  .../http/mock/MockHttpServletRequest.java       |  8 +----
>> > > >  .../http/mock/MockHttpServletRequestTest.java   | 32
>> > > ++++++++++----------
>> > > >  6 files changed, 69 insertions(+), 28 deletions(-)
>> > > > ------------------------------------------------------------
>> ----------
>> > > >
>> > > >
>> > > > http://git-wip-us.apache.org/repos/asf/wicket/blob/26557b35/pom.xml
>> > > > ------------------------------------------------------------
>> ----------
>> > > > diff --git a/pom.xml b/pom.xml
>> > > > index 8e3a754..fd8498c 100644
>> > > > --- a/pom.xml
>> > > > +++ b/pom.xml
>> > > > @@ -442,6 +442,28 @@
>> > > >                                 <version>2.4.2.SP1</version>
>> > > >                         </dependency>
>> > > >                         <dependency>
>> > > > +                           <groupId>org.jboss.weld</groupId>
>> > > > +                           <artifactId>weld-spi</artifactId>
>> > > > +                           <version>3.0.SP3</version>
>> > > > +                       </dependency>
>> > > > +                       <dependency>
>> > > > +                           <groupId>org.jboss.weld.modul
>> e</groupId>
>> > > > +                           <artifactId>weld-web</artifactId>
>> > > > +                           <version>3.0.4.Final</version>
>> > > > +                       </dependency>
>> > > > +
>> > > > +                       <dependency>
>> > > > +                           <groupId>org.jboss.weld</groupId>
>> > > > +                           <artifactId>weld-core</artifactId>
>> > > > +                           <version>2.4.7.Final</version>
>> > > > +                       </dependency>
>> > > > +                       <dependency>
>> > > > +                           <groupId>org.jboss.weld.se</groupId>
>> > > > +                           <artifactId>weld-se</artifactId>
>> > > > +                           <version>2.4.7.Final</version>
>> > > > +                           <scope>test</scope>
>> > > > +                       </dependency>
>> > > > +                       <dependency>
>> > > >                                 <groupId>org.objenesis</groupId>
>> > > >                                 <artifactId>objenesis</artifactId>
>> > > >                                 <version>${objenesis.version}<
>> > /version>
>> > > > @@ -544,7 +566,7 @@
>> > > >                         <dependency>
>> > > >                                 <groupId>org.jglue.cdi-unit</
>> groupId>
>> > > >                                 <artifactId>cdi-unit</artifactId>
>> > > > -                               <version>2.2.1</version>
>> > > > +                               <version>4.0.2</version>
>> > > >                                 <scope>test</scope>
>> > > >                         </dependency>
>> > > >                         <dependency>
>> > > > @@ -959,6 +981,7 @@
>> > > >                                                 <includes>
>> > > >
>> > > > <include>**/*Test.java</include>
>> > > >                                                 </includes>
>> > > > +                                               <argLine>--add-opens
>> > > > java.base/jdk.internal.loader=ALL-UNNAMED</argLine>
>> > > >                                         </configuration>
>> > > >                                         <dependencies>
>> > > >                                                 <dependency>
>> > > >
>> > > > http://git-wip-us.apache.org/repos/asf/wicket/blob/
>> > > > 26557b35/testing/wicket-arquillian/pom.xml
>> > > > ------------------------------------------------------------
>> ----------
>> > > > diff --git a/testing/wicket-arquillian/pom.xml
>> > > > b/testing/wicket-arquillian/pom.xml
>> > > > index f82ed07..954dd62 100644
>> > > > --- a/testing/wicket-arquillian/pom.xml
>> > > > +++ b/testing/wicket-arquillian/pom.xml
>> > > > @@ -42,7 +42,7 @@
>> > > >                 <wicket.arquillian.management.
>> > > > port>11091</wicket.arquillian.management.port>
>> > > >                 <!-- end port configuration -->
>> > > >
>> > > > -               <arquillian.version>1.1.13.Fi
>> nal</arquillian.version>
>> > > > +               <arquillian.version>1.4.0.Fin
>> al</arquillian.version>
>> > > >                 <maven.dependency.plugin.version>2.10</maven.
>> > > > dependency.plugin.version>
>> > > >                 <project.build.sourceEncoding>UTF-8</project.build.
>> > > > sourceEncoding>
>> > > >                 <wildfly.version>8.2.1.Final</wildfly.version>
>> > > > @@ -84,6 +84,12 @@
>> > > >                         <groupId>org.wildfly</groupId>
>> > > >                         <artifactId>wildfly-embedded</artifactId>
>> > > >                         <version>${wildfly.version}</version>
>> > > > +                       <exclusions>
>> > > > +            <exclusion>
>> > > > +                <groupId>sun.jdk</groupId>
>> > > > +                <artifactId>jconsole</artifactId>
>> > > > +            </exclusion>
>> > > > +        </exclusions>
>> > > >                 </dependency>
>> > > >                 <dependency>
>> > > >                         <groupId>org.jboss.
>> arquillian.junit</groupId>
>> > > >
>> > > > http://git-wip-us.apache.org/repos/asf/wicket/blob/
>> > > > 26557b35/wicket-cdi-1.1/pom.xml
>> > > > ------------------------------------------------------------
>> ----------
>> > > > diff --git a/wicket-cdi-1.1/pom.xml b/wicket-cdi-1.1/pom.xml
>> > > > index 957ff0e..9bfa684 100644
>> > > > --- a/wicket-cdi-1.1/pom.xml
>> > > > +++ b/wicket-cdi-1.1/pom.xml
>> > > > @@ -60,5 +60,22 @@
>> > > >                         <groupId>org.jglue.cdi-unit</groupId>
>> > > >                         <artifactId>cdi-unit</artifactId>
>> > > >                 </dependency>
>> > > > +               <dependency>
>> > > > +                   <groupId>org.jboss.weld</groupId>
>> > > > +                   <artifactId>weld-spi</artifactId>
>> > > > +               </dependency>
>> > > > +               <dependency>
>> > > > +                   <groupId>org.jboss.weld</groupId>
>> > > > +                   <artifactId>weld-core</artifactId>
>> > > > +               </dependency>
>> > > > +               <dependency>
>> > > > +                   <groupId>org.jboss.weld.se</groupId>
>> > > > +                   <artifactId>weld-se</artifactId>
>> > > > +                   <scope>test</scope>
>> > > > +               </dependency>
>> > > > +               <dependency>
>> > > > +                       <groupId>org.jboss.weld.module</groupId>
>> > > > +                       <artifactId>weld-web</artifactId>
>> > > > +               </dependency>
>> > > >         </dependencies>
>> > > >  </project>
>> > > >
>> > > > http://git-wip-us.apache.org/repos/asf/wicket/blob/
>> > > > 26557b35/wicket-cdi-1.1/src/test/java/org/apache/wicket/
>> > > > cdi/ContextManager.java
>> > > > ------------------------------------------------------------
>> ----------
>> > > > diff --git a/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/
>> > > ContextManager.java
>> > > > b/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/
>> > ContextManager.java
>> > > > index 3e22aef..ee92367 100644
>> > > > --- a/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/
>> > > > ContextManager.java
>> > > > +++ b/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/
>> > > > ContextManager.java
>> > > > @@ -26,7 +26,8 @@ import javax.servlet.http.HttpSession;
>> > > >  import org.jboss.weld.bean.builtin.BeanManagerProxy;
>> > > >  import org.jboss.weld.servlet.HttpContextLifecycle;
>> > > >  import org.jboss.weld.servlet.spi.helpers.
>> > > AcceptingHttpContextActivation
>> > > > Filter;
>> > > > -import org.jglue.cdiunit.internal.LifecycleAwareRequest;
>> > > > +import org.jglue.cdiunit.internal.CdiUnitInitialListenerImpl;
>> > > > +import org.jglue.cdiunit.internal.servlet.LifecycleAwareRequest;
>> > > >
>> > > >  /**
>> > > >   * @author jsarman
>> > > > @@ -49,7 +50,7 @@ public class ContextManager
>> > > >                 try
>> > > >                 {
>> > > >                         lifecycle = new HttpContextLifecycle(
>> > > > BeanManagerProxy.unwrap(beanManager),
>> > > > -
>> AcceptingHttpContextActivation
>> > > Filter.INSTANCE,
>> > > > true, true);
>> > > > +
>> AcceptingHttpContextActivation
>> > > Filter.INSTANCE,
>> > > > true, true, false, true);
>> > > >                 }
>> > > >                 catch (NoSuchMethodError e)
>> > > >                 {
>> > > > @@ -73,7 +74,7 @@ public class ContextManager
>> > > >                 if (currentRequest != null)
>> > > >                         return;
>> > > >
>> > > > -               currentRequest = new LifecycleAwareRequest(lifecycl
>> e,
>> > > > request, currentSession);
>> > > > +               currentRequest = new LifecycleAwareRequest(new
>> > > > CdiUnitInitialListenerImpl(), request);
>> > > >                 lifecycle.requestInitialized(currentRequest, null);
>> > > >         }
>> > > >
>> > > >
>> > > > http://git-wip-us.apache.org/repos/asf/wicket/blob/
>> > > > 26557b35/wicket-core/src/main/java/org/apache/wicket/
>> > protocol/http/mock/
>> > > > MockHttpServletRequest.java
>> > > > ------------------------------------------------------------
>> ----------
>> > > > diff --git a/wicket-core/src/main/java/org/apache/wicket/protocol/
>> > > > http/mock/MockHttpServletRequest.java b/wicket-core/src/main/java/
>> > > > org/apache/wicket/protocol/http/mock/MockHttpServletRequest.java
>> > > > index 44ee8d4..10c878d 100755
>> > > > --- a/wicket-core/src/main/java/org/apache/wicket/protocol/http/
>> mock/
>> > > > MockHttpServletRequest.java
>> > > > +++ b/wicket-core/src/main/java/org/apache/wicket/protocol/http/
>> mock/
>> > > > MockHttpServletRequest.java
>> > > > @@ -1180,7 +1180,6 @@ public class MockHttpServletRequest implements
>> > > > HttpServletRequest
>> > > >         @Override
>> > > >         public HttpSession getSession(boolean b)
>> > > >         {
>> > > > -               HttpSession sess = null;
>> > > >                 if (session instanceof MockHttpSession)
>> > > >                 {
>> > > >                         MockHttpSession mockHttpSession =
>> > > > (MockHttpSession)session;
>> > > > @@ -1188,13 +1187,8 @@ public class MockHttpServletRequest
>> implements
>> > > > HttpServletRequest
>> > > >                         {
>> > > >                                 mockHttpSession.setTemporary(
>> false);
>> > > >                         }
>> > > > -
>> > > > -                       if (mockHttpSession.isTemporary() == false)
>> > > > -                       {
>> > > > -                               sess = session;
>> > > > -                       }
>> > > >                 }
>> > > > -               return sess;
>> > > > +               return session;
>> > > >         }
>> > > >
>> > > >         /**
>> > > >
>> > > > http://git-wip-us.apache.org/repos/asf/wicket/blob/
>> > > > 26557b35/wicket-core/src/test/java/org/apache/wicket/
>> > protocol/http/mock/
>> > > > MockHttpServletRequestTest.java
>> > > > ------------------------------------------------------------
>> ----------
>> > > > diff --git a/wicket-core/src/test/java/org/apache/wicket/protocol/
>> > > > http/mock/MockHttpServletRequestTest.java
>> b/wicket-core/src/test/java/
>> > > > org/apache/wicket/protocol/http/mock/MockHttpServletRequestT
>> est.java
>> > > > index 99f956e..8f0802c 100755
>> > > > --- a/wicket-core/src/test/java/org/apache/wicket/protocol/http/
>> mock/
>> > > > MockHttpServletRequestTest.java
>> > > > +++ b/wicket-core/src/test/java/org/apache/wicket/protocol/http/
>> mock/
>> > > > MockHttpServletRequestTest.java
>> > > > @@ -119,22 +119,22 @@ public class MockHttpServletRequestTest
>> extends
>> > > > WicketTestCase
>> > > >          assertNull(url.getQueryString());
>> > > >      }
>> > > >
>> > > > -       @Test
>> > > > -       public void getSessionFromNonMockHttpSession()
>> > > > -       {
>> > > > -               HttpSession httpSession = Mockito.mock(HttpSession.
>> > > class);
>> > > > -               MockHttpServletRequest request = new
>> > > > MockHttpServletRequest(null, httpSession, null);
>> > > > -               assertNull("MockHttpServletRequest knows how to
>> work
>> > > only
>> > > > with MockHttpSession", request.getSession(true));
>> > > > -               assertNull("MockHttpServletRequest knows how to
>> work
>> > > only
>> > > > with MockHttpSession", request.getSession(false));
>> > > > -       }
>> > > > -
>> > > > -       @Test
>> > > > -       public void getSessionFalseFromMockHttpSession()
>> > > > -       {
>> > > > -               HttpSession httpSession = new MockHttpSession(null);
>> > > > -               MockHttpServletRequest request = new
>> > > > MockHttpServletRequest(null, httpSession, null);
>> > > > -               assertNull("HttpSession should not be created!",
>> > > > request.getSession(false));
>> > > > -       }
>> > > > +//     @Test
>> > > > +//     public void getSessionFromNonMockHttpSession()
>> > > > +//     {
>> > > > +//             HttpSession httpSession = Mockito.mock(HttpSession.
>> > > class);
>> > > > +//             MockHttpServletRequest request = new
>> > > > MockHttpServletRequest(null, httpSession, null);
>> > > > +//             assertTrue("MockHttpServletRequest knows how to
>> work
>> > > only
>> > > > with MockHttpSession", request.getSession(true).);
>> > > > +//             assertNull("MockHttpServletRequest knows how to
>> work
>> > > only
>> > > > with MockHttpSession", request.getSession(false));
>> > > > +//     }
>> > > > +//
>> > > > +//     @Test
>> > > > +//     public void getSessionFalseFromMockHttpSession()
>> > > > +//     {
>> > > > +//             HttpSession httpSession = new MockHttpSession(null);
>> > > > +//             MockHttpServletRequest request = new
>> > > > MockHttpServletRequest(null, httpSession, null);
>> > > > +//             assertNull("HttpSession should not be created!",
>> > > > request.getSession(false));
>> > > > +//     }
>> > > >
>> > > >         @Test
>> > > >         public void getSessionDefaultFromMockHttpSession()
>> > > >
>> > > >
>> > >
>> > >
>> > > --
>> > > WBR
>> > > Maxim aka solomax
>> > >
>> >
>>
>>
>>
>> --
>> WBR
>> Maxim aka solomax
>>
>
>

Reply via email to