@Test void loadNoPolicy() { assertThrows(BundleLoadException.class, () -> load(new Bundle())); }
@Override public void load(Bundle bundle, Element element) { final Element encassElement = getSingleChildElement(getSingleChildElement(element, RESOURCE), ENCAPSULATED_ASSERTION); final String policyId = getSingleChildElementAttribute(encassElement, POLICY_REFERENCE, ATTRIBUTE_ID); final String name = getSingleChildElementTextContent(encassElement, NAME); final String guid = getSingleChildElementTextContent(encassElement, GUID); final Map<String, Object> properties = mapPropertiesElements(getSingleChildElement(encassElement, PROPERTIES, true), PROPERTIES); properties.remove(POLICY_GUID_PROP); Encass encass = new Encass(); encass.setGuid(guid); encass.setName(name); encass.setProperties(properties); String policyPath = getPath(bundle, policyId); encass.setId(encassElement.getAttribute(ATTRIBUTE_ID)); encass.setPolicy(policyPath); encass.setArguments(getArguments(encassElement)); encass.setResults(getResults(encassElement)); encass.setPolicyId(policyId); bundle.getEncasses().put(name, encass); }
EncassLoader implements BundleEntityLoader { @Override public void load(Bundle bundle, Element element) { final Element encassElement = getSingleChildElement(getSingleChildElement(element, RESOURCE), ENCAPSULATED_ASSERTION); final String policyId = getSingleChildElementAttribute(encassElement, POLICY_REFERENCE, ATTRIBUTE_ID); final String name = getSingleChildElementTextContent(encassElement, NAME); final String guid = getSingleChildElementTextContent(encassElement, GUID); final Map<String, Object> properties = mapPropertiesElements(getSingleChildElement(encassElement, PROPERTIES, true), PROPERTIES); properties.remove(POLICY_GUID_PROP); Encass encass = new Encass(); encass.setGuid(guid); encass.setName(name); encass.setProperties(properties); String policyPath = getPath(bundle, policyId); encass.setId(encassElement.getAttribute(ATTRIBUTE_ID)); encass.setPolicy(policyPath); encass.setArguments(getArguments(encassElement)); encass.setResults(getResults(encassElement)); encass.setPolicyId(policyId); bundle.getEncasses().put(name, encass); } }
EncassLoader implements BundleEntityLoader { @Override public void load(Bundle bundle, Element element) { final Element encassElement = getSingleChildElement(getSingleChildElement(element, RESOURCE), ENCAPSULATED_ASSERTION); final String policyId = getSingleChildElementAttribute(encassElement, POLICY_REFERENCE, ATTRIBUTE_ID); final String name = getSingleChildElementTextContent(encassElement, NAME); final String guid = getSingleChildElementTextContent(encassElement, GUID); final Map<String, Object> properties = mapPropertiesElements(getSingleChildElement(encassElement, PROPERTIES, true), PROPERTIES); properties.remove(POLICY_GUID_PROP); Encass encass = new Encass(); encass.setGuid(guid); encass.setName(name); encass.setProperties(properties); String policyPath = getPath(bundle, policyId); encass.setId(encassElement.getAttribute(ATTRIBUTE_ID)); encass.setPolicy(policyPath); encass.setArguments(getArguments(encassElement)); encass.setResults(getResults(encassElement)); encass.setPolicyId(policyId); bundle.getEncasses().put(name, encass); }  }
EncassLoader implements BundleEntityLoader { @Override public void load(Bundle bundle, Element element) { final Element encassElement = getSingleChildElement(getSingleChildElement(element, RESOURCE), ENCAPSULATED_ASSERTION); final String policyId = getSingleChildElementAttribute(encassElement, POLICY_REFERENCE, ATTRIBUTE_ID); final String name = getSingleChildElementTextContent(encassElement, NAME); final String guid = getSingleChildElementTextContent(encassElement, GUID); final Map<String, Object> properties = mapPropertiesElements(getSingleChildElement(encassElement, PROPERTIES, true), PROPERTIES); properties.remove(POLICY_GUID_PROP); Encass encass = new Encass(); encass.setGuid(guid); encass.setName(name); encass.setProperties(properties); String policyPath = getPath(bundle, policyId); encass.setId(encassElement.getAttribute(ATTRIBUTE_ID)); encass.setPolicy(policyPath); encass.setArguments(getArguments(encassElement)); encass.setResults(getResults(encassElement)); encass.setPolicyId(policyId); bundle.getEncasses().put(name, encass); }  @Override void load(Bundle bundle, Element element); @Override String getEntityType(); }
EncassLoader implements BundleEntityLoader { @Override public void load(Bundle bundle, Element element) { final Element encassElement = getSingleChildElement(getSingleChildElement(element, RESOURCE), ENCAPSULATED_ASSERTION); final String policyId = getSingleChildElementAttribute(encassElement, POLICY_REFERENCE, ATTRIBUTE_ID); final String name = getSingleChildElementTextContent(encassElement, NAME); final String guid = getSingleChildElementTextContent(encassElement, GUID); final Map<String, Object> properties = mapPropertiesElements(getSingleChildElement(encassElement, PROPERTIES, true), PROPERTIES); properties.remove(POLICY_GUID_PROP); Encass encass = new Encass(); encass.setGuid(guid); encass.setName(name); encass.setProperties(properties); String policyPath = getPath(bundle, policyId); encass.setId(encassElement.getAttribute(ATTRIBUTE_ID)); encass.setPolicy(policyPath); encass.setArguments(getArguments(encassElement)); encass.setResults(getResults(encassElement)); encass.setPolicyId(policyId); bundle.getEncasses().put(name, encass); }  @Override void load(Bundle bundle, Element element); @Override String getEntityType();  }