You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whirr.apache.org by fr...@apache.org on 2012/03/07 22:14:33 UTC
svn commit: r1298124 - in
/whirr/trunk/cli/src/test/java/org/apache/whirr/cli/command:
DestroyClusterCommandTest.java LaunchClusterCommandTest.java
ListClusterCommandTest.java
Author: frankscholten
Date: Wed Mar 7 21:14:32 2012
New Revision: 1298124
URL: http://svn.apache.org/viewvc?rev=1298124&view=rev
Log:
WHIRR-549. Remove dependency on system SSH keys in tests
Modified:
whirr/trunk/cli/src/test/java/org/apache/whirr/cli/command/DestroyClusterCommandTest.java
whirr/trunk/cli/src/test/java/org/apache/whirr/cli/command/LaunchClusterCommandTest.java
whirr/trunk/cli/src/test/java/org/apache/whirr/cli/command/ListClusterCommandTest.java
Modified: whirr/trunk/cli/src/test/java/org/apache/whirr/cli/command/DestroyClusterCommandTest.java
URL: http://svn.apache.org/viewvc/whirr/trunk/cli/src/test/java/org/apache/whirr/cli/command/DestroyClusterCommandTest.java?rev=1298124&r1=1298123&r2=1298124&view=diff
==============================================================================
--- whirr/trunk/cli/src/test/java/org/apache/whirr/cli/command/DestroyClusterCommandTest.java (original)
+++ whirr/trunk/cli/src/test/java/org/apache/whirr/cli/command/DestroyClusterCommandTest.java Wed Mar 7 21:14:32 2012
@@ -28,7 +28,6 @@ import org.apache.whirr.util.KeyPair;
import org.junit.Test;
import java.io.File;
-import java.util.Collections;
import java.util.Map;
import static org.hamcrest.Matchers.containsString;
@@ -44,7 +43,10 @@ public class DestroyClusterCommandTest e
@Test
public void testInsufficientOptions() throws Exception {
DestroyClusterCommand command = new DestroyClusterCommand();
- int rc = command.run(null, null, err, Collections.<String>emptyList());
+ Map<String, File> keys = KeyPair.generateTemporaryFiles();
+ int rc = command.run(null, null, err, Lists.<String>newArrayList(
+ "--private-key-file", keys.get("private").getAbsolutePath())
+ );
assertThat(rc, is(-1));
assertThat(errBytes.toString(), containsString("Option 'cluster-name' not set"));
}
Modified: whirr/trunk/cli/src/test/java/org/apache/whirr/cli/command/LaunchClusterCommandTest.java
URL: http://svn.apache.org/viewvc/whirr/trunk/cli/src/test/java/org/apache/whirr/cli/command/LaunchClusterCommandTest.java?rev=1298124&r1=1298123&r2=1298124&view=diff
==============================================================================
--- whirr/trunk/cli/src/test/java/org/apache/whirr/cli/command/LaunchClusterCommandTest.java (original)
+++ whirr/trunk/cli/src/test/java/org/apache/whirr/cli/command/LaunchClusterCommandTest.java Wed Mar 7 21:14:32 2012
@@ -18,7 +18,6 @@
package org.apache.whirr.cli.command;
-import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import org.apache.commons.configuration.Configuration;
import org.apache.commons.configuration.PropertiesConfiguration;
@@ -33,7 +32,6 @@ import org.hamcrest.MatcherAssert;
import org.junit.Test;
import java.io.File;
-import java.util.Collections;
import java.util.Map;
import static org.hamcrest.Matchers.containsString;
@@ -49,7 +47,10 @@ public class LaunchClusterCommandTest ex
@Test
public void testInsufficientArgs() throws Exception {
LaunchClusterCommand command = new LaunchClusterCommand();
- int rc = command.run(null, null, err, Collections.<String>emptyList());
+ Map<String, File> keys = KeyPair.generateTemporaryFiles();
+ int rc = command.run(null, null, err, Lists.<String>newArrayList(
+ "--private-key-file", keys.get("private").getAbsolutePath())
+ );
assertThat(rc, is(-1));
assertThat(errBytes.toString(), containsString("Option 'cluster-name' not set."));
}
@@ -159,13 +160,15 @@ public class LaunchClusterCommandTest ex
ClusterControllerFactory factory = new ClusterControllerFactory();
LaunchClusterCommand launchCluster = new LaunchClusterCommand(factory);
+ Map<String, File> keys = KeyPair.generateTemporaryFiles();
- int rc = launchCluster.run(null, out, err, ImmutableList.of(
+ int rc = launchCluster.run(null, out, err, Lists.<String>newArrayList(
"--cluster-name", "test-cluster-launch",
"--state-store", "none",
"--instance-templates", "1 zookeeper+cassandra, 1 zookeeper+elasticsearch",
"--provider", "stub",
- "--identity", "dummy"
+ "--identity", "dummy",
+ "--private-key-file", keys.get("private").getAbsolutePath()
));
MatcherAssert.assertThat(rc, is(0));
Modified: whirr/trunk/cli/src/test/java/org/apache/whirr/cli/command/ListClusterCommandTest.java
URL: http://svn.apache.org/viewvc/whirr/trunk/cli/src/test/java/org/apache/whirr/cli/command/ListClusterCommandTest.java?rev=1298124&r1=1298123&r2=1298124&view=diff
==============================================================================
--- whirr/trunk/cli/src/test/java/org/apache/whirr/cli/command/ListClusterCommandTest.java (original)
+++ whirr/trunk/cli/src/test/java/org/apache/whirr/cli/command/ListClusterCommandTest.java Wed Mar 7 21:14:32 2012
@@ -31,7 +31,6 @@ import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import java.io.File;
-import java.util.Collections;
import java.util.Map;
import java.util.Set;
@@ -56,7 +55,10 @@ public class ListClusterCommandTest exte
@Test
public void testInsufficientOptions() throws Exception {
ListClusterCommand command = new ListClusterCommand();
- int rc = command.run(null, null, err, Collections.<String>emptyList());
+ Map<String, File> keys = KeyPair.generateTemporaryFiles();
+ int rc = command.run(null, null, err, Lists.<String>newArrayList(
+ "--private-key-file", keys.get("private").getAbsolutePath())
+ );
assertThat(rc, is(-1));
assertThat(errBytes.toString(), containsString("Option 'cluster-name' not set."));
}