@Test public void testInvalidSyntax() throws Exception { ContentHandle content = resourceToContentHandle("kconnect-invalid.json"); KafkaConnectContentValidator validator = new KafkaConnectContentValidator(); Assertions.assertThrows(InvalidContentException.class, () -> { validator.validate(ValidityLevel.SYNTAX_ONLY, content); }); }
@Override public void validate(ValidityLevel level, ContentHandle artifactContent) throws InvalidContentException { if (level == ValidityLevel.SYNTAX_ONLY || level == ValidityLevel.FULL) { try { JsonNode jsonNode = mapper.readTree(artifactContent.content()); jsonConverter.asConnectSchema(jsonNode); } catch (Exception e) { throw new InvalidContentException("Syntax violation for Kafka Connect Schema artifact.", e); } } }
KafkaConnectContentValidator implements ContentValidator { @Override public void validate(ValidityLevel level, ContentHandle artifactContent) throws InvalidContentException { if (level == ValidityLevel.SYNTAX_ONLY || level == ValidityLevel.FULL) { try { JsonNode jsonNode = mapper.readTree(artifactContent.content()); jsonConverter.asConnectSchema(jsonNode); } catch (Exception e) { throw new InvalidContentException("Syntax violation for Kafka Connect Schema artifact.", e); } } } }
KafkaConnectContentValidator implements ContentValidator { @Override public void validate(ValidityLevel level, ContentHandle artifactContent) throws InvalidContentException { if (level == ValidityLevel.SYNTAX_ONLY || level == ValidityLevel.FULL) { try { JsonNode jsonNode = mapper.readTree(artifactContent.content()); jsonConverter.asConnectSchema(jsonNode); } catch (Exception e) { throw new InvalidContentException("Syntax violation for Kafka Connect Schema artifact.", e); } } } KafkaConnectContentValidator(); }
KafkaConnectContentValidator implements ContentValidator { @Override public void validate(ValidityLevel level, ContentHandle artifactContent) throws InvalidContentException { if (level == ValidityLevel.SYNTAX_ONLY || level == ValidityLevel.FULL) { try { JsonNode jsonNode = mapper.readTree(artifactContent.content()); jsonConverter.asConnectSchema(jsonNode); } catch (Exception e) { throw new InvalidContentException("Syntax violation for Kafka Connect Schema artifact.", e); } } } KafkaConnectContentValidator(); @Override void validate(ValidityLevel level, ContentHandle artifactContent); }
KafkaConnectContentValidator implements ContentValidator { @Override public void validate(ValidityLevel level, ContentHandle artifactContent) throws InvalidContentException { if (level == ValidityLevel.SYNTAX_ONLY || level == ValidityLevel.FULL) { try { JsonNode jsonNode = mapper.readTree(artifactContent.content()); jsonConverter.asConnectSchema(jsonNode); } catch (Exception e) { throw new InvalidContentException("Syntax violation for Kafka Connect Schema artifact.", e); } } } KafkaConnectContentValidator(); @Override void validate(ValidityLevel level, ContentHandle artifactContent);  }