@Test void testRegister() { Stack stack = new Stack(); stack.setEnvironmentCrn("env"); stack.setAccountId("acc"); stack.setName("name"); stack.setAppVersion("2.20.0"); InstanceGroup instanceGroup = new InstanceGroup(); instanceGroup.setInstanceGroupType(InstanceGroupType.MASTER); InstanceMetaData instanceMetaData = new InstanceMetaData(); instanceMetaData.setDiscoveryFQDN("fqdn"); instanceMetaData.setPrivateIp("1.1.1.1"); instanceGroup.setInstanceMetaData(Collections.singleton(instanceMetaData)); stack.setInstanceGroups(Collections.singleton(instanceGroup)); when(stackService.getByIdWithListsInTransaction(anyLong())).thenReturn(stack); FreeIpa freeIpa = new FreeIpa(); freeIpa.setDomain("testdomain.local"); freeIpa.setAdminPassword("asdf"); when(freeIpaService.findByStackId(anyLong())).thenReturn(freeIpa); when(balancedDnsAvailabilityChecker.isBalancedDnsAvailable(stack)).thenReturn(true); underTest.register(1L); ArgumentCaptor<LdapConfig> ldapConfigArgumentCaptor = ArgumentCaptor.forClass(LdapConfig.class); ArgumentCaptor<String> accountIdArgumentCaptor = ArgumentCaptor.forClass(String.class); verify(ldapConfigService).createLdapConfig(ldapConfigArgumentCaptor.capture(), accountIdArgumentCaptor.capture()); assertEquals(stack.getAccountId(), accountIdArgumentCaptor.getValue()); LdapConfig ldapConfig = ldapConfigArgumentCaptor.getValue(); assertEquals(ldapConfig.getName(), stack.getName()); assertEquals(ldapConfig.getEnvironmentCrn(), stack.getEnvironmentCrn()); String domainComponent = ",dc=testdomain,dc=local"; assertEquals(ldapConfig.getBindDn(), BIND_DN + domainComponent); assertEquals(ldapConfig.getUserSearchBase(), USER_SEARCH_BASE + domainComponent); assertEquals(ldapConfig.getGroupSearchBase(), GROUP_SEARCH_BASE + domainComponent); assertEquals(ldapConfig.getUserDnPattern(), USER_DN_PATTERN + domainComponent); assertEquals(ldapConfig.getServerHost(), "ldap.testdomain.local"); assertEquals(ldapConfig.getProtocol(), PROTOCOL); assertEquals(ldapConfig.getServerPort(), SERVER_PORT); assertEquals(ldapConfig.getDomain(), freeIpa.getDomain()); assertEquals(ldapConfig.getBindPassword(), freeIpa.getAdminPassword()); assertEquals(ldapConfig.getDirectoryType(), DirectoryType.LDAP); assertEquals(ldapConfig.getUserNameAttribute(), USER_NAME_ATTRIBUTE); assertEquals(ldapConfig.getUserObjectClass(), USER_OBJECT_CLASS); assertEquals(ldapConfig.getGroupMemberAttribute(), GROUP_MEMBER_ATTRIBUTE); assertEquals(ldapConfig.getGroupNameAttribute(), GROUP_NAME_ATTRIBUTE); assertEquals(ldapConfig.getGroupObjectClass(), GROUP_OBJECT_CLASS); }
@Override public void register(Long stackId) { createLdapConfig(stackId, null, null, null, null); }
LdapConfigRegisterService extends AbstractConfigRegister { @Override public void register(Long stackId) { createLdapConfig(stackId, null, null, null, null); } }
LdapConfigRegisterService extends AbstractConfigRegister { @Override public void register(Long stackId) { createLdapConfig(stackId, null, null, null, null); }  }
LdapConfigRegisterService extends AbstractConfigRegister { @Override public void register(Long stackId) { createLdapConfig(stackId, null, null, null, null); }  @Override void register(Long stackId); LdapConfig createLdapConfig(Long stackId, String bindDn, String bindPassword, String clusterName, String environmentCrn); @Override void delete(Stack stack); }
LdapConfigRegisterService extends AbstractConfigRegister { @Override public void register(Long stackId) { createLdapConfig(stackId, null, null, null, null); }  @Override void register(Long stackId); LdapConfig createLdapConfig(Long stackId, String bindDn, String bindPassword, String clusterName, String environmentCrn); @Override void delete(Stack stack); static final String USER_GROUP; static final String BIND_DN; static final String USER_SEARCH_BASE; static final String GROUP_SEARCH_BASE; static final String USER_DN_PATTERN; static final String PROTOCOL; static final String USER_NAME_ATTRIBUTE; static final String USER_OBJECT_CLASS; static final String GROUP_MEMBER_ATTRIBUTE; static final String GROUP_NAME_ATTRIBUTE; static final String GROUP_OBJECT_CLASS; static final Integer SERVER_PORT; }