use of org.apache.servicecomb.transport.highway.message.RequestHeader in project java-chassis by ServiceComb.
the class TestHighwayCodec method test_decode_request_successful_and_not_copy_header.
@Test
public void test_decode_request_successful_and_not_copy_header(@Mocked Endpoint endpoint) throws Exception {
// test decode request not thrown exception and not copy header
// header should copied before invocation start.
commonMock();
Invocation invocation = new Invocation(endpoint, operationMeta, null);
invocation.addContext("X-B3-traceId", "test1");
Assert.assertEquals("test1", invocation.getContext("X-B3-traceId"));
RequestHeader headers = new RequestHeader();
Map<String, String> context = new HashMap<>();
headers.setContext(context);
HighwayCodec.decodeRequest(invocation, headers, operationProtobuf, bodyBuffer);
Assert.assertEquals("test1", invocation.getContext("X-B3-traceId"));
context.put("X-B3-traceId", "test2");
HighwayCodec.decodeRequest(invocation, headers, operationProtobuf, bodyBuffer);
Assert.assertEquals("test1", invocation.getContext("X-B3-traceId"));
}
Aggregations