Search in sources :

Example 1 with TEST_APP_ID

use of org.sagebionetworks.bridge.TestConstants.TEST_APP_ID in project BridgeServer2 by Sage-Bionetworks.

the class InitRecordHandlerTest method setupContextWithJsonDataMap.

private UploadValidationContext setupContextWithJsonDataMap(Map<String, JsonNode> jsonDataMap) {
    UploadValidationContext context = new UploadValidationContext();
    // noinspection ConstantConditions
    context.setUnzippedDataFileMap(Maps.transformEntries(jsonDataMap, (name, node) -> makeFileWithContent(name, node.toString())));
    // Contexts always include appId.
    context.setAppId(TEST_APP_ID);
    // And upload (with upload ID and health code).
    DynamoUpload2 upload = new DynamoUpload2();
    upload.setHealthCode(HEALTH_CODE);
    upload.setUploadId(UPLOAD_ID);
    context.setUpload(upload);
    return context;
}
Also used : Charsets(com.google.common.base.Charsets) AfterClass(org.testng.annotations.AfterClass) Assert.assertNull(org.testng.Assert.assertNull) InMemoryFileHelper(org.sagebionetworks.bridge.file.InMemoryFileHelper) ImmutableMap(com.google.common.collect.ImmutableMap) DateTimeUtils(org.joda.time.DateTimeUtils) TEST_APP_ID(org.sagebionetworks.bridge.TestConstants.TEST_APP_ID) Assert.fail(org.testng.Assert.fail) BeforeClass(org.testng.annotations.BeforeClass) DateTime(org.joda.time.DateTime) BeforeMethod(org.testng.annotations.BeforeMethod) DynamoUpload2(org.sagebionetworks.bridge.dynamodb.DynamoUpload2) Assert.assertEquals(org.testng.Assert.assertEquals) HealthDataRecord(org.sagebionetworks.bridge.models.healthdata.HealthDataRecord) Test(org.testng.annotations.Test) Assert.assertNotNull(org.testng.Assert.assertNotNull) Maps(com.google.common.collect.Maps) File(java.io.File) ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) BridgeObjectMapper(org.sagebionetworks.bridge.json.BridgeObjectMapper) LocalDate(org.joda.time.LocalDate) Map(java.util.Map) Assert.assertTrue(org.testng.Assert.assertTrue) JsonNode(com.fasterxml.jackson.databind.JsonNode) DynamoUpload2(org.sagebionetworks.bridge.dynamodb.DynamoUpload2)

Example 2 with TEST_APP_ID

use of org.sagebionetworks.bridge.TestConstants.TEST_APP_ID in project BridgeServer2 by Sage-Bionetworks.

the class AuthUtilsTest method getAccountEnrolledIn.

