use of io.opencensus.tags.TagContext in project instrumentation-java by census-instrumentation.
the class TaggerImplTest method toBuilder_TaggingReenabled.
@Test
public void toBuilder_TaggingReenabled() {
TagContext tags = new SimpleTagContext(TAG1);
tagsComponent.setState(TaggingState.DISABLED);
assertThat(tagger.toBuilder(tags)).isSameInstanceAs(NoopTagMapBuilder.INSTANCE);
tagsComponent.setState(TaggingState.ENABLED);
TagContextBuilder builder = tagger.toBuilder(tags);
assertThat(builder).isInstanceOf(TagMapBuilderImpl.class);
assertThat(tagContextToList(builder.build())).containsExactly(TAG1);
}
use of io.opencensus.tags.TagContext in project instrumentation-java by census-instrumentation.
the class TaggerImplTest method getCurrentTagContext_ConvertUnknownTagContextToTagMapImpl.
@Test
public void getCurrentTagContext_ConvertUnknownTagContextToTagMapImpl() {
TagContext unknownTagContext = new SimpleTagContext(TAG1, TAG2, TAG3);
TagContext result = getResultOfGetCurrentTagContext(unknownTagContext);
assertThat(result).isInstanceOf(TagMapImpl.class);
assertThat(tagContextToList(result)).containsExactly(TAG1, TAG2, TAG3);
}
use of io.opencensus.tags.TagContext in project instrumentation-java by census-instrumentation.
the class TaggerImplTest method withTagContext_TaggingReenabled.
@Test
public void withTagContext_TaggingReenabled() {
TagContext tags = new SimpleTagContext(TAG1);
tagsComponent.setState(TaggingState.DISABLED);
assertThat(tagContextToList(getResultOfWithTagContext(tags))).isEmpty();
tagsComponent.setState(TaggingState.ENABLED);
assertThat(tagContextToList(getResultOfWithTagContext(tags))).containsExactly(TAG1);
}
use of io.opencensus.tags.TagContext in project instrumentation-java by census-instrumentation.
the class TaggerImplTest method currentBuilder_SkipNullTag.
@Test
public void currentBuilder_SkipNullTag() {
TagContext tagContextWithNullTag = new SimpleTagContext(TAG1, null, TAG2);
TagContextBuilder result = getResultOfCurrentBuilder(tagContextWithNullTag);
assertThat(tagContextToList(result.build())).containsExactly(TAG1, TAG2);
}
use of io.opencensus.tags.TagContext in project instrumentation-java by census-instrumentation.
the class TaggerImplTest method currentBuilder.
@Test
public void currentBuilder() {
TagContext tags = new SimpleTagContext(TAG1, TAG2, TAG3);
TagContextBuilder result = getResultOfCurrentBuilder(tags);
assertThat(result).isInstanceOf(TagMapBuilderImpl.class);
assertThat(tagContextToList(result.build())).containsExactly(TAG1, TAG2, TAG3);
}
Aggregations