@Test public void testFromConnectRecursiveSchema() { Descriptor expected = RecursiveKeyValue.RecursiveKeyValueMessage.getDescriptor(); ProtobufData protobufData = new ProtobufData(); ProtobufSchema protobufSchema = protobufData.fromConnectSchema(getRecursiveSchema()); Descriptor actual = protobufSchema.toDescriptor(); FieldDescriptor expectedKey = expected.findFieldByName("key"); FieldDescriptor expectedValue = expected.findFieldByName("value"); FieldDescriptor expectedKeyValue = expected.findFieldByName("key_value"); FieldDescriptor actualKey = actual.findFieldByName("key"); FieldDescriptor actualValue = actual.findFieldByName("value"); FieldDescriptor actualKeyValue = actual.findFieldByName("key_value"); assertEquals(expectedKey.getType(), actualKey.getType()); assertEquals(expectedKey.getNumber(), actualKey.getNumber()); assertEquals(expectedValue.getType(), actualValue.getType()); assertEquals(expectedValue.getNumber(), actualValue.getNumber()); assertEquals(actual, actualKeyValue.getMessageType()); assertEquals(expectedKeyValue.getNumber(), actualKeyValue.getNumber()); }
public ProtobufSchema fromConnectSchema(Schema schema) { if (schema == null) { return null; } ProtobufSchema cachedSchema = fromConnectSchemaCache.get(schema); if (cachedSchema != null) { return cachedSchema; } String name = schema.name(); if (name == null) { name = DEFAULT_SCHEMA_NAME + "1"; } ProtobufSchema resultSchema = new ProtobufSchema( rawSchemaFromConnectSchema(schema).getMessageDescriptor(name) ); fromConnectSchemaCache.put(schema, resultSchema); return resultSchema; }
ProtobufData { public ProtobufSchema fromConnectSchema(Schema schema) { if (schema == null) { return null; } ProtobufSchema cachedSchema = fromConnectSchemaCache.get(schema); if (cachedSchema != null) { return cachedSchema; } String name = schema.name(); if (name == null) { name = DEFAULT_SCHEMA_NAME + "1"; } ProtobufSchema resultSchema = new ProtobufSchema( rawSchemaFromConnectSchema(schema).getMessageDescriptor(name) ); fromConnectSchemaCache.put(schema, resultSchema); return resultSchema; } }
ProtobufData { public ProtobufSchema fromConnectSchema(Schema schema) { if (schema == null) { return null; } ProtobufSchema cachedSchema = fromConnectSchemaCache.get(schema); if (cachedSchema != null) { return cachedSchema; } String name = schema.name(); if (name == null) { name = DEFAULT_SCHEMA_NAME + "1"; } ProtobufSchema resultSchema = new ProtobufSchema( rawSchemaFromConnectSchema(schema).getMessageDescriptor(name) ); fromConnectSchemaCache.put(schema, resultSchema); return resultSchema; } ProtobufData();  ProtobufData(int cacheSize);  ProtobufData(ProtobufDataConfig protobufDataConfig); }
ProtobufData { public ProtobufSchema fromConnectSchema(Schema schema) { if (schema == null) { return null; } ProtobufSchema cachedSchema = fromConnectSchemaCache.get(schema); if (cachedSchema != null) { return cachedSchema; } String name = schema.name(); if (name == null) { name = DEFAULT_SCHEMA_NAME + "1"; } ProtobufSchema resultSchema = new ProtobufSchema( rawSchemaFromConnectSchema(schema).getMessageDescriptor(name) ); fromConnectSchemaCache.put(schema, resultSchema); return resultSchema; } ProtobufData();  ProtobufData(int cacheSize);  ProtobufData(ProtobufDataConfig protobufDataConfig); ProtobufSchemaAndValue fromConnectData(Schema schema, Object value); ProtobufSchema fromConnectSchema(Schema schema); SchemaAndValue toConnectData(ProtobufSchema protobufSchema, Message message); Schema toConnectSchema(ProtobufSchema schema); }
ProtobufData { public ProtobufSchema fromConnectSchema(Schema schema) { if (schema == null) { return null; } ProtobufSchema cachedSchema = fromConnectSchemaCache.get(schema); if (cachedSchema != null) { return cachedSchema; } String name = schema.name(); if (name == null) { name = DEFAULT_SCHEMA_NAME + "1"; } ProtobufSchema resultSchema = new ProtobufSchema( rawSchemaFromConnectSchema(schema).getMessageDescriptor(name) ); fromConnectSchemaCache.put(schema, resultSchema); return resultSchema; } ProtobufData();  ProtobufData(int cacheSize);  ProtobufData(ProtobufDataConfig protobufDataConfig); ProtobufSchemaAndValue fromConnectData(Schema schema, Object value); ProtobufSchema fromConnectSchema(Schema schema); SchemaAndValue toConnectData(ProtobufSchema protobufSchema, Message message); Schema toConnectSchema(ProtobufSchema schema); static final String NAMESPACE; static final String DEFAULT_SCHEMA_NAME; static final String MAP_ENTRY_SUFFIX; static final String KEY_FIELD; static final String VALUE_FIELD; static final String PROTOBUF_TYPE_ENUM; static final String PROTOBUF_TYPE_ENUM_PREFIX; static final String PROTOBUF_TYPE_UNION; static final String PROTOBUF_TYPE_UNION_PREFIX; static final String PROTOBUF_TYPE_TAG; static final String GOOGLE_PROTOBUF_PACKAGE; static final String GOOGLE_PROTOBUF_TIMESTAMP_NAME; static final String GOOGLE_PROTOBUF_TIMESTAMP_FULL_NAME; static final String GOOGLE_PROTOBUF_TIMESTAMP_LOCATION; }