@Test public void testGetProviderTypesStatus() { Map<ProviderType, ProviderTypeStatus> initialStatusMap = service.getProviderTypesStatus(); assertEquals(PROVIDER_TYPES_COUNT, initialStatusMap.size()); initialStatusMap.values().forEach(status -> assertEquals(status, ProviderTypeStatus.DISABLED)); pickSomeProviders(); service.enableProviderTypes(pickedProviderTypes); Map<ProviderType, ProviderTypeStatus> currentStatusMap = service.getProviderTypesStatus(); assertEquals(PROVIDER_TYPES_COUNT, currentStatusMap.size()); pickedProviderTypes.forEach(enabledProvider -> assertEquals(ProviderTypeStatus.ENABLED, currentStatusMap.get(pickedProviderTypes.get(0)))); long expectedDisabled = PROVIDER_TYPES_COUNT - pickedProviderTypes.size(); long currentDisabled = currentStatusMap.values().stream() .filter(status -> status == ProviderTypeStatus.DISABLED).count(); assertEquals(expectedDisabled, currentDisabled); }
@Override public Map<ProviderType, ProviderTypeStatus> getProviderTypesStatus() { final Map<ProviderType, ProviderTypeStatus> result = new HashMap<>(); readProviderTypeEnablements().forEach((providerType, isEnabled) -> result.put(providerType, Boolean.TRUE.equals(isEnabled) ? ProviderTypeStatus.ENABLED : ProviderTypeStatus.DISABLED) ); getAvailableProviderTypes().forEach(providerType -> { if (!result.containsKey(providerType)) { result.put(providerType, ProviderTypeStatus.DISABLED); } }); return result; }
ProviderTypeServiceImpl implements ProviderTypeService { @Override public Map<ProviderType, ProviderTypeStatus> getProviderTypesStatus() { final Map<ProviderType, ProviderTypeStatus> result = new HashMap<>(); readProviderTypeEnablements().forEach((providerType, isEnabled) -> result.put(providerType, Boolean.TRUE.equals(isEnabled) ? ProviderTypeStatus.ENABLED : ProviderTypeStatus.DISABLED) ); getAvailableProviderTypes().forEach(providerType -> { if (!result.containsKey(providerType)) { result.put(providerType, ProviderTypeStatus.DISABLED); } }); return result; } }
ProviderTypeServiceImpl implements ProviderTypeService { @Override public Map<ProviderType, ProviderTypeStatus> getProviderTypesStatus() { final Map<ProviderType, ProviderTypeStatus> result = new HashMap<>(); readProviderTypeEnablements().forEach((providerType, isEnabled) -> result.put(providerType, Boolean.TRUE.equals(isEnabled) ? ProviderTypeStatus.ENABLED : ProviderTypeStatus.DISABLED) ); getAvailableProviderTypes().forEach(providerType -> { if (!result.containsKey(providerType)) { result.put(providerType, ProviderTypeStatus.DISABLED); } }); return result; } ProviderTypeServiceImpl(); @Inject  ProviderTypeServiceImpl(final RuntimeProvisioningServiceBackend runtimeProvisioningService,
                                   final ProvisioningPreferences provisioningPreferences,
                                   final PreferenceScopeFactory scopeFactory); }
ProviderTypeServiceImpl implements ProviderTypeService { @Override public Map<ProviderType, ProviderTypeStatus> getProviderTypesStatus() { final Map<ProviderType, ProviderTypeStatus> result = new HashMap<>(); readProviderTypeEnablements().forEach((providerType, isEnabled) -> result.put(providerType, Boolean.TRUE.equals(isEnabled) ? ProviderTypeStatus.ENABLED : ProviderTypeStatus.DISABLED) ); getAvailableProviderTypes().forEach(providerType -> { if (!result.containsKey(providerType)) { result.put(providerType, ProviderTypeStatus.DISABLED); } }); return result; } ProviderTypeServiceImpl(); @Inject  ProviderTypeServiceImpl(final RuntimeProvisioningServiceBackend runtimeProvisioningService,
                                   final ProvisioningPreferences provisioningPreferences,
                                   final PreferenceScopeFactory scopeFactory); @Override Collection<ProviderType> getAvailableProviderTypes(); @Override ProviderType getProviderType(final ProviderTypeKey providerTypeKey); @Override Collection<ProviderType> getEnabledProviderTypes(); @Override void enableProviderTypes(final Collection<ProviderType> providerTypes); @Override void disableProviderType(final ProviderType providerType); @Override Map<ProviderType, ProviderTypeStatus> getProviderTypesStatus(); }
ProviderTypeServiceImpl implements ProviderTypeService { @Override public Map<ProviderType, ProviderTypeStatus> getProviderTypesStatus() { final Map<ProviderType, ProviderTypeStatus> result = new HashMap<>(); readProviderTypeEnablements().forEach((providerType, isEnabled) -> result.put(providerType, Boolean.TRUE.equals(isEnabled) ? ProviderTypeStatus.ENABLED : ProviderTypeStatus.DISABLED) ); getAvailableProviderTypes().forEach(providerType -> { if (!result.containsKey(providerType)) { result.put(providerType, ProviderTypeStatus.DISABLED); } }); return result; } ProviderTypeServiceImpl(); @Inject  ProviderTypeServiceImpl(final RuntimeProvisioningServiceBackend runtimeProvisioningService,
                                   final ProvisioningPreferences provisioningPreferences,
                                   final PreferenceScopeFactory scopeFactory); @Override Collection<ProviderType> getAvailableProviderTypes(); @Override ProviderType getProviderType(final ProviderTypeKey providerTypeKey); @Override Collection<ProviderType> getEnabledProviderTypes(); @Override void enableProviderTypes(final Collection<ProviderType> providerTypes); @Override void disableProviderType(final ProviderType providerType); @Override Map<ProviderType, ProviderTypeStatus> getProviderTypesStatus();  }