@Test public void testCreateComponentNameWithNamespace() { Artifact artifact = new Artifact(); artifact.addFact(new ArtifactCoordinates( new CoordinateBuilder() .withType(COORD_TYPE) .withName(COORD_NAME) .withNamespace(COORD_NAMESPACE) .withVersion(COORD_VERSION) .build())); String name = ArtifactToComponentUtils.createComponentName(artifact); assertThat(name).isEqualTo(COORD_NAMESPACE + "/" + COORD_NAME); }
public static String createComponentName(Artifact artifact) { return artifact.askFor(ArtifactCoordinates.class) .map(ArtifactCoordinates::getMainCoordinate) .map(ArtifactToComponentUtils::createNameForCoordinate) .orElseGet(() -> artifact.askFor(ArtifactFilename.class) .flatMap(ArtifactFilename::getBestFilenameEntryGuess) .map(ArtifactFilenameEntry::getFilename) .orElseThrow( () -> new ExecutionException("Artifact " + artifact.prettyPrint() + " does not have " + "enough facts to create a component name. Please provide more information " + "by an analyzer (" + artifact.getAnalysisSource() + ")"))); }
ArtifactToComponentUtils { public static String createComponentName(Artifact artifact) { return artifact.askFor(ArtifactCoordinates.class) .map(ArtifactCoordinates::getMainCoordinate) .map(ArtifactToComponentUtils::createNameForCoordinate) .orElseGet(() -> artifact.askFor(ArtifactFilename.class) .flatMap(ArtifactFilename::getBestFilenameEntryGuess) .map(ArtifactFilenameEntry::getFilename) .orElseThrow( () -> new ExecutionException("Artifact " + artifact.prettyPrint() + " does not have " + "enough facts to create a component name. Please provide more information " + "by an analyzer (" + artifact.getAnalysisSource() + ")"))); } }
ArtifactToComponentUtils { public static String createComponentName(Artifact artifact) { return artifact.askFor(ArtifactCoordinates.class) .map(ArtifactCoordinates::getMainCoordinate) .map(ArtifactToComponentUtils::createNameForCoordinate) .orElseGet(() -> artifact.askFor(ArtifactFilename.class) .flatMap(ArtifactFilename::getBestFilenameEntryGuess) .map(ArtifactFilenameEntry::getFilename) .orElseThrow( () -> new ExecutionException("Artifact " + artifact.prettyPrint() + " does not have " + "enough facts to create a component name. Please provide more information " + "by an analyzer (" + artifact.getAnalysisSource() + ")"))); } private  ArtifactToComponentUtils(); }
ArtifactToComponentUtils { public static String createComponentName(Artifact artifact) { return artifact.askFor(ArtifactCoordinates.class) .map(ArtifactCoordinates::getMainCoordinate) .map(ArtifactToComponentUtils::createNameForCoordinate) .orElseGet(() -> artifact.askFor(ArtifactFilename.class) .flatMap(ArtifactFilename::getBestFilenameEntryGuess) .map(ArtifactFilenameEntry::getFilename) .orElseThrow( () -> new ExecutionException("Artifact " + artifact.prettyPrint() + " does not have " + "enough facts to create a component name. Please provide more information " + "by an analyzer (" + artifact.getAnalysisSource() + ")"))); } private  ArtifactToComponentUtils(); static String createComponentName(Artifact artifact); static String createComponentVersion(Artifact artifact); static void setName(SW360Component component, Artifact artifact); static void prepareComponent(SW360Component component, Artifact artifact); }
ArtifactToComponentUtils { public static String createComponentName(Artifact artifact) { return artifact.askFor(ArtifactCoordinates.class) .map(ArtifactCoordinates::getMainCoordinate) .map(ArtifactToComponentUtils::createNameForCoordinate) .orElseGet(() -> artifact.askFor(ArtifactFilename.class) .flatMap(ArtifactFilename::getBestFilenameEntryGuess) .map(ArtifactFilenameEntry::getFilename) .orElseThrow( () -> new ExecutionException("Artifact " + artifact.prettyPrint() + " does not have " + "enough facts to create a component name. Please provide more information " + "by an analyzer (" + artifact.getAnalysisSource() + ")"))); } private  ArtifactToComponentUtils(); static String createComponentName(Artifact artifact); static String createComponentVersion(Artifact artifact); static void setName(SW360Component component, Artifact artifact); static void prepareComponent(SW360Component component, Artifact artifact);  }