@Test void buildOneBindOnlyIP() throws DocumentParseException { final Bundle bundle = new Bundle(projectInfo); final IdentityProvider identityProvider = createBindOnlyLdap(); identityProvider.setId(TEST_ID); bundle.putAllIdentityProviders(new HashMap<String, IdentityProvider>() {{ put(SIMPLE_LDAP_CONFIG, identityProvider); }}); final List<Entity> identityProviders = builder.build(bundle, BundleType.ENVIRONMENT, DocumentTools.INSTANCE.getDocumentBuilder().newDocument()); assertEquals(1, identityProviders.size()); final Element identityProviderEntityXml = verifyIdProvider(identityProviders, "::TestGroup::simple ldap config::1.0", BIND_ONLY_LDAP); final Element idProviderProperties = getSingleElement(identityProviderEntityXml, PROPERTIES); final NodeList propertyList = idProviderProperties.getElementsByTagName(PROPERTY); assertEquals(2, propertyList.getLength()); Node property1 = propertyList.item(0); Node property2 = propertyList.item(1); if (!"key1".equals(property1.getAttributes().getNamedItem(ATTRIBUTE_KEY).getTextContent())) { property2 = propertyList.item(0); property1 = propertyList.item(1); } assertEquals("key1", property1.getAttributes().getNamedItem(ATTRIBUTE_KEY).getTextContent()); assertEquals("key2", property2.getAttributes().getNamedItem(ATTRIBUTE_KEY).getTextContent()); assertEquals("value1", getSingleElement((Element) property1, STRING_VALUE).getTextContent()); assertEquals("value2", getSingleElement((Element) property2, STRING_VALUE).getTextContent()); final Element bindOnlyLdapIdentityProviderDetailXml = getSingleElement(identityProviderEntityXml, BIND_ONLY_ID_PROV_DETAIL); final Element serverUrls = getSingleElement(bindOnlyLdapIdentityProviderDetailXml, SERVER_URLS); final NodeList serverList = serverUrls.getElementsByTagName(STRING_VALUE); assertEquals(2, serverList.getLength()); assertEquals("http: assertEquals("http: final Element useSslClientAuthXml = getSingleElement(bindOnlyLdapIdentityProviderDetailXml, USE_SSL_CLIENT_AUTH); assertFalse(Boolean.parseBoolean(useSslClientAuthXml.getTextContent())); final Element bindPatternPrefix = getSingleElement(bindOnlyLdapIdentityProviderDetailXml, BIND_PATTERN_PREFIX); assertEquals("testpre", bindPatternPrefix.getTextContent()); final Element bindPatternSuffix = getSingleElement(bindOnlyLdapIdentityProviderDetailXml, BIND_PATTERN_SUFFIX); assertEquals("testsuf", bindPatternSuffix.getTextContent()); }
public List<Entity> build(Bundle bundle, BundleType bundleType, Document document) { if (bundle instanceof AnnotatedBundle) { Map<String, IdentityProvider> identityProviderMap = Optional.ofNullable(bundle.getIdentityProviders()).orElse(Collections.emptyMap()); return buildEntities(identityProviderMap, ((AnnotatedBundle)bundle).getFullBundle(), bundleType, document); } else { return buildEntities(bundle.getIdentityProviders(), bundle, bundleType, document); } }
IdentityProviderEntityBuilder implements EntityBuilder { public List<Entity> build(Bundle bundle, BundleType bundleType, Document document) { if (bundle instanceof AnnotatedBundle) { Map<String, IdentityProvider> identityProviderMap = Optional.ofNullable(bundle.getIdentityProviders()).orElse(Collections.emptyMap()); return buildEntities(identityProviderMap, ((AnnotatedBundle)bundle).getFullBundle(), bundleType, document); } else { return buildEntities(bundle.getIdentityProviders(), bundle, bundleType, document); } } }
IdentityProviderEntityBuilder implements EntityBuilder { public List<Entity> build(Bundle bundle, BundleType bundleType, Document document) { if (bundle instanceof AnnotatedBundle) { Map<String, IdentityProvider> identityProviderMap = Optional.ofNullable(bundle.getIdentityProviders()).orElse(Collections.emptyMap()); return buildEntities(identityProviderMap, ((AnnotatedBundle)bundle).getFullBundle(), bundleType, document); } else { return buildEntities(bundle.getIdentityProviders(), bundle, bundleType, document); } } IdentityProviderEntityBuilder(); }
IdentityProviderEntityBuilder implements EntityBuilder { public List<Entity> build(Bundle bundle, BundleType bundleType, Document document) { if (bundle instanceof AnnotatedBundle) { Map<String, IdentityProvider> identityProviderMap = Optional.ofNullable(bundle.getIdentityProviders()).orElse(Collections.emptyMap()); return buildEntities(identityProviderMap, ((AnnotatedBundle)bundle).getFullBundle(), bundleType, document); } else { return buildEntities(bundle.getIdentityProviders(), bundle, bundleType, document); } } IdentityProviderEntityBuilder(); List<Entity> build(Bundle bundle, BundleType bundleType, Document document); @Override @NotNull Integer getOrder(); }
IdentityProviderEntityBuilder implements EntityBuilder { public List<Entity> build(Bundle bundle, BundleType bundleType, Document document) { if (bundle instanceof AnnotatedBundle) { Map<String, IdentityProvider> identityProviderMap = Optional.ofNullable(bundle.getIdentityProviders()).orElse(Collections.emptyMap()); return buildEntities(identityProviderMap, ((AnnotatedBundle)bundle).getFullBundle(), bundleType, document); } else { return buildEntities(bundle.getIdentityProviders(), bundle, bundleType, document); } } IdentityProviderEntityBuilder(); List<Entity> build(Bundle bundle, BundleType bundleType, Document document); @Override @NotNull Integer getOrder();  }