Skip to content

Commit

Permalink
GEODE-3092: fix specifiedDefaultValue for cacheLoader and cacheWriter
Browse files Browse the repository at this point in the history
  • Loading branch information
jinmeiliao committed Jun 19, 2017
1 parent 87c26be commit c6d88f7
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,28 @@
*/
package org.apache.geode.management.internal.cli.commands;

import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.TreeSet;
import java.util.concurrent.atomic.AtomicReference;
import java.util.regex.Pattern;

import javax.management.MBeanServer;
import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;

import org.apache.commons.lang.StringUtils;
import org.springframework.shell.core.annotation.CliCommand;
import org.springframework.shell.core.annotation.CliOption;

import org.apache.geode.LogWriter;
import org.apache.geode.cache.DataPolicy;
import org.apache.geode.cache.ExpirationAttributes;
Expand Down Expand Up @@ -58,26 +79,6 @@
import org.apache.geode.management.internal.security.ResourceOperation;
import org.apache.geode.security.ResourcePermission.Operation;
import org.apache.geode.security.ResourcePermission.Resource;
import org.springframework.shell.core.annotation.CliAvailabilityIndicator;
import org.springframework.shell.core.annotation.CliCommand;
import org.springframework.shell.core.annotation.CliOption;

import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.TreeSet;
import java.util.concurrent.atomic.AtomicReference;
import java.util.regex.Pattern;
import javax.management.MBeanServer;
import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;

/**
* @since GemFire 7.0
Expand Down Expand Up @@ -408,9 +409,9 @@ public Result alterRegion(
help = CliStrings.ALTER_REGION__REGIONEXPIRATIONTTLACTION__HELP) String regionExpirationTTLAction,
@CliOption(key = CliStrings.ALTER_REGION__CACHELISTENER, specifiedDefaultValue = "",
help = CliStrings.ALTER_REGION__CACHELISTENER__HELP) String[] cacheListeners,
@CliOption(key = CliStrings.ALTER_REGION__CACHELOADER, specifiedDefaultValue = "null",
@CliOption(key = CliStrings.ALTER_REGION__CACHELOADER, specifiedDefaultValue = "",
help = CliStrings.ALTER_REGION__CACHELOADER__HELP) String cacheLoader,
@CliOption(key = CliStrings.ALTER_REGION__CACHEWRITER, specifiedDefaultValue = "null",
@CliOption(key = CliStrings.ALTER_REGION__CACHEWRITER, specifiedDefaultValue = "",
help = CliStrings.ALTER_REGION__CACHEWRITER__HELP) String cacheWriter,
@CliOption(key = CliStrings.ALTER_REGION__ASYNCEVENTQUEUEID, specifiedDefaultValue = "",
help = CliStrings.ALTER_REGION__ASYNCEVENTQUEUEID__HELP) String[] asyncEventQueueIds,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,16 @@
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;

import org.apache.geode.management.internal.cli.i18n.CliStrings;
import org.apache.geode.test.dunit.rules.GfshParserRule;
import org.apache.geode.test.junit.categories.IntegrationTest;
import java.util.Map;

import org.junit.ClassRule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.springframework.shell.event.ParseResult;

import java.util.Map;
import org.apache.geode.management.internal.cli.i18n.CliStrings;
import org.apache.geode.test.dunit.rules.GfshParserRule;
import org.apache.geode.test.junit.categories.IntegrationTest;

@Category(IntegrationTest.class)
public class GfshParserParsingTest {
Expand Down Expand Up @@ -290,4 +291,14 @@ public void testCommandWithBackSlashFour() throws Exception {
GfshParseResult result = parser.parse(command);
assertThat(result.getParamValue("name")).isEqualTo("\\u0005Name");
}

@Test
public void testAlterRegion() throws Exception {
String command =
"alter region --name=/Person --cache-writer='' --cache-listener='' --cache-loader=''";
GfshParseResult result = parser.parse(command);
assertThat(result.getParamValue("cache-writer")).isNotNull().isEmpty();
assertThat(result.getParamValue("cache-listener")).isNotNull().isEmpty();
assertThat(result.getParamValue("cache-loader")).isNotNull().isEmpty();
}
}

0 comments on commit c6d88f7

Please sign in to comment.