use of org.sagebionetworks.bridge.models.schedules.CompoundActivityDefinition in project BridgeServer2 by Sage-Bionetworks.
the class DynamoCompoundActivityDefinitionDaoTest method createCompoundActivityDefinition.
@Test
public void createCompoundActivityDefinition() {
DynamoCompoundActivityDefinition def = new DynamoCompoundActivityDefinition();
def.setAppId(TEST_APP_ID);
def.setTaskId(TASK_ID);
def.setVersion(1L);
CompoundActivityDefinition result = dao.createCompoundActivityDefinition(def);
assertSame(result, def);
verify(mockMapper).save(defCaptor.capture());
assertNull(defCaptor.getValue().getVersion());
}
use of org.sagebionetworks.bridge.models.schedules.CompoundActivityDefinition in project BridgeServer2 by Sage-Bionetworks.
the class CompoundActivityDefinitionController method updateCompoundActivityDefinition.
/**
* Update a compound activity definition.
*/
@PostMapping(path = "/v3/compoundactivitydefinitions/{taskId}", produces = { APPLICATION_JSON_UTF8_VALUE })
public String updateCompoundActivityDefinition(@PathVariable String taskId) throws JsonProcessingException, IOException {
UserSession session = getAuthenticatedSession(DEVELOPER);
CompoundActivityDefinition requestDef = parseJson(CompoundActivityDefinition.class);
CompoundActivityDefinition updatedDef = compoundActivityDefService.updateCompoundActivityDefinition(session.getAppId(), taskId, requestDef);
return PUBLIC_DEFINITION_WRITER.writeValueAsString(updatedDef);
}
use of org.sagebionetworks.bridge.models.schedules.CompoundActivityDefinition in project BridgeServer2 by Sage-Bionetworks.
the class CompoundActivityDefinitionController method createCompoundActivityDefinition.
/**
* Creates a compound activity definition.
*/
@PostMapping(path = "/v3/compoundactivitydefinitions", produces = { APPLICATION_JSON_UTF8_VALUE })
@ResponseStatus(HttpStatus.CREATED)
public String createCompoundActivityDefinition() throws JsonProcessingException, IOException {
UserSession session = getAuthenticatedSession(DEVELOPER);
CompoundActivityDefinition requestDef = parseJson(CompoundActivityDefinition.class);
CompoundActivityDefinition createdDef = compoundActivityDefService.createCompoundActivityDefinition(session.getAppId(), requestDef);
return PUBLIC_DEFINITION_WRITER.writeValueAsString(createdDef);
}
use of org.sagebionetworks.bridge.models.schedules.CompoundActivityDefinition in project BridgeServer2 by Sage-Bionetworks.
the class CompoundActivityDefinitionServiceTest method createInvalidDef.
@Test
public void createInvalidDef() {
// make invalid def by having it have no task ID
CompoundActivityDefinition def = makeValidDef();
def.setTaskId(null);
// execute, will throw
try {
service.createCompoundActivityDefinition(TEST_APP_ID, def);
fail("expected exception");
} catch (InvalidEntityException ex) {
// expected exception
}
// verify dao is never called
verifyZeroInteractions(dao);
}
use of org.sagebionetworks.bridge.models.schedules.CompoundActivityDefinition in project BridgeServer2 by Sage-Bionetworks.
the class CompoundActivityDefinitionServiceTest method makeValidDef.
private static CompoundActivityDefinition makeValidDef() {
CompoundActivityDefinition def = CompoundActivityDefinition.create();
def.setTaskId(TASK_ID);
def.setSchemaList(SCHEMA_LIST);
def.setSurveyList(SURVEY_LIST);
return def;
}
Aggregations