use of com.nike.cerberus.domain.SafeDepositBoxV1 in project cerberus by Nike-Inc.
the class SafeDepositBoxServiceTest method test_that_convertSafeDepositBoxV2ToV1_creates_expected_safe_deposit_box_v1.
@Test
public void test_that_convertSafeDepositBoxV2ToV1_creates_expected_safe_deposit_box_v1() {
String id = "id";
String name = "name";
String description = "description";
String path = "path";
String categoryId = "category id";
String createdBy = "created by";
String lastUpdatedBy = "last updated by";
OffsetDateTime createdTs = OffsetDateTime.now();
OffsetDateTime lastUpdatedTs = OffsetDateTime.now();
String owner = "owner";
String accountId = "123";
String roleName = "abc";
String arn = "arn:aws:iam::123:role/abc";
String roleId = "role id";
Set<UserGroupPermission> userGroupPermissions = Sets.newHashSet();
UserGroupPermission userGroupPermission = new UserGroupPermission();
userGroupPermissions.add(userGroupPermission);
Set<IamRolePermission> iamRolePermissions = Sets.newHashSet();
IamRolePermission iamRolePermission = new IamRolePermission().withAccountId(accountId).withIamRoleName(roleName).withRoleId(roleId);
iamRolePermissions.add(iamRolePermission);
SafeDepositBoxV1 safeDepositBoxV1 = new SafeDepositBoxV1();
safeDepositBoxV1.setId(id);
safeDepositBoxV1.setName(name);
safeDepositBoxV1.setDescription(description);
safeDepositBoxV1.setPath(path);
safeDepositBoxV1.setCategoryId(categoryId);
safeDepositBoxV1.setCreatedBy(createdBy);
safeDepositBoxV1.setLastUpdatedBy(lastUpdatedBy);
safeDepositBoxV1.setCreatedTs(createdTs);
safeDepositBoxV1.setLastUpdatedTs(lastUpdatedTs);
safeDepositBoxV1.setOwner(owner);
safeDepositBoxV1.setUserGroupPermissions(userGroupPermissions);
safeDepositBoxV1.setIamRolePermissions(iamRolePermissions);
SafeDepositBoxV2 resultantSDBV1 = safeDepositBoxService.convertSafeDepositBoxV1ToV2(safeDepositBoxV1);
SafeDepositBoxV2 expectedSdbV2 = new SafeDepositBoxV2();
expectedSdbV2.setId(id);
expectedSdbV2.setName(name);
expectedSdbV2.setDescription(description);
expectedSdbV2.setPath(path);
expectedSdbV2.setCategoryId(categoryId);
expectedSdbV2.setCreatedBy(createdBy);
expectedSdbV2.setLastUpdatedBy(lastUpdatedBy);
expectedSdbV2.setCreatedTs(createdTs);
expectedSdbV2.setLastUpdatedTs(lastUpdatedTs);
expectedSdbV2.setOwner(owner);
expectedSdbV2.setUserGroupPermissions(userGroupPermissions);
Set<IamPrincipalPermission> expectedIamRolePermissionsV2 = Sets.newHashSet();
IamPrincipalPermission expectedIamPrincipalPermission = new IamPrincipalPermission().withIamPrincipalArn(arn).withRoleId(roleId);
expectedIamRolePermissionsV2.add(expectedIamPrincipalPermission);
expectedSdbV2.setIamPrincipalPermissions(expectedIamRolePermissionsV2);
assertEquals(expectedSdbV2, resultantSDBV1);
}
Aggregations