use of org.apache.geode.test.dunit.rules.GfshShellConnectionRule in project geode by apache.
the class ConcurrentDeployDUnitTest method connectToLocator.
public static void connectToLocator(int locatorPort) throws Exception {
gfsh = new GfshShellConnectionRule();
gfsh.connectAndVerify(locatorPort, GfshShellConnectionRule.PortType.locator);
}
use of org.apache.geode.test.dunit.rules.GfshShellConnectionRule in project geode by apache.
the class ConnectToLocatorSSLDUnitTest method setUpLocatorAndConnect.
private void setUpLocatorAndConnect(Properties securityProps) throws Exception {
MemberVM locator = lsRule.startLocatorVM(0, securityProps);
// saving the securityProps to a file
OutputStream out = new FileOutputStream(securityPropsFile);
securityProps.store(out, null);
/*
* When using SSL, the GfshShellConnectionRule seems to leave behind state in the JVM that
* causes test flakinesss. (Each test method will pass if run in isolation, but when all run
* together, the second and third tests will fail.) To avoid this issue, we connect to our
* locator from a remote VM which is cleaned up by the CleanupDUnitVMsRule in between tests.
*/
final int locatorPort = locator.getPort();
final String securityPropsFilePath = securityPropsFile.getCanonicalPath();
Host.getHost(0).getVM(1).invoke(() -> {
GfshShellConnectionRule gfshConnector = new GfshShellConnectionRule();
try {
gfshConnector.connectAndVerify(locatorPort, GfshShellConnectionRule.PortType.locator, CliStrings.CONNECT__SECURITY_PROPERTIES, securityPropsFilePath);
} finally {
gfshConnector.close();
}
});
}
use of org.apache.geode.test.dunit.rules.GfshShellConnectionRule in project geode by apache.
the class PDXPostProcessorDUnitTest method testGfshCommand.
@Test
public void testGfshCommand() {
// have client2 input some domain data into the region
client2.invoke(() -> {
ClientCache cache = createClientCache("super-user", "1234567", server.getPort());
Region region = createProxyRegion(cache, REGION_NAME);
// put in a value that's a domain object
region.put("key1", new SimpleClass(1, (byte) 1));
// put in a byte value
region.put("key2", BYTES);
});
client1.invoke(() -> {
GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
gfsh.secureConnectAndVerify(server.getJmxPort(), GfshShellConnectionRule.PortType.jmxManger, "dataUser", "1234567");
// get command
CommandResult result = gfsh.executeAndVerifyCommand("get --key=key1 --region=AuthRegion");
if (pdxPersistent)
assertThat(gfsh.getGfshOutput().contains("org.apache.geode.pdx.internal.PdxInstanceImpl"));
else
assertThat(gfsh.getGfshOutput()).contains("SimpleClass");
result = gfsh.executeAndVerifyCommand("get --key=key2 --region=AuthRegion");
assertTrue(result.getContent().toString().contains("byte[]"));
gfsh.executeAndVerifyCommand("query --query=\"select * from /AuthRegion\"");
gfsh.close();
});
PDXPostProcessor pp = (PDXPostProcessor) SecurityService.getSecurityService().getPostProcessor();
assertEquals(pp.getCount(), 4);
}
Aggregations