@Test public void testMetaDataReceiverIsCreated() { SW360ConnectionConfigurationFactory connectionFactory = mock(SW360ConnectionConfigurationFactory.class); HttpClient httpClient = mock(HttpClient.class); ObjectMapper mapper = mock(ObjectMapper.class); SW360Connection connection = mock(SW360Connection.class); when(antennaContextMock.getHttpClient()).thenReturn(httpClient); when(antennaContextMock.getObjectMapper()).thenReturn(mapper); when(connectionFactory.createConnection(any(), eq(httpClient), eq(mapper))).thenReturn(connection); sw360Enricher = new SW360Enricher(connectionFactory); sw360Enricher.setAntennaContext(antennaContextMock); SW360MetaDataReceiver metaDataReceiver = sw360Enricher.createMetaDataReceiver(createStandardConfigMap()); assertThat(metaDataReceiver).isNotNull(); @SuppressWarnings("unchecked") ArgumentCaptor<SW360ConnectionConfigurationFactory.Getter<String>> captor = ArgumentCaptor.forClass(SW360ConnectionConfigurationFactory.Getter.class); verify(connectionFactory).createConnection(captor.capture(), eq(httpClient), eq(mapper)); SW360ConnectionConfigurationFactory.Getter<String> getter = captor.getValue(); for (Map.Entry<String, String> e : createStandardConfigMap().entrySet()) { assertThat(getter.apply(e.getKey())).isEqualTo(e.getValue()); } verify(connection).getReleaseAdapter(); verify(antennaContextMock).getHttpClient(); verify(antennaContextMock).getObjectMapper(); }
SW360MetaDataReceiver createMetaDataReceiver(Map<String, String> configMap) { SW360Connection connection = getConnectionFactory().createConnection(key -> getConfigValue(key, configMap), context.getHttpClient(), context.getObjectMapper()); return new SW360MetaDataReceiver(connection); }
SW360Enricher extends AbstractProcessor { SW360MetaDataReceiver createMetaDataReceiver(Map<String, String> configMap) { SW360Connection connection = getConnectionFactory().createConnection(key -> getConfigValue(key, configMap), context.getHttpClient(), context.getObjectMapper()); return new SW360MetaDataReceiver(connection); } }
SW360Enricher extends AbstractProcessor { SW360MetaDataReceiver createMetaDataReceiver(Map<String, String> configMap) { SW360Connection connection = getConnectionFactory().createConnection(key -> getConfigValue(key, configMap), context.getHttpClient(), context.getObjectMapper()); return new SW360MetaDataReceiver(connection); } SW360Enricher();   SW360Enricher(SW360ConnectionConfigurationFactory factory); }
SW360Enricher extends AbstractProcessor { SW360MetaDataReceiver createMetaDataReceiver(Map<String, String> configMap) { SW360Connection connection = getConnectionFactory().createConnection(key -> getConfigValue(key, configMap), context.getHttpClient(), context.getObjectMapper()); return new SW360MetaDataReceiver(connection); } SW360Enricher();   SW360Enricher(SW360ConnectionConfigurationFactory factory); @Override void configure(Map<String, String> configMap); @Override Collection<Artifact> process(Collection<Artifact> intermediates); }
SW360Enricher extends AbstractProcessor { SW360MetaDataReceiver createMetaDataReceiver(Map<String, String> configMap) { SW360Connection connection = getConnectionFactory().createConnection(key -> getConfigValue(key, configMap), context.getHttpClient(), context.getObjectMapper()); return new SW360MetaDataReceiver(connection); } SW360Enricher();   SW360Enricher(SW360ConnectionConfigurationFactory factory); @Override void configure(Map<String, String> configMap); @Override Collection<Artifact> process(Collection<Artifact> intermediates);  }