use of org.apache.geode.test.dunit.rules.MemberVM in project geode by apache.
the class ClusterConfigImportDUnitTest method testImportClusterConfig.
@Test
public void testImportClusterConfig() throws Exception {
gfshConnector.executeAndVerifyCommand("import cluster-configuration --zip-file-name=" + clusterConfigZipPath);
// Make sure that a backup of the old clusterConfig was created
assertThat(locatorVM.getWorkingDir().listFiles()).filteredOn((File file) -> file.getName().contains("cluster_config")).hasSize(2);
CONFIG_FROM_ZIP.verify(locatorVM);
// start server1 with no group
MemberVM server1 = lsRule.startServerVM(1, serverProps, locatorVM.getPort());
new ClusterConfig(CLUSTER).verify(server1);
// start server2 in group1
serverProps.setProperty(GROUPS, "group1");
MemberVM server2 = lsRule.startServerVM(2, serverProps, locatorVM.getPort());
new ClusterConfig(CLUSTER, GROUP1).verify(server2);
// start server3 in group1 and group2
serverProps.setProperty(GROUPS, "group1,group2");
MemberVM server3 = lsRule.startServerVM(3, serverProps, locatorVM.getPort());
new ClusterConfig(CLUSTER, GROUP1, GROUP2).verify(server3);
}
use of org.apache.geode.test.dunit.rules.MemberVM in project geode by apache.
the class ClusterConfigImportDUnitTest method testImportWithMultipleLocators.
@Test
public void testImportWithMultipleLocators() throws Exception {
locatorProps.setProperty(LOCATORS, "localhost[" + locatorVM.getPort() + "]");
MemberVM locator1 = lsRule.startLocatorVM(1, locatorProps);
locatorProps.setProperty(LOCATORS, "localhost[" + locatorVM.getPort() + "],localhost[" + locator1.getPort() + "]");
MemberVM locator2 = lsRule.startLocatorVM(2, locatorProps);
gfshConnector.executeAndVerifyCommand("import cluster-configuration --zip-file-name=" + clusterConfigZipPath);
CONFIG_FROM_ZIP.verify(locatorVM);
REPLICATED_CONFIG_FROM_ZIP.verify(locator1);
REPLICATED_CONFIG_FROM_ZIP.verify(locator2);
}
use of org.apache.geode.test.dunit.rules.MemberVM in project geode by apache.
the class ClusterConfigStartMemberDUnitTest method startLocatorWithLoadCCFromDir.
private MemberVM startLocatorWithLoadCCFromDir() throws Exception {
File locatorDir = lsRule.getTempFolder().newFolder("locator-0");
File configDir = new File(locatorDir, "cluster_config");
// The unzip should yield a cluster config directory structure like:
// tempFolder/locator-0/cluster_config/cluster/cluster.xml
// tempFolder/locator-0/cluster_config/cluster/cluster.properties
// tempFolder/locator-0/cluster_config/cluster/cluster.jar
// tempFolder/locator-0/cluster_config/group1/ {group1.xml, group1.properties, group1.jar}
// tempFolder/locator-0/cluster_config/group2/ ...
ZipUtils.unzip(clusterConfigZipPath, configDir.getCanonicalPath());
Properties properties = new Properties();
properties.setProperty(ENABLE_CLUSTER_CONFIGURATION, "true");
properties.setProperty(LOAD_CLUSTER_CONFIGURATION_FROM_DIR, "true");
properties.setProperty(CLUSTER_CONFIGURATION_DIR, locatorDir.getCanonicalPath());
MemberVM locator = lsRule.startLocatorVM(0, properties);
CONFIG_FROM_ZIP.verify(locator);
return locator;
}
use of org.apache.geode.test.dunit.rules.MemberVM in project geode by apache.
the class ClusterConfigStartMemberDUnitTest method testStartServerWithMultipleGroup.
@Test
public void testStartServerWithMultipleGroup() throws Exception {
ClusterConfig expectedGroup1And2Config = new ClusterConfig(CLUSTER, GROUP1, GROUP2);
serverProps.setProperty(GROUPS, "group1,group2");
MemberVM server = lsRule.startServerVM(1, serverProps, locator.getPort());
expectedGroup1And2Config.verify(server);
}
use of org.apache.geode.test.dunit.rules.MemberVM in project geode by apache.
the class LuceneClusterConfigurationDUnitTest method verifyMemberWithGroupStartsAfterAlterRegion.
@Test
public void verifyMemberWithGroupStartsAfterAlterRegion() throws Exception {
// Start a member with no group
startNodeUsingClusterConfiguration(1);
// Start a member with group
String group = "group1";
Properties properties = new Properties();
properties.setProperty(GROUPS, group);
MemberVM vm2 = startNodeUsingClusterConfiguration(2, properties);
// Connect Gfsh to locator
gfshConnector.connectAndVerify(locator);
// Create index and region in no group
createLuceneIndexUsingGfsh();
createRegionUsingGfsh(REGION_NAME, RegionShortcut.PARTITION, null);
// Alter region in group
CommandResult alterRegionResult = alterRegionUsingGfsh(group);
TabularResultData alterRegionResultData = (TabularResultData) alterRegionResult.getResultData();
List<String> alterRegionResultDataStatus = alterRegionResultData.retrieveAllValues("Status");
// Verify region is altered on only one server
assertEquals(1, alterRegionResultDataStatus.size());
assertEquals("Region \"/" + REGION_NAME + "\" altered on \"" + vm2.getName() + "\"", alterRegionResultDataStatus.get(0));
// Start another member with group
startNodeUsingClusterConfiguration(3, properties);
// Verify all members have indexes
CommandResult listIndexesResult = listIndexesUsingGfsh();
TabularResultData listIndexesResultData = (TabularResultData) listIndexesResult.getResultData();
List<String> listIndexesResultDataStatus = listIndexesResultData.retrieveAllValues("Status");
assertEquals(3, listIndexesResultDataStatus.size());
for (String status : listIndexesResultDataStatus) {
assertEquals("Initialized", status);
}
}
Aggregations