@Test public void testAnnotatedEncassDeleteBundle() { BundleEntityBuilder builder = createBundleEntityBuilder(); Bundle bundle = createBundle(ENCASS_POLICY_WITH_ENV_DEPENDENCIES, true, true, false, projectInfo); Encass encass = buildTestEncassWithAnnotation(TEST_GUID, TEST_ENCASS_POLICY, false); bundle.putAllEncasses(ImmutableMap.of(TEST_ENCASS, encass)); Map<String, BundleArtifacts> bundles = builder.build(bundle, DEPLOYMENT, DocumentTools.INSTANCE.getDocumentBuilder().newDocument(), projectInfo); assertNotNull(bundles); assertEquals(1, bundles.size()); Element deleteBundleElement = bundles.get(TEST_ENCASS_ANNOTATION_NAME + "-1.0").getDeleteBundle().getElement(); assertNotNull(deleteBundleElement); assertEquals(BundleDocumentBuilder.GATEWAY_MANAGEMENT, deleteBundleElement.getAttribute(BundleDocumentBuilder.L7)); assertEquals(BUNDLE, deleteBundleElement.getTagName()); final int expectedElementCountBundle = 2; final Element references = getSingleChildElement(deleteBundleElement, REFERENCES); assertNotNull(references); final List<Element> itemList = getChildElements(references, ITEM); assertNotNull(itemList); assertEquals(expectedElementCountBundle, itemList.size()); final Element item1 = itemList.get(1); assertEquals("::" + projectInfo.getGroupName() + "." + TEST_ENCASS_ANNOTATION_NAME + "::" + TEST_ENCASS_POLICY + "::" + projectInfo.getVersion() , getSingleChildElementTextContent(item1, NAME)); assertEquals(EntityTypes.POLICY_TYPE, getSingleChildElementTextContent(item1, TYPE)); assertNotNull(getSingleChildElement(item1, RESOURCE)); final Element item2 = itemList.get(0); assertEquals("::" + projectInfo.getGroupName() + "." + TEST_ENCASS_ANNOTATION_NAME + "::" + TEST_ENCASS + "::" + projectInfo.getVersion(), getSingleChildElementTextContent(item2, NAME)); assertEquals(EntityTypes.ENCAPSULATED_ASSERTION_TYPE, getSingleChildElementTextContent(item2, TYPE)); assertNotNull(getSingleChildElement(item2, RESOURCE)); final Element mappings = getSingleChildElement(deleteBundleElement, MAPPINGS); assertNotNull(mappings); final List<Element> mappingItemList = getChildElements(mappings, MAPPING); assertEquals(expectedElementCountBundle, mappingItemList.size()); final Element mapping1 = mappingItemList.get(1); assertEquals(MappingActions.DELETE, mapping1.getAttribute("action")); assertEquals(EntityTypes.POLICY_TYPE, mapping1.getAttribute("type")); final Element mapping2 = mappingItemList.get(0); assertEquals(MappingActions.DELETE, mapping2.getAttribute("action")); assertEquals(EntityTypes.ENCAPSULATED_ASSERTION_TYPE, mapping2.getAttribute("type")); }
public Map<String, BundleArtifacts> build(Bundle bundle, BundleType bundleType, Document document, ProjectInfo projectInfo) { return build(bundle, bundleType, document, projectInfo, false); }
BundleEntityBuilder { public Map<String, BundleArtifacts> build(Bundle bundle, BundleType bundleType, Document document, ProjectInfo projectInfo) { return build(bundle, bundleType, document, projectInfo, false); } }
BundleEntityBuilder { public Map<String, BundleArtifacts> build(Bundle bundle, BundleType bundleType, Document document, ProjectInfo projectInfo) { return build(bundle, bundleType, document, projectInfo, false); } @Inject  BundleEntityBuilder(final Set<EntityBuilder> entityBuilders, final BundleDocumentBuilder bundleDocumentBuilder,
                        final BundleMetadataBuilder bundleMetadataBuilder,
                        final EntityTypeRegistry entityTypeRegistry, PrivateKeyImportContextBuilder privateKeyImportContextBuilder); }
BundleEntityBuilder { public Map<String, BundleArtifacts> build(Bundle bundle, BundleType bundleType, Document document, ProjectInfo projectInfo) { return build(bundle, bundleType, document, projectInfo, false); } @Inject  BundleEntityBuilder(final Set<EntityBuilder> entityBuilders, final BundleDocumentBuilder bundleDocumentBuilder,
                        final BundleMetadataBuilder bundleMetadataBuilder,
                        final EntityTypeRegistry entityTypeRegistry, PrivateKeyImportContextBuilder privateKeyImportContextBuilder); Map<String, BundleArtifacts> build(Bundle bundle, BundleType bundleType,
                                              Document document, ProjectInfo projectInfo); Map<String, BundleArtifacts> build(Bundle bundle, BundleType bundleType,
                                              Document document, ProjectInfo projectInfo, boolean generateMetadata); void addPrivateKeyContexts(Bundle bundle, ProjectInfo projectInfo, BundleArtifacts bundleArtifacts,
                                      Document document); @VisibleForTesting Set<EntityBuilder> getEntityBuilders(); }
BundleEntityBuilder { public Map<String, BundleArtifacts> build(Bundle bundle, BundleType bundleType, Document document, ProjectInfo projectInfo) { return build(bundle, bundleType, document, projectInfo, false); } @Inject  BundleEntityBuilder(final Set<EntityBuilder> entityBuilders, final BundleDocumentBuilder bundleDocumentBuilder,
                        final BundleMetadataBuilder bundleMetadataBuilder,
                        final EntityTypeRegistry entityTypeRegistry, PrivateKeyImportContextBuilder privateKeyImportContextBuilder); Map<String, BundleArtifacts> build(Bundle bundle, BundleType bundleType,
                                              Document document, ProjectInfo projectInfo); Map<String, BundleArtifacts> build(Bundle bundle, BundleType bundleType,
                                              Document document, ProjectInfo projectInfo, boolean generateMetadata); void addPrivateKeyContexts(Bundle bundle, ProjectInfo projectInfo, BundleArtifacts bundleArtifacts,
                                      Document document); @VisibleForTesting Set<EntityBuilder> getEntityBuilders();  }