use of org.apache.servicecomb.foundation.vertx.SimpleJsonObject in project incubator-servicecomb-java-chassis by apache.
the class VertxRestTransport method init.
@Override
public boolean init() throws Exception {
restClient = RestTransportClientManager.INSTANCE.getRestClient();
// 部署transport server
DeploymentOptions options = new DeploymentOptions().setInstances(TransportConfig.getThreadCount());
SimpleJsonObject json = new SimpleJsonObject();
json.put(ENDPOINT_KEY, getEndpoint());
options.setConfig(json);
return VertxUtils.blockDeploy(transportVertx, RestServerVerticle.class, options);
}
use of org.apache.servicecomb.foundation.vertx.SimpleJsonObject in project incubator-servicecomb-java-chassis by apache.
the class TestClientVerticle method start.
@Test
public void start(@Mocked Context context) throws Exception {
AtomicInteger count = new AtomicInteger();
ClientPoolManager<HttpClientWithContext> clientMgr = new MockUp<ClientPoolManager<HttpClientWithContext>>() {
@Mock
HttpClientWithContext createClientPool() {
count.incrementAndGet();
return null;
}
}.getMockInstance();
clientVerticle.init(null, context);
JsonObject config = new SimpleJsonObject();
config.put(ClientVerticle.CLIENT_MGR, clientMgr);
new Expectations() {
{
context.config();
result = config;
}
};
clientVerticle.start();
Assert.assertEquals(1, count.get());
}
use of org.apache.servicecomb.foundation.vertx.SimpleJsonObject in project incubator-servicecomb-java-chassis by apache.
the class HighwayTransport method init.
public boolean init() throws Exception {
highwayClient.init(transportVertx);
DeploymentOptions deployOptions = new DeploymentOptions().setInstances(HighwayConfig.getServerThreadCount());
setListenAddressWithoutSchema(HighwayConfig.getAddress(), Collections.singletonMap(TcpConst.LOGIN, "true"));
SimpleJsonObject json = new SimpleJsonObject();
json.put(ENDPOINT_KEY, getEndpoint());
deployOptions.setConfig(json);
return VertxUtils.blockDeploy(transportVertx, HighwayServerVerticle.class, deployOptions);
}
use of org.apache.servicecomb.foundation.vertx.SimpleJsonObject in project java-chassis by ServiceComb.
the class TestClientVerticle method start.
@Test
public void start(@Mocked Context context) throws Exception {
AtomicInteger count = new AtomicInteger();
ClientPoolManager<HttpClientWithContext> clientMgr = new MockUp<ClientPoolManager<HttpClientWithContext>>() {
@Mock
HttpClientWithContext createClientPool(Context context) {
count.incrementAndGet();
return null;
}
}.getMockInstance();
clientVerticle.init(null, context);
JsonObject config = new SimpleJsonObject();
config.put(ClientVerticle.CLIENT_MGR, clientMgr);
new Expectations() {
{
context.config();
result = config;
}
};
clientVerticle.start();
Assert.assertEquals(1, count.get());
}
use of org.apache.servicecomb.foundation.vertx.SimpleJsonObject in project java-chassis by ServiceComb.
the class HighwayTransport method init.
@Override
public boolean init() throws Exception {
highwayClient.init(transportVertx);
DeploymentOptions deployOptions = new DeploymentOptions().setInstances(HighwayConfig.getServerThreadCount());
setListenAddressWithoutSchema(HighwayConfig.getAddress(), Collections.singletonMap(TcpConst.LOGIN, "true"));
SimpleJsonObject json = new SimpleJsonObject();
json.put(ENDPOINT_KEY, getEndpoint());
deployOptions.setConfig(json);
deployOptions.setWorkerPoolName("pool-worker-transport-highway");
return VertxUtils.blockDeploy(transportVertx, HighwayServerVerticle.class, deployOptions);
}
Aggregations