@Test public void testCreateVirtualGroupsWithExistingGroups() { when(grpcUmsClient.getWorkloadAdministrationGroupName(anyString(), eq(ACCOUNT_ID), eq(Optional.empty()), anyString(), eq(ENV_CRN))).thenReturn(MOCK_VIRTUAL_GROUP); Map<UmsRight, String> result = virtualGroupService.createVirtualGroups(ACCOUNT_ID, ENV_CRN); assertEquals(UmsRight.values().length, result.size()); verify(grpcUmsClient, times(0)).setWorkloadAdministrationGroupName(anyString(), eq(ACCOUNT_ID), eq(Optional.empty()), anyString(), eq(ENV_CRN)); for (UmsRight umsRight : UmsRight.values()) { assertEquals(MOCK_VIRTUAL_GROUP, result.get(umsRight)); } }
public Map<UmsRight, String> createVirtualGroups(String accountId, String environmentCrn) { Map<UmsRight, String> virtualGroups = new HashMap<>(); for (UmsRight right : UmsRight.values()) { virtualGroups.put(right, createOrGetVirtualGroup(accountId, environmentCrn, right.getRight())); } return virtualGroups; }
VirtualGroupService { public Map<UmsRight, String> createVirtualGroups(String accountId, String environmentCrn) { Map<UmsRight, String> virtualGroups = new HashMap<>(); for (UmsRight right : UmsRight.values()) { virtualGroups.put(right, createOrGetVirtualGroup(accountId, environmentCrn, right.getRight())); } return virtualGroups; } }
VirtualGroupService { public Map<UmsRight, String> createVirtualGroups(String accountId, String environmentCrn) { Map<UmsRight, String> virtualGroups = new HashMap<>(); for (UmsRight right : UmsRight.values()) { virtualGroups.put(right, createOrGetVirtualGroup(accountId, environmentCrn, right.getRight())); } return virtualGroups; }  }
VirtualGroupService { public Map<UmsRight, String> createVirtualGroups(String accountId, String environmentCrn) { Map<UmsRight, String> virtualGroups = new HashMap<>(); for (UmsRight right : UmsRight.values()) { virtualGroups.put(right, createOrGetVirtualGroup(accountId, environmentCrn, right.getRight())); } return virtualGroups; }  Map<UmsRight, String> createVirtualGroups(String accountId, String environmentCrn); String getVirtualGroup(VirtualGroupRequest virtualGroupRequest, String right); void cleanupVirtualGroups(String accountId, String environmentCrn); }
VirtualGroupService { public Map<UmsRight, String> createVirtualGroups(String accountId, String environmentCrn) { Map<UmsRight, String> virtualGroups = new HashMap<>(); for (UmsRight right : UmsRight.values()) { virtualGroups.put(right, createOrGetVirtualGroup(accountId, environmentCrn, right.getRight())); } return virtualGroups; }  Map<UmsRight, String> createVirtualGroups(String accountId, String environmentCrn); String getVirtualGroup(VirtualGroupRequest virtualGroupRequest, String right); void cleanupVirtualGroups(String accountId, String environmentCrn);  }