Search in sources :

Example 1 with ServiceInfo

use of io.scalecube.services.ServiceInfo in project scalecube by scalecube.

the class ServiceInfoTest method test_service_info_one_tag.

@Test
public void test_service_info_one_tag() {
    Map<String, String> tags = new HashMap<>();
    ServiceInfo info = new ServiceInfo("service1", null, tags);
    tags.put("key1", "value1");
    String metadata = info.toMetadata();
    ServiceInfo info2 = ServiceInfo.from(metadata);
    assertTrue(info2.getServiceName().equals("service1"));
    assertTrue(info2.getTags().get("key1").equals("value1"));
}
Also used : ServiceInfo(io.scalecube.services.ServiceInfo) HashMap(java.util.HashMap) Test(org.junit.Test) BaseTest(io.scalecube.testlib.BaseTest)

Example 2 with ServiceInfo

use of io.scalecube.services.ServiceInfo in project scalecube by scalecube.

the class ServiceInfoTest method test_service_info_one_tag_with_equals.

@Test
public void test_service_info_one_tag_with_equals() {
    Map<String, String> tags = new HashMap<>();
    ServiceInfo info = new ServiceInfo("service1", null, tags);
    tags.put("key1", "value1=1");
    String metadata = info.toMetadata();
    ServiceInfo info2 = ServiceInfo.from(metadata);
    assertTrue(info2.getServiceName().equals("service1"));
    assertTrue(info2.getTags().get("key1").equals("value1=1"));
}
Also used : ServiceInfo(io.scalecube.services.ServiceInfo) HashMap(java.util.HashMap) Test(org.junit.Test) BaseTest(io.scalecube.testlib.BaseTest)

Example 3 with ServiceInfo

use of io.scalecube.services.ServiceInfo in project scalecube by scalecube.

the class ServiceInfoTest method test_service_info.

@Test
public void test_service_info() {
    Map<String, String> tags = new HashMap<>();
    tags.put("key1", "value1");
    tags.put("key2", "value2");
    ServiceInfo info = new ServiceInfo("service1", null, tags);
    String metadata = info.toMetadata();
    ServiceInfo info2 = ServiceInfo.from(metadata);
    assertTrue(info2.getServiceName().equals("service1"));
    assertTrue(info2.getTags().get("key1").equals("value1"));
    assertTrue(info2.getTags().get("key2").equals("value2"));
}
Also used : ServiceInfo(io.scalecube.services.ServiceInfo) HashMap(java.util.HashMap) Test(org.junit.Test) BaseTest(io.scalecube.testlib.BaseTest)

Example 4 with ServiceInfo

use of io.scalecube.services.ServiceInfo in project scalecube by scalecube.

the class ServiceInfoTest method test_service_info_no_tags.

@Test
public void test_service_info_no_tags() {
    Map<String, String> tags = new HashMap<>();
    ServiceInfo info = new ServiceInfo("service1", null, tags);
    String metadata = info.toMetadata();
    ServiceInfo info2 = ServiceInfo.from(metadata);
    assertTrue(info2.getServiceName().equals("service1"));
}
Also used : ServiceInfo(io.scalecube.services.ServiceInfo) HashMap(java.util.HashMap) Test(org.junit.Test) BaseTest(io.scalecube.testlib.BaseTest)

Aggregations

ServiceInfo (io.scalecube.services.ServiceInfo)4 BaseTest (io.scalecube.testlib.BaseTest)4 HashMap (java.util.HashMap)4 Test (org.junit.Test)4