use of org.voltdb.client.ClientConfigForTest in project voltdb by VoltDB.
the class RegressionSuite method getFullyConnectedClient.
public Client getFullyConnectedClient(long timeout) throws IOException {
final List<String> listeners = m_config.getListenerAddresses();
final Random r = new Random();
ClientConfig config = new ClientConfigForTest(m_username, m_password);
config.setConnectionResponseTimeout(timeout);
config.setProcedureCallTimeout(timeout);
final Client client = ClientFactory.createClient(config);
for (String listener : listeners) {
// Use the port generated by LocalCluster if applicable
try {
client.createConnection(listener);
}// retry once
catch (ConnectException e) {
listener = listeners.get(r.nextInt(listeners.size()));
client.createConnection(listener);
}
}
m_clients.add(client);
return client;
}
use of org.voltdb.client.ClientConfigForTest in project voltdb by VoltDB.
the class RegressionSuite method getClientToHostId.
/**
* Get a VoltClient instance connected to a specific server driven by the
* VoltServerConfig instance. Find the server by the config's HostId.
*
* @return A VoltClient instance connected to the server driven by the
* VoltServerConfig instance.
*/
public Client getClientToHostId(int hostId, long timeout) throws IOException {
final String listener = m_config.getListenerAddress(hostId);
ClientConfig config = new ClientConfigForTest(m_username, m_password);
config.setConnectionResponseTimeout(timeout);
config.setProcedureCallTimeout(timeout);
final Client client = ClientFactory.createClient(config);
try {
client.createConnection(listener);
}// retry once
catch (ConnectException e) {
client.createConnection(listener);
}
m_clients.add(client);
return client;
}
use of org.voltdb.client.ClientConfigForTest in project voltdb by VoltDB.
the class RegressionSuite method getClient.
public Client getClient(long timeout, ClientAuthScheme scheme, boolean useAdmin) throws IOException {
final Random r = new Random();
String listener = null;
if (useAdmin) {
listener = m_config.getAdminAddress(r.nextInt(m_config.getListenerCount()));
} else {
listener = m_config.getListenerAddress(r.nextInt(m_config.getListenerCount()));
}
ClientConfig config = new ClientConfigForTest(m_username, m_password, scheme);
config.setConnectionResponseTimeout(timeout);
config.setProcedureCallTimeout(timeout);
final Client client = ClientFactory.createClient(config);
// Use the port generated by LocalCluster if applicable
try {
client.createConnection(listener);
}// retry once
catch (ConnectException e) {
if (useAdmin) {
listener = m_config.getAdminAddress(r.nextInt(m_config.getListenerCount()));
} else {
listener = m_config.getListenerAddress(r.nextInt(m_config.getListenerCount()));
}
client.createConnection(listener);
}
m_clients.add(client);
return client;
}
use of org.voltdb.client.ClientConfigForTest in project voltdb by VoltDB.
the class RegressionSuite method getClientSha1.
/**
* Get a VoltClient instance connected to the server driven by the
* VoltServerConfig instance. Just pick from the list of listeners
* randomly.
*
* Only uses the time
*
* @return A VoltClient instance connected to the server driven by the
* VoltServerConfig instance.
*/
public Client getClientSha1(long timeout) throws IOException {
final List<String> listeners = m_config.getListenerAddresses();
final Random r = new Random();
String listener = listeners.get(r.nextInt(listeners.size()));
ClientConfig config = new ClientConfigForTest(m_username, m_password, ClientAuthScheme.HASH_SHA1);
config.setConnectionResponseTimeout(timeout);
config.setProcedureCallTimeout(timeout);
final Client client = ClientFactory.createClient(config);
// Use the port generated by LocalCluster if applicable
try {
client.createConnection(listener);
}// retry once
catch (ConnectException e) {
listener = listeners.get(r.nextInt(listeners.size()));
client.createConnection(listener);
}
m_clients.add(client);
return client;
}
Aggregations