use of org.sagebionetworks.bridge.models.apps.App in project BridgeServer2 by Sage-Bionetworks.
the class DynamoAppDaoTest method updateAppConditionalCheckFailedException.
@Test(expectedExceptions = ConcurrentModificationException.class)
public void updateAppConditionalCheckFailedException() {
doThrow(new ConditionalCheckFailedException("")).when(mockMapper).save(any());
App app = App.create();
app.setVersion(2L);
dao.updateApp(app);
}
use of org.sagebionetworks.bridge.models.apps.App in project BridgeServer2 by Sage-Bionetworks.
the class DynamoAppDaoTest method createApp.
@Test
public void createApp() {
App app = App.create();
dao.createApp(app);
verify(mockMapper).save(app);
}
use of org.sagebionetworks.bridge.models.apps.App in project BridgeServer2 by Sage-Bionetworks.
the class DynamoAppDaoTest method deactivateApp.
@Test
public void deactivateApp() {
App app = App.create();
app.setActive(true);
app.setVersion(2L);
when(mockMapper.load(any())).thenReturn(app);
dao.deactivateApp(TEST_APP_ID);
verify(mockMapper).save(appCaptor.capture());
assertFalse(appCaptor.getValue().isActive());
}
use of org.sagebionetworks.bridge.models.apps.App in project BridgeServer2 by Sage-Bionetworks.
the class DynamoAppTest method automaticCustomEventsIsNeverNull.
@Test
public void automaticCustomEventsIsNeverNull() {
// Starts as empty
App app = App.create();
assertTrue(app.getAutomaticCustomEvents().isEmpty());
// Set value works
Map<String, String> dummyMap = ImmutableMap.of("3-days-after-enrollment", "P3D");
app.setAutomaticCustomEvents(dummyMap);
assertEquals(app.getAutomaticCustomEvents(), dummyMap);
// Set to null makes it empty again
app.setAutomaticCustomEvents(null);
assertTrue(app.getAutomaticCustomEvents().isEmpty());
}
use of org.sagebionetworks.bridge.models.apps.App in project BridgeServer2 by Sage-Bionetworks.
the class DynamoAppTest method activityEventKeysMergeIntoCustomEvents.
@SuppressWarnings("deprecation")
@Test
public void activityEventKeysMergeIntoCustomEvents() {
App app = App.create();
// key3 would be future_only, except that it is already set in custom
// events, so that will be used in preference
app.setActivityEventKeys(Sets.newHashSet("key1", "key2", "key3"));
app.setCustomEvents(newHashMap(ImmutableMap.of("key3", MUTABLE, "key4", IMMUTABLE)));
assertEquals(app.getCustomEvents().get("key1"), FUTURE_ONLY);
assertEquals(app.getCustomEvents().get("key2"), FUTURE_ONLY);
assertEquals(app.getCustomEvents().get("key3"), MUTABLE);
assertEquals(app.getCustomEvents().get("key4"), IMMUTABLE);
assertTrue(app.getActivityEventKeys().isEmpty());
}
Aggregations