private Account getAccountEnrolledIn(String... studyIds) {
    Account account = Account.create();
    account.setId(TEST_USER_ID);
    Set<Enrollment> enrollments = Arrays.asList(studyIds).stream().map(id -> Enrollment.create(TEST_APP_ID, id, TEST_USER_ID)).collect(toSet());
    account.setEnrollments(enrollments);
    return account;
}
Also used : CAN_EDIT_OTHER_ENROLLMENTS(org.sagebionetworks.bridge.AuthUtils.CAN_EDIT_OTHER_ENROLLMENTS) ORG_ADMIN(org.sagebionetworks.bridge.Roles.ORG_ADMIN) Enrollment(org.sagebionetworks.bridge.models.studies.Enrollment) Arrays(java.util.Arrays) TEST_STUDY_ID(org.sagebionetworks.bridge.TestConstants.TEST_STUDY_ID) CAN_EDIT_ASSESSMENTS(org.sagebionetworks.bridge.AuthUtils.CAN_EDIT_ASSESSMENTS) CAN_EDIT_SCHEDULES(org.sagebionetworks.bridge.AuthUtils.CAN_EDIT_SCHEDULES) Test(org.testng.annotations.Test) CAN_READ_STUDY_ASSOCIATIONS(org.sagebionetworks.bridge.AuthUtils.CAN_READ_STUDY_ASSOCIATIONS) NULL_INSTANCE(org.sagebionetworks.bridge.RequestContext.NULL_INSTANCE) CAN_EDIT_PARTICIPANTS(org.sagebionetworks.bridge.AuthUtils.CAN_EDIT_PARTICIPANTS) AfterMethod(org.testng.annotations.AfterMethod) STUDY_COORDINATOR(org.sagebionetworks.bridge.Roles.STUDY_COORDINATOR) USER_ID(org.sagebionetworks.bridge.AuthEvaluatorField.USER_ID) CAN_EDIT_ENROLLMENTS(org.sagebionetworks.bridge.AuthUtils.CAN_EDIT_ENROLLMENTS) TEST_OWNER_ID(org.sagebionetworks.bridge.TestConstants.TEST_OWNER_ID) CAN_EDIT_MEMBERS(org.sagebionetworks.bridge.AuthUtils.CAN_EDIT_MEMBERS) CAN_READ_EXTERNAL_IDS(org.sagebionetworks.bridge.AuthUtils.CAN_READ_EXTERNAL_IDS) OWNER_ID(org.sagebionetworks.bridge.AuthEvaluatorField.OWNER_ID) WORKER(org.sagebionetworks.bridge.Roles.WORKER) RESEARCHER(org.sagebionetworks.bridge.Roles.RESEARCHER) Assert.assertFalse(org.testng.Assert.assertFalse) Collectors.toSet(java.util.stream.Collectors.toSet) CAN_READ_PARTICIPANTS(org.sagebionetworks.bridge.AuthUtils.CAN_READ_PARTICIPANTS) ImmutableSet(com.google.common.collect.ImmutableSet) ORG_ID(org.sagebionetworks.bridge.AuthEvaluatorField.ORG_ID) CAN_DOWNLOAD_PARTICIPANT_ROSTER(org.sagebionetworks.bridge.AuthUtils.CAN_DOWNLOAD_PARTICIPANT_ROSTER) CAN_EDIT_STUDY_PARTICIPANTS(org.sagebionetworks.bridge.AuthUtils.CAN_EDIT_STUDY_PARTICIPANTS) TEST_APP_ID(org.sagebionetworks.bridge.TestConstants.TEST_APP_ID) SUPERADMIN(org.sagebionetworks.bridge.Roles.SUPERADMIN) TEST_USER_ID(org.sagebionetworks.bridge.TestConstants.TEST_USER_ID) Set(java.util.Set) CAN_EDIT_SHARED_ASSESSMENTS(org.sagebionetworks.bridge.AuthUtils.CAN_EDIT_SHARED_ASSESSMENTS) STUDY_DESIGNER(org.sagebionetworks.bridge.Roles.STUDY_DESIGNER) UnauthorizedException(org.sagebionetworks.bridge.exceptions.UnauthorizedException) Account(org.sagebionetworks.bridge.models.accounts.Account) ADMIN(org.sagebionetworks.bridge.Roles.ADMIN) Mockito(org.mockito.Mockito) CAN_ACCESS_ADHERENCE_DATA(org.sagebionetworks.bridge.AuthUtils.CAN_ACCESS_ADHERENCE_DATA) TEST_USER_GROUP(org.sagebionetworks.bridge.BridgeConstants.TEST_USER_GROUP) STUDY_ID(org.sagebionetworks.bridge.AuthEvaluatorField.STUDY_ID) CAN_TRANSITION_STUDY(org.sagebionetworks.bridge.AuthUtils.CAN_TRANSITION_STUDY) TEST_ORG_ID(org.sagebionetworks.bridge.TestConstants.TEST_ORG_ID) Assert.assertTrue(org.testng.Assert.assertTrue) DEVELOPER(org.sagebionetworks.bridge.Roles.DEVELOPER) Account(org.sagebionetworks.bridge.models.accounts.Account) Enrollment(org.sagebionetworks.bridge.models.studies.Enrollment)

Aggregations

TEST_APP_ID (org.sagebionetworks.bridge.TestConstants.TEST_APP_ID)2 Assert.assertTrue (org.testng.Assert.assertTrue)2 Test (org.testng.annotations.Test)2 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)1 Charsets (com.google.common.base.Charsets)1 ImmutableMap (com.google.common.collect.ImmutableMap)1 ImmutableSet (com.google.common.collect.ImmutableSet)1 Maps (com.google.common.collect.Maps)1 File (java.io.File)1 Arrays (java.util.Arrays)1 Map (java.util.Map)1 Set (java.util.Set)1 Collectors.toSet (java.util.stream.Collectors.toSet)1 DateTime (org.joda.time.DateTime)1 DateTimeUtils (org.joda.time.DateTimeUtils)1 LocalDate (org.joda.time.LocalDate)1 Mockito (org.mockito.Mockito)1 ORG_ID (org.sagebionetworks.bridge.AuthEvaluatorField.ORG_ID)1 OWNER_ID (org.sagebionetworks.bridge.AuthEvaluatorField.OWNER_ID)1