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);
}
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());
}
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);
}
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;
}
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);
}
Aggregations