use of org.apache.servicecomb.registry.api.registry.Microservice in project java-chassis by ServiceComb.
the class TestMicroService method setUp.
@Before
public void setUp() throws Exception {
oMicroservice = new Microservice();
oMapProperties = new HashMap<>();
oListSchemas = new ArrayList<>();
}
use of org.apache.servicecomb.registry.api.registry.Microservice 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());
}
use of org.apache.servicecomb.registry.api.registry.Microservice in project java-chassis by ServiceComb.
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.Microservice in project java-chassis by ServiceComb.
the class TestMicroserviceFactory method testSetDescriptionOnEmptyDescription.
@Test
public void testSetDescriptionOnEmptyDescription() {
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.Microservice in project java-chassis by ServiceComb.
the class InvocationFactory method setSrcMicroservice.
public static Invocation setSrcMicroservice(Invocation invocation) {
Microservice microservice = RegistrationManager.INSTANCE.getMicroservice();
invocation.addContext(Const.SRC_MICROSERVICE, microservice.getServiceName());
if (addSourceServiceId()) {
invocation.addContext(Const.SRC_SERVICE_ID, microservice.getServiceId());
}
if (addSourceInstanceId()) {
invocation.addContext(Const.SRC_INSTANCE_ID, microservice.getInstance().getInstanceId());
}
return invocation;
}
Aggregations