use of org.apache.helix.tools.ClusterSetup in project helix by apache.
the class TaskSynchronizedTestBase method beforeClass.
@BeforeClass
public void beforeClass() throws Exception {
_participants = new MockParticipantManager[_numNodes];
String namespace = "/" + CLUSTER_NAME;
if (_gZkClient.exists(namespace)) {
_gZkClient.deleteRecursively(namespace);
}
_setupTool = new ClusterSetup(ZK_ADDR);
_setupTool.addCluster(CLUSTER_NAME, true);
setupParticipants();
setupDBs();
startParticipants();
createManagers();
}
use of org.apache.helix.tools.ClusterSetup in project helix by apache.
the class TestJobStateOnCreation method beforeClass.
@BeforeClass
public void beforeClass() throws Exception {
_cache = new ClusterDataCache();
_idealState = new IdealState(WORKFLOW_NAME);
_resource = new Resource(WORKFLOW_NAME);
_currStateOutput = new CurrentStateOutput();
_participants = new MockParticipantManager[_numNodes];
String namespace = "/" + CLUSTER_NAME;
if (_gZkClient.exists(namespace)) {
_gZkClient.deleteRecursively(namespace);
}
_setupTool = new ClusterSetup(ZK_ADDR);
_setupTool.addCluster(CLUSTER_NAME, true);
createManagers();
}
use of org.apache.helix.tools.ClusterSetup in project helix by apache.
the class ClusterAccessor method createCluster.
@PUT
@Path("{clusterId}")
public Response createCluster(@PathParam("clusterId") String clusterId, @DefaultValue("false") @QueryParam("recreate") String recreate) {
boolean recreateIfExists = Boolean.valueOf(recreate);
ClusterSetup clusterSetup = getClusterSetup();
try {
clusterSetup.addCluster(clusterId, recreateIfExists);
} catch (Exception ex) {
_logger.error("Failed to create cluster " + clusterId + ", exception: " + ex);
return serverError(ex);
}
return created();
}
use of org.apache.helix.tools.ClusterSetup in project helix by apache.
the class TestDropResourceMetricsReset method testBasic.
@Test
public void testBasic() throws Exception {
final int NUM_PARTICIPANTS = 4;
final int NUM_PARTITIONS = 64;
final int NUM_REPLICAS = 1;
final String RESOURCE_NAME = "TestDB0";
String className = TestHelper.getTestClassName();
String methodName = TestHelper.getTestMethodName();
String clusterName = className + "_" + methodName;
System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis()));
ParticipantMonitorListener listener = new ParticipantMonitorListener("ClusterStatus", clusterName, RESOURCE_NAME);
// Set up cluster
// participant port
TestHelper.setupCluster(// participant port
clusterName, // participant port
ZK_ADDR, // participant port
12918, // participant name prefix
"localhost", // resource name prefix
"TestDB", // resources
1, // partitions per resource
NUM_PARTITIONS, // number of nodes
NUM_PARTICIPANTS, // replicas
NUM_REPLICAS, // use FULL_AUTO mode to test node tagging
"MasterSlave", // use FULL_AUTO mode to test node tagging
RebalanceMode.FULL_AUTO, // do rebalance
true);
// Start participants and controller
ClusterSetup setupTool = new ClusterSetup(_gZkClient);
MockParticipantManager[] participants = new MockParticipantManager[NUM_PARTICIPANTS];
for (int i = 0; i < NUM_PARTICIPANTS; i++) {
participants[i] = new MockParticipantManager(ZK_ADDR, clusterName, "localhost_" + (12918 + i));
participants[i].syncStart();
}
ClusterControllerManager controller = new ClusterControllerManager(ZK_ADDR, clusterName, "controller_0");
controller.syncStart();
// Verify that the bean was created
boolean noTimeout = _registerLatch.await(30000, TimeUnit.MILLISECONDS);
Assert.assertTrue(noTimeout);
// Drop the resource
setupTool.dropResourceFromCluster(clusterName, RESOURCE_NAME);
// Verify that the bean was removed
noTimeout = _unregisterLatch.await(30000, TimeUnit.MILLISECONDS);
Assert.assertTrue(noTimeout);
// Clean up
listener.disconnect();
controller.syncStop();
for (MockParticipantManager participant : participants) {
participant.syncStop();
}
System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis()));
}
use of org.apache.helix.tools.ClusterSetup in project helix by apache.
the class MockSpectatorProcess method setup.
private static void setup() {
IDefaultNameSpace defaultNameSpace = new IDefaultNameSpace() {
@Override
public void createDefaultNameSpace(org.I0Itec.zkclient.ZkClient client) {
client.deleteRecursive("/" + clusterName);
}
};
zkServer = new ZkServer(dataDir, logDir, defaultNameSpace, port);
zkServer.start();
ClusterSetup clusterSetup = new ClusterSetup(zkConnectString);
clusterSetup.setupTestCluster(clusterName);
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
Aggregations