use of com.fasterxml.jackson.dataformat.protobuf.schema.FieldType in project java-chassis by ServiceComb.
the class TestAbstractFieldCodec method testInit.
@Test
public void testInit() {
ProtobufField[] protobufFieldArray = new ProtobufField[5];
FieldElement rawType = null;
FieldType type = FieldType.STRING;
ProtobufField p = new ProtobufField(rawType, type);
protobufFieldArray[0] = p;
Type[] types = new Type[1];
types[0] = Integer.TYPE;
Mockito.when(schema.getRootType()).thenReturn(Mockito.mock(ProtobufMessage.class));
Mockito.when(schema.getRootType().getFieldCount()).thenReturn(1);
Mockito.when(schema.getRootType().fields()).thenReturn(Arrays.asList(protobufFieldArray));
abstractFieldCodec.init(schema, types);
Assert.assertNotNull(abstractFieldCodec.readerHelpDataMap.get("UNKNOWN"));
}
use of com.fasterxml.jackson.dataformat.protobuf.schema.FieldType in project java-chassis by ServiceComb.
the class TestParamFieldCodec method testInit.
@Test
public void testInit() {
Assert.assertNotNull(paramFieldCodec);
ProtobufField[] protobufFieldArray = new ProtobufField[5];
FieldElement rawType = null;
FieldType type = FieldType.STRING;
ProtobufField p = new ProtobufField(rawType, type);
protobufFieldArray[0] = p;
Type[] types = new Type[10];
types[0] = Integer.TYPE;
Mockito.when(schema.getRootType()).thenReturn(Mockito.mock(ProtobufMessage.class));
Mockito.when(schema.getRootType().getFieldCount()).thenReturn(1);
Mockito.when(schema.getRootType().fields()).thenReturn(Arrays.asList(protobufFieldArray));
Assert.assertNull(paramFieldCodec.reader);
Assert.assertNull(paramFieldCodec.writer);
paramFieldCodec.init(schema, types);
Assert.assertNotNull(paramFieldCodec.reader);
Assert.assertNotNull(paramFieldCodec.writer);
}
use of com.fasterxml.jackson.dataformat.protobuf.schema.FieldType in project java-chassis by ServiceComb.
the class TestResultFieldCodec method testInit.
@Test
public void testInit() {
Assert.assertNotNull(resultFieldCodec);
ProtobufField[] protobufFieldArray = new ProtobufField[5];
FieldElement rawType = null;
FieldType type = FieldType.STRING;
ProtobufField p = new ProtobufField(rawType, type);
protobufFieldArray[0] = p;
Type[] types = new Type[10];
types[0] = Integer.TYPE;
Mockito.when(schema.getRootType()).thenReturn(Mockito.mock(ProtobufMessage.class));
Mockito.when(schema.getRootType().getFieldCount()).thenReturn(1);
Mockito.when(schema.getRootType().fields()).thenReturn(Arrays.asList(protobufFieldArray));
Assert.assertNull(resultFieldCodec.reader);
Assert.assertNull(resultFieldCodec.writer);
resultFieldCodec.init(schema, types);
Assert.assertNotNull(resultFieldCodec.reader);
Assert.assertNotNull(resultFieldCodec.writer);
}
use of com.fasterxml.jackson.dataformat.protobuf.schema.FieldType in project java-chassis by ServiceComb.
the class TestStandardParamCodec method testInit.
@Test
public void testInit() {
Assert.assertNotNull(standardParamCodec);
ProtobufField[] protobufFieldArray = new ProtobufField[5];
FieldElement rawType = null;
FieldType type = FieldType.STRING;
ProtobufField p = new ProtobufField(rawType, type);
protobufFieldArray[0] = p;
Type[] types = new Type[1];
types[0] = Integer.TYPE;
Mockito.when(schema.getSchemaType()).thenReturn(FORMAT_NAME_PROTOBUF);
Mockito.when(schema.getRootType()).thenReturn(Mockito.mock(ProtobufMessage.class));
Mockito.when(schema.getRootType().getFieldCount()).thenReturn(1);
Mockito.when(schema.getRootType().fields()).thenReturn(Arrays.asList(protobufFieldArray));
Assert.assertNull(standardParamCodec.writer);
Assert.assertNull(standardParamCodec.reader);
standardParamCodec.init(schema, types);
Assert.assertNotNull(standardParamCodec.writer);
Assert.assertNotNull(standardParamCodec.reader);
}
use of com.fasterxml.jackson.dataformat.protobuf.schema.FieldType in project java-chassis by ServiceComb.
the class TestStandardResultCodec method testInit.
@Test
public void testInit() {
Assert.assertNotNull(standardResultCodec);
ProtobufField[] protobufFieldArray = new ProtobufField[5];
FieldElement rawType = null;
FieldType type = FieldType.STRING;
ProtobufField p = new ProtobufField(rawType, type);
protobufFieldArray[0] = p;
Type[] types = new Type[1];
types[0] = Integer.TYPE;
Mockito.when(schema.getSchemaType()).thenReturn(FORMAT_NAME_PROTOBUF);
Mockito.when(schema.getRootType()).thenReturn(Mockito.mock(ProtobufMessage.class));
Mockito.when(schema.getRootType().getFieldCount()).thenReturn(1);
Mockito.when(schema.getRootType().fields()).thenReturn(Arrays.asList(protobufFieldArray));
Assert.assertNull(standardResultCodec.reader);
Assert.assertNull(standardResultCodec.writer);
standardResultCodec.init(schema, types);
Assert.assertNotNull(standardResultCodec.reader);
Assert.assertNotNull(standardResultCodec.writer);
}
Aggregations