This is an automated email from the ASF dual-hosted git repository.
jensdeppe pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git
The following commit(s) were added to refs/heads/develop by this push:
new 74933fa GEODE-3819: Refactor CreateRegionCommandDUnitTest to use gfsh
rules (#928)
74933fa is described below
commit 74933fa2dff26bbe3b74e74c0d670835209d5304
Author: Jens Deppe <[email protected]>
AuthorDate: Mon Oct 16 14:00:58 2017 -0700
GEODE-3819: Refactor CreateRegionCommandDUnitTest to use gfsh rules (#928)
* GEODE-3819: Refactor CreateRegionCommandDUnitTest to use gfsh rules
* GEODE-3819: Refactor CreateRegionCommandDUnitTest to use gfsh rules
* GEODE-3819: Refactor CreateRegionCommandDUnitTest to use gfsh rules
* GEODE-3819: Refactor CreateRegionCommandDUnitTest to use gfsh rules
---
.../internal/cli/commands/CreateRegionCommand.java | 26 +-
.../cli/commands/CreateRegionCommandDUnitTest.java | 334 ++++++---------------
.../cli/commands/CreateRegionCommandTest.java | 16 -
.../test/dunit/rules/LocatorServerStartupRule.java | 6 +
.../apache/geode/test/compiler/ClassBuilder.java | 7 -
5 files changed, 110 insertions(+), 279 deletions(-)
diff --git
a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/CreateRegionCommand.java
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/CreateRegionCommand.java
index 132efb8..e5aced8 100644
---
a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/CreateRegionCommand.java
+++
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/CreateRegionCommand.java
@@ -159,6 +159,7 @@ public class CreateRegionCommand implements GfshCommand {
) {
Result result;
AtomicReference<XmlEntity> xmlEntity = new AtomicReference<>();
+ String lastError = null;
try {
InternalCache cache = getCache();
@@ -252,7 +253,7 @@ public class CreateRegionCommand implements GfshCommand {
CliStrings.CREATE_REGION__MSG__OPTION_0_CAN_BE_USED_ONLY_FOR_PARTITIONEDREGION,
regionFunctionArgs.getPartitionArgs().getUserSpecifiedPartitionAttributes()) +
" "
+
CliStrings.format(CliStrings.CREATE_REGION__MSG__0_IS_NOT_A_PARITIONEDREGION,
- useAttributesFrom));
+ regionPath));
}
}
@@ -295,6 +296,8 @@ public class CreateRegionCommand implements GfshCommand {
if (success) {
xmlEntity.set(regionCreateResult.getXmlEntity());
+ } else {
+ lastError = regionCreateResult.getMessage();
}
}
result = ResultBuilder.buildResult(tabularResultData);
@@ -304,6 +307,11 @@ public class CreateRegionCommand implements GfshCommand {
LogWrapper.getInstance().info(e.getMessage());
result = ResultBuilder.createUserErrorResult(e.getMessage());
}
+
+ if (lastError != null) {
+ result = ResultBuilder.createUserErrorResult(lastError);
+ }
+
if (xmlEntity.get() != null) {
persistClusterConfiguration(result,
() -> getSharedConfiguration().addXmlEntity(xmlEntity.get(),
groups));
@@ -552,22 +560,6 @@ public class CreateRegionCommand implements GfshCommand {
new Object[] {regionFunctionArgs.getCompressor()}));
}
}
-
- if (regionFunctionArgs.hasPartitionAttributes()) {
- if (regionFunctionArgs.isPartitionResolverSet()) {
- String partitionResolverClassName =
regionFunctionArgs.getPartitionResolver();
- try {
- Class<PartitionResolver> resolverClass = (Class<PartitionResolver>)
ClassPathLoader
- .getLatest().forName(partitionResolverClassName);
- PartitionResolver partitionResolver = resolverClass.newInstance();
- } catch (InstantiationException | IllegalAccessException |
ClassNotFoundException e) {
- throw new IllegalArgumentException(
-
CliStrings.format(CliStrings.CREATE_REGION__MSG__INVALID_PARTITION_RESOLVER,
- new Object[] {regionFunctionArgs.getPartitionResolver()}),
- e);
- }
- }
- }
}
private static <K, V>
FetchRegionAttributesFunction.FetchRegionAttributesFunctionResult<K, V>
getRegionAttributes(
diff --git
a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/CreateRegionCommandDUnitTest.java
b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/CreateRegionCommandDUnitTest.java
index 3adb0d3..41155a0 100644
---
a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/CreateRegionCommandDUnitTest.java
+++
b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/CreateRegionCommandDUnitTest.java
@@ -15,290 +15,146 @@
package org.apache.geode.management.internal.cli.commands;
-import static org.apache.geode.test.dunit.LogWriterUtils.getLogWriter;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import static org.assertj.core.api.Assertions.assertThat;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.List;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import org.apache.geode.cache.PartitionAttributes;
+import org.apache.geode.cache.Cache;
import org.apache.geode.cache.PartitionResolver;
import org.apache.geode.cache.Region;
import org.apache.geode.compression.SnappyCompressor;
-import org.apache.geode.test.compiler.ClassBuilder;
import org.apache.geode.internal.cache.PartitionedRegion;
import org.apache.geode.internal.cache.RegionEntryContext;
-import org.apache.geode.management.cli.Result;
-import org.apache.geode.management.internal.cli.i18n.CliStrings;
import org.apache.geode.management.internal.cli.result.CommandResult;
-import org.apache.geode.management.internal.cli.util.CommandStringBuilder;
-import org.apache.geode.test.dunit.Host;
-import org.apache.geode.test.dunit.VM;
+import org.apache.geode.test.compiler.JarBuilder;
+import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
+import org.apache.geode.test.dunit.rules.MemberVM;
import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.categories.FlakyTest;
-
-@Category({DistributedTest.class, FlakyTest.class}) // GEODE-973 GEODE-3530
-@SuppressWarnings("serial")
-public class CreateRegionCommandDUnitTest extends CliCommandTestBase {
-
- private final List<String> filesToBeDeleted = new CopyOnWriteArrayList<>();
+import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.serializable.SerializableTestName;
+import org.json.JSONArray;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.rules.TemporaryFolder;
+import org.junit.rules.TestName;
- /**
- * Asserts that the "compressor" option for the "create region" command
succeeds for a recognized
- * compressor.
- */
- @Test
- public void testCreateRegionWithGoodCompressor() {
- setUpJmxManagerOnVm0ThenConnect(null);
- VM vm = Host.getHost(0).getVM(1);
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
- // Create a cache in vm 1
- vm.invoke(() -> assertNotNull(getCache()));
+@Category(DistributedTest.class)
+public class CreateRegionCommandDUnitTest {
- // Run create region command with compression
- CommandStringBuilder commandStringBuilder = new
CommandStringBuilder(CliStrings.CREATE_REGION);
- commandStringBuilder.addOption(CliStrings.CREATE_REGION__REGION,
"compressedRegion");
- commandStringBuilder.addOption(CliStrings.CREATE_REGION__REGIONSHORTCUT,
"REPLICATE");
- commandStringBuilder.addOption(CliStrings.CREATE_REGION__COMPRESSOR,
- RegionEntryContext.DEFAULT_COMPRESSION_PROVIDER);
- CommandResult cmdResult = executeCommand(commandStringBuilder.toString());
- assertEquals(Result.Status.OK, cmdResult.getStatus());
+ MemberVM locator;
+ MemberVM server;
- // Make sure our region exists with compression enabled
- vm.invoke(() -> {
- Region region = getCache().getRegion("compressedRegion");
- assertNotNull(region);
- assertTrue(
-
SnappyCompressor.getDefaultInstance().equals(region.getAttributes().getCompressor()));
- });
+ @Rule
+ public LocatorServerStartupRule lsRule = new LocatorServerStartupRule();
- // cleanup
- commandStringBuilder = new CommandStringBuilder(CliStrings.DESTROY_REGION);
- commandStringBuilder.addOption(CliStrings.DESTROY_REGION__REGION,
"compressedRegion");
- cmdResult = executeCommand(commandStringBuilder.toString());
- assertEquals(Result.Status.OK, cmdResult.getStatus());
- }
+ @Rule
+ public GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
- /**
- * Asserts that the "compressor" option for the "create region" command
fails for an unrecognized
- * compressorc.
- */
- @Test
- public void testCreateRegionWithBadCompressor() {
- setUpJmxManagerOnVm0ThenConnect(null);
+ @Rule
+ public TestName testName = new SerializableTestName();
- VM vm = Host.getHost(0).getVM(1);
+ @Rule
+ public TemporaryFolder tmpDir = new TemporaryFolder();
- // Create a cache in vm 1
- vm.invoke(() -> assertNotNull(getCache()));
+ @Before
+ public void before() throws Exception {
+ locator = lsRule.startLocatorVM(0);
+ server = lsRule.startServerVM(1, locator.getPort());
- // Create a region with an unrecognized compressor
- CommandStringBuilder commandStringBuilder = new
CommandStringBuilder(CliStrings.CREATE_REGION);
- commandStringBuilder.addOption(CliStrings.CREATE_REGION__REGION,
"compressedRegion");
- commandStringBuilder.addOption(CliStrings.CREATE_REGION__REGIONSHORTCUT,
"REPLICATE");
- commandStringBuilder.addOption(CliStrings.CREATE_REGION__COMPRESSOR,
"BAD_COMPRESSOR");
- CommandResult cmdResult = executeCommand(commandStringBuilder.toString());
- assertEquals(Result.Status.ERROR, cmdResult.getStatus());
+ gfsh.connectAndVerify(locator);
+ }
- // Assert that our region was not created
- vm.invoke(() -> {
- Region region = getCache().getRegion("compressedRegion");
- assertNull(region);
+ @Test
+ public void testCreateRegionWithGoodCompressor() throws Exception {
+ String regionName = testName.getMethodName();
+ gfsh.executeAndVerifyCommand("create region --name=" + regionName
+ + " --type=REPLICATE --compressor=" +
RegionEntryContext.DEFAULT_COMPRESSION_PROVIDER);
+
+ server.invoke(() -> {
+ Cache cache = LocatorServerStartupRule.serverStarter.getCache();
+ Region region = cache.getRegion(regionName);
+ assertThat(region).isNotNull();
+ assertThat(region.getAttributes().getCompressor())
+ .isEqualTo(SnappyCompressor.getDefaultInstance());
});
}
- /**
- * Asserts that a missing "compressor" option for the "create region"
command results in a region
- * with no compression.
- */
@Test
- public void testCreateRegionWithNoCompressor() {
- setUpJmxManagerOnVm0ThenConnect(null);
-
- VM vm = Host.getHost(0).getVM(1);
-
- // Create a cache in vm 1
- vm.invoke(() -> assertNotNull(getCache()));
-
- // Create a region with no compression
- CommandStringBuilder commandStringBuilder = new
CommandStringBuilder(CliStrings.CREATE_REGION);
- commandStringBuilder.addOption(CliStrings.CREATE_REGION__REGION,
"testRegion");
- commandStringBuilder.addOption(CliStrings.CREATE_REGION__REGIONSHORTCUT,
"REPLICATE");
- CommandResult cmdResult = executeCommand(commandStringBuilder.toString());
- assertEquals(Result.Status.OK, cmdResult.getStatus());
-
- // Assert that our newly created region has no compression
- vm.invoke(() -> {
- Region region = getCache().getRegion("testRegion");
- assertNotNull(region);
- assertNull(region.getAttributes().getCompressor());
+ public void testCreateRegionWithBadCompressor() throws Exception {
+ String regionName = testName.getMethodName();
+ gfsh.executeAndVerifyCommandError(
+ "create region --name=" + regionName + " --type=REPLICATE
--compressor=BAD_COMPRESSOR");
+
+ server.invoke(() -> {
+ Cache cache = LocatorServerStartupRule.serverStarter.getCache();
+ Region region = cache.getRegion(regionName);
+ assertThat(region).isNull();
});
-
- // Cleanup
- commandStringBuilder = new CommandStringBuilder(CliStrings.DESTROY_REGION);
- commandStringBuilder.addOption(CliStrings.DESTROY_REGION__REGION,
"testRegion");
- cmdResult = executeCommand(commandStringBuilder.toString());
- assertEquals(Result.Status.OK, cmdResult.getStatus());
}
- @Test // FlakyTest: GEODE-973
- public void testCreateRegion46391() throws IOException {
- setUpJmxManagerOnVm0ThenConnect(null); // GEODE-973: getRandomAvailablePort
- String region46391 = "region46391";
- String command = CliStrings.CREATE_REGION + " --" +
CliStrings.CREATE_REGION__REGION + "="
- + region46391 + " --" + CliStrings.CREATE_REGION__REGIONSHORTCUT +
"=REPLICATE";
-
- getLogWriter().info("testCreateRegion46391 create region command=" +
command);
-
- CommandResult cmdResult = executeCommand(command);
- assertEquals(Result.Status.OK, cmdResult.getStatus());
-
- command = CliStrings.PUT + " --" + CliStrings.PUT__KEY + "=k1" + " --" +
CliStrings.PUT__VALUE
- + "=k1" + " --" + CliStrings.PUT__REGIONNAME + "=" + region46391;
-
- getLogWriter().info("testCreateRegion46391 put command=" + command);
-
- CommandResult cmdResult2 = executeCommand(command);
- assertEquals(Result.Status.OK, cmdResult2.getStatus());
-
- getLogWriter().info("testCreateRegion46391 cmdResult2=" +
commandResultToString(cmdResult2));
- String str1 = "Result : true";
- String str2 = "Key : k1";
- String str3 = "Key Class : java.lang.String";
- String str4 = "Value Class : java.lang.String";
- String str5 = "Old Value : <NULL>";
-
- assertTrue(
- commandResultToString(cmdResult).contains("Region \"/" + region46391 +
"\" created on"));
-
- assertTrue(commandResultToString(cmdResult2).contains(str1));
- assertTrue(commandResultToString(cmdResult2).contains(str2));
- assertTrue(commandResultToString(cmdResult2).contains(str3));
- assertTrue(commandResultToString(cmdResult2).contains(str4));
- assertTrue(commandResultToString(cmdResult2).contains(str5));
+ @Test
+ public void testCreateRegionWithNoCompressor() throws Exception {
+ String regionName = testName.getMethodName();
+ gfsh.executeAndVerifyCommand("create region --name=" + regionName + "
--type=REPLICATE");
+
+ server.invoke(() -> {
+ Cache cache = LocatorServerStartupRule.serverStarter.getCache();
+ Region region = cache.getRegion(regionName);
+ assertThat(region).isNotNull();
+ assertThat(region.getAttributes().getCompressor()).isNull();
+ });
}
- /**
- * Test Description 1. Deploy a JAR with Custom Partition Resolver 2. Create
Region with Partition
- * Resolver 3. Region should get created with no Errors 4. Verify Region
Partition Attributes for
- * Partition Resolver
- */
@Test
- public void testCreateRegionWithPartitionResolver() throws IOException {
- setUpJmxManagerOnVm0ThenConnect(null);
- VM vm = Host.getHost(0).getVM(1);
- // Create a cache in vm 1
- vm.invoke(() -> assertNotNull(getCache()));
-
- ClassBuilder classBuilder = new ClassBuilder();
- // classBuilder.addToClassPath(".");
- final File prJarFile = new
File(temporaryFolder.getRoot().getCanonicalPath() + File.separator,
- "myPartitionResolver.jar");
- this.filesToBeDeleted.add(prJarFile.getAbsolutePath());
- String PR_STRING = " package com.cadrdunit;"
- + " public class TestPartitionResolver implements
org.apache.geode.cache.PartitionResolver { "
+ public void testCreateRegionWithPartitionResolver() throws Exception {
+ String regionName = testName.getMethodName();
+ String PR_STRING = "package io.pivotal; "
+ + "public class TestPartitionResolver implements
org.apache.geode.cache.PartitionResolver { "
+ " @Override" + " public void close() {" + " }" + " @Override"
+ " public Object
getRoutingObject(org.apache.geode.cache.EntryOperation opDetails) { "
+ " return null; " + " }" + " @Override" + " public String
getName() { "
+ " return \"TestPartitionResolver\";" + " }" + " }";
- byte[] jarBytes =
-
classBuilder.createJarFromClassContent("com/cadrdunit/TestPartitionResolver",
PR_STRING);
- writeJarBytesToFile(prJarFile, jarBytes);
+ final File prJarFile = new File(tmpDir.getRoot(),
"myPartitionResolver.jar");
+ new JarBuilder().buildJar(prJarFile, PR_STRING);
- CommandResult cmdResult = executeCommand("deploy --jar=" +
prJarFile.getAbsolutePath());
- assertEquals(Result.Status.OK, cmdResult.getStatus());
+ gfsh.executeAndVerifyCommand("deploy --jar=" +
prJarFile.getAbsolutePath());
+ gfsh.executeAndVerifyCommand("create region --name=" + regionName
+ + " --type=PARTITION
--partition-resolver=io.pivotal.TestPartitionResolver");
- // Create a region with an unrecognized compressor
- CommandStringBuilder commandStringBuilder = new
CommandStringBuilder(CliStrings.CREATE_REGION);
- commandStringBuilder.addOption(CliStrings.CREATE_REGION__REGION,
"regionWithPartitionResolver");
- commandStringBuilder.addOption(CliStrings.CREATE_REGION__REGIONSHORTCUT,
"PARTITION");
-
commandStringBuilder.addOption(CliStrings.CREATE_REGION__PARTITION_RESOLVER,
- "com.cadrdunit.TestPartitionResolver");
- CommandResult cmdResult1 = executeCommand(commandStringBuilder.toString());
- assertEquals(Result.Status.OK, cmdResult1.getStatus());
-
- // Assert that our region was not created
- vm.invoke(() -> {
- Region region = getCache().getRegion("regionWithPartitionResolver");
- assertNotNull(region);
-
- PartitionedRegion pr = (PartitionedRegion) region;
- PartitionAttributes partitionAttributes = pr.getPartitionAttributes();
- assertNotNull(partitionAttributes);
- PartitionResolver partitionResolver =
partitionAttributes.getPartitionResolver();
- assertNotNull(partitionResolver);
- assertEquals("TestPartitionResolver", partitionResolver.getName());
+ server.invoke(() -> {
+ Cache cache = LocatorServerStartupRule.serverStarter.getCache();
+ PartitionedRegion region = (PartitionedRegion)
cache.getRegion(regionName);
+ PartitionResolver resolver =
region.getPartitionAttributes().getPartitionResolver();
+ assertThat(resolver).isNotNull();
+ assertThat(resolver.getName()).isEqualTo("TestPartitionResolver");
});
-
- vm.invoke(() ->
getCache().getRegion("regionWithPartitionResolver").destroyRegion());
}
@Test
- public void testCreateRegionWithInvalidPartitionResolver() {
- setUpJmxManagerOnVm0ThenConnect(null);
- VM vm = Host.getHost(0).getVM(1);
- // Create a cache in vm 1
- vm.invoke(() -> assertNotNull(getCache()));
-
- // Create a region with an unrecognized compressor
- CommandStringBuilder commandStringBuilder = new
CommandStringBuilder(CliStrings.CREATE_REGION);
- commandStringBuilder.addOption(CliStrings.CREATE_REGION__REGION,
- "testCreateRegionWithInvalidPartitionResolver");
- commandStringBuilder.addOption(CliStrings.CREATE_REGION__REGIONSHORTCUT,
"PARTITION");
-
commandStringBuilder.addOption(CliStrings.CREATE_REGION__PARTITION_RESOLVER,
"a.b.c.d");
- CommandResult cmdResult = executeCommand(commandStringBuilder.toString());
- assertEquals(Result.Status.ERROR, cmdResult.getStatus());
-
- // Assert that our region was not created
- vm.invoke(() -> {
- Region region =
getCache().getRegion("testCreateRegionWithInvalidPartitionResolver");
- assertNull(region);
- });
+ public void testCreateRegionWithInvalidPartitionResolver() throws Exception {
+ gfsh.executeAndVerifyCommandError("create region --name=" +
testName.getMethodName()
+ + " --type=PARTITION --partition-resolver=InvalidPartitionResolver");
}
- /**
- * Test Description Try creating region of type REPLICATED and specify
partition resolver Region
- * Creation should fail.
- */
@Test
- public void testCreateRegionForReplicatedRegionWithParitionResolver() {
- setUpJmxManagerOnVm0ThenConnect(null);
- VM vm = Host.getHost(0).getVM(1);
- // Create a cache in vm 1
- vm.invoke(() -> assertNotNull(getCache()));
+ public void testCreateRegionForReplicatedRegionWithPartitionResolver() {
+ String regionName = testName.getMethodName();
+ CommandResult result = gfsh.executeAndVerifyCommandError("create region
--name=" + regionName
+ + " --type=REPLICATE --partition-resolver=InvalidPartitionResolver");
- // Create a region with an unrecognized compressor
- CommandStringBuilder commandStringBuilder = new
CommandStringBuilder(CliStrings.CREATE_REGION);
- commandStringBuilder.addOption(CliStrings.CREATE_REGION__REGION,
- "testCreateRegionForReplicatedRegionWithParitionResolver");
- commandStringBuilder.addOption(CliStrings.CREATE_REGION__REGIONSHORTCUT,
"REPLICATE");
-
commandStringBuilder.addOption(CliStrings.CREATE_REGION__PARTITION_RESOLVER,
"a.b.c.d");
- CommandResult cmdResult = executeCommand(commandStringBuilder.toString());
- assertEquals(Result.Status.ERROR, cmdResult.getStatus());
-
- // Assert that our region was not created
- vm.invoke(() -> {
- Region region =
-
getCache().getRegion("testCreateRegionForReplicatedRegionWithParitionResolver");
- assertNull(region);
- });
+ assertThat(((String) ((JSONArray)
result.getContent().get("message")).get(0)))
+ .contains("\"" + regionName + "\" is not a Partitioned Region");
}
private void writeJarBytesToFile(File jarFile, byte[] jarBytes) throws
IOException {
- final OutputStream outStream = new FileOutputStream(jarFile);
- outStream.write(jarBytes);
- outStream.flush();
- outStream.close();
+ try (OutputStream os = new FileOutputStream(jarFile)) {
+ os.write(jarBytes);
+ }
}
}
diff --git
a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/CreateRegionCommandTest.java
b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/CreateRegionCommandTest.java
index a187bd7..a4e2eb4 100644
---
a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/CreateRegionCommandTest.java
+++
b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/CreateRegionCommandTest.java
@@ -38,22 +38,6 @@ public class CreateRegionCommandTest {
public GfshParserRule parser = new GfshParserRule();
@Test
- public void testCreateRegionWithInvalidPartitionResolver() throws Exception {
- InternalCache cache = mock(InternalCache.class);
- DistributedSystemMXBean dsMBean = mock(DistributedSystemMXBean.class);
- CreateRegionCommand spy = Mockito.spy(CreateRegionCommand.class);
-
- doReturn(cache).when(spy).getCache();
- doReturn(dsMBean).when(spy).getDSMBean(cache);
-
- String command = "create region --name=region3 --type=PARTITION
--partition-resolver=Foo";
- CommandResult result = parser.executeCommandWithInstance(spy, command);
-
- assertThat(result.getStatus()).isEqualTo(Result.Status.ERROR);
- assertThat(result.getContent().toString()).contains("Foo is an invalid
Partition Resolver");
- }
-
- @Test
public void testRegionExistsReturnsCorrectValue() throws Exception {
InternalCache cache = mock(InternalCache.class);
assertThat(regionExists(cache, null)).isFalse();
diff --git
a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/LocatorServerStartupRule.java
b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/LocatorServerStartupRule.java
index 3079373..ae8c2ff 100644
---
a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/LocatorServerStartupRule.java
+++
b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/LocatorServerStartupRule.java
@@ -208,6 +208,12 @@ public class LocatorServerStartupRule extends
ExternalResource implements Serial
return startServerVM(index, properties, -1);
}
+ public MemberVM startServerAsJmxManager(int index, Properties properties,
int locatorPort)
+ throws IOException {
+ properties.setProperty(JMX_MANAGER_PORT,
AvailablePortHelper.getRandomAvailableTCPPort() + "");
+ return startServerVM(index, properties, locatorPort);
+ }
+
public MemberVM startServerAsEmbededLocator(int index) throws IOException {
return startServerAsEmbededLocator(index, new Properties());
}
diff --git
a/geode-junit/src/main/java/org/apache/geode/test/compiler/ClassBuilder.java
b/geode-junit/src/main/java/org/apache/geode/test/compiler/ClassBuilder.java
index c51a0f8..aae21a4 100644
--- a/geode-junit/src/main/java/org/apache/geode/test/compiler/ClassBuilder.java
+++ b/geode-junit/src/main/java/org/apache/geode/test/compiler/ClassBuilder.java
@@ -145,13 +145,6 @@ public class ClassBuilder implements Serializable {
formattedName = formattedName.concat(".class");
}
- // If the class is in a package create a directory entry in the JAR file
for the package.
- if (className.contains("/")) {
- JarEntry entry = new JarEntry(className.substring(0,
className.lastIndexOf('/')));
- entry.setTime(System.currentTimeMillis());
- jarOutputStream.putNextEntry(entry);
- }
-
JarEntry entry = new JarEntry(formattedName);
entry.setTime(System.currentTimeMillis());
jarOutputStream.putNextEntry(entry);
--
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].