Search in sources :

Example 26 with MemberVM

use of org.apache.geode.test.dunit.rules.MemberVM in project geode by apache.

the class LuceneClusterConfigurationDUnitTest method indexGetsCreatedUsingClusterConfiguration.

@Test
public void indexGetsCreatedUsingClusterConfiguration() throws Exception {
    Member vm1 = startNodeUsingClusterConfiguration(1);
    // Connect Gfsh to locator.
    gfshConnector.connectAndVerify(locator);
    // Create lucene index.
    createLuceneIndexUsingGfsh();
    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);
        validateIndexFields(new String[] { "field1", "field2", "field3" }, index);
    });
}
Also used : LuceneIndex(org.apache.geode.cache.lucene.LuceneIndex) MemberVM(org.apache.geode.test.dunit.rules.MemberVM) Member(org.apache.geode.test.dunit.rules.Member) LuceneService(org.apache.geode.cache.lucene.LuceneService) Test(org.junit.Test) DistributedTest(org.apache.geode.test.junit.categories.DistributedTest)

Example 27 with MemberVM

use of org.apache.geode.test.dunit.rules.MemberVM in project geode by apache.

the class NetstatDUnitTest method beforeClass.

@BeforeClass
public static void beforeClass() throws Exception {
    Properties properties = new Properties();
    // common properties
    properties.setProperty("locators", "localhost[" + ports[0] + "]");
    properties.setProperty("http-service-port", "0");
    // start peer locator
    properties.setProperty("start-locator", "localhost[" + ports[0] + "],peer=true,server=true");
    properties.setProperty("jmx-manager-port", ports[1] + "");
    lsRule.startServerVM(0, properties);
    // start server with jmx Manager as well
    properties.remove("start-locator");
    properties.setProperty("jmx-manager-port", ports[2] + "");
    MemberVM server = lsRule.startServerVM(1, properties);
    // start server with no jmx Manager
    properties.setProperty("jmx-manager", "false");
    properties.setProperty("jmx-manager-port", "0");
    properties.setProperty("jmx-manager-start", "false");
    lsRule.startServerVM(2, properties);
    // start another server
    lsRule.startServerVM(3, properties);
    netStatCommand = "netstat --with-lsof=false --member=" + server.getName();
    netStatLsofCommand = "netstat --with-lsof=true --member=" + server.getName();
}
Also used : MemberVM(org.apache.geode.test.dunit.rules.MemberVM) Properties(java.util.Properties) BeforeClass(org.junit.BeforeClass)

Aggregations

MemberVM (org.apache.geode.test.dunit.rules.MemberVM)27 DistributedTest (org.apache.geode.test.junit.categories.DistributedTest)19 Test (org.junit.Test)19 Properties (java.util.Properties)8 File (java.io.File)5 ZipFile (java.util.zip.ZipFile)3 Cache (org.apache.geode.cache.Cache)3 CommandResult (org.apache.geode.management.internal.cli.result.CommandResult)3 HashSet (java.util.HashSet)2 LuceneIndex (org.apache.geode.cache.lucene.LuceneIndex)2 LuceneService (org.apache.geode.cache.lucene.LuceneService)2 ClusterConfigurationService (org.apache.geode.distributed.internal.ClusterConfigurationService)2 InternalLocator (org.apache.geode.distributed.internal.InternalLocator)2 CommandStringBuilder (org.apache.geode.management.internal.cli.util.CommandStringBuilder)2 Before (org.junit.Before)2 FileOutputStream (java.io.FileOutputStream)1 OutputStream (java.io.OutputStream)1 Serializable (java.io.Serializable)1 URL (java.net.URL)1 URLClassLoader (java.net.URLClassLoader)1