Package com.twitter.zipkin.gen

Examples of com.twitter.zipkin.gen.BinaryAnnotation$BinaryAnnotationTupleSchemeFactory


        assertEquals(SPAN_ID, span.getId());
        assertEquals(TRACE_ID, span.getTrace_id());
        assertEquals(SPAN_NAME, span.getName());
        final List<BinaryAnnotation> binary_annotations = span.getBinary_annotations();
        assertEquals("Expect default annotation to have been submitted.", 1, binary_annotations.size());
        final BinaryAnnotation binaryAnnotation = binary_annotations.get(0);
        assertEquals(KEY1, binaryAnnotation.getKey());
        assertEquals(VALUE1, new String(binaryAnnotation.getValue()));

    }
View Full Code Here


        Validate.notNull(value);

        try {
            final ByteBuffer bb = ByteBuffer.wrap(value.getBytes(UTF_8));

            final BinaryAnnotation binaryAnnotation = new BinaryAnnotation();
            binaryAnnotation.setKey(key);
            binaryAnnotation.setValue(bb);
            binaryAnnotation.setAnnotation_type(AnnotationType.STRING);
            defaultAnnotations.add(binaryAnnotation);

        } catch (final UnsupportedEncodingException e) {
            throw new IllegalStateException(e);
        }
View Full Code Here

    @Test
    public void testSubmitBinaryAnnotationStringValue() throws UnsupportedEncodingException {
        abstractAnnotationSubmitter.submitBinaryAnnotation(KEY, STRING_VALUE);

        final BinaryAnnotation expectedAnnodation = new BinaryAnnotation();
        expectedAnnodation.setHost(endPoint);
        expectedAnnodation.setKey(KEY);
        expectedAnnodation.setValue(STRING_VALUE.getBytes("UTF-8"));
        expectedAnnodation.setAnnotation_type(AnnotationType.STRING);

        verify(mockSpan).addToBinary_annotations(expectedAnnodation);
        verifyNoMoreInteractions(mockSpan);
    }
View Full Code Here

    @Test
    public void testSubmitBinaryAnnotationIntValue() {
        abstractAnnotationSubmitter.submitBinaryAnnotation(KEY, INT_VALUE);

        final BinaryAnnotation expectedAnnodation = new BinaryAnnotation();
        expectedAnnodation.setHost(endPoint);
        expectedAnnodation.setKey(KEY);
        expectedAnnodation.setValue(String.valueOf(INT_VALUE).getBytes());
        expectedAnnodation.setAnnotation_type(AnnotationType.STRING);

        verify(mockSpan).addToBinary_annotations(expectedAnnodation);
        verifyNoMoreInteractions(mockSpan);
    }
View Full Code Here

     */
    private void submitBinaryAnnotation(final Span span, final Endpoint endPoint, final String key, final ByteBuffer value,
        final AnnotationType annotationType) {
        Validate.notBlank(key);
        Validate.notNull(value);
        final BinaryAnnotation binaryAnnotation = new BinaryAnnotation();
        binaryAnnotation.setKey(key);
        binaryAnnotation.setValue(value);
        binaryAnnotation.setAnnotation_type(annotationType);
        binaryAnnotation.setHost(endPoint);
        addBinaryAnnotation(span, binaryAnnotation);
    }
View Full Code Here

        Validate.notNull(value);

        try {
            final ByteBuffer bb = ByteBuffer.wrap(value.getBytes(UTF_8));

            final BinaryAnnotation binaryAnnotation = new BinaryAnnotation();
            binaryAnnotation.setKey(key);
            binaryAnnotation.setValue(bb);
            binaryAnnotation.setAnnotation_type(AnnotationType.STRING);
            defaultAnnotations.add(binaryAnnotation);

        } catch (final UnsupportedEncodingException e) {
            throw new IllegalStateException(e);
        }
View Full Code Here

        final Span mockSpan = mock(Span.class);
        spanCollector.collect(mockSpan);

        // Create expected annotation.
        final BinaryAnnotation expectedBinaryAnnoration = create(KEY1, VALUE1);

        final InOrder inOrder = inOrder(mockSpan, mockLogger);

        inOrder.verify(mockSpan).addToBinary_annotations(expectedBinaryAnnoration);
        inOrder.verify(mockLogger).isInfoEnabled();
View Full Code Here

        final Span mockSpan = mock(Span.class);
        spanCollector.collect(mockSpan);

        // Create expected annotations.
        final BinaryAnnotation expectedBinaryAnnoration = create(KEY1, VALUE1);
        final BinaryAnnotation expectedBinaryAnnoration2 = create(KEY2, VALUE2);

        verify(mockSpan).addToBinary_annotations(expectedBinaryAnnoration);
        verify(mockSpan).addToBinary_annotations(expectedBinaryAnnoration2);
        verify(mockLogger).isInfoEnabled();
View Full Code Here

    }

    private BinaryAnnotation create(final String key, final String value) {
        // Create expected annotation.
        final ByteBuffer bb = ByteBuffer.wrap(value.getBytes());
        final BinaryAnnotation expectedBinaryAnnoration = new BinaryAnnotation();
        expectedBinaryAnnoration.setKey(key);
        expectedBinaryAnnoration.setValue(bb);
        expectedBinaryAnnoration.setAnnotation_type(AnnotationType.STRING);
        return expectedBinaryAnnoration;
    }
View Full Code Here

        final Annotation expectedServerSendAnnotation = new Annotation();
        expectedServerSendAnnotation.setHost(mockEndPoint);
        expectedServerSendAnnotation.setValue(zipkinCoreConstants.SERVER_SEND);
        expectedServerSendAnnotation.setTimestamp(CURRENT_TIME_MICROSECONDS);

        final BinaryAnnotation expectedThreadDurationAnnotation = new BinaryAnnotation();
        expectedThreadDurationAnnotation.setAnnotation_type(AnnotationType.STRING);
        expectedThreadDurationAnnotation.setHost(mockEndPoint);
        expectedThreadDurationAnnotation.setKey(BraveAnnotations.THREAD_DURATION);
        final ByteBuffer bb = ByteBuffer.wrap(String.valueOf(DURATION_MS).getBytes("UTF-8"));
        expectedThreadDurationAnnotation.setValue(bb);

        verify(mockSpan).addToAnnotations(expectedServerSendAnnotation);
        verify(mockSpan).addToBinary_annotations(expectedThreadDurationAnnotation);

        verify(mockServerSpanState).getServerSpanThreadDuration();
View Full Code Here

TOP

Related Classes of com.twitter.zipkin.gen.BinaryAnnotation$BinaryAnnotationTupleSchemeFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.