public static synchronized HelixManager setup(String helixClusterName, String zkPath, String controllerInstanceId) { try { createHelixClusterIfNeeded(helixClusterName, zkPath); } catch (final Exception e) { LOGGER.error("Caught exception", e); return null; } try { return startHelixControllerInStandadloneMode(helixClusterName, zkPath, controllerInstanceId); } catch (final Exception e) { LOGGER.error("Caught exception", e); return null; } }
@Override public StateModel createNewStateModel(String resourceName, String stateUnitKey) { TestOnlineOfflineStateModel stateModel = new TestOnlineOfflineStateModel(_instanceId); stateModel.setDelay(_delay); return stateModel; }
public static ControllerRequestURLBuilder baseUrl(String baseUrl) { return new ControllerRequestURLBuilder(baseUrl); }
@AfterTest public void shutdown() { LOGGER.info("Trying to shutdown"); kafkaBrokerTopicObserver.stop(); KafkaStarterUtils.stopServer(kafkaStarter); ZkStarter.stopLocalZkServer(); }
public static FakeInstance startDefault(String instanceId) throws Exception { String zkPath = "localhost:2181"; String helixClusterName = "testMirrorMaker"; FakeInstance fakeInstance = new FakeInstance(helixClusterName, instanceId, zkPath); fakeInstance.start(); final ShutdownHook shutdownHook = new ShutdownHook(fakeInstance); Runtime.getRuntime().addShutdownHook(shutdownHook); return fakeInstance; }
public static List<FakeInstance> addFakeDataInstancesToAutoJoinHelixCluster( String helixClusterName, String zkServer, int numInstances, int base) throws Exception { List<FakeInstance> ret = new ArrayList<FakeInstance>(); for (int i = base; i < numInstances + base; ++i) { final String instanceId = "Server_localhost_" + i; FakeInstance fakeInstance = new FakeInstance(helixClusterName, instanceId, zkServer); fakeInstance.start(); ret.add(fakeInstance); } return ret; }
/** * Starts an empty local Zk instance on the default port */ public static void startLocalZkServer() { // DEFAULT_ZK_TEST_PORT = new Random().nextInt(10000) + 10000; // DEFAULT_ZK_STR = "localhost:" + DEFAULT_ZK_TEST_PORT; try { startLocalZkServer(DEFAULT_ZK_TEST_PORT); } catch (Exception e) { LOGGER.error("Failed to start ZK: " + e); } }
/** * Stops a local Zk instance, deleting its data directory */ public static void stopLocalZkServer() { try { stopLocalZkServer(true); } catch (Exception e) { LOGGER.error("Failed to stop ZK: " + e); } }
@Override public void run() { try { _zookeeperServerMain.initializeAndRun(args); } catch (QuorumPeerConfig.ConfigException e) { LOGGER.warn("Caught exception while starting ZK", e); } catch (IOException e) { LOGGER.warn("Caught exception while starting ZK", e); } } }.start();
@Override public void run() { LOGGER.info("Running shutdown hook"); if (_fakeInstance != null) { try { _fakeInstance.stop(); } catch (Exception e) { LOGGER.error("Failed to Shutdown FakeInstance !!"); } } LOGGER.info("Shutdown completed !!"); } }
public HelixMirrorMakerManager(ControllerConf controllerConf) { _controllerConf = controllerConf; _helixZkURL = HelixUtils.getAbsoluteZkPathForHelix(_controllerConf.getZkStr()); _helixClusterName = _controllerConf.getHelixClusterName(); _instanceId = controllerConf.getInstanceId(); }
@AfterTest public void shutdown() { LOGGER.info("Trying to shutdown"); helixMirrorMakerManager.stop(); kafkaBrokerTopicObserver.stop(); KafkaStarterUtils.stopServer(kafkaStarter); ZkStarter.stopLocalZkServer(); }
@BeforeTest public void setup() { LOGGER.info("Trying to setup"); ZkStarter.startLocalZkServer(); }
@AfterTest public void shutdown() { LOGGER.info("Trying to shutdown"); ZkStarter.stopLocalZkServer(); }
@AfterTest public void shutdown() { LOGGER.info("Trying to shutdown"); helixMirrorMakerManager.stop(); kafkaBrokerTopicObserver.stop(); KafkaStarterUtils.stopServer(kafkaStarter); ZkStarter.stopLocalZkServer(); }
@BeforeTest public void setup() { LOGGER.info("Trying to setup"); ZkStarter.startLocalZkServer(); }
@AfterTest public void shutdown() { LOGGER.info("Trying to shutdown"); ZkStarter.stopLocalZkServer(); }
@AfterTest public void shutdown() { LOGGER.info("Trying to shutdown"); helixMirrorMakerManager.stop(); kafkaBrokerTopicObserver.stop(); KafkaStarterUtils.stopServer(kafkaStarter); ZkStarter.stopLocalZkServer(); }
@BeforeTest public void setup() { LOGGER.info("Trying to setup"); ZkStarter.startLocalZkServer(); }
@AfterTest public void shutdown() { LOGGER.info("Trying to shutdown"); ZkStarter.stopLocalZkServer(); }