use of com.aerospike.test.util.Args in project aerospike-client-java by aerospike.
the class SuiteSync method init.
@BeforeClass
public static void init() {
System.out.println("Begin AerospikeClient");
Args args = Args.Instance;
ClientPolicy policy = new ClientPolicy();
policy.user = args.user;
policy.password = args.password;
policy.tlsPolicy = args.tlsPolicy;
Host[] hosts = Host.parseHosts(args.host, args.port);
client = new AerospikeClient(policy, hosts);
try {
args.setServerSpecific(client);
} catch (RuntimeException re) {
client.close();
throw re;
}
}
use of com.aerospike.test.util.Args in project aerospike-client-java by aerospike.
the class SuiteAsync method init.
@BeforeClass
public static void init() {
System.out.println("Begin AerospikeClient");
Args args = Args.Instance;
switch(args.eventLoopType) {
default:
case DIRECT_NIO:
{
eventLoops = new NioEventLoops(1);
break;
}
case NETTY_NIO:
{
EventLoopGroup group = new NioEventLoopGroup(1);
eventLoops = new NettyEventLoops(group);
break;
}
case NETTY_EPOLL:
{
EventLoopGroup group = new EpollEventLoopGroup(1);
eventLoops = new NettyEventLoops(group);
break;
}
}
try {
ClientPolicy policy = new ClientPolicy();
policy.eventLoops = eventLoops;
policy.user = args.user;
policy.password = args.password;
policy.tlsPolicy = args.tlsPolicy;
Host[] hosts = Host.parseHosts(args.host, args.port);
eventLoop = eventLoops.get(0);
client = new AerospikeClient(policy, hosts);
try {
args.setServerSpecific(client);
} catch (RuntimeException re) {
client.close();
throw re;
}
} catch (Exception e) {
eventLoops.close();
throw e;
}
}
Aggregations