Skip to content

Commit

Permalink
The additional commit to #147.
Browse files Browse the repository at this point in the history
A bug was found and now it is fixed.
  • Loading branch information
TikhomirovSergey committed Sep 13, 2015
1 parent 6b91363 commit 86a3850
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,12 @@ protected ImmutableList<String> createArgs() {
Map.Entry<String, String> entry = iterator.next();
String argument = entry.getKey();
String value = entry.getValue();
if (StringUtils.isBlank(argument) || StringUtils.isBlank(value))
if (StringUtils.isBlank(argument) || value == null)
continue;

argList.add(argument);
argList.add(value);
if (!StringUtils.isBlank(value))
argList.add(value);
}

ImmutableList<String> result = new ImmutableList.Builder<String>().addAll(argList).build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public void checkAbilityToBuildServiceWithDefinedParametersAndNodeSetInPropertie
String definedNode = findCustomNode().getAbsolutePath();
System.setProperty(AppiumServiceBuilder.APPIUM_NODE_PROPERTY, definedNode);
AppiumDriverLocalService.buildService(new AppiumServiceBuilder().withIPAddress("127.0.0.1").
usingPort(4000).withArgument(GeneralServerFlag.LOG_TIMESTAMP,""));
usingPort(4000).withArgument(GeneralServerFlag.SESSION_OVERRIDE,""));
}
finally {
System.clearProperty(AppiumServiceBuilder.APPIUM_NODE_PROPERTY);
Expand All @@ -60,7 +60,7 @@ public void checkAbilityToStartServiceOnAFreePort(){
String definedNode = findCustomNode().getAbsolutePath();
System.setProperty(AppiumServiceBuilder.APPIUM_NODE_PROPERTY, definedNode);
AppiumDriverLocalService service = AppiumDriverLocalService.buildService(new AppiumServiceBuilder().withIPAddress("127.0.0.1").
usingAnyFreePort().withArgument(GeneralServerFlag.LOG_TIMESTAMP));
usingAnyFreePort().withArgument(GeneralServerFlag.SESSION_OVERRIDE));
service.start();
assertEquals(true, service.isRunning());
service.stop();
Expand All @@ -74,7 +74,7 @@ public void checkAbilityToStartServiceOnAFreePort(){
public void checkAbilityToBuildServiceWithDefinedParametersAndExternallyDefinedNode(){
File definedNode = findCustomNode();
AppiumDriverLocalService.buildService(new AppiumServiceBuilder().withAppiumJS(definedNode).withIPAddress("127.0.0.1").
usingPort(4000).withArgument(GeneralServerFlag.LOG_TIMESTAMP,""));
usingPort(4000).withArgument(GeneralServerFlag.SESSION_OVERRIDE,""));
}

@Test
Expand All @@ -85,13 +85,22 @@ public void checkStartingOfDefaultService(){
service.stop();
}

@Test
public void checkStartingOfDefaultServiceWithNonDefaultArguments(){
AppiumDriverLocalService service = new AppiumServiceBuilder().
withArgument(GeneralServerFlag.LOG_NO_COLORS).withIPAddress("127.0.0.1").build();
service.start();
assertEquals(true, service.isRunning());
service.stop();
}

@Test
public void checkStartingOfTheServiceDefinedByProperty(){
try {
String definedNode = findCustomNode().getAbsolutePath();
System.setProperty(AppiumServiceBuilder.APPIUM_NODE_PROPERTY, definedNode);
AppiumDriverLocalService service = AppiumDriverLocalService.buildService(new AppiumServiceBuilder().withIPAddress("127.0.0.1").
usingPort(4000).withArgument(GeneralServerFlag.LOG_TIMESTAMP));
usingPort(4000).withArgument(GeneralServerFlag.SESSION_OVERRIDE));
service.start();
assertEquals(true, service.isRunning());
service.stop();
Expand All @@ -105,7 +114,7 @@ public void checkStartingOfTheServiceDefinedByProperty(){
public void checkStartingOfTheServiceDefinedExternally(){
File definedNode = findCustomNode();
AppiumDriverLocalService service = AppiumDriverLocalService.buildService(new AppiumServiceBuilder().withAppiumJS(definedNode).withIPAddress("127.0.0.1").
usingPort(4000).withArgument(GeneralServerFlag.LOG_TIMESTAMP,""));
usingPort(4000).withArgument(GeneralServerFlag.SESSION_OVERRIDE,""));
service.start();
assertEquals(true, service.isRunning());
service.stop();
Expand Down

0 comments on commit 86a3850

Please sign in to comment.