Search in sources :

Example 16 with EncoderWrapper

use of com.netflix.discovery.converters.wrappers.EncoderWrapper in project eureka by Netflix.

the class EurekaCodecCompatibilityTest method testInstanceInfoEncodeDecodeJsonWithEmptyMetadataMap.

@Test
public void testInstanceInfoEncodeDecodeJsonWithEmptyMetadataMap() throws Exception {
    final InstanceInfo base = infoIterator.next();
    final InstanceInfo instanceInfo = new InstanceInfo.Builder(base).setMetadata(Collections.EMPTY_MAP).build();
    Action2 codingAction = new Action2() {

        @Override
        public void call(EncoderWrapper encodingCodec, DecoderWrapper decodingCodec) throws IOException {
            String encodedString = encodingCodec.encode(instanceInfo);
            InstanceInfo decodedValue = decodingCodec.decode(encodedString, InstanceInfo.class);
            assertThat(EurekaEntityComparators.equal(instanceInfo, decodedValue), is(true));
        }
    };
    verifyAllPairs(codingAction, Application.class, availableJsonWrappers);
    verifyAllPairs(codingAction, Application.class, availableXmlWrappers);
}
Also used : DecoderWrapper(com.netflix.discovery.converters.wrappers.DecoderWrapper) InstanceInfo(com.netflix.appinfo.InstanceInfo) EncoderWrapper(com.netflix.discovery.converters.wrappers.EncoderWrapper) Test(org.junit.Test)

Aggregations

EncoderWrapper (com.netflix.discovery.converters.wrappers.EncoderWrapper)16 DecoderWrapper (com.netflix.discovery.converters.wrappers.DecoderWrapper)14 Test (org.junit.Test)13 InstanceInfo (com.netflix.appinfo.InstanceInfo)9 CodecWrappers (com.netflix.discovery.converters.wrappers.CodecWrappers)7 CodecWrapper (com.netflix.discovery.converters.wrappers.CodecWrapper)3 Applications (com.netflix.discovery.shared.Applications)2 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 MyDataCenterInfo (com.netflix.appinfo.MyDataCenterInfo)1 Application (com.netflix.discovery.shared.Application)1 ReplicationInstance (com.netflix.eureka.cluster.protocol.ReplicationInstance)1 ReplicationInstanceResponse (com.netflix.eureka.cluster.protocol.ReplicationInstanceResponse)1 ReplicationList (com.netflix.eureka.cluster.protocol.ReplicationList)1 ReplicationListResponse (com.netflix.eureka.cluster.protocol.ReplicationListResponse)1 WebApplicationException (javax.ws.rs.WebApplicationException)1