use of org.apache.servicecomb.registry.api.registry.MicroserviceFactory in project incubator-servicecomb-java-chassis by apache.
the class LocalRegistryStore method init.
public void init() {
MicroserviceFactory microserviceFactory = new MicroserviceFactory();
selfMicroservice = microserviceFactory.create();
selfMicroserviceInstance = selfMicroservice.getInstance();
microserviceMap.clear();
microserviceInstanceMap.clear();
}
use of org.apache.servicecomb.registry.api.registry.MicroserviceFactory in project incubator-servicecomb-java-chassis by apache.
the class TestMicroserviceFactory method testSetDescriptionOnBlankDescription.
@Test
public void testSetDescriptionOnBlankDescription() {
Configuration configuration = ConfigUtil.createLocalConfig();
configuration.setProperty(BootStrapProperties.CONFIG_SERVICE_DESCRIPTION, new String[] { " ", " " });
MicroserviceFactory factory = new MicroserviceFactory();
Microservice microservice = factory.create(configuration);
Assert.assertEquals(" , ", microservice.getDescription());
}
use of org.apache.servicecomb.registry.api.registry.MicroserviceFactory in project incubator-servicecomb-java-chassis by apache.
the class TestMicroserviceFactory method testInit.
@Test
public void testInit() {
MicroserviceFactory factory = new MicroserviceFactory();
Microservice microservice = factory.create(ConfigUtil.createLocalConfig());
String microserviceName = "default";
Assert.assertEquals(microserviceName, microservice.getServiceName());
}
use of org.apache.servicecomb.registry.api.registry.MicroserviceFactory in project java-chassis by ServiceComb.
the class TestServiceRegistryClientImpl method testPrivateMethodCreateHttpClientOptions.
@Test
public void testPrivateMethodCreateHttpClientOptions() {
ArchaiusUtils.setProperty(BootStrapProperties.CONFIG_SERVICE_APPLICATION, "app");
ArchaiusUtils.setProperty(BootStrapProperties.CONFIG_SERVICE_NAME, "ms");
MicroserviceFactory microserviceFactory = new MicroserviceFactory();
Microservice microservice = microserviceFactory.create();
oClient.registerMicroservice(microservice);
oClient.registerMicroserviceInstance(microservice.getInstance());
try {
oClient.init();
HttpClientOptions httpClientOptions = Deencapsulation.invoke(oClient, "createHttpClientOptions");
Assert.assertNotNull(httpClientOptions);
Assert.assertEquals(80, httpClientOptions.getDefaultPort());
} catch (Exception e) {
Assert.assertNotNull(e);
}
ArchaiusUtils.resetConfig();
}
use of org.apache.servicecomb.registry.api.registry.MicroserviceFactory in project java-chassis by ServiceComb.
the class TestMicroserviceFactory method testSetDescriptionOnNullDescription.
@Test
public void testSetDescriptionOnNullDescription() {
Configuration configuration = ConfigUtil.createLocalConfig();
configuration.clearProperty(BootStrapProperties.CONFIG_SERVICE_DESCRIPTION);
MicroserviceFactory factory = new MicroserviceFactory();
Microservice microservice = factory.create(configuration);
Assert.assertNull(microservice.getDescription());
configuration.setProperty(BootStrapProperties.CONFIG_SERVICE_DESCRIPTION, new String[] {});
microservice = factory.create(configuration);
Assert.assertNull(microservice.getDescription());
}
Aggregations