/** * Validates the arguments passed to the Builder when the 'start' command has been issued. * * @see org.apache.geode.distributed.ServerLauncher.Command#START */ void validateOnStart() { if (Command.START == getCommand()) { if (isBlank(getMemberName()) && !isSet(System.getProperties(), DistributionConfig.GEMFIRE_PREFIX + NAME) && !isSet(getDistributedSystemProperties(), NAME) && !isSet(loadGemFireProperties(DistributedSystem.getPropertyFileURL()), NAME)) { throw new IllegalStateException( String.format( MEMBER_NAME_ERROR_MESSAGE, "Server", "Server")); } if (!CURRENT_DIRECTORY.equalsIgnoreCase(getWorkingDirectory())) { throw new IllegalStateException( String.format( AbstractLauncher.WORKING_DIRECTORY_OPTION_NOT_VALID_ERROR_MESSAGE, "Server", "Server")); } } }
/** * Validates the arguments passed to the Builder when the 'start' command has been issued. * * @see org.apache.geode.distributed.LocatorLauncher.Command#START */ protected void validateOnStart() { if (Command.START == getCommand()) { if (isBlank(getMemberName()) && !isSet(System.getProperties(), DistributionConfig.GEMFIRE_PREFIX + NAME) && !isSet(getDistributedSystemProperties(), NAME) && !isSet(loadGemFireProperties(DistributedSystem.getPropertyFileURL()), NAME)) { throw new IllegalStateException( String.format( AbstractLauncher.MEMBER_NAME_ERROR_MESSAGE, "Locator", "Locator")); } if (!CURRENT_DIRECTORY.equalsIgnoreCase(getWorkingDirectory())) { throw new IllegalStateException( String.format( AbstractLauncher.WORKING_DIRECTORY_OPTION_NOT_VALID_ERROR_MESSAGE, "Locator", "Locator")); } } }
@Test public void isSetReturnsFalseIfPropertyHasEmptyValue() throws Exception { Properties properties = new Properties(); properties.setProperty(NAME, ""); assertThat(AbstractLauncher.isSet(properties, NAME)).isFalse(); }
@Test public void isSetReturnsTrueIfPropertyHasRealValue() throws Exception { Properties properties = new Properties(); properties.setProperty(NAME, "memberOne"); assertThat(AbstractLauncher.isSet(properties, NAME)).isTrue(); }
@Test public void isSetReturnsFalseIfPropertyHasBlankValue() throws Exception { Properties properties = new Properties(); properties.setProperty(NAME, " "); assertThat(AbstractLauncher.isSet(properties, NAME)).isFalse(); }
@Test public void isSetKeyIsCaseSensitive() throws Exception { Properties properties = new Properties(); properties.setProperty(NAME, "memberOne"); assertThat(AbstractLauncher.isSet(properties, "NaMe")).isFalse(); }
@Test public void isSetReturnsFalseIfPropertyDoesNotExist() throws Exception { assertThat(AbstractLauncher.isSet(new Properties(), NAME)).isFalse(); }