@Override public void stop() { try { oracleServer.stop(); appIdCache.close(); reporters.close(); env.close(); } catch (Exception e) { throw new FluoException(e); } }
@Override public void stop() { try { oracleServer.stop(); appIdCache.close(); reporters.close(); env.close(); } catch (Exception e) { throw new FluoException(e); } }
@Override public void close() { try { if (oserver != null) { notificationFinder.stop(); mnp.close(); oserver.stop(); env.close(); reporter.close(); if (cluster != null) { cluster.stop(); } } } catch (Exception e) { throw new RuntimeException(e); } }
@Override public void close() { try { if (oserver != null) { notificationFinder.stop(); mnp.close(); oserver.stop(); env.close(); reporter.close(); if (cluster != null) { cluster.stop(); } } } catch (Exception e) { throw new RuntimeException(e); } }
oserver.stop();
@After public void tearDownFluo() throws Exception { client.close(); if (oserver.isConnected()) { oserver.stop(); } env.close(); aClient.tableOperations().delete(table); } }
@Test public void testInitializeLongChroot() throws Exception { // stop oracle to avoid spurious exceptions when initializing oserver.stop(); String zk = config.getAppZookeepers(); String longPath = "/very/long/path"; config.setInstanceZookeepers(zk + longPath); InitializationOptions opts = new InitializationOptions(); opts.setClearZookeeper(true).setClearTable(true); try (FluoAdmin admin = new FluoAdminImpl(config)) { admin.initialize(opts); } try (CuratorFramework curator = CuratorUtil.newRootFluoCurator(config)) { curator.start(); Assert.assertNotNull(curator.checkExists().forPath(ZookeeperUtil.parseRoot(zk + longPath))); } String longPath2 = "/very/long/path2"; config.setInstanceZookeepers(zk + longPath2); try (FluoAdmin admin = new FluoAdminImpl(config)) { admin.initialize(opts); } try (CuratorFramework curator = CuratorUtil.newRootFluoCurator(config)) { curator.start(); Assert.assertNotNull(curator.checkExists().forPath(ZookeeperUtil.parseRoot(zk + longPath2))); Assert.assertNotNull(curator.checkExists().forPath(ZookeeperUtil.parseRoot(zk + longPath))); } }
oserver.stop();
/** * If an {@link OracleServer} goes away and comes back, the client should automatically reconnect * and start a new block of timestamps (making sure that no timestamp should ever go backwards). */ @Test public void singleOracle_goesAwayAndComesBack() throws Exception { sleepUntil(oserver::isConnected); OracleClient client = env.getSharedResources().getOracleClient(); long timestamp; for (long i = 2; i <= 7; i++) { timestamp = client.getStamp().getTxTimestamp(); assertEquals(i, timestamp); } oserver.stop(); sleepWhile(oserver::isConnected); while (client.getOracle() != null) { Thread.sleep(100); } assertNull(client.getOracle()); oserver.start(); sleepUntil(oserver::isConnected); assertEquals(1002, client.getStamp().getTxTimestamp()); assertTrue(client.getOracle().endsWith(Integer.toString(oserver.getPort()))); oserver.stop(); }
@Test public void testInitializeWithNoChroot() throws Exception { // stop oracle to avoid spurious exceptions when initializing oserver.stop(); InitializationOptions opts = new InitializationOptions().setClearZookeeper(true).setClearTable(true); for (String host : new String[] {"localhost", "localhost/", "localhost:9999", "localhost:9999/"}) { config.setInstanceZookeepers(host); try (FluoAdmin fluoAdmin = new FluoAdminImpl(config)) { fluoAdmin.initialize(opts); fail("This should have failed"); } catch (IllegalArgumentException e) { // expected } } }
oserver.stop(); sleepWhile(oserver::isConnected); sleepUntil(oserver2::isLeader);
@Test public void testRestart() throws Exception { OracleClient client = env.getSharedResources().getOracleClient(); long ts1 = client.getStamp().getTxTimestamp(); long ts2 = client.getStamp().getTxTimestamp(); oserver.stop(); oserver.start(); long ts3 = client.getStamp().getTxTimestamp(); long ts4 = client.getStamp().getTxTimestamp(); assertTrue(ts1 + " " + ts2, ts1 < ts2); assertTrue(ts2 + " " + ts3, ts2 < ts3); assertTrue(ts3 + " " + ts4, ts3 < ts4); }
oserver.stop();