use of org.apache.whirr.ClusterController in project whirr by apache.
the class BaseServiceDryRunTest method launchWithClusterSpec.
protected DryRun launchWithClusterSpec(ClusterSpec clusterSpec) throws IOException, InterruptedException {
ClusterController controller = new ClusterController();
DryRun dryRun = controller.getCompute().apply(clusterSpec).utils().injector().getInstance(DryRun.class);
dryRun.reset();
controller.launchCluster(clusterSpec);
return dryRun;
}
use of org.apache.whirr.ClusterController in project whirr by apache.
the class DruidServiceTest method setUp.
@Before
public void setUp() throws Exception {
CompositeConfiguration config = new CompositeConfiguration();
config.addConfiguration(new PropertiesConfiguration("whirr-druid-test.properties"));
if (System.getProperty("config") != null) {
config.addConfiguration(new PropertiesConfiguration(System.getProperty("config")));
}
clusterSpec = ClusterSpec.withTemporaryKeys(config);
controller = new ClusterController();
// controller = new ClusterControllerFactory().create(clusterSpec.getServiceName());
cluster = controller.launchCluster(clusterSpec);
}
use of org.apache.whirr.ClusterController in project whirr by apache.
the class ChefServiceTest method setUp.
// private static Cluster cluster;
@BeforeClass
public static void setUp() throws Exception {
CompositeConfiguration config = new CompositeConfiguration();
if (System.getProperty("config") != null) {
config.addConfiguration(new PropertiesConfiguration(System.getProperty("config")));
}
config.addConfiguration(new PropertiesConfiguration("whirr-chef-test.properties"));
clusterSpec = ClusterSpec.withTemporaryKeys(config);
controller = new ClusterController();
controller.launchCluster(clusterSpec);
}
use of org.apache.whirr.ClusterController in project whirr by apache.
the class HamaServiceController method startup.
public synchronized void startup() throws Exception {
LOG.info("Starting up cluster...");
CompositeConfiguration config = new CompositeConfiguration();
if (System.getProperty("config") != null) {
config.addConfiguration(new PropertiesConfiguration(System.getProperty("config")));
}
config.addConfiguration(new PropertiesConfiguration(HamaServiceController.class.getResource("/whirr-hama-test.properties")));
clusterSpec = ClusterSpec.withTemporaryKeys(config);
controller = new ClusterController();
cluster = controller.launchCluster(clusterSpec);
proxy = new HadoopProxy(clusterSpec, cluster);
proxy.start();
HamaConfiguration conf = getConfiguration();
BSPJobClient client = new BSPJobClient(conf);
waitForGroomServers(client);
running = true;
}
use of org.apache.whirr.ClusterController in project whirr by apache.
the class DestroyClusterCommandTest method testAllOptions.
@Test
public void testAllOptions() throws Exception {
ClusterControllerFactory factory = mock(ClusterControllerFactory.class);
ClusterController controller = mock(ClusterController.class);
when(factory.create((String) any())).thenReturn(controller);
DestroyClusterCommand command = new DestroyClusterCommand(factory);
Map<String, File> keys = KeyPair.generateTemporaryFiles();
int rc = command.run(null, out, null, Lists.newArrayList("--instance-templates", "1 noop", "--service-name", "test-service", "--cluster-name", "test-cluster", "--provider", "rackspace", "--identity", "myusername", "--credential", "mypassword", "--private-key-file", keys.get("private").getAbsolutePath(), "--version", "version-string"));
assertThat(rc, is(0));
Configuration conf = new PropertiesConfiguration();
conf.addProperty("whirr.version", "version-string");
conf.addProperty("whirr.instance-templates", "1 noop");
ClusterSpec expectedClusterSpec = ClusterSpec.withTemporaryKeys(conf);
expectedClusterSpec.setServiceName("test-service");
expectedClusterSpec.setProvider("rackspace");
expectedClusterSpec.setIdentity("myusername");
expectedClusterSpec.setCredential("mypassword");
expectedClusterSpec.setClusterName("test-cluster");
expectedClusterSpec.setPrivateKey(keys.get("private"));
expectedClusterSpec.setPublicKey(keys.get("public"));
verify(factory).create("test-service");
verify(controller).destroyCluster(expectedClusterSpec);
}
Aggregations