@Test(expected = InvalidContentException.class) public void throwInvalidContentWhenMetadataEmpty() { InputStream mavenMetadata = toInputStream(""); underTest.validate(VALID_PATH, mavenMetadata); }
public void validate(final String path, final InputStream mavenMetadata) { try { Metadata metadata = MavenModels.readMetadata(mavenMetadata); if (metadata == null) { throw new InvalidContentException("Metadata at path " + path + " is not a valid maven-metadata.xml"); } if (isNotEmpty(metadata.getGroupId())) { validatePath(path, metadata); } else { log.debug("No groupId found in maven-metadata.xml therefore skipping validation"); } } catch (IOException e) { log.warn("Unable to read maven-metadata.xml at path {}", path, e ); throw new InvalidContentException("Unable to read maven-metadata.xml reason: " + e.getMessage()); } }
MavenMetadataContentValidator extends ComponentSupport { public void validate(final String path, final InputStream mavenMetadata) { try { Metadata metadata = MavenModels.readMetadata(mavenMetadata); if (metadata == null) { throw new InvalidContentException("Metadata at path " + path + " is not a valid maven-metadata.xml"); } if (isNotEmpty(metadata.getGroupId())) { validatePath(path, metadata); } else { log.debug("No groupId found in maven-metadata.xml therefore skipping validation"); } } catch (IOException e) { log.warn("Unable to read maven-metadata.xml at path {}", path, e ); throw new InvalidContentException("Unable to read maven-metadata.xml reason: " + e.getMessage()); } } }
MavenMetadataContentValidator extends ComponentSupport { public void validate(final String path, final InputStream mavenMetadata) { try { Metadata metadata = MavenModels.readMetadata(mavenMetadata); if (metadata == null) { throw new InvalidContentException("Metadata at path " + path + " is not a valid maven-metadata.xml"); } if (isNotEmpty(metadata.getGroupId())) { validatePath(path, metadata); } else { log.debug("No groupId found in maven-metadata.xml therefore skipping validation"); } } catch (IOException e) { log.warn("Unable to read maven-metadata.xml at path {}", path, e ); throw new InvalidContentException("Unable to read maven-metadata.xml reason: " + e.getMessage()); } }  }
MavenMetadataContentValidator extends ComponentSupport { public void validate(final String path, final InputStream mavenMetadata) { try { Metadata metadata = MavenModels.readMetadata(mavenMetadata); if (metadata == null) { throw new InvalidContentException("Metadata at path " + path + " is not a valid maven-metadata.xml"); } if (isNotEmpty(metadata.getGroupId())) { validatePath(path, metadata); } else { log.debug("No groupId found in maven-metadata.xml therefore skipping validation"); } } catch (IOException e) { log.warn("Unable to read maven-metadata.xml at path {}", path, e ); throw new InvalidContentException("Unable to read maven-metadata.xml reason: " + e.getMessage()); } }  void validate(final String path, final InputStream mavenMetadata); }
MavenMetadataContentValidator extends ComponentSupport { public void validate(final String path, final InputStream mavenMetadata) { try { Metadata metadata = MavenModels.readMetadata(mavenMetadata); if (metadata == null) { throw new InvalidContentException("Metadata at path " + path + " is not a valid maven-metadata.xml"); } if (isNotEmpty(metadata.getGroupId())) { validatePath(path, metadata); } else { log.debug("No groupId found in maven-metadata.xml therefore skipping validation"); } } catch (IOException e) { log.warn("Unable to read maven-metadata.xml at path {}", path, e ); throw new InvalidContentException("Unable to read maven-metadata.xml reason: " + e.getMessage()); } }  void validate(final String path, final InputStream mavenMetadata);  }