public HostConfiguration(Map externalProperties, List<Server> servers, String persistenceUnit, final KunderaMetadata kunderaMetadata) { buildHosts(externalProperties, servers, persistenceUnit, kunderaMetadata); }
public void onValidation(final String host, final String port) { super.onValidation(host, port); } }
prop.setHost(host.getHost()); prop.setPort(host.getPort()); prop.setKeySpace(keyspace); logger.warn("Node {} are down, Caused by {} .", host.getHost(), e.getMessage()); if (host.isRetryHost())
@Test public void testPartialOverridingOfPUProperties() { Map<String, Object> puMap = new HashMap<String, Object>(); puMap.put("kundera.keyspace", "KunderaKeyspace"); puMap.put("kundera.port", "9160"); puMap.put("kundera.client.lookup.class", "com.impetus.client.cassandra.thrift.ThriftClientFactory"); puMap.put(CassandraConstants.CQL_VERSION, CassandraConstants.CQL_VERSION_3_0); emf = Persistence.createEntityManagerFactory("partialPropertyOverridePU", puMap); em = emf.createEntityManager(); HostConfiguration hostConfig = new CassandraHostConfiguration(puMap, CassandraPropertyReader.csmd, "partialPropertyOverridePU", ((EntityManagerFactoryImpl) emf).getKunderaMetadataInstance()); Assert.assertEquals(hostConfig.getHosts().get(0).getHost(), "localhost"); Assert.assertEquals(hostConfig.getHosts().get(0).getPort(), 9160); }
logger.warn("Node " + host.getHost() + " are down"); if (host.isRetryHost())
connectionBuilder.addContactPoint(host.getHost()).withPort(host.getPort()); if (host.getUser() != null) connectionBuilder.withCredentials(host.getUser(), host.getPassword());
public boolean testHost(Host host, String path) { boolean success = false; try { FTPClient ftp = new FTPClient(); ftp.setRemoteHost(host.getIpaddress()); ftp.connect(); ftp.login(host.getUsername(), host.getPassword()); success = ftp.connected(); if (success && path != null){ ftp.chdir(path); } } catch (UnknownHostException e) { LOG.info("Host IPAddress cannot be reached on " + host.getIpaddress()); success = false; } catch (IOException e) { e.printStackTrace(); success = false; } catch (FTPException e) { success = false; } ftp.quit(); return success; }
/** * test method. */ @Test public void test() { CoreHostConfiguration hostConfiguration = new CoreHostConfiguration(null, null, persistenceUnit, emf.getKunderaMetadataInstance()); Assert.assertNotNull(hostConfiguration.hosts); Assert.assertNotNull(hostConfiguration.port); Assert.assertTrue(hostConfiguration.getHosts().isEmpty()); Assert.assertEquals("localhost", hostConfiguration.hosts); Assert.assertEquals("9160", hostConfiguration.port); try { hostConfiguration.onValidation(null, null); } catch (IllegalArgumentException iaex) { Assert.assertNotNull(iaex.getMessage()); } }
Assert.assertEquals(host.getMaxActive(), 200); Assert.assertEquals(host.getMaxIdle(), 200); Assert.assertEquals(host.getMinIdle(), 20);
/** * on setup */ @Before public void setUp() { emf = getEntityManagerFactory("create"); }
prop.setHost(host.getHost()); prop.setPort(host.getPort()); prop.setKeySpace(keyspace); logger.warn("Node {} are down, Caused by {} .", host.getHost(), e.getMessage()); if (host.isRetryHost())
logger.warn("Node " + host.getHost() + " are down"); if (host.isRetryHost())
buildHosts(hosts, portAsString, this.hostsList); buildHosts(servers, this.hostsList);
logger.warn("Node " + host.getHost() + " are down"); if (host.isRetryHost())