@Test(groups = "deserializationTest") public void testBuildFastGenericDeserializerSurviveFromWrongClasspath() throws Exception { String wrongClasspath = "."; FastSerdeCache cache = new FastSerdeCache(wrongClasspath); Schema testRecord = Schema.parse("{\"type\": \"record\", \"name\": \"test_record\", \"fields\":[]}"); cache.buildFastGenericDeserializer(testRecord, testRecord); }
public FastDeserializer<?> buildFastGenericDeserializer(Schema writerSchema, Schema readerSchema) { FastGenericDeserializerGenerator<?> generator = new FastGenericDeserializerGenerator<>(writerSchema, readerSchema, classesDir, classLoader, compileClassPath.orElseGet(() -> null)); FastDeserializer<?> fastDeserializer = generator.generateDeserializer(); if (LOGGER.isDebugEnabled()) { LOGGER.debug("Generated classes dir: {} and generation of generic FastDeserializer is done for writer schema of type: {} with fingerprint: {}" + " and content: [\n{}\n] and reader schema of type: {} with fingerprint: {} and content: [\n{}\n]", classesDir, getSchemaFullName(writerSchema), writerSchema.toString(true), getSchemaFingerprint(writerSchema), getSchemaFullName(readerSchema), getSchemaFingerprint(readerSchema), readerSchema.toString(true)); } else { LOGGER.info("Generated classes dir: {} and generation of generic FastDeserializer is done for writer schema of type: {} with fingerprint: {}" + " and reader schema of type: {} with fingerprint: {}", classesDir, getSchemaFullName(writerSchema), getSchemaFingerprint(writerSchema), getSchemaFullName(readerSchema), getSchemaFingerprint(readerSchema)); } return fastDeserializer; }
FastSerdeCache { public FastDeserializer<?> buildFastGenericDeserializer(Schema writerSchema, Schema readerSchema) { FastGenericDeserializerGenerator<?> generator = new FastGenericDeserializerGenerator<>(writerSchema, readerSchema, classesDir, classLoader, compileClassPath.orElseGet(() -> null)); FastDeserializer<?> fastDeserializer = generator.generateDeserializer(); if (LOGGER.isDebugEnabled()) { LOGGER.debug("Generated classes dir: {} and generation of generic FastDeserializer is done for writer schema of type: {} with fingerprint: {}" + " and content: [\n{}\n] and reader schema of type: {} with fingerprint: {} and content: [\n{}\n]", classesDir, getSchemaFullName(writerSchema), writerSchema.toString(true), getSchemaFingerprint(writerSchema), getSchemaFullName(readerSchema), getSchemaFingerprint(readerSchema), readerSchema.toString(true)); } else { LOGGER.info("Generated classes dir: {} and generation of generic FastDeserializer is done for writer schema of type: {} with fingerprint: {}" + " and reader schema of type: {} with fingerprint: {}", classesDir, getSchemaFullName(writerSchema), getSchemaFingerprint(writerSchema), getSchemaFullName(readerSchema), getSchemaFingerprint(readerSchema)); } return fastDeserializer; } }
FastSerdeCache { public FastDeserializer<?> buildFastGenericDeserializer(Schema writerSchema, Schema readerSchema) { FastGenericDeserializerGenerator<?> generator = new FastGenericDeserializerGenerator<>(writerSchema, readerSchema, classesDir, classLoader, compileClassPath.orElseGet(() -> null)); FastDeserializer<?> fastDeserializer = generator.generateDeserializer(); if (LOGGER.isDebugEnabled()) { LOGGER.debug("Generated classes dir: {} and generation of generic FastDeserializer is done for writer schema of type: {} with fingerprint: {}" + " and content: [\n{}\n] and reader schema of type: {} with fingerprint: {} and content: [\n{}\n]", classesDir, getSchemaFullName(writerSchema), writerSchema.toString(true), getSchemaFingerprint(writerSchema), getSchemaFullName(readerSchema), getSchemaFingerprint(readerSchema), readerSchema.toString(true)); } else { LOGGER.info("Generated classes dir: {} and generation of generic FastDeserializer is done for writer schema of type: {} with fingerprint: {}" + " and reader schema of type: {} with fingerprint: {}", classesDir, getSchemaFullName(writerSchema), getSchemaFingerprint(writerSchema), getSchemaFullName(readerSchema), getSchemaFingerprint(readerSchema)); } return fastDeserializer; } FastSerdeCache(Supplier<String> compileClassPathSupplier);  FastSerdeCache(Executor executorService, Supplier<String> compileClassPathSupplier);  FastSerdeCache(String compileClassPath);  FastSerdeCache(Executor executorService, String compileClassPath);  FastSerdeCache(Executor executorService); private  FastSerdeCache(); }
FastSerdeCache { public FastDeserializer<?> buildFastGenericDeserializer(Schema writerSchema, Schema readerSchema) { FastGenericDeserializerGenerator<?> generator = new FastGenericDeserializerGenerator<>(writerSchema, readerSchema, classesDir, classLoader, compileClassPath.orElseGet(() -> null)); FastDeserializer<?> fastDeserializer = generator.generateDeserializer(); if (LOGGER.isDebugEnabled()) { LOGGER.debug("Generated classes dir: {} and generation of generic FastDeserializer is done for writer schema of type: {} with fingerprint: {}" + " and content: [\n{}\n] and reader schema of type: {} with fingerprint: {} and content: [\n{}\n]", classesDir, getSchemaFullName(writerSchema), writerSchema.toString(true), getSchemaFingerprint(writerSchema), getSchemaFullName(readerSchema), getSchemaFingerprint(readerSchema), readerSchema.toString(true)); } else { LOGGER.info("Generated classes dir: {} and generation of generic FastDeserializer is done for writer schema of type: {} with fingerprint: {}" + " and reader schema of type: {} with fingerprint: {}", classesDir, getSchemaFullName(writerSchema), getSchemaFingerprint(writerSchema), getSchemaFullName(readerSchema), getSchemaFingerprint(readerSchema)); } return fastDeserializer; } FastSerdeCache(Supplier<String> compileClassPathSupplier);  FastSerdeCache(Executor executorService, Supplier<String> compileClassPathSupplier);  FastSerdeCache(String compileClassPath);  FastSerdeCache(Executor executorService, String compileClassPath);  FastSerdeCache(Executor executorService); private  FastSerdeCache(); static FastSerdeCache getDefaultInstance(); static boolean isSupportedForFastDeserializer(Schema.Type readerSchemaType); static boolean isSupportedForFastSerializer(Schema.Type schemaType); FastDeserializer<?> getFastSpecificDeserializer(Schema writerSchema, Schema readerSchema); FastDeserializer<?> getFastGenericDeserializer(Schema writerSchema, Schema readerSchema); FastSerializer<?> getFastSpecificSerializer(Schema schema); FastSerializer<?> getFastGenericSerializer(Schema schema); FastDeserializer<?> buildFastSpecificDeserializer(Schema writerSchema, Schema readerSchema); FastDeserializer<?> buildFastGenericDeserializer(Schema writerSchema, Schema readerSchema); FastSerializer<?> buildFastSpecificSerializer(Schema schema); FastSerializer<?> buildFastGenericSerializer(Schema schema); }
FastSerdeCache { public FastDeserializer<?> buildFastGenericDeserializer(Schema writerSchema, Schema readerSchema) { FastGenericDeserializerGenerator<?> generator = new FastGenericDeserializerGenerator<>(writerSchema, readerSchema, classesDir, classLoader, compileClassPath.orElseGet(() -> null)); FastDeserializer<?> fastDeserializer = generator.generateDeserializer(); if (LOGGER.isDebugEnabled()) { LOGGER.debug("Generated classes dir: {} and generation of generic FastDeserializer is done for writer schema of type: {} with fingerprint: {}" + " and content: [\n{}\n] and reader schema of type: {} with fingerprint: {} and content: [\n{}\n]", classesDir, getSchemaFullName(writerSchema), writerSchema.toString(true), getSchemaFingerprint(writerSchema), getSchemaFullName(readerSchema), getSchemaFingerprint(readerSchema), readerSchema.toString(true)); } else { LOGGER.info("Generated classes dir: {} and generation of generic FastDeserializer is done for writer schema of type: {} with fingerprint: {}" + " and reader schema of type: {} with fingerprint: {}", classesDir, getSchemaFullName(writerSchema), getSchemaFingerprint(writerSchema), getSchemaFullName(readerSchema), getSchemaFingerprint(readerSchema)); } return fastDeserializer; } FastSerdeCache(Supplier<String> compileClassPathSupplier);  FastSerdeCache(Executor executorService, Supplier<String> compileClassPathSupplier);  FastSerdeCache(String compileClassPath);  FastSerdeCache(Executor executorService, String compileClassPath);  FastSerdeCache(Executor executorService); private  FastSerdeCache(); static FastSerdeCache getDefaultInstance(); static boolean isSupportedForFastDeserializer(Schema.Type readerSchemaType); static boolean isSupportedForFastSerializer(Schema.Type schemaType); FastDeserializer<?> getFastSpecificDeserializer(Schema writerSchema, Schema readerSchema); FastDeserializer<?> getFastGenericDeserializer(Schema writerSchema, Schema readerSchema); FastSerializer<?> getFastSpecificSerializer(Schema schema); FastSerializer<?> getFastGenericSerializer(Schema schema); FastDeserializer<?> buildFastSpecificDeserializer(Schema writerSchema, Schema readerSchema); FastDeserializer<?> buildFastGenericDeserializer(Schema writerSchema, Schema readerSchema); FastSerializer<?> buildFastSpecificSerializer(Schema schema); FastSerializer<?> buildFastGenericSerializer(Schema schema); static final String CLASSPATH; static final String CLASSPATH_SUPPLIER; }