@Test public void testCreateProviderExisting() { prepareConfigurationForCreate(); String existingId = providers.get(1).getKey().getId(); when(providerConfiguration.getId()).thenReturn(existingId); expectedException.expectMessage("A provider with the given name already exists: " + existingId); service.createProvider(providerType, providerConfiguration); verify(runtimeProvisioningService, never()).registerProvider(any(ProviderConfig.class)); }
@Override public void createProvider(final ProviderType providerType, final ProviderConfiguration configuration) { checkNotNull("providerType", providerType); checkNotNull("providerType.providerTypeKey", providerType.getKey()); checkNotNull("configuration", configuration); checkNotEmpty("configuration.values", configuration.getValues()); validateForCreateProvider(configuration); @SuppressWarnings("unchecked") final ProviderConfig providerConfig = (ProviderConfig) providerConverterFactory.getProviderConfigConverter(providerType.getKey()).toDomain(configuration); runtimeProvisioningService.registerProvider(providerConfig); }
ProviderServiceImpl implements ProviderService { @Override public void createProvider(final ProviderType providerType, final ProviderConfiguration configuration) { checkNotNull("providerType", providerType); checkNotNull("providerType.providerTypeKey", providerType.getKey()); checkNotNull("configuration", configuration); checkNotEmpty("configuration.values", configuration.getValues()); validateForCreateProvider(configuration); @SuppressWarnings("unchecked") final ProviderConfig providerConfig = (ProviderConfig) providerConverterFactory.getProviderConfigConverter(providerType.getKey()).toDomain(configuration); runtimeProvisioningService.registerProvider(providerConfig); } }
ProviderServiceImpl implements ProviderService { @Override public void createProvider(final ProviderType providerType, final ProviderConfiguration configuration) { checkNotNull("providerType", providerType); checkNotNull("providerType.providerTypeKey", providerType.getKey()); checkNotNull("configuration", configuration); checkNotEmpty("configuration.values", configuration.getValues()); validateForCreateProvider(configuration); @SuppressWarnings("unchecked") final ProviderConfig providerConfig = (ProviderConfig) providerConverterFactory.getProviderConfigConverter(providerType.getKey()).toDomain(configuration); runtimeProvisioningService.registerProvider(providerConfig); } ProviderServiceImpl(); @Inject  ProviderServiceImpl(final RuntimeProvisioningServiceBackend runtimeProvisioningService,
                               final ProviderConverterFactory providerConverterFactory); }
ProviderServiceImpl implements ProviderService { @Override public void createProvider(final ProviderType providerType, final ProviderConfiguration configuration) { checkNotNull("providerType", providerType); checkNotNull("providerType.providerTypeKey", providerType.getKey()); checkNotNull("configuration", configuration); checkNotEmpty("configuration.values", configuration.getValues()); validateForCreateProvider(configuration); @SuppressWarnings("unchecked") final ProviderConfig providerConfig = (ProviderConfig) providerConverterFactory.getProviderConfigConverter(providerType.getKey()).toDomain(configuration); runtimeProvisioningService.registerProvider(providerConfig); } ProviderServiceImpl(); @Inject  ProviderServiceImpl(final RuntimeProvisioningServiceBackend runtimeProvisioningService,
                               final ProviderConverterFactory providerConverterFactory); @Override Collection<Provider> getProviders(final ProviderType providerType); @Override Collection<ProviderKey> getProvidersKey(final ProviderType providerType); @Override void createProvider(final ProviderType providerType,
                               final ProviderConfiguration configuration); @Override void deleteProvider(final ProviderKey providerKey); @Override Provider getProvider(final ProviderKey providerKey); }
ProviderServiceImpl implements ProviderService { @Override public void createProvider(final ProviderType providerType, final ProviderConfiguration configuration) { checkNotNull("providerType", providerType); checkNotNull("providerType.providerTypeKey", providerType.getKey()); checkNotNull("configuration", configuration); checkNotEmpty("configuration.values", configuration.getValues()); validateForCreateProvider(configuration); @SuppressWarnings("unchecked") final ProviderConfig providerConfig = (ProviderConfig) providerConverterFactory.getProviderConfigConverter(providerType.getKey()).toDomain(configuration); runtimeProvisioningService.registerProvider(providerConfig); } ProviderServiceImpl(); @Inject  ProviderServiceImpl(final RuntimeProvisioningServiceBackend runtimeProvisioningService,
                               final ProviderConverterFactory providerConverterFactory); @Override Collection<Provider> getProviders(final ProviderType providerType); @Override Collection<ProviderKey> getProvidersKey(final ProviderType providerType); @Override void createProvider(final ProviderType providerType,
                               final ProviderConfiguration configuration); @Override void deleteProvider(final ProviderKey providerKey); @Override Provider getProvider(final ProviderKey providerKey);  }