You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/04/11 13:58:22 UTC

[GitHub] [pulsar] eolivelli commented on a diff in pull request #15122: Add a cache of versioned sub-schemas in KeyValueSchemaImpl

eolivelli commented on code in PR #15122:
URL: https://github.com/apache/pulsar/pull/15122#discussion_r847359502


##########
pulsar-client/src/test/java/org/apache/pulsar/client/impl/schema/KeyValueSchemaTest.java:
##########
@@ -400,4 +404,18 @@ public void testKeyValueSchemaSeparatedEncoding() {
                 AutoConsumeSchema.getSchema(keyValueSchema.getSchemaInfo());
         assertEquals(keyValueSchema.getKeyValueEncodingType(), keyValueSchema2.getKeyValueEncodingType());
     }
+
+    @Test
+    public void testSchemaCaches() {
+        Schema<Foo> keySchema = spy(Schema.AVRO(Foo.class));
+        Schema<Foo> valueSchema = spy(Schema.AVRO(Foo.class));
+        KeyValueSchemaImpl<Foo, Foo> keyValueSchema = (KeyValueSchemaImpl<Foo,Foo>)
+                KeyValueSchemaImpl.of(keySchema, valueSchema, KeyValueEncodingType.SEPARATED);
+
+        keyValueSchema.atSchemaVersion(new byte[0]);
+        keyValueSchema.atSchemaVersion(new byte[0]);

Review Comment:
   can we assert that we are returning the same object ?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org