@Test void linkFolderIsMissing() throws DocumentParseException { Bundle fullBundle = new Bundle(); myEncass.setProperties(new HashMap<String, Object>() {{ put(PALETTE_FOLDER, DEFAULT_PALETTE_FOLDER_LOCATION); }}); fullBundle.addEntity(myEncass); fullBundle.addEntity(createPolicy("myEncassPolicy", "1","1", "1", DocumentUtils.stringToXML(DocumentTools.INSTANCE, ENCASS_POLICY_WITH_PORTAL_INTEGRATION), "")); fullBundle.addEntity(createFolder("myFolder", "2", null)); FolderTree folderTree = new FolderTree(fullBundle.getEntities(Folder.class).values()); fullBundle.setFolderTree(folderTree); assertThrows(LinkerException.class, () -> encassLinker.link(bundle, fullBundle)); }
@Override public void link(Encass encass, Bundle bundle, Bundle targetBundle) { Policy policy = bundle.getPolicies().values().stream().filter(p -> encass.getPolicyId().equals(p.getId())).findFirst().orElse(null); if (policy == null) { throw new LinkerException("Could not find policy for Encapsulated Assertion: " + encass.getName() + ". Policy ID: " + encass.getPolicyId()); } encass.getProperties().put(L7_TEMPLATE, encassPolicyXMLSimplifier.simplifyEncassPolicyXML(policy)); encass.setPolicy(policy.getPath()); encass.setPath(getPolicyPath(policy, bundle, encass)); }
EncassLinker implements EntityLinker<Encass> { @Override public void link(Encass encass, Bundle bundle, Bundle targetBundle) { Policy policy = bundle.getPolicies().values().stream().filter(p -> encass.getPolicyId().equals(p.getId())).findFirst().orElse(null); if (policy == null) { throw new LinkerException("Could not find policy for Encapsulated Assertion: " + encass.getName() + ". Policy ID: " + encass.getPolicyId()); } encass.getProperties().put(L7_TEMPLATE, encassPolicyXMLSimplifier.simplifyEncassPolicyXML(policy)); encass.setPolicy(policy.getPath()); encass.setPath(getPolicyPath(policy, bundle, encass)); } }
EncassLinker implements EntityLinker<Encass> { @Override public void link(Encass encass, Bundle bundle, Bundle targetBundle) { Policy policy = bundle.getPolicies().values().stream().filter(p -> encass.getPolicyId().equals(p.getId())).findFirst().orElse(null); if (policy == null) { throw new LinkerException("Could not find policy for Encapsulated Assertion: " + encass.getName() + ". Policy ID: " + encass.getPolicyId()); } encass.getProperties().put(L7_TEMPLATE, encassPolicyXMLSimplifier.simplifyEncassPolicyXML(policy)); encass.setPolicy(policy.getPath()); encass.setPath(getPolicyPath(policy, bundle, encass)); } @Inject  EncassLinker(EncassPolicyXMLSimplifier encassPolicyXMLSimplifier); }
EncassLinker implements EntityLinker<Encass> { @Override public void link(Encass encass, Bundle bundle, Bundle targetBundle) { Policy policy = bundle.getPolicies().values().stream().filter(p -> encass.getPolicyId().equals(p.getId())).findFirst().orElse(null); if (policy == null) { throw new LinkerException("Could not find policy for Encapsulated Assertion: " + encass.getName() + ". Policy ID: " + encass.getPolicyId()); } encass.getProperties().put(L7_TEMPLATE, encassPolicyXMLSimplifier.simplifyEncassPolicyXML(policy)); encass.setPolicy(policy.getPath()); encass.setPath(getPolicyPath(policy, bundle, encass)); } @Inject  EncassLinker(EncassPolicyXMLSimplifier encassPolicyXMLSimplifier); @Override Class<Encass> getEntityClass(); @Override void link(Encass encass, Bundle bundle, Bundle targetBundle); }
EncassLinker implements EntityLinker<Encass> { @Override public void link(Encass encass, Bundle bundle, Bundle targetBundle) { Policy policy = bundle.getPolicies().values().stream().filter(p -> encass.getPolicyId().equals(p.getId())).findFirst().orElse(null); if (policy == null) { throw new LinkerException("Could not find policy for Encapsulated Assertion: " + encass.getName() + ". Policy ID: " + encass.getPolicyId()); } encass.getProperties().put(L7_TEMPLATE, encassPolicyXMLSimplifier.simplifyEncassPolicyXML(policy)); encass.setPolicy(policy.getPath()); encass.setPath(getPolicyPath(policy, bundle, encass)); } @Inject  EncassLinker(EncassPolicyXMLSimplifier encassPolicyXMLSimplifier); @Override Class<Encass> getEntityClass(); @Override void link(Encass encass, Bundle bundle, Bundle targetBundle);  }