forked from apache/geode
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GEODE-2901: Adding integration tests of session replication
Adding integration tests that test both session replications frameworks shipped with geode. These tests use cargo to download and launch different J2EE containers, so the tests can run against many different containers. This closes apache#584
- Loading branch information
1 parent
52fe793
commit aa68f04
Showing
26 changed files
with
2,683 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ build-eclipse/ | |
/tags | ||
out/ | ||
|
||
|
||
.DS_store | ||
*.iml | ||
*.ipr | ||
*.iws | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
apply plugin: 'war' | ||
|
||
dependencies { | ||
provided 'javax.servlet:javax.servlet-api:' + project.'javax.servlet-api.version' | ||
} | ||
|
||
war { | ||
version = '' | ||
} | ||
|
||
disableMavenPublishing() |
94 changes: 94 additions & 0 deletions
94
...ns/session-testing-war/src/main/java/org/apache/geode/modules/session/CommandServlet.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license | ||
* agreements. See the NOTICE file distributed with this work for additional information regarding | ||
* copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance with the License. You may obtain a | ||
* copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License | ||
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | ||
* or implied. See the License for the specific language governing permissions and limitations under | ||
* the License. | ||
*/ | ||
|
||
package org.apache.geode.modules.session; | ||
|
||
import java.io.IOException; | ||
import java.io.PrintWriter; | ||
import javax.servlet.ServletConfig; | ||
import javax.servlet.ServletContext; | ||
import javax.servlet.ServletException; | ||
import javax.servlet.http.HttpServlet; | ||
import javax.servlet.http.HttpServletRequest; | ||
import javax.servlet.http.HttpServletResponse; | ||
import javax.servlet.http.HttpSession; | ||
|
||
/** | ||
* | ||
*/ | ||
public class CommandServlet extends HttpServlet { | ||
|
||
private ServletContext context; | ||
|
||
/** | ||
* The standard servlet method overridden. | ||
* | ||
* @param request | ||
* @param response | ||
* @throws IOException | ||
*/ | ||
@Override | ||
protected void doGet(HttpServletRequest request, HttpServletResponse response) | ||
throws IOException, ServletException { | ||
|
||
QueryCommand cmd = QueryCommand.UNKNOWN; | ||
String param = request.getParameter("param"); | ||
String value = request.getParameter("value"); | ||
PrintWriter out = response.getWriter(); | ||
|
||
String cmdStr = request.getParameter("cmd"); | ||
if (cmdStr != null) { | ||
cmd = QueryCommand.valueOf(cmdStr); | ||
} | ||
|
||
HttpSession session; | ||
|
||
switch (cmd) { | ||
case SET: | ||
session = request.getSession(); | ||
session.setAttribute(param, value); | ||
break; | ||
case SET_MAX_INACTIVE: | ||
session = request.getSession(); | ||
session.setMaxInactiveInterval(Integer.valueOf(value)); | ||
break; | ||
case GET: | ||
session = request.getSession(); | ||
String val = (String) session.getAttribute(param); | ||
if (val != null) { | ||
out.write(val); | ||
} | ||
break; | ||
case REMOVE: | ||
session = request.getSession(); | ||
session.removeAttribute(param); | ||
break; | ||
case INVALIDATE: | ||
session = request.getSession(); | ||
session.invalidate(); | ||
break; | ||
} | ||
} | ||
|
||
/** | ||
* Save a reference to the ServletContext for later use. | ||
* | ||
* @param config | ||
*/ | ||
@Override | ||
public void init(ServletConfig config) { | ||
this.context = config.getServletContext(); | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
...ions/session-testing-war/src/main/java/org/apache/geode/modules/session/QueryCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license | ||
* agreements. See the NOTICE file distributed with this work for additional information regarding | ||
* copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance with the License. You may obtain a | ||
* copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License | ||
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | ||
* or implied. See the License for the specific language governing permissions and limitations under | ||
* the License. | ||
*/ | ||
package org.apache.geode.modules.session; | ||
|
||
/** | ||
* Basic commands to pass to our test servlet | ||
*/ | ||
public enum QueryCommand { | ||
|
||
SET, | ||
|
||
SET_MAX_INACTIVE, | ||
|
||
GET, | ||
|
||
REMOVE, | ||
|
||
INVALIDATE, | ||
|
||
UNKNOWN; | ||
|
||
} |
43 changes: 43 additions & 0 deletions
43
extensions/session-testing-war/src/main/webapp/WEB-INF/web.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Licensed to the Apache Software Foundation (ASF) under one or more | ||
contributor license agreements. See the NOTICE file distributed with | ||
this work for additional information regarding copyright ownership. | ||
The ASF licenses this file to You under the Apache License, Version 2.0 | ||
(the "License"); you may not use this file except in compliance with | ||
the License. You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
<web-app xmlns="http://java.sun.com/xml/ns/javaee" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" | ||
version="3.0" | ||
metadata-complete="true"> | ||
|
||
<display-name>Geode Test war</display-name> | ||
|
||
<description> | ||
Test war file for geode session management | ||
</description> | ||
|
||
<servlet> | ||
<description> | ||
Some test servlet | ||
</description> | ||
<servlet-name>cmd-servlet</servlet-name> | ||
<servlet-class>org.apache.geode.modules.session.CommandServlet</servlet-class> | ||
</servlet> | ||
|
||
<servlet-mapping> | ||
<servlet-name>cmd-servlet</servlet-name> | ||
<url-pattern>/*</url-pattern> | ||
</servlet-mapping> | ||
|
||
</web-app> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.