use of org.sagebionetworks.bridge.config.BridgeConfig in project BridgeServer2 by Sage-Bionetworks.
the class TestUtils method mockConfigResolver.
public static ConfigResolver mockConfigResolver(Environment env, String subdomain) {
BridgeConfig mockConfig = Mockito.mock(BridgeConfig.class);
when(mockConfig.getEnvironment()).thenReturn(env);
when(mockConfig.getHostnameWithPostfix(subdomain)).thenReturn(subdomain + "-" + env.name().toLowerCase() + ".bridge.org");
return new ConfigResolver(mockConfig);
}
use of org.sagebionetworks.bridge.config.BridgeConfig in project BridgeServer2 by Sage-Bionetworks.
the class DynamoAppDaoTest method beforeMethod.
@BeforeMethod
public void beforeMethod() {
MockitoAnnotations.initMocks(this);
BridgeConfig config = mock(BridgeConfig.class);
when(config.getPropertyAsList(APP_WHITELIST_PROPERTY)).thenReturn(ImmutableList.of("whitelisted-app"));
dao.setBridgeConfig(config);
}
use of org.sagebionetworks.bridge.config.BridgeConfig in project BridgeServer2 by Sage-Bionetworks.
the class DynamoFPHSExternalIdentifierDaoTest method beforeMethod.
@BeforeMethod
public void beforeMethod() {
MockitoAnnotations.initMocks(this);
BridgeConfig bridgeConfig = mock(BridgeConfig.class);
when(bridgeConfig.getInt(CONFIG_KEY_ADD_LIMIT)).thenReturn(5);
dao.setConfig(bridgeConfig);
// These have state and change; reset every test.
externalId = new DynamoExternalIdentifier(TEST_APP_ID, EXT_ID_STRING1);
fphsExternalId1 = new DynamoFPHSExternalIdentifier(EXT_ID_STRING1);
fphsExternalId2 = new DynamoFPHSExternalIdentifier(EXT_ID_STRING2);
}
use of org.sagebionetworks.bridge.config.BridgeConfig in project BridgeServer2 by Sage-Bionetworks.
the class Exporter3ServiceTest method before.
@BeforeMethod
public void before() {
MockitoAnnotations.initMocks(this);
// Mock config. This is done separately because we need to set mock config params.
BridgeConfig mockConfig = mock(BridgeConfig.class);
when(mockConfig.getInt(Exporter3Service.CONFIG_KEY_TEAM_BRIDGE_ADMIN)).thenReturn((int) BRIDGE_ADMIN_TEAM_ID);
when(mockConfig.getInt(Exporter3Service.CONFIG_KEY_TEAM_BRIDGE_STAFF)).thenReturn((int) BRIDGE_STAFF_TEAM_ID);
when(mockConfig.getInt(Exporter3Service.CONFIG_KEY_EXPORTER_SYNAPSE_ID)).thenReturn((int) EXPORTER_SYNAPSE_ID);
when(mockConfig.getProperty(Exporter3Service.CONFIG_KEY_EXPORTER_SYNAPSE_USER)).thenReturn(EXPORTER_SYNAPSE_USER);
when(mockConfig.getProperty(Exporter3Service.CONFIG_KEY_RAW_HEALTH_DATA_BUCKET)).thenReturn(RAW_HEALTH_DATA_BUCKET);
when(mockConfig.getProperty(Exporter3Service.CONFIG_KEY_SYNAPSE_TRACKING_VIEW)).thenReturn(SYNAPSE_TRACKING_VIEW_ID);
when(mockConfig.getProperty(BridgeConstants.CONFIG_KEY_WORKER_SQS_URL)).thenReturn(WORKER_QUEUE_URL);
exporter3Service.setConfig(mockConfig);
// Spy getNameScopingToken to make it easier to test.
doReturn(NAME_SCOPING_TOKEN).when(exporter3Service).getNameScopingToken();
// Mock app service. Override some app properties for ease of testing.
app = TestUtils.getValidApp(Exporter3ServiceTest.class);
app.setIdentifier(TestConstants.TEST_APP_ID);
app.setName(APP_NAME);
when(mockAppService.getApp(TestConstants.TEST_APP_ID)).thenReturn(app);
}
use of org.sagebionetworks.bridge.config.BridgeConfig in project BridgeServer2 by Sage-Bionetworks.
the class StudyConsentServiceTest method before.
@BeforeMethod
public void before() throws Exception {
DateTimeUtils.setCurrentMillisFixed(CREATED_ON);
MockitoAnnotations.initMocks(this);
BridgeConfig config = mock(BridgeConfig.class);
when(config.getConsentsBucket()).thenReturn(CONSENT_BUCKET);
when(config.getHostnameWithPostfix("docs")).thenReturn(PUBLICATION_BUCKET);
service.setBridgeConfig(config);
StudyConsentValidator validator = new StudyConsentValidator();
validator.setConsentBodyTemplate(new ByteArrayResource("<p>This is the template</p>".getBytes()));
service.setValidator(validator);
}
Aggregations