Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion geode-assembly/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,8 @@ dependencies {
distributedTestRuntimeOnly(project(':extensions:geode-modules-session-internal')) {
exclude group: 'org.apache.tomcat'
}
distributedTestRuntimeOnly('org.codehaus.cargo:cargo-core-uberjar')
distributedTestImplementation('org.codehaus.cargo:cargo-core-uberjar')

distributedTestRuntimeOnly('io.swagger:swagger-annotations')
distributedTestRuntimeOnly(project(':geode-wan'))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
@Category({SessionTest.class})
public abstract class CargoTestBase {
private final UniquePortSupplier portSupplier = new UniquePortSupplier();
private static Logger logger = LogService.getLogger();
private static final Logger logger = LogService.getLogger();

@Rule
public TestName testName = new TestName();
Expand Down Expand Up @@ -106,15 +106,14 @@ public void customizeContainers() throws Exception {}
public void stop() throws IOException {
try {
manager.stopAllActiveContainers();
} catch (Exception exception) {
manager.dumpLogs();
throw exception;
} finally {
try {
manager.dumpLogs();
manager.cleanUp();
} finally {
try {
manager.cleanUp();
} finally {
announceTest("END");
}
announceTest("END");
}
}
}
Expand Down Expand Up @@ -170,6 +169,10 @@ private String getResponseValue(Client client, String key)
@Test
public void containersShouldReplicateCookies() throws IOException, URISyntaxException {
manager.startAllInactiveContainers();
await().until(() -> {
ServerContainer container = manager.getContainer(0);
return container.getState().isStarted();
});

client.setPort(Integer.parseInt(manager.getContainerPort(0)));
Client.Response resp = client.get(null);
Expand All @@ -183,6 +186,10 @@ public void containersShouldReplicateCookies() throws IOException, URISyntaxExce
@Test
public void containersShouldHavePersistentSessionData() throws IOException, URISyntaxException {
manager.startAllInactiveContainers();
await().until(() -> {
ServerContainer container = manager.getContainer(0);
return container.getState().isStarted();
});

String key = "value_testSessionPersists";
String value = "Foo";
Expand All @@ -200,6 +207,10 @@ public void containersShouldHavePersistentSessionData() throws IOException, URIS
public void failureShouldStillAllowOtherContainersDataAccess()
throws IOException, URISyntaxException {
manager.startAllInactiveContainers();
await().until(() -> {
ServerContainer container = manager.getContainer(0);
return container.getState().isStarted();
});

String key = "value_testSessionPersists";
String value = "Foo";
Expand All @@ -220,6 +231,10 @@ public void failureShouldStillAllowOtherContainersDataAccess()
@Test
public void invalidationShouldRemoveValueAccessForAllContainers() throws Exception {
manager.startAllInactiveContainers();
await().until(() -> {
ServerContainer container = manager.getContainer(0);
return container.getState().isStarted();
});

String key = "value_testInvalidate";
String value = "Foo";
Expand All @@ -246,6 +261,10 @@ protected void verifySessionIsRemoved(String key) throws IOException, URISyntaxE
public void containersShouldExpireInSetTimeframe()
throws IOException, URISyntaxException, InterruptedException {
manager.startAllInactiveContainers();
await().until(() -> {
ServerContainer container = manager.getContainer(0);
return container.getState().isStarted();
});

String key = "value_testSessionExpiration";
String value = "Foo";
Expand All @@ -272,6 +291,10 @@ public void containersShouldExpireInSetTimeframe()
public void sessionPicksUpSessionTimeoutConfiguredInWebXml()
throws IOException, URISyntaxException {
manager.startAllInactiveContainers();
await().until(() -> {
ServerContainer container = manager.getContainer(0);
return container.getState().isStarted();
});

String key = "value_testSessionExpiration";
String value = "Foo";
Expand Down Expand Up @@ -310,6 +333,10 @@ protected void verifyMaxInactiveInterval(int expected) throws IOException, URISy
public void containersShouldShareSessionExpirationReset()
throws URISyntaxException, IOException {
manager.startAllInactiveContainers();
await().until(() -> {
ServerContainer container = manager.getContainer(0);
return container.getState().isStarted();
});

int timeToExp = 30;
String key = "value_testSessionExpiration";
Expand Down Expand Up @@ -348,6 +375,11 @@ public void containersShouldShareSessionExpirationReset()
@Test
public void containersShouldShareDataRemovals() throws IOException, URISyntaxException {
manager.startAllInactiveContainers();
await().until(() -> {
ServerContainer container = manager.getContainer(0);
return container.getState().isStarted();
});

String key = "value_testSessionRemove";
String value = "Foo";
client.setPort(Integer.parseInt(manager.getContainerPort(0)));
Expand All @@ -368,6 +400,10 @@ public void containersShouldShareDataRemovals() throws IOException, URISyntaxExc
@Test
public void newContainersShouldShareDataAccess() throws Exception {
manager.startAllInactiveContainers();
await().until(() -> {
ServerContainer container = manager.getContainer(0);
return container.getState().isStarted();
});

String key = "value_testSessionAdd";
String value = "Foo";
Expand All @@ -390,6 +426,11 @@ public void newContainersShouldShareDataAccess() throws Exception {
@Test
public void attributesCanBeReplaced() throws IOException, URISyntaxException {
manager.startAllInactiveContainers();
await().until(() -> {
ServerContainer container = manager.getContainer(0);
return container.getState().isStarted();
});

String key = "value_testSessionUpdate";
String value = "Foo";
String updateValue = "Bar";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@

import static org.apache.geode.session.tests.ContainerInstall.ConnectionType.CACHING_CLIENT_SERVER;
import static org.apache.geode.session.tests.GenericAppServerInstall.GenericAppServerVersion.JETTY9;
import static org.junit.Assert.assertEquals;
import static org.apache.geode.test.awaitility.GeodeAwaitility.await;
import static org.assertj.core.api.Assertions.assertThat;

import java.io.IOException;
import java.util.function.IntSupplier;
Expand Down Expand Up @@ -46,13 +47,17 @@ public ContainerInstall getInstall(IntSupplier portSupplier)
public void shouldCacheSessionOnClient()
throws Exception {
manager.startAllInactiveContainers();

await().until(() -> {
ServerContainer container = manager.getContainer(0);
return container.getState().isStarted();
});
String key = "value_testSessionExpiration";
String value = "Foo";

client.setPort(Integer.parseInt(manager.getContainerPort(0)));
Client.Response resp = client.set(key, value);
String cookie = resp.getSessionCookie();
assertThat(resp.getResponse()).isEqualTo("");
assertThat(resp.getSessionCookie()).isNotEqualTo("");

serverVM.invoke("set bogus session key", () -> {
final InternalCache cache = ClusterStartupRule.memberStarter.getCache();
Expand All @@ -62,6 +67,6 @@ public void shouldCacheSessionOnClient()

// Make sure the client still sees its original cached value
resp = client.get(key);
assertEquals(value, resp.getResponse());
assertThat(resp.getResponse()).isEqualTo(value);
}
}