Search in sources :

Example 11 with PAnnotationValue

use of com.navercorp.pinpoint.grpc.trace.PAnnotationValue in project pinpoint by naver.

the class GrpcAnnotationValueMapperTest method buildPAnnotationValue_IntString.

@Test
public void buildPAnnotationValue_IntString() {
    IntStringValue intStringValue = new IntStringValue(1, "2");
    PAnnotationValue container = mapper.buildPAnnotationValue(Annotations.of(1, intStringValue));
    PIntStringValue pAnnotation = container.getIntStringValue();
    Assert.assertEquals(pAnnotation.getIntValue(), 1);
    Assert.assertEquals(pAnnotation.getStringValue().getValue(), "2");
}
Also used : PAnnotationValue(com.navercorp.pinpoint.grpc.trace.PAnnotationValue) PIntStringValue(com.navercorp.pinpoint.grpc.trace.PIntStringValue) IntStringValue(com.navercorp.pinpoint.common.util.IntStringValue) PIntStringValue(com.navercorp.pinpoint.grpc.trace.PIntStringValue) Test(org.junit.Test)

Example 12 with PAnnotationValue

use of com.navercorp.pinpoint.grpc.trace.PAnnotationValue in project pinpoint by naver.

the class GrpcAnnotationValueMapperTest method buildPAnnotationValue_primitive.

@Test
public void buildPAnnotationValue_primitive() {
    PAnnotationValue value = mapper.buildPAnnotationValue(Annotations.of(1, "foo"));
    assertEquals("foo", value.getStringValue());
    value = mapper.buildPAnnotationValue(Annotations.of(1, Integer.MAX_VALUE));
    assertEquals(Integer.MAX_VALUE, value.getIntValue());
    value = mapper.buildPAnnotationValue(Annotations.of(1, Long.MAX_VALUE));
    assertEquals(Long.MAX_VALUE, value.getLongValue());
    value = mapper.buildPAnnotationValue(Annotations.of(1, Boolean.TRUE));
    assertEquals(Boolean.TRUE, value.getBoolValue());
    value = mapper.buildPAnnotationValue(Annotations.of(1, Byte.MAX_VALUE));
    assertEquals(Byte.MAX_VALUE, value.getByteValue());
    value = mapper.buildPAnnotationValue(Annotations.of(1, Float.MAX_VALUE));
    assertEquals(Float.MAX_VALUE, value.getDoubleValue(), 0);
    value = mapper.buildPAnnotationValue(Annotations.of(1, Double.MAX_VALUE));
    assertEquals(Double.MAX_VALUE, value.getDoubleValue(), 0);
    value = mapper.buildPAnnotationValue(Annotations.of(1, "foo".getBytes()));
    assertEquals(ByteString.copyFrom("foo".getBytes()), value.getBinaryValue());
    value = mapper.buildPAnnotationValue(Annotations.of(1, Short.MAX_VALUE));
    assertEquals(Short.MAX_VALUE, value.getShortValue());
}
Also used : PAnnotationValue(com.navercorp.pinpoint.grpc.trace.PAnnotationValue) Test(org.junit.Test)

Aggregations

PAnnotationValue (com.navercorp.pinpoint.grpc.trace.PAnnotationValue)12 Test (org.junit.Test)8 IntStringStringValue (com.navercorp.pinpoint.common.util.IntStringStringValue)3 PIntStringStringValue (com.navercorp.pinpoint.grpc.trace.PIntStringStringValue)3 IntBooleanIntBooleanValue (com.navercorp.pinpoint.common.util.IntBooleanIntBooleanValue)2 IntStringValue (com.navercorp.pinpoint.common.util.IntStringValue)2 LongIntIntByteByteStringValue (com.navercorp.pinpoint.common.util.LongIntIntByteByteStringValue)2 StringStringValue (com.navercorp.pinpoint.common.util.StringStringValue)2 PAnnotation (com.navercorp.pinpoint.grpc.trace.PAnnotation)2 PIntBooleanIntBooleanValue (com.navercorp.pinpoint.grpc.trace.PIntBooleanIntBooleanValue)2 PIntStringValue (com.navercorp.pinpoint.grpc.trace.PIntStringValue)2 PLongIntIntByteByteStringValue (com.navercorp.pinpoint.grpc.trace.PLongIntIntByteByteStringValue)2 PStringStringValue (com.navercorp.pinpoint.grpc.trace.PStringStringValue)2 Descriptors (com.google.protobuf.Descriptors)1 VisibleForTesting (com.navercorp.pinpoint.common.annotations.VisibleForTesting)1 DataType (com.navercorp.pinpoint.common.util.DataType)1 PSpan (com.navercorp.pinpoint.grpc.trace.PSpan)1 PSpanEvent (com.navercorp.pinpoint.grpc.trace.PSpanEvent)1 PSpanMessage (com.navercorp.pinpoint.grpc.trace.PSpanMessage)1 TIntBooleanIntBooleanValue (com.navercorp.pinpoint.thrift.dto.TIntBooleanIntBooleanValue)1