Search in sources :

Example 1 with ServiceInfoBo

use of com.navercorp.pinpoint.common.server.bo.ServiceInfoBo in project pinpoint by naver.

the class ServerMetaDataBoMapper method map.

@Override
public ServerMetaDataBo map(TServerMetaData thriftObject) {
    final String serverInfo = thriftObject.getServerInfo();
    final List<String> vmArgs = thriftObject.getVmArgs();
    ServerMetaDataBo.Builder builder = new ServerMetaDataBo.Builder();
    builder.serverInfo(serverInfo);
    builder.vmArgs(vmArgs);
    if (thriftObject.isSetServiceInfos()) {
        final List<ServiceInfoBo> serviceInfos = new ArrayList<>(thriftObject.getServiceInfosSize());
        for (TServiceInfo tServiceInfo : thriftObject.getServiceInfos()) {
            final ServiceInfoBo serviceInfoBo = mapServiceInfo(tServiceInfo);
            serviceInfos.add(serviceInfoBo);
        }
        builder.serviceInfos(serviceInfos);
        return builder.build();
    } else {
        builder.serviceInfos(Collections.<ServiceInfoBo>emptyList());
        return builder.build();
    }
}
Also used : TServiceInfo(com.navercorp.pinpoint.thrift.dto.TServiceInfo) ArrayList(java.util.ArrayList) ServerMetaDataBo(com.navercorp.pinpoint.common.server.bo.ServerMetaDataBo) ServiceInfoBo(com.navercorp.pinpoint.common.server.bo.ServiceInfoBo)

Example 2 with ServiceInfoBo

use of com.navercorp.pinpoint.common.server.bo.ServiceInfoBo in project pinpoint by naver.

the class ServiceInfoBoTest method testByteArrayConversionNullValues.

@Test
public void testByteArrayConversionNullValues() {
    // Given
    final ServiceInfoBo testBo = createTestBo(null, null);
    // When
    final byte[] serializedBo = testBo.writeValue();
    final ServiceInfoBo deserializedBo = new ServiceInfoBo.Builder(serializedBo).build();
    // Then
    assertEquals(testBo, deserializedBo);
}
Also used : ServiceInfoBo(com.navercorp.pinpoint.common.server.bo.ServiceInfoBo) Test(org.junit.Test)

Example 3 with ServiceInfoBo

use of com.navercorp.pinpoint.common.server.bo.ServiceInfoBo in project pinpoint by naver.

the class ServiceInfoBoTest method testByteArrayConversion.

@Test
public void testByteArrayConversion() {
    // Given
    final ServiceInfoBo testBo = createTestBo("testService", Arrays.asList("lib1", "lib2"));
    // When
    final byte[] serializedBo = testBo.writeValue();
    final ServiceInfoBo deserializedBo = new ServiceInfoBo.Builder(serializedBo).build();
    // Then
    assertEquals(testBo, deserializedBo);
}
Also used : ServiceInfoBo(com.navercorp.pinpoint.common.server.bo.ServiceInfoBo) Test(org.junit.Test)

Aggregations

ServiceInfoBo (com.navercorp.pinpoint.common.server.bo.ServiceInfoBo)3 Test (org.junit.Test)2 ServerMetaDataBo (com.navercorp.pinpoint.common.server.bo.ServerMetaDataBo)1 TServiceInfo (com.navercorp.pinpoint.thrift.dto.TServiceInfo)1 ArrayList (java.util.ArrayList)1