@Test public void testFindReleaseForArtifactNotPresentComponent() { final String version = "version"; final Artifact artifact = new Artifact() .addFact(new ArtifactCoordinates(new Coordinate("name", version))); final String componentName = ArtifactToComponentUtils.createComponentName(artifact); when(componentClientAdapter.getComponentByName(componentName)) .thenReturn(Optional.empty()); setUp(); final Optional<SW360Release> releaseForArtifact = metaDataReceiver.findReleaseForArtifact(artifact); assertThat(releaseForArtifact).isNotPresent(); verify(componentClientAdapter, times(1)).getComponentByName(componentName); verify(releaseClientAdapter, never()).getReleaseByVersion(any(), any()); }
public Optional<SW360Release> findReleaseForArtifact(Artifact artifact) { Optional<SW360Component> component = getComponentByArtifact(artifact); if (component.isPresent()) { String releaseVersionOfArtifact = ArtifactToReleaseUtils.createSW360ReleaseVersion(artifact); return releaseClientAdapter.getReleaseByVersion(component.get(), releaseVersionOfArtifact); } return Optional.empty(); }
SW360MetaDataReceiver { public Optional<SW360Release> findReleaseForArtifact(Artifact artifact) { Optional<SW360Component> component = getComponentByArtifact(artifact); if (component.isPresent()) { String releaseVersionOfArtifact = ArtifactToReleaseUtils.createSW360ReleaseVersion(artifact); return releaseClientAdapter.getReleaseByVersion(component.get(), releaseVersionOfArtifact); } return Optional.empty(); } }
SW360MetaDataReceiver { public Optional<SW360Release> findReleaseForArtifact(Artifact artifact) { Optional<SW360Component> component = getComponentByArtifact(artifact); if (component.isPresent()) { String releaseVersionOfArtifact = ArtifactToReleaseUtils.createSW360ReleaseVersion(artifact); return releaseClientAdapter.getReleaseByVersion(component.get(), releaseVersionOfArtifact); } return Optional.empty(); } SW360MetaDataReceiver(SW360Connection sw360ConnectionConfiguration); }
SW360MetaDataReceiver { public Optional<SW360Release> findReleaseForArtifact(Artifact artifact) { Optional<SW360Component> component = getComponentByArtifact(artifact); if (component.isPresent()) { String releaseVersionOfArtifact = ArtifactToReleaseUtils.createSW360ReleaseVersion(artifact); return releaseClientAdapter.getReleaseByVersion(component.get(), releaseVersionOfArtifact); } return Optional.empty(); } SW360MetaDataReceiver(SW360Connection sw360ConnectionConfiguration); Optional<SW360Release> findReleaseForArtifact(Artifact artifact); Optional<SW360License> getLicenseDetails(SW360SparseLicense sparseLicense); Optional<Path> downloadAttachment(SW360Release release, SW360SparseAttachment attachment, Path downloadPath); }
SW360MetaDataReceiver { public Optional<SW360Release> findReleaseForArtifact(Artifact artifact) { Optional<SW360Component> component = getComponentByArtifact(artifact); if (component.isPresent()) { String releaseVersionOfArtifact = ArtifactToReleaseUtils.createSW360ReleaseVersion(artifact); return releaseClientAdapter.getReleaseByVersion(component.get(), releaseVersionOfArtifact); } return Optional.empty(); } SW360MetaDataReceiver(SW360Connection sw360ConnectionConfiguration); Optional<SW360Release> findReleaseForArtifact(Artifact artifact); Optional<SW360License> getLicenseDetails(SW360SparseLicense sparseLicense); Optional<Path> downloadAttachment(SW360Release release, SW360SparseAttachment attachment, Path downloadPath);  }