public HeartbeatSendTask(int taskId, int tryTimes) { this.taskId = taskId; this.tryTimes = tryTimes; this.runtimesBook = new double[tryTimes]; try { client = new NimbusClient(initializedConfig(), NIMBUS_HOST, NIMBUS_PORT, null, null); } catch (TTransportException e) { e.printStackTrace(); } }
Nimbus.Iface override = _localOverrideClient; if (override != null) { return new NimbusClient(override); NimbusClient client = null; try { client = new NimbusClient(conf, host, port, timeout, asUser); nimbusSummary = client.getClient().getLeader(); if (nimbusSummary != null) { return new NimbusClient(conf, nimbusSummary.get_host(), nimbusSummary.get_port(), timeout, asUser); } catch (TTransportException e) { throw new RuntimeException("Failed to create a nimbus client for the leader " + leaderNimbus, e);
try (NimbusClient client = new NimbusClient(conf, nimbusInfo.getHost(), nimbusInfo.getPort(), null)) { rbm = client.getClient().getBlobMeta(key); remoteBlobStore = new NimbusBlobStore();
public static void createStateInZookeeper(Map<String, Object> conf, String key, NimbusInfo nimbusInfo) throws TTransportException { ClientBlobStore cb = new NimbusBlobStore(); cb.setClient(conf, new NimbusClient(conf, nimbusInfo.getHost(), nimbusInfo.getPort(), null)); cb.createStateInZookeeper(key); }
public static void tryConnectAs(Map<String, Object> conf, ThriftServer server, Subject subject, String topoId) throws PrivilegedActionException { Subject.doAs(subject, (PrivilegedExceptionAction<Void>) () -> { try (NimbusClient client = new NimbusClient(conf, "localhost", server.getPort(), NIMBUS_TIMEOUT)) { client.getClient().activate(topoId); //Yes this should be a topo name, but it makes this simpler... } return null; }); }
public static void verifyIncorrectJaasConf(ThriftServer server, Map<String, Object> conf, String jaas, Class<? extends Exception> expectedException) { Map<String, Object> badConf = new HashMap<>(conf); badConf.put("java.security.auth.login.config", jaas); try (NimbusClient client = new NimbusClient(badConf, "localhost", server.getPort(), NIMBUS_TIMEOUT)) { client.getClient().activate("bad_auth_test_topology"); fail("An exception should have been thrown trying to connect."); } catch (Exception e) { LOG.info("Got Exception...", e); assert (Utils.exceptionCauseIsInstanceOf(expectedException, e)); } }
break; try (NimbusClient client = new NimbusClient(conf, nimbusInfo.getHost(), nimbusInfo.getPort(), null)) { remoteBlobStore = new NimbusBlobStore(); remoteBlobStore.setClient(conf, client);
public void getConfiguredClientThrowsRuntimeExceptionOnBadArgsTest() throws TTransportException { Map<String, Object> config = ConfigUtils.readStormConfig(); config.put(Config.STORM_NIMBUS_RETRY_TIMES, 0); try { new NimbusClient(config, "", 65535); Assert.fail("Expected exception to be thrown"); } catch (RuntimeException e) { Assert.assertTrue( "Cause is not TTransportException " + e, Utils.exceptionCauseIsInstanceOf(TTransportException.class, e)); } }
@Test public void simpleAuthTest() throws Exception { Nimbus.Iface impl = mock(Nimbus.Iface.class); withServer(SimpleTransportPlugin.class, impl, (ThriftServer server, Map<String, Object> conf) -> { try (NimbusClient client = new NimbusClient(conf, "localhost", server.getPort(), NIMBUS_TIMEOUT)) { client.getClient().activate("security_auth_test_topology"); } //Verify digest is rejected... Map<String, Object> badConf = new HashMap<>(conf); badConf.put(Config.STORM_THRIFT_TRANSPORT_PLUGIN, DigestSaslTransportPlugin.class.getName()); badConf.put("java.security.auth.login.config", DIGEST_JAAS_CONF); badConf.put(Config.STORM_NIMBUS_RETRY_TIMES, 0); try (NimbusClient client = new NimbusClient(badConf, "localhost", server.getPort(), NIMBUS_TIMEOUT)) { client.getClient().activate("bad_security_auth_test_topology"); fail("An exception should have been thrown trying to connect."); } catch (Exception te) { LOG.info("Got Exception...", te); assert (Utils.exceptionCauseIsInstanceOf(TTransportException.class, te)); } }); verify(impl).activate("security_auth_test_topology"); verify(impl, never()).activate("bad_security_auth_test_topology"); }
impl, (ThriftServer server, Map<String, Object> conf) -> { try (NimbusClient client = new NimbusClient(conf, "localhost", server.getPort(), NIMBUS_TIMEOUT)) { client.getClient().activate("security_auth_test_topology"); try (NimbusClient client = new NimbusClient(badTransport, "localhost", server.getPort(), NIMBUS_TIMEOUT)) { client.getClient().activate("bad_security_auth_test_topology"); fail("An exception should have been thrown trying to connect.");
conf.put(Config.STORM_NIMBUS_RETRY_TIMES, 0); try (NimbusClient client = new NimbusClient(conf, "localhost", server.getPort(), NIMBUS_TIMEOUT)) { client.getClient().activate("bad_auth_test_topology"); fail("We should not be able to connect without a token...");
NimbusClient client = null; try { client = new NimbusClient(conf, host, port, timeout, asUser); nimbusSummary = client.getClient().getLeader(); if (nimbusSummary != null) { return new NimbusClient(conf, nimbusSummary.get_host(), nimbusSummary.get_port(), timeout, asUser); } catch (TTransportException e) { throw new RuntimeException("Failed to create a nimbus client for the leader " + leaderNimbus, e);
try(NimbusClient client = new NimbusClient(conf, nimbusInfo.getHost(), nimbusInfo.getPort(), null)) { rbm = client.getClient().getBlobMeta(key); remoteBlobStore = new NimbusBlobStore();
public static void createStateInZookeeper(Map conf, String key, NimbusInfo nimbusInfo) throws TTransportException { ClientBlobStore cb = new NimbusBlobStore(); cb.setClient(conf, new NimbusClient(conf, nimbusInfo.getHost(), nimbusInfo.getPort(), null)); cb.createStateInZookeeper(key); }
break; try(NimbusClient client = new NimbusClient(conf, nimbusInfo.getHost(), nimbusInfo.getPort(), null)) { remoteBlobStore = new NimbusBlobStore(); remoteBlobStore.setClient(conf, client);