Search in sources :

Example 56 with Metadata

use of org.apache.beam.vendor.grpc.v1p43p2.io.grpc.Metadata in project pinpoint by naver.

the class AgentHeaderReaderTest method extract_fail_agentId.

@Test(expected = StatusRuntimeException.class)
public void extract_fail_agentId() {
    Metadata metadata = newMetadata();
    metadata.put(Header.AGENT_ID_KEY, "!!agentId");
    reader.extract(metadata);
}
Also used : Metadata(io.grpc.Metadata) Test(org.junit.Test)

Example 57 with Metadata

use of org.apache.beam.vendor.grpc.v1p43p2.io.grpc.Metadata in project pinpoint by naver.

the class AgentHeaderReaderTest method extract_no_agentName.

@Test
public void extract_no_agentName() {
    Metadata metadata = newMetadata();
    metadata.remove(Header.AGENT_NAME_KEY, AGENT_NAME);
    final Header header = reader.extract(metadata);
    Assert.assertNull(header.getAgentName());
}
Also used : Header(com.navercorp.pinpoint.grpc.Header) Metadata(io.grpc.Metadata) Test(org.junit.Test)

Example 58 with Metadata

use of org.apache.beam.vendor.grpc.v1p43p2.io.grpc.Metadata in project pinpoint by naver.

the class AgentHeaderReaderTest method extract.

@Test
public void extract() {
    Metadata metadata = newMetadata();
    Header header = reader.extract(metadata);
    Assert.assertEquals(header.getAgentId(), AGENT_ID);
    Assert.assertEquals(header.getAgentName(), AGENT_NAME);
    Assert.assertEquals(header.getApplicationName(), APPLICATION_NAME);
    Assert.assertEquals(header.getAgentStartTime(), AGENT_START_TIME);
    Assert.assertEquals(header.getSocketId(), SOCKET_ID);
    Assert.assertEquals(header.getServiceType(), SERVICE_TYPE);
}
Also used : Header(com.navercorp.pinpoint.grpc.Header) Metadata(io.grpc.Metadata) Test(org.junit.Test)

Example 59 with Metadata

use of org.apache.beam.vendor.grpc.v1p43p2.io.grpc.Metadata in project pinpoint by naver.

the class AgentHeaderReaderTest method newMetadata.

private Metadata newMetadata() {
    Metadata metadata = new Metadata();
    metadata.put(Header.AGENT_ID_KEY, AGENT_ID);
    metadata.put(Header.AGENT_NAME_KEY, AGENT_NAME);
    metadata.put(Header.APPLICATION_NAME_KEY, APPLICATION_NAME);
    metadata.put(Header.AGENT_START_TIME_KEY, Long.toString(AGENT_START_TIME));
    metadata.put(Header.SOCKET_ID, Long.toString(SOCKET_ID));
    metadata.put(Header.SERVICE_TYPE_KEY, Integer.toString(SERVICE_TYPE));
    return metadata;
}
Also used : Metadata(io.grpc.Metadata)

Example 60 with Metadata

use of org.apache.beam.vendor.grpc.v1p43p2.io.grpc.Metadata in project pinpoint by naver.

the class MetadataTest method metadataTest.

@Test
public void metadataTest() {
    Metadata.Key<String> dd = Metadata.Key.of("key", Metadata.ASCII_STRING_MARSHALLER);
    Metadata metadata = InternalMetadata.newMetadata(BytesUtils.toBytes("key"), BytesUtils.toBytes("value"));
    Iterable<String> remove1 = metadata.removeAll(dd);
    logger.debug("{}", remove1);
    Iterable<String> remove2 = metadata.removeAll(dd);
    logger.debug("{}", remove2);
}
Also used : Metadata(io.grpc.Metadata) InternalMetadata(io.grpc.InternalMetadata) Test(org.junit.Test)

Aggregations

Metadata (io.grpc.Metadata)701 Test (org.junit.Test)559 Status (io.grpc.Status)190 CallOptions (io.grpc.CallOptions)56 ClientStreamTracer (io.grpc.ClientStreamTracer)51 ServerCall (io.grpc.ServerCall)48 PickSubchannelArgs (io.grpc.LoadBalancer.PickSubchannelArgs)44 InOrder (org.mockito.InOrder)41 Subchannel (io.grpc.LoadBalancer.Subchannel)40 ByteArrayInputStream (java.io.ByteArrayInputStream)40 InputStream (java.io.InputStream)38 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)33 IOException (java.io.IOException)32 AtomicReference (java.util.concurrent.atomic.AtomicReference)32 Context (io.grpc.Context)31 MockClientTransportInfo (io.grpc.internal.TestUtils.MockClientTransportInfo)31 InternalMetadata (io.grpc.InternalMetadata)30 MethodDescriptor (io.grpc.MethodDescriptor)30 EquivalentAddressGroup (io.grpc.EquivalentAddressGroup)29 ManagedChannel (io.grpc.ManagedChannel)27