use of org.apache.geode.test.dunit.rules.MemberVM in project geode by apache.
the class ClusterConfigStartMemberDUnitTest method testStartLocator.
@Test
public void testStartLocator() throws Exception {
locatorProps.setProperty(LOCATORS, "localhost[" + locator.getPort() + "]");
MemberVM secondLocator = lsRule.startLocatorVM(1, locatorProps);
REPLICATED_CONFIG_FROM_ZIP.verify(secondLocator);
}
use of org.apache.geode.test.dunit.rules.MemberVM in project geode by apache.
the class ClusterConfigStartMemberDUnitTest method testStartServerWithSingleGroup.
@Test
public void testStartServerWithSingleGroup() throws Exception {
ClusterConfig expectedNoGroupConfig = new ClusterConfig(CLUSTER);
ClusterConfig expectedGroup1Config = new ClusterConfig(CLUSTER, GROUP1);
ClusterConfig expectedGroup2Config = new ClusterConfig(CLUSTER, GROUP2);
MemberVM serverWithNoGroup = lsRule.startServerVM(1, serverProps, locator.getPort());
expectedNoGroupConfig.verify(serverWithNoGroup);
serverProps.setProperty(GROUPS, "group1");
MemberVM serverForGroup1 = lsRule.startServerVM(2, serverProps, locator.getPort());
expectedGroup1Config.verify(serverForGroup1);
serverProps.setProperty(GROUPS, "group2");
MemberVM serverForGroup2 = lsRule.startServerVM(3, serverProps, locator.getPort());
expectedGroup2Config.verify(serverForGroup2);
}
use of org.apache.geode.test.dunit.rules.MemberVM in project geode by apache.
the class LuceneClusterConfigurationDUnitTest method indexWithAnalyzerGetsCreatedUsingClusterConfiguration.
@Test
public void indexWithAnalyzerGetsCreatedUsingClusterConfiguration() throws Exception {
startNodeUsingClusterConfiguration(1);
// Connect Gfsh to locator.
gfshConnector.connectAndVerify(locator);
// Create lucene index.
// createLuceneIndexUsingGfsh();
createLuceneIndexWithAnalyzerUsingGfsh(false);
createRegionUsingGfsh(REGION_NAME, RegionShortcut.PARTITION, null);
// Start vm2. This should have lucene index created using cluster
// configuration.
MemberVM vm2 = startNodeUsingClusterConfiguration(2);
vm2.invoke(() -> {
LuceneService luceneService = LuceneServiceProvider.get(LocatorServerStartupRule.serverStarter.getCache());
final LuceneIndex index = luceneService.getIndex(INDEX_NAME, REGION_NAME);
assertNotNull(index);
String[] fields = new String[] { "field1", "field2", "field3" };
validateIndexFields(fields, index);
// Add this check back when we complete xml generation for analyzer.
validateIndexFieldAnalyzer(fields, new String[] { "org.apache.lucene.analysis.standard.StandardAnalyzer", "org.apache.lucene.analysis.standard.StandardAnalyzer", "org.apache.lucene.analysis.standard.StandardAnalyzer" }, index);
});
}
use of org.apache.geode.test.dunit.rules.MemberVM in project geode by apache.
the class ClusterConfigurationIndexWithFromClauseDUnitTest method indexCreatedWithEntrySetInFromClauseMustPersist.
@Test
@Parameters(method = "getRegionTypes")
public void indexCreatedWithEntrySetInFromClauseMustPersist(RegionShortcut regionShortcut) throws Exception {
MemberVM vm1 = lsRule.startServerVM(1, locator.getPort());
gfshShellConnectionRule.connectAndVerify(locator);
createRegionUsingGfsh(REGION_NAME, regionShortcut, null);
createIndexUsingGfsh("\"" + REGION_NAME + ".entrySet() z\"", "z.key", INDEX_NAME);
String serverName = vm1.getName();
CommandStringBuilder csb = new CommandStringBuilder(CliStrings.LIST_MEMBER);
gfshShellConnectionRule.executeAndVerifyCommand(csb.toString());
lsRule.stopMember(1);
lsRule.startServerVM(1, lsRule.getMember(0).getPort());
;
verifyIndexRecreated(INDEX_NAME);
}
use of org.apache.geode.test.dunit.rules.MemberVM 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();
}
});
}
Aggregations