@Test public void testGetProviderNotExisting() { ProviderTypeKey providerTypeKey = new ProviderTypeKey("not exist", "not exist"); ProviderKey providerKey = new ProviderKey(providerTypeKey, "not exist"); Provider provider = service.getProvider(providerKey); assertNull(provider); }
@Override public Provider getProvider(final ProviderKey providerKey) { List<org.guvnor.ala.runtime.providers.Provider> providers = runtimeProvisioningService.getProviders(0, 1000, PROVIDER_TYPE_NAME_SORT, true); Optional<Provider> result = Optional.empty(); if (providers != null) { result = providers.stream() .filter(provider -> provider.getId().equals(providerKey.getId())) .map(this::convert) .findFirst(); } return result.orElse(null); }
ProviderServiceImpl implements ProviderService { @Override public Provider getProvider(final ProviderKey providerKey) { List<org.guvnor.ala.runtime.providers.Provider> providers = runtimeProvisioningService.getProviders(0, 1000, PROVIDER_TYPE_NAME_SORT, true); Optional<Provider> result = Optional.empty(); if (providers != null) { result = providers.stream() .filter(provider -> provider.getId().equals(providerKey.getId())) .map(this::convert) .findFirst(); } return result.orElse(null); } }
ProviderServiceImpl implements ProviderService { @Override public Provider getProvider(final ProviderKey providerKey) { List<org.guvnor.ala.runtime.providers.Provider> providers = runtimeProvisioningService.getProviders(0, 1000, PROVIDER_TYPE_NAME_SORT, true); Optional<Provider> result = Optional.empty(); if (providers != null) { result = providers.stream() .filter(provider -> provider.getId().equals(providerKey.getId())) .map(this::convert) .findFirst(); } return result.orElse(null); } ProviderServiceImpl(); @Inject  ProviderServiceImpl(final RuntimeProvisioningServiceBackend runtimeProvisioningService,
                               final ProviderConverterFactory providerConverterFactory); }
ProviderServiceImpl implements ProviderService { @Override public Provider getProvider(final ProviderKey providerKey) { List<org.guvnor.ala.runtime.providers.Provider> providers = runtimeProvisioningService.getProviders(0, 1000, PROVIDER_TYPE_NAME_SORT, true); Optional<Provider> result = Optional.empty(); if (providers != null) { result = providers.stream() .filter(provider -> provider.getId().equals(providerKey.getId())) .map(this::convert) .findFirst(); } return result.orElse(null); } 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 Provider getProvider(final ProviderKey providerKey) { List<org.guvnor.ala.runtime.providers.Provider> providers = runtimeProvisioningService.getProviders(0, 1000, PROVIDER_TYPE_NAME_SORT, true); Optional<Provider> result = Optional.empty(); if (providers != null) { result = providers.stream() .filter(provider -> provider.getId().equals(providerKey.getId())) .map(this::convert) .findFirst(); } return result.orElse(null); } 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);  }