Skip to content

Commit

Permalink
GEODE-6867: Updating Tomcat Session State Module docs (apache#3886)
Browse files Browse the repository at this point in the history
* GEODE-6867: Updating Tomcat Session State Module docs

* GEODE-6867: Fixing dependency list for AppServer

* Another doc fix and making test more robust
  • Loading branch information
mcmellawatt authored and gesterzhou committed Aug 30, 2019
1 parent f0d0183 commit b31d9f3
Show file tree
Hide file tree
Showing 5 changed files with 100 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ public String jarSkipPropertyName() {
}
}

/**
* If you update this list method to return different dependencies, please also update
* the Tomcat module documentation!
* The documentation can be found here:
* geode-docs/tools_modules/http_session_mgmt/tomcat_installing_the_module.html.md.erb
*/
private static final String[] tomcatRequiredJars =
{"antlr", "commons-io", "commons-lang", "commons-validator", "fastutil", "geode-common",
"geode-core", "geode-management", "javax.transaction-api", "jgroups", "log4j-api",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
import java.io.IOException;
import java.net.URISyntaxException;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.commons.lang3.JavaVersion;
import org.apache.commons.lang3.SystemUtils;
Expand All @@ -36,6 +38,7 @@

import org.apache.geode.cache.RegionShortcut;
import org.apache.geode.internal.UniquePortSupplier;
import org.apache.geode.internal.Version;
import org.apache.geode.management.internal.cli.i18n.CliStrings;
import org.apache.geode.management.internal.cli.util.CommandStringBuilder;
import org.apache.geode.test.junit.categories.BackwardCompatibilityTest;
Expand All @@ -57,12 +60,20 @@ public class Tomcat8ClientServerRollingUpgradeTest {
private String locatorDir;
private String server1Dir;
private String server2Dir;
private static Map<String, Version> versionMap = new HashMap<>();

@Parameterized.Parameters(name = "{0}")
public static Collection<String> data() {
List<String> result = VersionManager.getInstance().getVersionsWithoutCurrent();
int minimumVersion = SystemUtils.isJavaVersionAtLeast(JavaVersion.JAVA_9) ? 180 : 170;
result.removeIf(s -> Integer.parseInt(s) < minimumVersion);
Version.getAllVersions().forEach(v -> {
result.forEach(r -> {
if (r.equals(v.getName().replace(".", ""))) {
versionMap.put(r, v);
}
});
});
return result;
}

Expand Down Expand Up @@ -140,12 +151,9 @@ public void setup() throws Exception {
ContainerInstall.ConnectionType.CLIENT_SERVER,
portSupplier::getAvailablePort);

classPathTomcat8AndOldModules = tomcat8AndOldModules.getHome() + "/lib/*" + File.pathSeparator
+ tomcat8AndOldModules.getHome() + "/bin/*";
classPathTomcat8AndOldModules = getClassPathTomcat8AndOldModules();

classPathTomcat8AndCurrentModules =
tomcat8AndCurrentModules.getHome() + "/lib/*" + File.pathSeparator
+ tomcat8AndCurrentModules.getHome() + "/bin/*";
classPathTomcat8AndCurrentModules = getClassPathTomcat8AndCurrentModules();

// Get available port for the locator
locatorPort = portSupplier.getAvailablePort();
Expand Down Expand Up @@ -290,4 +298,67 @@ private void verifySessionReplication() throws IOException, URISyntaxException {
}
}

/**
* If this test breaks due to a change in required jars, please update the
* "Setting up the Module" section of the Tomcat module documentation!
*
* Returns the jars required on the classpath for the old modules. This list may
* differ from the list required by the current modules at some point in the future, hence the
* duplication of the requiredClasspathJars array.
*
* @return Paths to required jars
*/
private String getClassPathTomcat8AndOldModules() {
String oldVersion = versionMap.get(this.oldVersion).getName();

final String[] requiredClasspathJars = {
"/lib/geode-modules-" + oldVersion + ".jar",
"/lib/geode-modules-tomcat8-" + oldVersion + ".jar",
"/lib/servlet-api.jar",
"/lib/catalina.jar",
"/lib/tomcat-util.jar",
"/bin/tomcat-juli.jar"
};

return getRequiredClasspathJars(tomcat8AndOldModules.getHome(), requiredClasspathJars);
}

/**
* If this test breaks due to a change in required jars, please update the
* "Setting up the Module" section of the Tomcat module documentation!
*
* Returns the jars required on the classpath for the current modules. This list may
* differ from the list required by the old modules at some point in the future, hence the
* duplication of the requiredClasspathJars array.
*
* @return Paths to required jars
*/
private String getClassPathTomcat8AndCurrentModules() {
String currentVersion = Version.CURRENT.getName();

final String[] requiredClasspathJars = {
"/lib/geode-modules-" + currentVersion + "-SNAPSHOT.jar",
"/lib/geode-modules-tomcat8-" + currentVersion + "-SNAPSHOT.jar",
"/lib/servlet-api.jar",
"/lib/catalina.jar",
"/lib/tomcat-util.jar",
"/bin/tomcat-juli.jar"
};

return getRequiredClasspathJars(tomcat8AndCurrentModules.getHome(), requiredClasspathJars);
}

private String getRequiredClasspathJars(final String tomcat8AndRequiredModules,
final String[] requiredClasspathJars) {
StringBuilder completeJarList = new StringBuilder();
for (String requiredJar : requiredClasspathJars) {
completeJarList.append(tomcat8AndRequiredModules)
.append(requiredJar)
.append(File.pathSeparator);
}

completeJarList.deleteCharAt(completeJarList.length() - 1);

return completeJarList.toString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,15 @@ This topic describes how to install the HTTP session management module for Tomca
- commons-lang jar
- commons-validator jar
- fastutil jar
- geode-commons jar
- geode-core jar
- geode-management jar
- javax.transaction-api jar
- jgroups jar
- log4j-api jar
- log4j-core jar
- log4j-jul jar
- micrometer-core jar
- shiro-core jar


Original file line number Diff line number Diff line change
Expand Up @@ -107,19 +107,18 @@ For Tomcat 9.0:
The application server operates as a <%=vars.product_name%> client in this configuration. With a similar environment to this example that is for a client/server set up,
``` pre
TC_VER=tomcat-8.0.30.C.RELEASE
INSTANCE=geode-cs
CLASSPATH=$PWD/$INSTANCE/lib/geode-modules-1.0.0.jar:\
$PWD/$INSTANCE/lib/geode-modules-tomcat8-1.0.0.jar:\
$PWD/$TC_VER/lib/servlet-api.jar:\
$PWD/$TC_VER/lib/catalina.jar:\
$PWD/$TC_VER/lib/tomcat-util.jar:\
$PWD/$TC_VER/bin/tomcat-juli.jar
CLASSPATH=$PWD/lib/geode-modules-<%=vars.product_version%>.0.jar:\
$PWD/lib/geode-modules-tomcat8-<%=vars.product_version%>.0.jar:\
$PWD/lib/servlet-api.jar:\
$PWD/lib/catalina.jar:\
$PWD/lib/tomcat-util.jar:\
$PWD/bin/tomcat-juli.jar
```
Start the server using `gfsh`:
Start the locator and server using `gfsh`:
``` pre
$ gfsh start locator --name=locator1 --classpath=$CLASSPATH
$ gfsh start server --name=server1 --locators=localhost[10334] --server-port=0 \
--classpath=$CLASSPATH
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,21 @@ To modify your war or ear file manually, make the following updates:
- slf4j-jdk14 jar
- Add the following jar files from the `$GEODE/lib` directory to the `WEB-INF/lib` directory of the war, where `$GEODE` is set to the <%=vars.product_name%> product installation:
- antlr jar
- commons-io jar
- commons-lang jar
- commons-validator jar
- fastutil jar
- geode-commons jar
- geode-core jar
- geode-json jar
- geode-management jar
- javax.transaction-api jar
- jgroups jar
- log4j-api jar
- log4j-core jar
- log4j-jul jar
- micrometer-core jar
- shiro-core jar
If you are deploying an ear file:
Expand Down

0 comments on commit b31d9f3

Please sign in to comment.