use of org.apache.servicecomb.core.Endpoint in project incubator-servicecomb-java-chassis by apache.
the class TestHighwayVerticle method testHighwayVerticle.
@Test
public void testHighwayVerticle(@Mocked Transport transport, @Mocked Vertx vertx, @Mocked Context context, @Mocked JsonObject json) {
URIEndpointObject endpiontObject = new URIEndpointObject("highway://127.0.0.1:9090");
new Expectations() {
{
transport.parseAddress(anyString);
result = endpiontObject;
}
};
Endpoint endpoint = new Endpoint(transport, "highway://127.0.0.1:9090");
new Expectations() {
{
context.config();
result = json;
json.getValue(anyString);
result = endpoint;
}
};
highwayVerticle.init(vertx, context);
@SuppressWarnings("unchecked") Future<Void> startFuture = Mockito.mock(Future.class);
highwayVerticle.startListen(startFuture);
MockUtil.getInstance().mockHighwayConfig();
try {
highwayVerticle.startListen(startFuture);
Assert.assertTrue(true);
} catch (Exception e) {
Assert.assertTrue(false);
}
}
use of org.apache.servicecomb.core.Endpoint in project incubator-servicecomb-java-chassis by apache.
the class TransportManager method init.
public void init() throws Exception {
buildTransportMap();
for (Transport transport : transportMap.values()) {
if (transport.init()) {
Endpoint endpoint = transport.getPublishEndpoint();
if (endpoint != null && endpoint.getEndpoint() != null) {
LOGGER.info("endpoint to publish: {}", endpoint.getEndpoint());
Microservice microservice = RegistryUtils.getMicroservice();
microservice.getInstance().getEndpoints().add(endpoint.getEndpoint());
}
continue;
}
}
}
use of org.apache.servicecomb.core.Endpoint in project incubator-servicecomb-java-chassis by apache.
the class TestRestServerVerticle method testRestServerVerticleWithRouter.
@Test
public void testRestServerVerticleWithRouter(@Mocked Transport transport, @Mocked Vertx vertx, @Mocked Context context, @Mocked JsonObject jsonObject, @Mocked Future<Void> startFuture) throws Exception {
URIEndpointObject endpointObject = new URIEndpointObject("http://127.0.0.1:8080");
new Expectations() {
{
transport.parseAddress("http://127.0.0.1:8080");
result = endpointObject;
}
};
Endpoint endpiont = new Endpoint(transport, "http://127.0.0.1:8080");
new Expectations() {
{
context.config();
result = jsonObject;
jsonObject.getValue(AbstractTransport.ENDPOINT_KEY);
result = endpiont;
}
};
RestServerVerticle server = new RestServerVerticle();
// process stuff done by Expectations
server.init(vertx, context);
server.start(startFuture);
}
use of org.apache.servicecomb.core.Endpoint in project incubator-servicecomb-java-chassis by apache.
the class TestRestServerVerticle method testRestServerVerticleWithRouterSSL.
@Test
public void testRestServerVerticleWithRouterSSL(@Mocked Transport transport, @Mocked Vertx vertx, @Mocked Context context, @Mocked JsonObject jsonObject, @Mocked Future<Void> startFuture) throws Exception {
URIEndpointObject endpointObject = new URIEndpointObject("http://127.0.0.1:8080?sslEnabled=true");
new Expectations() {
{
transport.parseAddress("http://127.0.0.1:8080?sslEnabled=true");
result = endpointObject;
}
};
Endpoint endpiont = new Endpoint(transport, "http://127.0.0.1:8080?sslEnabled=true");
new Expectations() {
{
context.config();
result = jsonObject;
jsonObject.getValue(AbstractTransport.ENDPOINT_KEY);
result = endpiont;
}
};
RestServerVerticle server = new RestServerVerticle();
// process stuff done by Expectations
server.init(vertx, context);
server.start(startFuture);
}
Aggregations