@Test public void getRangerVirtualGroupTestSuccess() { Mockito.when(virtualGroupService.getVirtualGroup( any(), any())) .thenReturn("_c_environments_adminranger"); LdapView ldapView = LdapView.LdapViewBuilder.aLdapView().withProtocol("") .withAdminGroup("admin<>") .build(); when(ldapConfigService.get(anyString(), anyString())).thenReturn(Optional.of(ldapView)); when(environmentConfigProvider.getParentEnvironmentCrn(anyString())).thenReturn(TestConstants.CRN); Stack stack = new Stack(); stack.setEnvironmentCrn(TestConstants.CRN); stack.setName("datalake-stack"); Assert.assertEquals("_c_environments_adminranger", underTest.getRangerVirtualGroup(stack)); }
public String getRangerVirtualGroup(Stack stack) { Optional<LdapView> ldapView = ldapConfigService.get(stack.getEnvironmentCrn(), stack.getName()); String virtualGroupsEnvironmentCrn = environmentConfigProvider.getParentEnvironmentCrn(stack.getEnvironmentCrn()); String adminGroup = ldapView.orElseThrow(() -> new CloudbreakServiceException("Ranger admin group not found.")) .getAdminGroup(); LOGGER.debug("Admin Group:", adminGroup); VirtualGroupRequest virtualGroupRequest = new VirtualGroupRequest(virtualGroupsEnvironmentCrn, adminGroup); return virtualGroupService.getVirtualGroup(virtualGroupRequest, UmsRight.RANGER_ADMIN.getRight()); }
RangerVirtualGroupService { public String getRangerVirtualGroup(Stack stack) { Optional<LdapView> ldapView = ldapConfigService.get(stack.getEnvironmentCrn(), stack.getName()); String virtualGroupsEnvironmentCrn = environmentConfigProvider.getParentEnvironmentCrn(stack.getEnvironmentCrn()); String adminGroup = ldapView.orElseThrow(() -> new CloudbreakServiceException("Ranger admin group not found.")) .getAdminGroup(); LOGGER.debug("Admin Group:", adminGroup); VirtualGroupRequest virtualGroupRequest = new VirtualGroupRequest(virtualGroupsEnvironmentCrn, adminGroup); return virtualGroupService.getVirtualGroup(virtualGroupRequest, UmsRight.RANGER_ADMIN.getRight()); } }
RangerVirtualGroupService { public String getRangerVirtualGroup(Stack stack) { Optional<LdapView> ldapView = ldapConfigService.get(stack.getEnvironmentCrn(), stack.getName()); String virtualGroupsEnvironmentCrn = environmentConfigProvider.getParentEnvironmentCrn(stack.getEnvironmentCrn()); String adminGroup = ldapView.orElseThrow(() -> new CloudbreakServiceException("Ranger admin group not found.")) .getAdminGroup(); LOGGER.debug("Admin Group:", adminGroup); VirtualGroupRequest virtualGroupRequest = new VirtualGroupRequest(virtualGroupsEnvironmentCrn, adminGroup); return virtualGroupService.getVirtualGroup(virtualGroupRequest, UmsRight.RANGER_ADMIN.getRight()); }  }
RangerVirtualGroupService { public String getRangerVirtualGroup(Stack stack) { Optional<LdapView> ldapView = ldapConfigService.get(stack.getEnvironmentCrn(), stack.getName()); String virtualGroupsEnvironmentCrn = environmentConfigProvider.getParentEnvironmentCrn(stack.getEnvironmentCrn()); String adminGroup = ldapView.orElseThrow(() -> new CloudbreakServiceException("Ranger admin group not found.")) .getAdminGroup(); LOGGER.debug("Admin Group:", adminGroup); VirtualGroupRequest virtualGroupRequest = new VirtualGroupRequest(virtualGroupsEnvironmentCrn, adminGroup); return virtualGroupService.getVirtualGroup(virtualGroupRequest, UmsRight.RANGER_ADMIN.getRight()); }  String getRangerVirtualGroup(Stack stack); }
RangerVirtualGroupService { public String getRangerVirtualGroup(Stack stack) { Optional<LdapView> ldapView = ldapConfigService.get(stack.getEnvironmentCrn(), stack.getName()); String virtualGroupsEnvironmentCrn = environmentConfigProvider.getParentEnvironmentCrn(stack.getEnvironmentCrn()); String adminGroup = ldapView.orElseThrow(() -> new CloudbreakServiceException("Ranger admin group not found.")) .getAdminGroup(); LOGGER.debug("Admin Group:", adminGroup); VirtualGroupRequest virtualGroupRequest = new VirtualGroupRequest(virtualGroupsEnvironmentCrn, adminGroup); return virtualGroupService.getVirtualGroup(virtualGroupRequest, UmsRight.RANGER_ADMIN.getRight()); }  String getRangerVirtualGroup(Stack stack);  }