Refine search
@Test public void addsStatusCode_badRequest() throws Exception { try { get("/badrequest"); } catch (RuntimeException e) { // some servers think 400 is an error } Span span = takeSpan(); assertThat(span.tags()) .containsEntry("http.status_code", "400") .containsEntry("error", "400"); }
@Test public void nestedMessage() { assertThat(DOCSTRINGS).containsEntry( "armeria.grpc.testing.SimpleRequest.NestedRequest", " A request nested in another request.\n"); }
@Test public void enumValue() { assertThat(DOCSTRINGS).containsEntry( "armeria.grpc.testing.CompressionType/NONE", " No compression\n"); }
@Test public void nestedEnumType() { assertThat(DOCSTRINGS).containsEntry( "armeria.grpc.testing.SimpleRequest.NestedEnum", " An enum nested in a request.\n"); }
@Test public void nestedEnumValue() { assertThat(DOCSTRINGS).containsEntry( "armeria.grpc.testing.SimpleRequest.NestedEnum/OK", " We're ok.\n"); } }
@Test public void message() { assertThat(DOCSTRINGS).containsEntry( "armeria.grpc.testing.SimpleRequest", " Unary request.\n"); }
@Test public void nestedMessageField() { assertThat(DOCSTRINGS).containsEntry( "armeria.grpc.testing.SimpleRequest.NestedRequest/nested_payload", " The payload for a nested request.\n"); }
@Test public void enumType() { assertThat(DOCSTRINGS).containsEntry( "armeria.grpc.testing.CompressionType", " Compression algorithms\n"); }
@Test public void field() { assertThat(DOCSTRINGS).containsEntry( "armeria.grpc.testing.SimpleRequest/response_type", " Desired payload type in the response from the server.\n" + " If response_type is RANDOM, server randomly chooses one from other formats.\n"); }
@Test public void service() { assertThat(DOCSTRINGS).containsEntry( "armeria.grpc.testing.TestService", " A simple service to test the various types of RPCs and experiment with\n" + " performance with various types of payload.\n"); }
@Test public void method() { assertThat(DOCSTRINGS).containsEntry( "armeria.grpc.testing.TestService/UnaryCall", " One request followed by one response.\n"); }
@Test public void httpPathTagExcludesQueryParams() throws Exception { get("/foo?z=2&yAA=1"); Span span = takeSpan(); assertThat(span.tags()) .containsEntry("http.path", "/foo"); }
/** * Shows that a framework can directly use the "brave.Span" rather than relying on the * current span. */ @Test public void canUseSpanAttribute() throws Exception { delegate = customHook; get("/foo"); Span span = takeSpan(); assertThat(span.tags()) .containsEntry("foo", "bar"); }
@Test public void addsStatusCodeWhenNotOk() throws Exception { server.enqueue(new MockResponse().setResponseCode(400)); try { get(client, "/foo"); } catch (Exception e) { // some clients think 400 is an error } Span span = takeSpan(); assertThat(span.tags()) .containsEntry("http.status_code", "400") .containsEntry("error", "400"); }
@Test public void testGet() { assertThat(new UnionMap<>(of("1", "a"), of("2", "b"))).containsEntry("1", "a"); assertThat(new UnionMap<>(of("1", "a"), of("2", "b"))).containsEntry("2", "b"); assertThat(new UnionMap<>(of("1", "a"), of("1", "b"))).containsEntry("1", "a"); }
@Test public void multi_properties_are_merged_by_default() { Map<String, Object> model = new HashMap<String, Object>(); model.put("a", "a"); model.put("b", "b"); model.put("c", "c"); Configuration conf = Configuration.defaultConfiguration(); Map<String, Object> result = using(conf).parse(model).read("$.['a', 'b']"); //assertThat(result).isInstanceOf(List.class); //assertThat((List)result).containsOnly("a", "b"); assertThat(result) .containsEntry("a", "a") .containsEntry("b", "b"); }
@Test public void httpPathTagExcludesQueryParams() throws Exception { String path = "/foo?z=2&yAA=1"; server.enqueue(new MockResponse()); get(client, path); Span span = takeSpan(); assertThat(span.tags()) .containsEntry("http.path", "/foo"); }
@Test public void convertClassAndPropertiesWithDoubleQuotes() { String json = "{\"k1\":\"v1\",\"k2\":\"v2\"}"; ClassName declarable = converter.convertFromText("abc" + json, ClassName.class, ""); assertThat(declarable.getClassName()).isEqualTo("abc"); assertThat(declarable.getInitProperties()).containsOnlyKeys("k1", "k2") .containsEntry("k1", "v1").containsEntry("k2", "v2"); } }
@Test public void convertClassAndProperties() { String json = "{'k1':'v1','k2':'v2'}"; ClassName declarable = converter.convertFromText("abc" + json, ClassName.class, ""); assertThat(declarable.getClassName()).isEqualTo("abc"); assertThat(declarable.getInitProperties()).containsOnlyKeys("k1", "k2") .containsEntry("k1", "v1").containsEntry("k2", "v2"); }
@Test public void testDiscloseUserNameAndIp() throws Exception { when(tracingPlugin.isPseudonymizeUserNames()).thenReturn(true); when(tracingPlugin.isAnonymizeIPs()).thenReturn(true); when(tracingPlugin.getDiscloseUsers()).thenReturn(Collections.singleton("a94a8fe5ccb19ba61c4c0873d391e987982fbbd3")); final SpanWrapper span = createSpanIpv4(); assertThat(span.getTags()).containsEntry("username", "a94a8fe5ccb19ba61c4c0873d391e987982fbbd3"); assertThat(span.getTags()).containsEntry("username_disclosed", "test"); assertThat(span.getTags()).containsEntry(Tags.PEER_HOST_IPV4.getKey(), InetAddresses.inetAddressToInt(IPV4)); }