use of org.apache.whirr.Cluster in project whirr by apache.
the class CassandraClusterActionHandler method beforeConfigure.
@Override
protected void beforeConfigure(final ClusterActionEvent event) throws IOException, InterruptedException {
Cluster cluster = event.getCluster();
Set<Instance> instances = cluster.getInstancesMatching(role(CASSANDRA_ROLE));
event.getFirewallManager().addRule(Rule.create().destination(instances).ports(CLIENT_PORT, JMX_PORT));
handleFirewallRules(event);
setInitialTokensAsEnvironmentVariables(event, instances);
List<Instance> seeds = getSeeds(instances);
String seedServers = Joiner.on(' ').join(getPrivateIps(seeds));
addStatement(event, call("configure_cassandra", seedServers));
}
use of org.apache.whirr.Cluster in project whirr by apache.
the class ScriptBasedClusterActionTest method testEmptyInstanceTemplates.
@Test(expected = IllegalArgumentException.class)
public void testEmptyInstanceTemplates() throws Exception {
T action = newClusterActionInstance(EMPTYSET, EMPTYSET);
DryRun dryRun = getDryRunForAction(action).reset();
ClusterSpec tempSpec = ClusterSpec.withTemporaryKeys();
tempSpec.setClusterName("test-cluster-for-script-exection");
tempSpec.setProvider("stub");
tempSpec.setIdentity("dummy");
tempSpec.setStateStore("none");
ClusterController controller = new ClusterController();
Cluster tempCluster = controller.launchCluster(tempSpec);
action.execute(tempSpec, tempCluster);
List<StatementOnNode> executions = dryRun.getTotallyOrderedExecutions();
}
use of org.apache.whirr.Cluster in project whirr by apache.
the class FirewallManagerTest method setUpClass.
@Before
public void setUpClass() throws Exception {
clusterSpec = getTestClusterSpec();
context = ComputeCache.INSTANCE.apply(clusterSpec);
/* create a dummy instance for testing */
instances = Sets.newHashSet(new Cluster.Instance(new Credentials("dummy", "dummy"), Sets.newHashSet("dummy-role"), "50.0.0.1", "10.0.0.1", region + "/i-dummy", null));
manager = new FirewallManager(context, clusterSpec, new Cluster(instances));
}
use of org.apache.whirr.Cluster in project whirr by apache.
the class TemplateUtilsTest method testProcessTemplate.
@Test
public void testProcessTemplate() throws Exception {
Credentials credentials = new Credentials("dummy", "dummy");
Cluster.Instance instance = new Cluster.Instance(credentials, Sets.newHashSet("foo"), "127.0.0.1", "127.0.0.1", "id-0", null);
ClusterSpec clusterSpec = ClusterSpec.withTemporaryKeys(new PropertiesConfiguration("whirr-core-test.properties"));
Cluster cluster = new Cluster(Sets.newHashSet(instance));
VelocityEngine ve = TemplateUtils.newVelocityEngine();
String result = TemplateUtils.processTemplate(ve, "template-test.txt.vm", clusterSpec, cluster);
Assert.assertEquals("instance ip: 127.0.0.1", result);
}
use of org.apache.whirr.Cluster in project whirr by apache.
the class HadoopTaskTrackerClusterActionHandler method doBeforeConfigure.
@Override
protected void doBeforeConfigure(ClusterActionEvent event) throws IOException {
Cluster cluster = event.getCluster();
Instance jobtracker = cluster.getInstanceMatching(role(HadoopJobTrackerClusterActionHandler.ROLE));
event.getFirewallManager().addRules(Rule.create().destination(jobtracker).ports(HadoopCluster.JOBTRACKER_WEB_UI_PORT), Rule.create().source(HadoopCluster.getNamenodePublicAddress(cluster).getHostAddress()).destination(jobtracker).ports(HadoopCluster.JOBTRACKER_PORT));
}
Aggregations