@Test public void testGetVirtualGroupWenAdminGroupIsProvided() { VirtualGroupRequest virtualGroupRequest = new VirtualGroupRequest(ENV_CRN, "mockgroup"); String result = virtualGroupService.getVirtualGroup(virtualGroupRequest, UmsRight.ENVIRONMENT_ACCESS.getRight()); verify(grpcUmsClient, times(0)).getWorkloadAdministrationGroupName(anyString(), eq(ACCOUNT_ID), eq(Optional.empty()), anyString(), eq(ENV_CRN)); verify(grpcUmsClient, times(0)).setWorkloadAdministrationGroupName(anyString(), eq(ACCOUNT_ID), eq(Optional.empty()), anyString(), eq(ENV_CRN)); assertEquals("mockgroup", result); }
public String getVirtualGroup(VirtualGroupRequest virtualGroupRequest, String right) { String virtualGroup; String adminGroup = virtualGroupRequest.getAdminGroup(); if (StringUtils.isEmpty(adminGroup)) { virtualGroup = createOrGetVirtualGroup(virtualGroupRequest.getAccountId(), virtualGroupRequest.getEnvironmentCrn(), right); } else { virtualGroup = adminGroup; LOGGER.info("Admingroup [{}] given by the user is used for {} right on {} environment", adminGroup, right, virtualGroupRequest.getEnvironmentCrn()); } return virtualGroup; }
VirtualGroupService { public String getVirtualGroup(VirtualGroupRequest virtualGroupRequest, String right) { String virtualGroup; String adminGroup = virtualGroupRequest.getAdminGroup(); if (StringUtils.isEmpty(adminGroup)) { virtualGroup = createOrGetVirtualGroup(virtualGroupRequest.getAccountId(), virtualGroupRequest.getEnvironmentCrn(), right); } else { virtualGroup = adminGroup; LOGGER.info("Admingroup [{}] given by the user is used for {} right on {} environment", adminGroup, right, virtualGroupRequest.getEnvironmentCrn()); } return virtualGroup; } }
VirtualGroupService { public String getVirtualGroup(VirtualGroupRequest virtualGroupRequest, String right) { String virtualGroup; String adminGroup = virtualGroupRequest.getAdminGroup(); if (StringUtils.isEmpty(adminGroup)) { virtualGroup = createOrGetVirtualGroup(virtualGroupRequest.getAccountId(), virtualGroupRequest.getEnvironmentCrn(), right); } else { virtualGroup = adminGroup; LOGGER.info("Admingroup [{}] given by the user is used for {} right on {} environment", adminGroup, right, virtualGroupRequest.getEnvironmentCrn()); } return virtualGroup; }  }
VirtualGroupService { public String getVirtualGroup(VirtualGroupRequest virtualGroupRequest, String right) { String virtualGroup; String adminGroup = virtualGroupRequest.getAdminGroup(); if (StringUtils.isEmpty(adminGroup)) { virtualGroup = createOrGetVirtualGroup(virtualGroupRequest.getAccountId(), virtualGroupRequest.getEnvironmentCrn(), right); } else { virtualGroup = adminGroup; LOGGER.info("Admingroup [{}] given by the user is used for {} right on {} environment", adminGroup, right, virtualGroupRequest.getEnvironmentCrn()); } return virtualGroup; }  Map<UmsRight, String> createVirtualGroups(String accountId, String environmentCrn); String getVirtualGroup(VirtualGroupRequest virtualGroupRequest, String right); void cleanupVirtualGroups(String accountId, String environmentCrn); }
VirtualGroupService { public String getVirtualGroup(VirtualGroupRequest virtualGroupRequest, String right) { String virtualGroup; String adminGroup = virtualGroupRequest.getAdminGroup(); if (StringUtils.isEmpty(adminGroup)) { virtualGroup = createOrGetVirtualGroup(virtualGroupRequest.getAccountId(), virtualGroupRequest.getEnvironmentCrn(), right); } else { virtualGroup = adminGroup; LOGGER.info("Admingroup [{}] given by the user is used for {} right on {} environment", adminGroup, right, virtualGroupRequest.getEnvironmentCrn()); } return virtualGroup; }  Map<UmsRight, String> createVirtualGroups(String accountId, String environmentCrn); String getVirtualGroup(VirtualGroupRequest virtualGroupRequest, String right); void cleanupVirtualGroups(String accountId, String environmentCrn);  }