Search in sources :

Example 1 with SelfServiceMetadata

use of uk.gov.ida.hub.config.domain.remoteconfig.SelfServiceMetadata in project verify-hub by alphagov.

the class ManagedEntityConfigRepositoryTest method setUp.

@BeforeEach
public void setUp() throws Exception {
    URL url = this.getClass().getResource("/remote-test-config.json");
    File initialFile = new File(url.getFile());
    InputStream inputStream = new FileInputStream(initialFile);
    ObjectMapper om = new ObjectMapper();
    SelfServiceMetadata selfServiceMetadata = om.readValue(inputStream, SelfServiceMetadata.class);
    RemoteConfigCollection remoteConfigCollection = new RemoteConfigCollection(null, selfServiceMetadata);
    when(s3ConfigSource.getRemoteConfig()).thenReturn(remoteConfigCollection);
    when(localConfigRepository.getData(LOCAL_ONLY_ENTITY_ID)).thenReturn(Optional.of(localOnlyTransaction));
    when(localConfigRepository.getData(REMOTE_ENABLED_ENTITY_ID)).thenReturn(Optional.of(remoteEnabledTransaction));
    when(localConfigRepository.getData(REMOTE_DISABLED_ENTITY_ID)).thenReturn(Optional.of(remoteDisabledTransaction));
}
Also used : FileInputStream(java.io.FileInputStream) InputStream(java.io.InputStream) SelfServiceMetadata(uk.gov.ida.hub.config.domain.remoteconfig.SelfServiceMetadata) RemoteConfigCollection(uk.gov.ida.hub.config.domain.remoteconfig.RemoteConfigCollection) File(java.io.File) URL(java.net.URL) FileInputStream(java.io.FileInputStream) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 File (java.io.File)1 FileInputStream (java.io.FileInputStream)1 InputStream (java.io.InputStream)1 URL (java.net.URL)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1 RemoteConfigCollection (uk.gov.ida.hub.config.domain.remoteconfig.RemoteConfigCollection)1 SelfServiceMetadata (uk.gov.ida.hub.config.domain.remoteconfig.SelfServiceMetadata)1