From 5d42f554e057986c6d342baa0ba75c46e09c676a Mon Sep 17 00:00:00 2001 From: Paul Ferraro Date: Thu, 22 Oct 2020 13:39:58 -0400 Subject: [PATCH] Upgrade to WildFly 21.0.0.Final --- README.md | 28 ++- core/pom.xml | 36 ++- .../marshalling/jdk/ClassLoaderResolver.java | 55 +++++ .../marshalling/jdk/ClassResolver.java | 40 ++++ .../jdk/JavaByteBufferMarshaller.java | 69 ++++++ .../marshalling/jdk/ObjectInputStream.java | 60 +++++ .../marshalling/jdk/ObjectOutputStream.java | 50 ++++ .../web/spring/JBossMarshallingVersion.java | 51 ++++ .../web/spring/SessionMarshallerFactory.java | 66 ++++++ .../spring/SessionPersistenceGranularity.java | 46 ++++ .../web/spring/AbstractSmokeITCase.java | 65 +++--- .../LoggingSessionAttributeListener.java | 2 +- .../LoggingSessionIdentifierListener.java | 2 +- .../{ => servlet}/LoggingSessionListener.java | 2 +- .../web/spring/servlet/MutableInteger.java | 55 +++++ ...r.java => MutableIntegerExternalizer.java} | 34 +-- .../web/spring/servlet/ServletHandler.java | 76 ++++++ .../web/spring/servlet/ServletService.java | 38 +++ .../web/spring/servlet/ServletSession.java | 33 +++ .../TestSerializationContextInitializer.java | 34 +++ hotrod/pom.xml | 59 +++-- .../hotrod/HotRodSessionRepository.java | 73 ++---- .../HotRodSessionRepositoryConfiguration.java | 8 +- .../HotRodHttpSessionConfiguration.java | 50 ++-- .../web/spring/hotrod/SmokeITCase.java | 4 +- .../web/spring/hotrod/applicationContext.xml | 8 +- .../spring/hotrod/servlet/SessionServlet.java | 37 +-- .../spring/hotrod/servlet/SpringService.java | 62 +++++ .../spring/hotrod/servlet/SpringSession.java | 59 +++++ hotrod/src/test/resources/config.xml | 49 ---- .../test/resources/infinispan/infinispan.xml | 43 ++++ .../resources/infinispan/users.properties | 32 +++ .../test/resources/{ => tomcat}/server.xml | 8 +- .../resources/{ => tomcat}/tomcat-users.xml | 0 pom.xml | 221 ++++++++++-------- 35 files changed, 1184 insertions(+), 371 deletions(-) create mode 100644 core/src/main/java/org/wildfly/clustering/marshalling/jdk/ClassLoaderResolver.java create mode 100644 core/src/main/java/org/wildfly/clustering/marshalling/jdk/ClassResolver.java create mode 100644 core/src/main/java/org/wildfly/clustering/marshalling/jdk/JavaByteBufferMarshaller.java create mode 100644 core/src/main/java/org/wildfly/clustering/marshalling/jdk/ObjectInputStream.java create mode 100644 core/src/main/java/org/wildfly/clustering/marshalling/jdk/ObjectOutputStream.java create mode 100644 core/src/main/java/org/wildfly/clustering/web/spring/JBossMarshallingVersion.java create mode 100644 core/src/main/java/org/wildfly/clustering/web/spring/SessionMarshallerFactory.java create mode 100644 core/src/main/java/org/wildfly/clustering/web/spring/SessionPersistenceGranularity.java rename core/src/test/java/org/wildfly/clustering/web/spring/{ => servlet}/LoggingSessionAttributeListener.java (97%) rename core/src/test/java/org/wildfly/clustering/web/spring/{ => servlet}/LoggingSessionIdentifierListener.java (96%) rename core/src/test/java/org/wildfly/clustering/web/spring/{ => servlet}/LoggingSessionListener.java (97%) create mode 100644 core/src/test/java/org/wildfly/clustering/web/spring/servlet/MutableInteger.java rename core/src/test/java/org/wildfly/clustering/web/spring/servlet/{SessionHandler.java => MutableIntegerExternalizer.java} (56%) create mode 100644 core/src/test/java/org/wildfly/clustering/web/spring/servlet/ServletHandler.java create mode 100644 core/src/test/java/org/wildfly/clustering/web/spring/servlet/ServletService.java create mode 100644 core/src/test/java/org/wildfly/clustering/web/spring/servlet/ServletSession.java create mode 100644 core/src/test/java/org/wildfly/clustering/web/spring/servlet/TestSerializationContextInitializer.java create mode 100644 hotrod/src/test/java/org/wildfly/clustering/web/spring/hotrod/servlet/SpringService.java create mode 100644 hotrod/src/test/java/org/wildfly/clustering/web/spring/hotrod/servlet/SpringSession.java delete mode 100644 hotrod/src/test/resources/config.xml create mode 100644 hotrod/src/test/resources/infinispan/infinispan.xml create mode 100644 hotrod/src/test/resources/infinispan/users.properties rename hotrod/src/test/resources/{ => tomcat}/server.xml (85%) rename hotrod/src/test/resources/{ => tomcat}/tomcat-users.xml (100%) diff --git a/README.md b/README.md index 2f2c929..4a624eb 100644 --- a/README.md +++ b/README.md @@ -99,15 +99,18 @@ The following is a sample `/WEB-INF/applicationContext.xml`: - - - 127.0.0.1:11222 - - - - FINE - - 1000 + + + 127.0.0.1:11222 + + + + SESSION + + + PROTOSTREAM + + 1000 @@ -117,9 +120,10 @@ The following is a sample `/WEB-INF/applicationContext.xml`: |Property|Description| |:---|:---| -|configurationName|Defines the server-side configuration template from which a deployment cache is created on the server. If undefined, the configuration of the server's default cache will be used.| -|persistenceStrategy|Defines how a session is mapped to entries in the cache. "COARSE" will store all attributes of a session in a single cache entry. "FINE" will store each session attribute in a separate cache entry. Default is "COARSE".| -|maxActiveSessions|Defines the maximum number of sessions to retain in the near cache. Default is boundless. A value of 0 will disable the near cache.| +|templateName|Defines the server-side configuration template from which a deployment cache is created on the server. Default is `org.infinispan.DIST_SYNC`.| +|granularity|Defines how a session is mapped to entries in the cache. Supported granularities are enumerated by the `org.wildfly.clustering.web.spring.SessionPersistenceGranularity` enum. `SESSION` will store all attributes of a session in a single cache entry, while `ATTRIBUTE` will store each session attribute in a separate cache entry. Default is `SESSION`.| +|maxActiveSessions|Defines the maximum number of sessions to retain in the near cache. Default is limitless. A value of 0 will disable the near cache.| +|marshallerFactory|Specifies the marshaller used to serialize and deserialize session attributes. Supported marshallers are enumerated by the `org.wildfly.clustering.web.spring.SessionMarshallerFactory` enum and include: `JAVA`, `JBOSS`, `PROTOSTREAM`. Default marshaller is `JBOSS`.| #### HotRod properties diff --git a/core/pom.xml b/core/pom.xml index cb1873c..ce90187 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -36,10 +36,22 @@ Distributed session management for Spring Session: Core integration + + jakarta.annotation + jakarta.annotation-api + provided + jakarta.servlet jakarta.servlet-api + provided + + org.kohsuke.metainf-services + metainf-services + provided + + org.springframework spring-context @@ -50,25 +62,35 @@ org.wildfly - wildfly-clustering-web-cache + wildfly-clustering-marshalling-jboss - org.kohsuke.metainf-services - metainf-services + org.wildfly + wildfly-clustering-marshalling-protostream + + org.wildfly + wildfly-clustering-web-cache + + org.apache.httpcomponents httpclient test - org.jboss.shrinkwrap - shrinkwrap-api + org.infinispan + infinispan-server-testdriver-junit4 test - org.infinispan - infinispan-server-testdriver-junit4 + org.infinispan.protostream + protostream-processor + test + + + org.jboss.shrinkwrap + shrinkwrap-api test diff --git a/core/src/main/java/org/wildfly/clustering/marshalling/jdk/ClassLoaderResolver.java b/core/src/main/java/org/wildfly/clustering/marshalling/jdk/ClassLoaderResolver.java new file mode 100644 index 0000000..f942280 --- /dev/null +++ b/core/src/main/java/org/wildfly/clustering/marshalling/jdk/ClassLoaderResolver.java @@ -0,0 +1,55 @@ +/* + * JBoss, Home of Professional Open Source. + * Copyright 2020, Red Hat, Inc., and individual contributors + * as indicated by the @author tags. See the copyright.txt file in the + * distribution for a full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ + +package org.wildfly.clustering.marshalling.jdk; + +import java.io.IOException; +import java.io.ObjectInput; +import java.io.ObjectOutput; + +/** + * A {@link ClassResolver} that resolves classes against a given class loader. + * @author Paul Ferraro + */ +public class ClassLoaderResolver implements ClassResolver { + + private final ClassLoader loader; + + public ClassLoaderResolver(ClassLoader loader) { + this.loader = loader; + } + + @Override + public void annotateClass(ObjectOutput output, Class targetClass) throws IOException { + // Do nothing + } + + @Override + public Class resolveClass(ObjectInput input, String className) throws IOException, ClassNotFoundException { + return this.loader.loadClass(className); + } + + @Override + public ClassLoader getClassLoader() { + return this.loader; + } +} diff --git a/core/src/main/java/org/wildfly/clustering/marshalling/jdk/ClassResolver.java b/core/src/main/java/org/wildfly/clustering/marshalling/jdk/ClassResolver.java new file mode 100644 index 0000000..56cc08a --- /dev/null +++ b/core/src/main/java/org/wildfly/clustering/marshalling/jdk/ClassResolver.java @@ -0,0 +1,40 @@ +/* + * JBoss, Home of Professional Open Source. + * Copyright 2020, Red Hat, Inc., and individual contributors + * as indicated by the @author tags. See the copyright.txt file in the + * distribution for a full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ + +package org.wildfly.clustering.marshalling.jdk; + +import java.io.IOException; +import java.io.ObjectInput; +import java.io.ObjectOutput; + +/** + * Annotates a resolves {@link Class} instances to/from an object stream. + * @author Paul Ferraro + */ +public interface ClassResolver { + + void annotateClass(ObjectOutput output, Class targetClass) throws IOException; + + Class resolveClass(ObjectInput input, String className) throws IOException, ClassNotFoundException; + + ClassLoader getClassLoader(); +} diff --git a/core/src/main/java/org/wildfly/clustering/marshalling/jdk/JavaByteBufferMarshaller.java b/core/src/main/java/org/wildfly/clustering/marshalling/jdk/JavaByteBufferMarshaller.java new file mode 100644 index 0000000..3e5941c --- /dev/null +++ b/core/src/main/java/org/wildfly/clustering/marshalling/jdk/JavaByteBufferMarshaller.java @@ -0,0 +1,69 @@ +/* + * JBoss, Home of Professional Open Source. + * Copyright 2020, Red Hat, Inc., and individual contributors + * as indicated by the @author tags. See the copyright.txt file in the + * distribution for a full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ + +package org.wildfly.clustering.marshalling.jdk; + +import java.io.IOException; +import java.io.InputStream; +import java.io.InvalidClassException; +import java.io.ObjectInput; +import java.io.ObjectOutput; +import java.io.OutputStream; +import java.io.Serializable; + +import org.wildfly.clustering.marshalling.spi.ByteBufferMarshaller; + +/** + * A {@link ByteBufferMarshaller} based on Java serialization. + * + * @author Paul Ferraro + */ +public class JavaByteBufferMarshaller implements ByteBufferMarshaller { + private final ClassResolver resolver; + + public JavaByteBufferMarshaller(ClassResolver resolver) { + this.resolver = resolver; + } + + @Override + public boolean isMarshallable(Object object) { + return (object == null) || object instanceof Serializable; + } + + @Override + public Object readFrom(InputStream in) throws IOException { + try (ObjectInput input = new ObjectInputStream(in, this.resolver)) { + return input.readObject(); + } catch (ClassNotFoundException e) { + InvalidClassException exception = new InvalidClassException(e.getMessage()); + exception.initCause(e); + throw exception; + } + } + + @Override + public void writeTo(OutputStream out, Object object) throws IOException { + try (ObjectOutput output = new ObjectOutputStream(out, this.resolver)) { + output.writeObject(object); + } + } +} diff --git a/core/src/main/java/org/wildfly/clustering/marshalling/jdk/ObjectInputStream.java b/core/src/main/java/org/wildfly/clustering/marshalling/jdk/ObjectInputStream.java new file mode 100644 index 0000000..8d7dda6 --- /dev/null +++ b/core/src/main/java/org/wildfly/clustering/marshalling/jdk/ObjectInputStream.java @@ -0,0 +1,60 @@ +/* + * JBoss, Home of Professional Open Source. + * Copyright 2020, Red Hat, Inc., and individual contributors + * as indicated by the @author tags. See the copyright.txt file in the + * distribution for a full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ + +package org.wildfly.clustering.marshalling.jdk; + +import java.io.IOException; +import java.io.InputStream; +import java.io.ObjectStreamClass; +import java.lang.reflect.Proxy; + +/** + * An {@link java.io.ObjectInputStream} that resolves classes using a given {@link ClassResolver}. + * @author Paul Ferraro + */ +public class ObjectInputStream extends java.io.ObjectInputStream { + + private final ClassResolver resolver; + + public ObjectInputStream(InputStream input, ClassResolver resolver) throws IOException { + super(input); + this.resolver = resolver; + } + + @Override + protected Class resolveClass(ObjectStreamClass description) throws IOException, ClassNotFoundException { + return this.resolver.resolveClass(this, description.getName()); + } + + @Override + protected Class resolveProxyClass(String[] interfaces) throws IOException, ClassNotFoundException { + Class[] interfaceClasses = new Class[interfaces.length]; + for (int i = 0; i < interfaces.length; ++i) { + interfaceClasses[i] = this.resolver.resolveClass(this, interfaces[i]); + } + try { + return Proxy.getProxyClass(this.resolver.getClassLoader(), interfaceClasses); + } catch (IllegalArgumentException e) { + throw new ClassNotFoundException(null, e); + } + } +} diff --git a/core/src/main/java/org/wildfly/clustering/marshalling/jdk/ObjectOutputStream.java b/core/src/main/java/org/wildfly/clustering/marshalling/jdk/ObjectOutputStream.java new file mode 100644 index 0000000..b70c7ad --- /dev/null +++ b/core/src/main/java/org/wildfly/clustering/marshalling/jdk/ObjectOutputStream.java @@ -0,0 +1,50 @@ +/* + * JBoss, Home of Professional Open Source. + * Copyright 2020, Red Hat, Inc., and individual contributors + * as indicated by the @author tags. See the copyright.txt file in the + * distribution for a full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ + +package org.wildfly.clustering.marshalling.jdk; + +import java.io.IOException; +import java.io.OutputStream; + +/** + * An {@link java.io.ObjectInputStream} that annotates classes using a given {@link ClassResolver}. + * @author Paul Ferraro + */ +public class ObjectOutputStream extends java.io.ObjectOutputStream { + + private final ClassResolver resolver; + + public ObjectOutputStream(OutputStream output, ClassResolver resolver) throws IOException { + super(output); + this.resolver = resolver; + } + + @Override + protected void annotateClass(Class targetClass) throws IOException { + this.resolver.annotateClass(this, targetClass); + } + + @Override + protected void annotateProxyClass(Class proxyClass) throws IOException { + this.resolver.annotateClass(this, proxyClass); + } +} diff --git a/core/src/main/java/org/wildfly/clustering/web/spring/JBossMarshallingVersion.java b/core/src/main/java/org/wildfly/clustering/web/spring/JBossMarshallingVersion.java new file mode 100644 index 0000000..649b3bb --- /dev/null +++ b/core/src/main/java/org/wildfly/clustering/web/spring/JBossMarshallingVersion.java @@ -0,0 +1,51 @@ +/* + * JBoss, Home of Professional Open Source. + * Copyright 2020, Red Hat, Inc., and individual contributors + * as indicated by the @author tags. See the copyright.txt file in the + * distribution for a full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ + +package org.wildfly.clustering.web.spring; + +import java.io.Externalizable; +import java.io.Serializable; +import java.util.function.Function; + +import org.jboss.marshalling.MarshallingConfiguration; +import org.jboss.marshalling.SimpleClassResolver; +import org.wildfly.clustering.marshalling.jboss.ExternalizerObjectTable; +import org.wildfly.clustering.marshalling.jboss.SimpleClassTable; + +/** + * @author Paul Ferraro + */ +public enum JBossMarshallingVersion implements Function { + + VERSION_1() { + @Override + public MarshallingConfiguration apply(ClassLoader loader) { + MarshallingConfiguration config = new MarshallingConfiguration(); + config.setClassResolver(new SimpleClassResolver(loader)); + config.setClassTable(new SimpleClassTable(Serializable.class, Externalizable.class)); + config.setObjectTable(new ExternalizerObjectTable(loader)); + return config; + } + }, + ; + static final JBossMarshallingVersion CURRENT = VERSION_1; +} diff --git a/core/src/main/java/org/wildfly/clustering/web/spring/SessionMarshallerFactory.java b/core/src/main/java/org/wildfly/clustering/web/spring/SessionMarshallerFactory.java new file mode 100644 index 0000000..18222ed --- /dev/null +++ b/core/src/main/java/org/wildfly/clustering/web/spring/SessionMarshallerFactory.java @@ -0,0 +1,66 @@ +/* + * JBoss, Home of Professional Open Source. + * Copyright 2020, Red Hat, Inc., and individual contributors + * as indicated by the @author tags. See the copyright.txt file in the + * distribution for a full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ + +package org.wildfly.clustering.web.spring; + +import java.util.NoSuchElementException; +import java.util.function.Function; + +import org.wildfly.clustering.marshalling.jboss.JBossByteBufferMarshaller; +import org.wildfly.clustering.marshalling.jboss.SimpleMarshallingConfigurationRepository; +import org.wildfly.clustering.marshalling.jdk.ClassLoaderResolver; +import org.wildfly.clustering.marshalling.jdk.JavaByteBufferMarshaller; +import org.wildfly.clustering.marshalling.protostream.ProtoStreamByteBufferMarshaller; +import org.wildfly.clustering.marshalling.protostream.SerializationContextBuilder; +import org.wildfly.clustering.marshalling.spi.ByteBufferMarshaller; + +/** + * @author Paul Ferraro + */ +public enum SessionMarshallerFactory implements Function { + + JAVA() { + @Override + public ByteBufferMarshaller apply(ClassLoader loader) { + return new JavaByteBufferMarshaller(new ClassLoaderResolver(loader)); + } + }, + JBOSS() { + @Override + public ByteBufferMarshaller apply(ClassLoader loader) { + return new JBossByteBufferMarshaller(new SimpleMarshallingConfigurationRepository(JBossMarshallingVersion.class, JBossMarshallingVersion.CURRENT, loader), loader); + } + }, + PROTOSTREAM() { + @Override + public ByteBufferMarshaller apply(ClassLoader loader) { + SerializationContextBuilder builder = new SerializationContextBuilder(); + try { + builder.register(loader); + } catch (NoSuchElementException e) { + // Ignore + } + return new ProtoStreamByteBufferMarshaller(builder.build()); + } + }, + ; +} diff --git a/core/src/main/java/org/wildfly/clustering/web/spring/SessionPersistenceGranularity.java b/core/src/main/java/org/wildfly/clustering/web/spring/SessionPersistenceGranularity.java new file mode 100644 index 0000000..c3192c7 --- /dev/null +++ b/core/src/main/java/org/wildfly/clustering/web/spring/SessionPersistenceGranularity.java @@ -0,0 +1,46 @@ +/* + * JBoss, Home of Professional Open Source. + * Copyright 2020, Red Hat, Inc., and individual contributors + * as indicated by the @author tags. See the copyright.txt file in the + * distribution for a full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ + +package org.wildfly.clustering.web.spring; + +import java.util.function.Supplier; + +import org.wildfly.clustering.web.session.SessionAttributePersistenceStrategy; + +/** + * @author Paul Ferraro + */ +public enum SessionPersistenceGranularity implements Supplier { + SESSION(SessionAttributePersistenceStrategy.COARSE), + ATTRIBUTE(SessionAttributePersistenceStrategy.FINE), + ; + private final SessionAttributePersistenceStrategy strategy; + + SessionPersistenceGranularity(SessionAttributePersistenceStrategy strategy) { + this.strategy = strategy; + } + + @Override + public SessionAttributePersistenceStrategy get() { + return this.strategy; + } +} diff --git a/core/src/test/java/org/wildfly/clustering/web/spring/AbstractSmokeITCase.java b/core/src/test/java/org/wildfly/clustering/web/spring/AbstractSmokeITCase.java index f3a613a..73e2737 100644 --- a/core/src/test/java/org/wildfly/clustering/web/spring/AbstractSmokeITCase.java +++ b/core/src/test/java/org/wildfly/clustering/web/spring/AbstractSmokeITCase.java @@ -22,10 +22,7 @@ package org.wildfly.clustering.web.spring; -import java.io.IOException; -import java.net.InetAddress; import java.net.URI; -import java.net.URISyntaxException; import java.net.URL; import java.util.Arrays; @@ -34,54 +31,51 @@ import org.apache.http.client.methods.HttpDelete; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpHead; -import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; -import org.infinispan.server.Server; +import org.infinispan.protostream.SerializationContextInitializer; import org.infinispan.server.test.core.ServerRunMode; -import org.infinispan.server.test.junit4.InfinispanServerRule; +import org.infinispan.server.test.core.TestSystemPropertyNames; import org.infinispan.server.test.junit4.InfinispanServerRuleBuilder; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.junit.Assert; import org.junit.ClassRule; -import org.wildfly.clustering.web.spring.servlet.SessionHandler; +import org.junit.rules.TestRule; +import org.wildfly.clustering.marshalling.Externalizer; +import org.wildfly.clustering.web.spring.servlet.MutableIntegerExternalizer; +import org.wildfly.clustering.web.spring.servlet.ServletHandler; +import org.wildfly.clustering.web.spring.servlet.TestSerializationContextInitializer; /** * @author Paul Ferraro */ public abstract class AbstractSmokeITCase { - public static final String CONTAINER_1 = "tomcat-1"; - public static final String CONTAINER_2 = "tomcat-2"; - public static final String DEPLOYMENT_1 = "deployment-1"; - public static final String DEPLOYMENT_2 = "deployment-2"; - static { - System.setProperty(Server.INFINISPAN_CLUSTER_STACK, Server.DEFAULT_CLUSTER_STACK); - System.setProperty(Server.INFINISPAN_CLUSTER_NAME, Server.DEFAULT_CLUSTER_NAME); - System.setProperty(Server.INFINISPAN_NODE_NAME, InetAddress.getLoopbackAddress().getHostName()); - } + private static final String INFINISPAN_SERVER_HOME = System.getProperty("infinispan.server.home"); @ClassRule - public static final InfinispanServerRule SERVERS = InfinispanServerRuleBuilder.config("config.xml") - .runMode(ServerRunMode.FORKED) - .numServers(1) - .build(); + public static final TestRule SERVERS = InfinispanServerRuleBuilder.config(INFINISPAN_SERVER_HOME + "/server/conf/infinispan.xml") + .property(TestSystemPropertyNames.INFINISPAN_SERVER_HOME, INFINISPAN_SERVER_HOME) + .runMode(ServerRunMode.FORKED) + .numServers(1) + .build(); - public static Archive deployment(Class testClass, Class servletClass) { + public static Archive deployment(Class testClass, Class> servletClass) { return ShrinkWrap.create(WebArchive.class, testClass.getSimpleName() + ".war") - .addClass(SessionHandler.class) - .addClasses(LoggingSessionListener.class, LoggingSessionIdentifierListener.class, LoggingSessionAttributeListener.class) - .addClass(servletClass) + .addPackage(ServletHandler.class.getPackage()) + .addPackage(servletClass.getPackage()) .addAsWebInfResource(testClass.getPackage(), "applicationContext.xml", "applicationContext.xml") + .addAsServiceProvider(Externalizer.class, MutableIntegerExternalizer.class) + .addAsServiceProvider(SerializationContextInitializer.class.getName(), TestSerializationContextInitializer.class.getName() + "Impl") .setWebXML(AbstractSmokeITCase.class.getPackage(), "web.xml") ; } - protected void test(URL baseURL1, URL baseURL2) throws IOException, URISyntaxException { - URI uri1 = SessionHandler.createURI(baseURL1); - URI uri2 = SessionHandler.createURI(baseURL2); + protected void test(URL baseURL1, URL baseURL2) throws Exception { + URI uri1 = ServletHandler.createURI(baseURL1); + URI uri2 = ServletHandler.createURI(baseURL2); try (CloseableHttpClient client = HttpClients.createDefault()) { String sessionId = null; @@ -90,28 +84,23 @@ protected void test(URL baseURL1, URL baseURL2) throws IOException, URISyntaxExc for (URI uri : Arrays.asList(uri1, uri2)) { try (CloseableHttpResponse response = client.execute(new HttpGet(uri))) { Assert.assertEquals(HttpStatus.SC_OK, response.getStatusLine().getStatusCode()); - Assert.assertEquals(String.valueOf(value++), response.getFirstHeader(SessionHandler.VALUE).getValue()); + Assert.assertEquals(String.valueOf(value++), response.getFirstHeader(ServletHandler.VALUE).getValue()); if (sessionId == null) { - sessionId = response.getFirstHeader(SessionHandler.SESSION_ID).getValue(); + sessionId = response.getFirstHeader(ServletHandler.SESSION_ID).getValue(); } else { - Assert.assertEquals(sessionId, response.getFirstHeader(SessionHandler.SESSION_ID).getValue()); + Assert.assertEquals(sessionId, response.getFirstHeader(ServletHandler.SESSION_ID).getValue()); } } + Thread.sleep(100); } } - try (CloseableHttpResponse response = client.execute(new HttpPost(uri2))) { - Assert.assertEquals(HttpStatus.SC_OK, response.getStatusLine().getStatusCode()); - String newSessionId = response.getFirstHeader(SessionHandler.SESSION_ID).getValue(); - Assert.assertNotEquals(sessionId, newSessionId); - sessionId = newSessionId; - } try (CloseableHttpResponse response = client.execute(new HttpDelete(uri1))) { Assert.assertEquals(HttpStatus.SC_OK, response.getStatusLine().getStatusCode()); - Assert.assertEquals(sessionId, response.getFirstHeader(SessionHandler.SESSION_ID).getValue()); + Assert.assertEquals(sessionId, response.getFirstHeader(ServletHandler.SESSION_ID).getValue()); } try (CloseableHttpResponse response = client.execute(new HttpHead(uri2))) { Assert.assertEquals(HttpStatus.SC_OK, response.getStatusLine().getStatusCode()); - Assert.assertFalse(response.containsHeader(SessionHandler.SESSION_ID)); + Assert.assertFalse(response.containsHeader(ServletHandler.SESSION_ID)); } } } diff --git a/core/src/test/java/org/wildfly/clustering/web/spring/LoggingSessionAttributeListener.java b/core/src/test/java/org/wildfly/clustering/web/spring/servlet/LoggingSessionAttributeListener.java similarity index 97% rename from core/src/test/java/org/wildfly/clustering/web/spring/LoggingSessionAttributeListener.java rename to core/src/test/java/org/wildfly/clustering/web/spring/servlet/LoggingSessionAttributeListener.java index 4e7f359..2197933 100644 --- a/core/src/test/java/org/wildfly/clustering/web/spring/LoggingSessionAttributeListener.java +++ b/core/src/test/java/org/wildfly/clustering/web/spring/servlet/LoggingSessionAttributeListener.java @@ -20,7 +20,7 @@ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ -package org.wildfly.clustering.web.spring; +package org.wildfly.clustering.web.spring.servlet; import javax.servlet.annotation.WebListener; import javax.servlet.http.HttpSessionAttributeListener; diff --git a/core/src/test/java/org/wildfly/clustering/web/spring/LoggingSessionIdentifierListener.java b/core/src/test/java/org/wildfly/clustering/web/spring/servlet/LoggingSessionIdentifierListener.java similarity index 96% rename from core/src/test/java/org/wildfly/clustering/web/spring/LoggingSessionIdentifierListener.java rename to core/src/test/java/org/wildfly/clustering/web/spring/servlet/LoggingSessionIdentifierListener.java index af4b7cd..4117ee9 100644 --- a/core/src/test/java/org/wildfly/clustering/web/spring/LoggingSessionIdentifierListener.java +++ b/core/src/test/java/org/wildfly/clustering/web/spring/servlet/LoggingSessionIdentifierListener.java @@ -20,7 +20,7 @@ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ -package org.wildfly.clustering.web.spring; +package org.wildfly.clustering.web.spring.servlet; import javax.servlet.annotation.WebListener; import javax.servlet.http.HttpSessionEvent; diff --git a/core/src/test/java/org/wildfly/clustering/web/spring/LoggingSessionListener.java b/core/src/test/java/org/wildfly/clustering/web/spring/servlet/LoggingSessionListener.java similarity index 97% rename from core/src/test/java/org/wildfly/clustering/web/spring/LoggingSessionListener.java rename to core/src/test/java/org/wildfly/clustering/web/spring/servlet/LoggingSessionListener.java index 5cf2199..b751ce9 100644 --- a/core/src/test/java/org/wildfly/clustering/web/spring/LoggingSessionListener.java +++ b/core/src/test/java/org/wildfly/clustering/web/spring/servlet/LoggingSessionListener.java @@ -20,7 +20,7 @@ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ -package org.wildfly.clustering.web.spring; +package org.wildfly.clustering.web.spring.servlet; import javax.servlet.annotation.WebListener; import javax.servlet.http.HttpSessionEvent; diff --git a/core/src/test/java/org/wildfly/clustering/web/spring/servlet/MutableInteger.java b/core/src/test/java/org/wildfly/clustering/web/spring/servlet/MutableInteger.java new file mode 100644 index 0000000..ecb144e --- /dev/null +++ b/core/src/test/java/org/wildfly/clustering/web/spring/servlet/MutableInteger.java @@ -0,0 +1,55 @@ +/* + * JBoss, Home of Professional Open Source. + * Copyright 2020, Red Hat, Inc., and individual contributors + * as indicated by the @author tags. See the copyright.txt file in the + * distribution for a full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ + +package org.wildfly.clustering.web.spring.servlet; + +import java.io.Serializable; +import java.util.function.IntConsumer; +import java.util.function.IntSupplier; + +import org.infinispan.protostream.annotations.ProtoFactory; +import org.infinispan.protostream.annotations.ProtoField; + +/** + * @author Paul Ferraro + */ +public class MutableInteger implements IntSupplier, IntConsumer, Serializable { + private static final long serialVersionUID = -5935940924708909645L; + + @ProtoField(value = 1, defaultValue = "0") + volatile int value; + + @ProtoFactory + public MutableInteger(int value) { + this.value = value; + } + + @Override + public void accept(int value) { + this.value = value; + } + + @Override + public int getAsInt() { + return this.value; + } +} diff --git a/core/src/test/java/org/wildfly/clustering/web/spring/servlet/SessionHandler.java b/core/src/test/java/org/wildfly/clustering/web/spring/servlet/MutableIntegerExternalizer.java similarity index 56% rename from core/src/test/java/org/wildfly/clustering/web/spring/servlet/SessionHandler.java rename to core/src/test/java/org/wildfly/clustering/web/spring/servlet/MutableIntegerExternalizer.java index b58a3a3..f240069 100644 --- a/core/src/test/java/org/wildfly/clustering/web/spring/servlet/SessionHandler.java +++ b/core/src/test/java/org/wildfly/clustering/web/spring/servlet/MutableIntegerExternalizer.java @@ -23,28 +23,28 @@ package org.wildfly.clustering.web.spring.servlet; import java.io.IOException; -import java.net.URI; -import java.net.URISyntaxException; -import java.net.URL; +import java.io.ObjectInput; +import java.io.ObjectOutput; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import org.wildfly.clustering.marshalling.Externalizer; /** * @author Paul Ferraro */ -public interface SessionHandler { - final String SERVLET_NAME = "session"; - final String SERVLET_PATH = "/" + SERVLET_NAME; - final String VALUE = "value"; - final String SESSION_ID = "session-id"; +public class MutableIntegerExternalizer implements Externalizer { - static URI createURI(URL baseURL) throws URISyntaxException { - return baseURL.toURI().resolve(SERVLET_NAME); + @Override + public Class getTargetClass() { + return MutableInteger.class; } - void doHead(HttpServletRequest request, HttpServletResponse response) throws IOException; - void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException; - void doDelete(HttpServletRequest request, HttpServletResponse response) throws IOException; - void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException; -} \ No newline at end of file + @Override + public MutableInteger readObject(ObjectInput input) throws IOException { + return new MutableInteger(input.readInt()); + } + + @Override + public void writeObject(ObjectOutput output, MutableInteger value) throws IOException { + output.writeInt(value.getAsInt()); + } +} diff --git a/core/src/test/java/org/wildfly/clustering/web/spring/servlet/ServletHandler.java b/core/src/test/java/org/wildfly/clustering/web/spring/servlet/ServletHandler.java new file mode 100644 index 0000000..e9078d6 --- /dev/null +++ b/core/src/test/java/org/wildfly/clustering/web/spring/servlet/ServletHandler.java @@ -0,0 +1,76 @@ +/* + * JBoss, Home of Professional Open Source. + * Copyright 2020, Red Hat, Inc., and individual contributors + * as indicated by the @author tags. See the copyright.txt file in the + * distribution for a full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ + +package org.wildfly.clustering.web.spring.servlet; + +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; +import java.net.URL; + +/** + * @author Paul Ferraro + */ +public interface ServletHandler { + final String SERVLET_NAME = "session"; + final String SERVLET_PATH = "/" + SERVLET_NAME; + final String VALUE = "value"; + final String SESSION_ID = "session-id"; + + static URI createURI(URL baseURL) throws URISyntaxException { + return baseURL.toURI().resolve(SERVLET_NAME); + } + + void doHead(REQUEST request, RESPONSE response) throws IOException; + void doGet(REQUEST request, RESPONSE response) throws IOException; + void doDelete(REQUEST request, RESPONSE response) throws IOException; + + default void doHead(ServletService service) throws IOException { + ServletSession session = service.getSession(false); + if (session != null) { + service.setHeader(SESSION_ID, session.getId()); + } + } + + default void doGet(ServletService service) throws IOException { + ServletSession session = service.getSession(); + service.setHeader(SESSION_ID, session.getId()); + + MutableInteger value = (MutableInteger) session.getAttribute(VALUE); + if (value == null) { + value = new MutableInteger(0); + session.setAttribute(VALUE, value); + } else { + value.accept(value.getAsInt() + 1); + } + + service.setHeader(VALUE, value.getAsInt()); + } + + default void doDelete(ServletService service) throws IOException { + ServletSession session = service.getSession(false); + if (session != null) { + service.setHeader(SESSION_ID, session.getId()); + session.invalidate(); + } + } +} \ No newline at end of file diff --git a/core/src/test/java/org/wildfly/clustering/web/spring/servlet/ServletService.java b/core/src/test/java/org/wildfly/clustering/web/spring/servlet/ServletService.java new file mode 100644 index 0000000..6dfeb15 --- /dev/null +++ b/core/src/test/java/org/wildfly/clustering/web/spring/servlet/ServletService.java @@ -0,0 +1,38 @@ +/* + * JBoss, Home of Professional Open Source. + * Copyright 2020, Red Hat, Inc., and individual contributors + * as indicated by the @author tags. See the copyright.txt file in the + * distribution for a full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ + +package org.wildfly.clustering.web.spring.servlet; + +import java.io.IOException; + +/** + * @author Paul Ferraro + */ +public interface ServletService { + default ServletSession getSession() { + return this.getSession(true); + } + ServletSession getSession(boolean create); + + void setHeader(String name, int value) throws IOException; + void setHeader(String name, String value) throws IOException; +} diff --git a/core/src/test/java/org/wildfly/clustering/web/spring/servlet/ServletSession.java b/core/src/test/java/org/wildfly/clustering/web/spring/servlet/ServletSession.java new file mode 100644 index 0000000..f3d426b --- /dev/null +++ b/core/src/test/java/org/wildfly/clustering/web/spring/servlet/ServletSession.java @@ -0,0 +1,33 @@ +/* + * JBoss, Home of Professional Open Source. + * Copyright 2020, Red Hat, Inc., and individual contributors + * as indicated by the @author tags. See the copyright.txt file in the + * distribution for a full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ + +package org.wildfly.clustering.web.spring.servlet; + +/** + * @author Paul Ferraro + */ +public interface ServletSession { + String getId(); + Object getAttribute(String name); + void setAttribute(String name, Object value); + void invalidate(); +} diff --git a/core/src/test/java/org/wildfly/clustering/web/spring/servlet/TestSerializationContextInitializer.java b/core/src/test/java/org/wildfly/clustering/web/spring/servlet/TestSerializationContextInitializer.java new file mode 100644 index 0000000..34ac37e --- /dev/null +++ b/core/src/test/java/org/wildfly/clustering/web/spring/servlet/TestSerializationContextInitializer.java @@ -0,0 +1,34 @@ +/* + * JBoss, Home of Professional Open Source. + * Copyright 2020, Red Hat, Inc., and individual contributors + * as indicated by the @author tags. See the copyright.txt file in the + * distribution for a full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ + +package org.wildfly.clustering.web.spring.servlet; + +import org.infinispan.protostream.SerializationContextInitializer; +import org.infinispan.protostream.annotations.AutoProtoSchemaBuilder; + +/** + * @author Paul Ferraro + */ +@AutoProtoSchemaBuilder(includeClasses = { MutableInteger.class }) +public interface TestSerializationContextInitializer extends SerializationContextInitializer { + +} diff --git a/hotrod/pom.xml b/hotrod/pom.xml index 02c7718..c1b13eb 100644 --- a/hotrod/pom.xml +++ b/hotrod/pom.xml @@ -39,16 +39,23 @@ jakarta.servlet jakarta.servlet-api + provided + - org.springframework - spring-web - - - org.wildfly.clustering + ${project.groupId} wildfly-clustering-spring-session-core ${project.version} + + + org.infinispan + infinispan-client-hotrod + + + org.springframework + spring-web + org.wildfly wildfly-clustering-infinispan-marshalling @@ -57,10 +64,6 @@ org.wildfly wildfly-clustering-web-hotrod - - org.infinispan - infinispan-client-hotrod - ${project.groupId} @@ -70,9 +73,10 @@ test-jar test + - org.apache.tomcat - tomcat-catalina + org.apache.httpcomponents + httpclient test @@ -90,11 +94,6 @@ arquillian-junit-container test - - org.apache.httpcomponents - httpclient - test - junit junit @@ -108,22 +107,29 @@ src/test/resources arquillian.xml - config.xml true - src/test/resources - ${project.build.directory}/apache-tomcat-${version.org.apache.tomcat}/conf/ + src/test/resources/infinispan + ${project.build.directory}/infinispan-server-${version.org.infinispan}/server/conf + + ** + + true + + + src/test/resources/tomcat + ${project.build.directory}/apache-tomcat-${version.org.apache.tomcat}/conf - server.xml - tomcat-users.xml + ** true src/test/java + **/*.properties **/*.xml true @@ -152,7 +158,7 @@ maven-dependency-plugin - unpack + unpack-tomcat generate-test-resources unpack @@ -172,7 +178,7 @@ - copy + configure-tomcat pre-integration-test copy @@ -252,15 +258,18 @@ maven-failsafe-plugin - test + smoke-test integration-test integration-test verify + false + + false - ${project.build.directory}/infinispan-server-${version.org.infinispan} + ${project.build.directory}/infinispan-server-${version.org.infinispan} diff --git a/hotrod/src/main/java/org/wildfly/clustering/web/spring/hotrod/HotRodSessionRepository.java b/hotrod/src/main/java/org/wildfly/clustering/web/spring/hotrod/HotRodSessionRepository.java index db07531..cd2af2d 100644 --- a/hotrod/src/main/java/org/wildfly/clustering/web/spring/hotrod/HotRodSessionRepository.java +++ b/hotrod/src/main/java/org/wildfly/clustering/web/spring/hotrod/HotRodSessionRepository.java @@ -24,25 +24,19 @@ import java.time.Duration; import java.util.EnumSet; -import java.util.NoSuchElementException; import java.util.Optional; import java.util.ServiceLoader; -import java.util.function.Consumer; -import java.util.function.Function; import java.util.function.Supplier; import javax.servlet.ServletContext; import javax.servlet.http.HttpSession; import javax.servlet.http.HttpSessionActivationListener; -import org.infinispan.client.hotrod.DefaultTemplate; import org.infinispan.client.hotrod.RemoteCache; import org.infinispan.client.hotrod.configuration.Configuration; import org.infinispan.client.hotrod.configuration.ConfigurationBuilder; import org.infinispan.client.hotrod.configuration.NearCacheMode; -import org.infinispan.client.hotrod.configuration.RemoteCacheConfigurationBuilder; import org.infinispan.client.hotrod.configuration.TransactionMode; -import org.jboss.marshalling.MarshallingConfiguration; import org.springframework.beans.factory.DisposableBean; import org.springframework.beans.factory.InitializingBean; import org.springframework.context.ApplicationEventPublisher; @@ -58,12 +52,6 @@ import org.wildfly.clustering.infinispan.client.RemoteCacheContainer; import org.wildfly.clustering.infinispan.client.manager.RemoteCacheManager; import org.wildfly.clustering.infinispan.marshalling.protostream.ProtoStreamMarshaller; -import org.wildfly.clustering.marshalling.jboss.DynamicClassTable; -import org.wildfly.clustering.marshalling.jboss.ExternalizerObjectTable; -import org.wildfly.clustering.marshalling.jboss.JBossByteBufferMarshaller; -import org.wildfly.clustering.marshalling.jboss.SimpleMarshallingConfigurationRepository; -import org.wildfly.clustering.marshalling.protostream.ProtoStreamByteBufferMarshaller; -import org.wildfly.clustering.marshalling.protostream.SerializationContextBuilder; import org.wildfly.clustering.marshalling.spi.ByteBufferMarshalledValueFactory; import org.wildfly.clustering.marshalling.spi.ByteBufferMarshaller; import org.wildfly.clustering.marshalling.spi.MarshalledValueFactory; @@ -84,26 +72,13 @@ import org.wildfly.clustering.web.spring.DistributableSessionRepository; import org.wildfly.clustering.web.spring.ImmutableSessionExpirationListener; import org.wildfly.clustering.web.spring.SpringSpecificationProvider; +import org.wildfly.security.manager.WildFlySecurityManager; /** * @author Paul Ferraro */ public class HotRodSessionRepository implements SessionRepository>, InitializingBean, DisposableBean, LocalContextFactory, Registrar, Registration { - enum JBossMarshallingVersion implements Function { - VERSION_1() { - @Override - public MarshallingConfiguration apply(ClassLoader loader) { - MarshallingConfiguration config = new MarshallingConfiguration(); - config.setClassTable(new DynamicClassTable(loader)); - config.setObjectTable(new ExternalizerObjectTable(loader)); - return config; - } - }, - ; - static final JBossMarshallingVersion CURRENT = VERSION_1; - } - private final HotRodSessionRepositoryConfiguration configuration; private volatile RemoteCacheContainer container; private volatile SessionManagerFactory managerFactory; @@ -114,47 +89,34 @@ public HotRodSessionRepository(HotRodSessionRepositoryConfiguration configuratio this.configuration = configuration; } - private static ByteBufferMarshaller createMarshaller(ClassLoader loader) { - try { - return new ProtoStreamByteBufferMarshaller(new SerializationContextBuilder().register(loader).build()); - } catch (NoSuchElementException e) { - return new JBossByteBufferMarshaller(new SimpleMarshallingConfigurationRepository(JBossMarshallingVersion.class, JBossMarshallingVersion.CURRENT, loader), loader); - } - } - @Override public void afterPropertiesSet() throws Exception { + + ServletContext context = this.configuration.getServletContext(); + // Deployment name = host name + context path + version + String deploymentName = context.getVirtualServerName() + context.getContextPath(); + String templateName = this.configuration.getTemplateName(); Integer maxActiveSessions = this.configuration.getMaxActiveSessions(); - ClassLoader managerLoader = HotRodSessionManagerFactory.class.getClassLoader(); + SessionAttributePersistenceStrategy strategy = this.configuration.getPersistenceStrategy(); + + ClassLoader containerLoader = WildFlySecurityManager.getClassLoaderPrivileged(HotRodSessionManagerFactory.class); Configuration configuration = new ConfigurationBuilder() .withProperties(this.configuration.getProperties()) - .marshaller(new ProtoStreamMarshaller(managerLoader)) + .marshaller(new ProtoStreamMarshaller(containerLoader)) + .classLoader(containerLoader) .build(); - ServletContext context = this.configuration.getServletContext(); - String configurationName = this.configuration.getConfigurationName(); - String templateName = (configurationName != null) ? configurationName : DefaultTemplate.DIST_SYNC.getTemplateName(); - String deploymentName = context.getVirtualServerName() + context.getContextPath(); - Consumer configurator = new Consumer() { - @Override - public void accept(RemoteCacheConfigurationBuilder builder) { - builder.forceReturnValues(false).transactionMode(TransactionMode.NONE).nearCacheMode(NearCacheMode.INVALIDATED).templateName(templateName); - } - }; - configuration.addRemoteCache(deploymentName, configurator); + configuration.addRemoteCache(deploymentName, builder -> builder.forceReturnValues(false).nearCacheMode(NearCacheMode.INVALIDATED).transactionMode(TransactionMode.NONE).templateName(templateName)); - ClassLoader deploymentLoader = this.configuration.getClassLoader(); - String containerName = context.getServletContextName(); - RemoteCacheContainer container = new RemoteCacheManager(containerName, configuration, this); + RemoteCacheContainer container = new RemoteCacheManager(this.getClass().getName(), configuration, this); container.start(); this.container = container; - ByteBufferMarshaller marshaller = createMarshaller(deploymentLoader); + ByteBufferMarshaller marshaller = this.configuration.getMarshallerFactory().apply(context.getClassLoader()); MarshalledValueFactory marshalledValueFactory = new ByteBufferMarshalledValueFactory(marshaller); ServiceLoader loadedImmutability = ServiceLoader.load(Immutability.class, Immutability.class.getClassLoader()); Immutability immutability = new CompositeImmutability(new CompositeIterable<>(EnumSet.allOf(DefaultImmutability.class), EnumSet.allOf(SessionAttributeImmutability.class), loadedImmutability)); - SessionAttributePersistenceStrategy strategy = this.configuration.getPersistenceStrategy(); HotRodSessionManagerFactoryConfiguration sessionManagerFactoryConfig = new HotRodSessionManagerFactoryConfiguration() { @Override @@ -169,8 +131,7 @@ public SessionAttributePersistenceStrategy getAttributePersistenceStrategy() { @Override public String getDeploymentName() { - // Deployment name = host name + context path - return context.getVirtualServerName() + context.getContextPath(); + return deploymentName; } @Override @@ -198,12 +159,12 @@ public RemoteCache getCache() { @Override public String getConfigurationName() { - return configurationName; + return null; } @Override public String getContainerName() { - return containerName; + return null; } @Override diff --git a/hotrod/src/main/java/org/wildfly/clustering/web/spring/hotrod/HotRodSessionRepositoryConfiguration.java b/hotrod/src/main/java/org/wildfly/clustering/web/spring/hotrod/HotRodSessionRepositoryConfiguration.java index 2d7b0e7..4b85828 100644 --- a/hotrod/src/main/java/org/wildfly/clustering/web/spring/hotrod/HotRodSessionRepositoryConfiguration.java +++ b/hotrod/src/main/java/org/wildfly/clustering/web/spring/hotrod/HotRodSessionRepositoryConfiguration.java @@ -23,11 +23,13 @@ package org.wildfly.clustering.web.spring.hotrod; import java.util.Properties; +import java.util.function.Function; import java.util.function.Supplier; import javax.servlet.ServletContext; import org.springframework.context.ApplicationEventPublisher; +import org.wildfly.clustering.marshalling.spi.ByteBufferMarshaller; import org.wildfly.clustering.web.session.SessionAttributePersistenceStrategy; /** @@ -35,13 +37,11 @@ */ public interface HotRodSessionRepositoryConfiguration { Properties getProperties(); - String getConfigurationName(); + String getTemplateName(); Integer getMaxActiveSessions(); SessionAttributePersistenceStrategy getPersistenceStrategy(); + Function getMarshallerFactory(); Supplier getIdentifierFactory(); ApplicationEventPublisher getEventPublisher(); ServletContext getServletContext(); - default ClassLoader getClassLoader() { - return this.getServletContext().getClassLoader(); - } } diff --git a/hotrod/src/main/java/org/wildfly/clustering/web/spring/hotrod/annotation/HotRodHttpSessionConfiguration.java b/hotrod/src/main/java/org/wildfly/clustering/web/spring/hotrod/annotation/HotRodHttpSessionConfiguration.java index 1b63e6e..190abb3 100644 --- a/hotrod/src/main/java/org/wildfly/clustering/web/spring/hotrod/annotation/HotRodHttpSessionConfiguration.java +++ b/hotrod/src/main/java/org/wildfly/clustering/web/spring/hotrod/annotation/HotRodHttpSessionConfiguration.java @@ -24,11 +24,12 @@ import java.util.Properties; import java.util.UUID; +import java.util.function.Function; import java.util.function.Supplier; import javax.servlet.ServletContext; -import org.springframework.beans.factory.BeanClassLoaderAware; +import org.infinispan.client.hotrod.DefaultTemplate; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.context.ApplicationEventPublisher; @@ -37,7 +38,10 @@ import org.springframework.context.annotation.Configuration; import org.springframework.session.config.annotation.web.http.SpringHttpSessionConfiguration; import org.springframework.web.context.ServletContextAware; +import org.wildfly.clustering.marshalling.spi.ByteBufferMarshaller; import org.wildfly.clustering.web.session.SessionAttributePersistenceStrategy; +import org.wildfly.clustering.web.spring.SessionMarshallerFactory; +import org.wildfly.clustering.web.spring.SessionPersistenceGranularity; import org.wildfly.clustering.web.spring.hotrod.HotRodSessionRepository; import org.wildfly.clustering.web.spring.hotrod.HotRodSessionRepositoryConfiguration; import org.wildfly.common.Assert; @@ -46,16 +50,16 @@ * @author Paul Ferraro */ @Configuration(proxyBeanMethods = false) -public class HotRodHttpSessionConfiguration extends SpringHttpSessionConfiguration implements HotRodSessionRepositoryConfiguration, ServletContextAware, ApplicationEventPublisherAware, BeanClassLoaderAware { +public class HotRodHttpSessionConfiguration extends SpringHttpSessionConfiguration implements HotRodSessionRepositoryConfiguration, ServletContextAware, ApplicationEventPublisherAware { private Properties properties; private Integer maxActiveSessions; - private SessionAttributePersistenceStrategy persistenceStrategy; - private String configurationName; + private SessionAttributePersistenceStrategy persistenceStrategy = SessionAttributePersistenceStrategy.COARSE; + private Function marshallerFactory = SessionMarshallerFactory.JBOSS; + private String templateName = DefaultTemplate.DIST_SYNC.getTemplateName(); private Supplier identifierFactory = () -> UUID.randomUUID().toString(); private ApplicationEventPublisher publisher; private ServletContext context; - private ClassLoader loader; @Bean public HotRodSessionRepository sessionRepository() { @@ -63,7 +67,6 @@ public HotRodSessionRepository sessionRepository() { Assert.assertNotNull(this.persistenceStrategy); Assert.assertNotNull(this.publisher); Assert.assertNotNull(this.context); - Assert.assertNotNull(this.loader); return new HotRodSessionRepository(this); } @@ -73,8 +76,8 @@ public Properties getProperties() { } @Override - public String getConfigurationName() { - return this.configurationName; + public String getTemplateName() { + return this.templateName; } @Override @@ -87,6 +90,11 @@ public SessionAttributePersistenceStrategy getPersistenceStrategy() { return this.persistenceStrategy; } + @Override + public Function getMarshallerFactory() { + return this.marshallerFactory; + } + @Override public Supplier getIdentifierFactory() { return this.identifierFactory; @@ -102,11 +110,6 @@ public ServletContext getServletContext() { return this.context; } - @Override - public ClassLoader getClassLoader() { - return this.loader; - } - @Override public void setApplicationEventPublisher(ApplicationEventPublisher publisher) { this.publisher = publisher; @@ -118,30 +121,35 @@ public void setServletContext(ServletContext context) { this.context = context; } - @Override - public void setBeanClassLoader(ClassLoader loader) { - this.loader = loader; - } - @Autowired(required = true) @Qualifier("hotRodProperties") public void setProperties(Properties properties) { this.properties = properties; } - @Autowired(required = true) + @Autowired(required = false) + public void setGranularity(SessionPersistenceGranularity granularity) { + this.persistenceStrategy = granularity.get(); + } + + @Autowired(required = false) public void setPersistenceStrategy(SessionAttributePersistenceStrategy persistenceStrategy) { this.persistenceStrategy = persistenceStrategy; } + @Autowired(required = false) + public void setMarshallerFactory(Function marshallerFactory) { + this.marshallerFactory = marshallerFactory; + } + @Autowired(required = false) public void setMaxActiveSessions(Integer maxActiveSessions) { this.maxActiveSessions = maxActiveSessions; } @Autowired(required = false) - public void setConfigurationName(String configurationName) { - this.configurationName = configurationName; + public void setTemplateName(String templateName) { + this.templateName = templateName; } @Autowired(required = false) diff --git a/hotrod/src/test/java/org/wildfly/clustering/web/spring/hotrod/SmokeITCase.java b/hotrod/src/test/java/org/wildfly/clustering/web/spring/hotrod/SmokeITCase.java index a94345a..ad04c2e 100644 --- a/hotrod/src/test/java/org/wildfly/clustering/web/spring/hotrod/SmokeITCase.java +++ b/hotrod/src/test/java/org/wildfly/clustering/web/spring/hotrod/SmokeITCase.java @@ -22,8 +22,6 @@ package org.wildfly.clustering.web.spring.hotrod; -import java.io.IOException; -import java.net.URISyntaxException; import java.net.URL; import org.jboss.arquillian.container.test.api.Deployment; @@ -63,7 +61,7 @@ public static Archive deployment2() { @Override @Test - public void test(@ArquillianResource(SessionServlet.class) @OperateOnDeployment(DEPLOYMENT_1) URL baseURL1, @ArquillianResource(SessionServlet.class) @OperateOnDeployment(DEPLOYMENT_2) URL baseURL2) throws IOException, URISyntaxException { + public void test(@ArquillianResource(SessionServlet.class) @OperateOnDeployment(DEPLOYMENT_1) URL baseURL1, @ArquillianResource(SessionServlet.class) @OperateOnDeployment(DEPLOYMENT_2) URL baseURL2) throws Exception { super.test(baseURL1, baseURL2); } } diff --git a/hotrod/src/test/java/org/wildfly/clustering/web/spring/hotrod/applicationContext.xml b/hotrod/src/test/java/org/wildfly/clustering/web/spring/hotrod/applicationContext.xml index 66bcaf2..7bd04d2 100644 --- a/hotrod/src/test/java/org/wildfly/clustering/web/spring/hotrod/applicationContext.xml +++ b/hotrod/src/test/java/org/wildfly/clustering/web/spring/hotrod/applicationContext.xml @@ -11,8 +11,12 @@ 127.0.0.1:11222 - - FINE + + ATTRIBUTE + + PROTOSTREAM + + \ No newline at end of file diff --git a/hotrod/src/test/java/org/wildfly/clustering/web/spring/hotrod/servlet/SessionServlet.java b/hotrod/src/test/java/org/wildfly/clustering/web/spring/hotrod/servlet/SessionServlet.java index 1121793..eb506ef 100644 --- a/hotrod/src/test/java/org/wildfly/clustering/web/spring/hotrod/servlet/SessionServlet.java +++ b/hotrod/src/test/java/org/wildfly/clustering/web/spring/hotrod/servlet/SessionServlet.java @@ -28,53 +28,28 @@ import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; -import org.wildfly.clustering.web.spring.servlet.SessionHandler; +import org.wildfly.clustering.web.spring.servlet.ServletHandler; /** * @author Paul Ferraro */ -@WebServlet(SessionHandler.SERVLET_PATH) -public class SessionServlet extends HttpServlet implements SessionHandler { +@WebServlet(ServletHandler.SERVLET_PATH) +public class SessionServlet extends HttpServlet implements ServletHandler { private static final long serialVersionUID = 2878267318695777395L; @Override public void doHead(HttpServletRequest request, HttpServletResponse response) throws IOException { - HttpSession session = request.getSession(false); - if (session != null) { - response.setHeader(SESSION_ID, session.getId()); - } + this.doHead(new SpringService(request, response)); } @Override public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { - HttpSession session = request.getSession(); - response.setHeader(SESSION_ID, session.getId()); - - Integer value = (Integer) session.getAttribute(VALUE); - if (value == null) { - value = Integer.valueOf(0); - } else { - value = Integer.valueOf(value.intValue() + 1); - } - session.setAttribute(VALUE, value); - - response.setIntHeader(VALUE, value); - } - - @Override - public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException { - String id = request.changeSessionId(); - response.setHeader(SESSION_ID, id); + this.doGet(new SpringService(request, response)); } @Override public void doDelete(HttpServletRequest request, HttpServletResponse response) throws IOException { - HttpSession session = request.getSession(false); - if (session != null) { - response.setHeader(SESSION_ID, session.getId()); - session.invalidate(); - } + this.doDelete(new SpringService(request, response)); } } \ No newline at end of file diff --git a/hotrod/src/test/java/org/wildfly/clustering/web/spring/hotrod/servlet/SpringService.java b/hotrod/src/test/java/org/wildfly/clustering/web/spring/hotrod/servlet/SpringService.java new file mode 100644 index 0000000..1af6278 --- /dev/null +++ b/hotrod/src/test/java/org/wildfly/clustering/web/spring/hotrod/servlet/SpringService.java @@ -0,0 +1,62 @@ +/* + * JBoss, Home of Professional Open Source. + * Copyright 2020, Red Hat, Inc., and individual contributors + * as indicated by the @author tags. See the copyright.txt file in the + * distribution for a full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ + +package org.wildfly.clustering.web.spring.hotrod.servlet; + +import java.io.IOException; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import org.wildfly.clustering.web.spring.servlet.ServletService; +import org.wildfly.clustering.web.spring.servlet.ServletSession; + +/** + * @author Paul Ferraro + */ +public class SpringService implements ServletService { + + private final HttpServletRequest request; + private final HttpServletResponse response; + + SpringService(HttpServletRequest request, HttpServletResponse response) { + this.request = request; + this.response = response; + } + + @Override + public ServletSession getSession(boolean create) { + HttpSession session = this.request.getSession(create); + return (session != null) ? new SpringSession(session) : null; + } + + @Override + public void setHeader(String name, int value) throws IOException { + this.response.setIntHeader(name, value); + } + + @Override + public void setHeader(String name, String value) throws IOException { + this.response.setHeader(name, value); + } +} diff --git a/hotrod/src/test/java/org/wildfly/clustering/web/spring/hotrod/servlet/SpringSession.java b/hotrod/src/test/java/org/wildfly/clustering/web/spring/hotrod/servlet/SpringSession.java new file mode 100644 index 0000000..c0746e5 --- /dev/null +++ b/hotrod/src/test/java/org/wildfly/clustering/web/spring/hotrod/servlet/SpringSession.java @@ -0,0 +1,59 @@ +/* + * JBoss, Home of Professional Open Source. + * Copyright 2020, Red Hat, Inc., and individual contributors + * as indicated by the @author tags. See the copyright.txt file in the + * distribution for a full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ + +package org.wildfly.clustering.web.spring.hotrod.servlet; + +import javax.servlet.http.HttpSession; + +import org.wildfly.clustering.web.spring.servlet.ServletSession; + +/** + * @author Paul Ferraro + */ +public class SpringSession implements ServletSession { + + private final HttpSession session; + + SpringSession(HttpSession session) { + this.session = session; + } + + @Override + public String getId() { + return this.session.getId(); + } + + @Override + public Object getAttribute(String name) { + return this.session.getAttribute(name); + } + + @Override + public void setAttribute(String name, Object value) { + this.session.setAttribute(name, value); + } + + @Override + public void invalidate() { + this.session.invalidate(); + } +} diff --git a/hotrod/src/test/resources/config.xml b/hotrod/src/test/resources/config.xml deleted file mode 100644 index e4c4b6e..0000000 --- a/hotrod/src/test/resources/config.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/hotrod/src/test/resources/infinispan/infinispan.xml b/hotrod/src/test/resources/infinispan/infinispan.xml new file mode 100644 index 0000000..26f5c54 --- /dev/null +++ b/hotrod/src/test/resources/infinispan/infinispan.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/hotrod/src/test/resources/infinispan/users.properties b/hotrod/src/test/resources/infinispan/users.properties new file mode 100644 index 0000000..afdebf7 --- /dev/null +++ b/hotrod/src/test/resources/infinispan/users.properties @@ -0,0 +1,32 @@ +# +# JBoss, Home of Professional Open Source. +# Copyright 2020, Red Hat, Inc., and individual contributors +# as indicated by the @author tags. See the copyright.txt file in the +# distribution for a full listing of individual contributors. +# +# This is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as +# published by the Free Software Foundation; either version 2.1 of +# the License, or (at your option) any later version. +# +# This software is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this software; if not, write to the Free +# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA +# 02110-1301 USA, or see the FSF site: http://www.fsf.org. +# + +# This file stores usernames and passwords (either encrypted or plain-text) +# +# Users can be added to this properties file at any time, updates after the server has started +# will be automatically detected. +# +# The format of this realm is as follows: +# username=password +# +# Use the CLI to manipulate users +testsuite-user=testsuite-password \ No newline at end of file diff --git a/hotrod/src/test/resources/server.xml b/hotrod/src/test/resources/tomcat/server.xml similarity index 85% rename from hotrod/src/test/resources/server.xml rename to hotrod/src/test/resources/tomcat/server.xml index d89b988..6e256e2 100644 --- a/hotrod/src/test/resources/server.xml +++ b/hotrod/src/test/resources/tomcat/server.xml @@ -7,7 +7,7 @@ - + @@ -20,9 +20,9 @@ - - + + - + \ No newline at end of file diff --git a/hotrod/src/test/resources/tomcat-users.xml b/hotrod/src/test/resources/tomcat/tomcat-users.xml similarity index 100% rename from hotrod/src/test/resources/tomcat-users.xml rename to hotrod/src/test/resources/tomcat/tomcat-users.xml diff --git a/pom.xml b/pom.xml index dfacdf6..2d7930b 100644 --- a/pom.xml +++ b/pom.xml @@ -45,17 +45,20 @@ - 21.0.0.Beta1 - 11.0.3.Final 5.2.9.RELEASE 2.3.1.RELEASE - 4.0.2 + 1.3.5 + 4.0.3 4.5.12 - 9.0.38 + 9.0.39 + 11.0.4.Final + 4.3.4.Final + ${version.org.infinispan} 1.6.0.Final 1.1.0.Final - 4.13.1 1.7 + 21.0.0.Final + 4.13.1 @@ -99,11 +102,68 @@ + + jakarta.annotation + jakarta.annotation-api + ${version.jakarta.annotation} + jakarta.servlet jakarta.servlet-api ${version.jakarta.servlet} - provided + + + org.apache.httpcomponents + httpclient + ${version.org.apache.httpcomponents} + + + org.apache.tomcat + tomcat-catalina + ${version.org.apache.tomcat} + + + org.infinispan + infinispan-client-hotrod + ${version.org.infinispan} + + + org.infinispan + infinispan-server-testdriver-junit4 + ${version.org.infinispan.server} + + + org.infinispan + infinispan-cli-client + + + + + org.infinispan.protostream + protostream + ${version.org.infinispan.protostream} + + + org.infinispan.protostream + protostream-processor + ${version.org.infinispan.protostream} + + + org.jboss.arquillian + arquillian-bom + ${version.org.jboss.arquillian} + import + pom + + + org.jboss.arquillian.container + arquillian-tomcat-managed-8 + ${version.org.jboss.arquillian.container.tomcat} + + + org.kohsuke.metainf-services + metainf-services + ${version.org.kohsuke.metainf-services} org.springframework @@ -122,20 +182,35 @@ org.wildfly - wildfly-clustering-infinispan-client + wildfly-clustering-common ${version.org.wildfly} - org.wildfly + org.jboss.msc + jboss-msc + + + org.wildfly.core wildfly-controller + + org.wildfly + wildfly-clustering-service + org.wildfly wildfly-naming + + + + org.wildfly + wildfly-clustering-infinispan-client + ${version.org.wildfly} + org.wildfly - wildfly-server + wildfly-clustering-common @@ -146,20 +221,46 @@ org.wildfly - wildfly-clustering-server + wildfly-clustering-marshalling-api + ${version.org.wildfly} + tests + + + org.wildfly + wildfly-clustering-marshalling-spi + ${version.org.wildfly} + tests + + + org.wildfly + wildfly-clustering-marshalling-jboss ${version.org.wildfly} - org.wildfly - wildfly-controller + org.jboss.modules + jboss-modules + + + + org.wildfly + wildfly-clustering-marshalling-protostream + ${version.org.wildfly} + - org.wildfly - wildfly-naming + org.jboss.modules + jboss-modules + + + + org.wildfly + wildfly-clustering-service + ${version.org.wildfly} + - org.wildfly - wildfly-server + org.jboss.msc + jboss-msc @@ -169,16 +270,8 @@ ${version.org.wildfly} - org.wildfly - wildfly-controller - - - org.wildfly - wildfly-naming - - - org.wildfly - wildfly-server + org.jboss.msc + jboss-msc @@ -187,21 +280,9 @@ wildfly-clustering-web-hotrod ${version.org.wildfly} - - org.jboss.modules - jboss-modules - org.wildfly - wildfly-controller - - - org.wildfly - wildfly-naming - - - org.wildfly - wildfly-server + wildfly-clustering-common @@ -212,72 +293,14 @@ org.wildfly - wildfly-controller - - - org.wildfly - wildfly-naming - - - org.wildfly - wildfly-server - - - org.jboss.metadata - jboss-metadata-web - - - org.jboss.spec.javax.servlet - jboss-servlet-api_4.0_spec + wildfly-clustering-common - - org.infinispan - infinispan-client-hotrod - ${version.org.infinispan} - - - org.infinispan - infinispan-core - ${version.org.infinispan} - - - org.kohsuke.metainf-services - metainf-services - ${version.org.kohsuke.metainf-services} - - - org.apache.httpcomponents - httpclient - ${version.org.apache.httpcomponents} - - - org.apache.tomcat - tomcat-catalina - ${version.org.apache.tomcat} - - - org.infinispan - infinispan-server-testdriver-junit4 - ${version.org.infinispan} - - - org.jboss.arquillian - arquillian-bom - ${version.org.jboss.arquillian} - import - pom - - - org.jboss.arquillian.container - arquillian-tomcat-managed-8 - ${version.org.jboss.arquillian.container.tomcat} - junit junit - ${version.org.junit} + ${version.junit}