@Test void buildOneFedIPWithCertReferences() throws DocumentParseException { final String FED_ID_NAME = "simple fed id with cert references"; final Bundle bundle = new Bundle(projectInfo); final TrustedCert cert1 = new TrustedCert(); cert1.setId("cert1"); final TrustedCert cert2 = new TrustedCert(); cert2.setId("cert2"); bundle.putAllTrustedCerts(new HashMap<String, TrustedCert>() {{ put("cert1", cert1); put("cert2", cert2); }}); final IdentityProvider identityProvider = new IdentityProvider(); identityProvider.setType(FEDERATED); identityProvider.setId(TEST_ID); final Set<String> certReferences = new LinkedHashSet<>(asList("cert1","cert2")); final FederatedIdentityProviderDetail identityProviderDetail = new FederatedIdentityProviderDetail(); identityProviderDetail.setCertificateReferences(certReferences); identityProvider.setIdentityProviderDetail(identityProviderDetail); bundle.putAllIdentityProviders(new HashMap<String, IdentityProvider>() {{ put(FED_ID_NAME, 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 fed id with cert references::1.0", FEDERATED); final Element fedIdentityProviderDetailXml = getSingleElement(identityProviderEntityXml, FEDERATED_ID_PROV_DETAIL); final Element certRefs = getSingleElement(fedIdentityProviderDetailXml, CERTIFICATE_REFERENCES); final List<String> certList = getChildElementAttributeValues(certRefs, REFERENCE, ATTRIBUTE_ID); assertEquals(2, certList.size()); assertEquals(certList.get(0), "cert1"); assertEquals(certList.get(1), "cert2"); }
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();  }