@Test void testPrepareEncapsulatedAssertionMissingEncass() { Element encapsulatedAssertionElement = createEncapsulatedAssertionElement(document); document.appendChild(encapsulatedAssertionElement); policyBuilderContext = new PolicyBuilderContext("path.xml", document, bundle, new IdGenerator()); policyBuilderContext.withPolicy(policy); policyBuilderContext.withAnnotatedBundle(null); EntityBuilderException exception = assertThrows(EntityBuilderException.class, () -> encapsulatedAssertionBuilder.buildAssertionElement(encapsulatedAssertionElement, policyBuilderContext)); assertTrue(exception.getMessage().contains(TEST_ENCASS)); }
@Override public void buildAssertionElement(Element encapsulatedAssertionElement, PolicyBuilderContext policyBuilderContext) throws DocumentParseException { final Bundle bundle = policyBuilderContext.getBundle(); final AnnotatedBundle annotatedBundle = policyBuilderContext.getAnnotatedBundle(); final Policy policy = policyBuilderContext.getPolicy(); if (encapsulatedAssertionElement.hasAttribute(ENCASS_NAME)) { final String encassName = encapsulatedAssertionElement.getAttribute(ENCASS_NAME); Encass encass = getEncass(bundle, encassName, annotatedBundle); final String guid = findEncassReferencedGuid(policy, encass, encapsulatedAssertionElement, encassName); updateEncapsulatedAssertion(policyBuilderContext, encapsulatedAssertionElement, encass, encassName, guid); } else if (!isNoOpIfConfigMissing(encapsulatedAssertionElement)) { Element guidElement = getSingleChildElement(encapsulatedAssertionElement, ENCAPSULATED_ASSERTION_CONFIG_GUID, true); Element nameElement = getSingleChildElement(encapsulatedAssertionElement, ENCAPSULATED_ASSERTION_CONFIG_NAME, true); throw new EntityBuilderException("No encassName specified for encass in policy: '" + policy.getPath() + "' GUID: '" + (guidElement != null ? guidElement.getAttribute(STRING_VALUE) : null) + "' Name: '" + (nameElement != null ? nameElement.getAttribute(STRING_VALUE) : null) + "'"); } else { LOGGER.log(Level.FINE, "No encassName specified for encass in policy: \"{0}\". Since NoOp is true, this will be treated as a No Op.", policy.getPath()); } }
EncapsulatedAssertionBuilder implements PolicyAssertionBuilder { @Override public void buildAssertionElement(Element encapsulatedAssertionElement, PolicyBuilderContext policyBuilderContext) throws DocumentParseException { final Bundle bundle = policyBuilderContext.getBundle(); final AnnotatedBundle annotatedBundle = policyBuilderContext.getAnnotatedBundle(); final Policy policy = policyBuilderContext.getPolicy(); if (encapsulatedAssertionElement.hasAttribute(ENCASS_NAME)) { final String encassName = encapsulatedAssertionElement.getAttribute(ENCASS_NAME); Encass encass = getEncass(bundle, encassName, annotatedBundle); final String guid = findEncassReferencedGuid(policy, encass, encapsulatedAssertionElement, encassName); updateEncapsulatedAssertion(policyBuilderContext, encapsulatedAssertionElement, encass, encassName, guid); } else if (!isNoOpIfConfigMissing(encapsulatedAssertionElement)) { Element guidElement = getSingleChildElement(encapsulatedAssertionElement, ENCAPSULATED_ASSERTION_CONFIG_GUID, true); Element nameElement = getSingleChildElement(encapsulatedAssertionElement, ENCAPSULATED_ASSERTION_CONFIG_NAME, true); throw new EntityBuilderException("No encassName specified for encass in policy: '" + policy.getPath() + "' GUID: '" + (guidElement != null ? guidElement.getAttribute(STRING_VALUE) : null) + "' Name: '" + (nameElement != null ? nameElement.getAttribute(STRING_VALUE) : null) + "'"); } else { LOGGER.log(Level.FINE, "No encassName specified for encass in policy: \"{0}\". Since NoOp is true, this will be treated as a No Op.", policy.getPath()); } } }
EncapsulatedAssertionBuilder implements PolicyAssertionBuilder { @Override public void buildAssertionElement(Element encapsulatedAssertionElement, PolicyBuilderContext policyBuilderContext) throws DocumentParseException { final Bundle bundle = policyBuilderContext.getBundle(); final AnnotatedBundle annotatedBundle = policyBuilderContext.getAnnotatedBundle(); final Policy policy = policyBuilderContext.getPolicy(); if (encapsulatedAssertionElement.hasAttribute(ENCASS_NAME)) { final String encassName = encapsulatedAssertionElement.getAttribute(ENCASS_NAME); Encass encass = getEncass(bundle, encassName, annotatedBundle); final String guid = findEncassReferencedGuid(policy, encass, encapsulatedAssertionElement, encassName); updateEncapsulatedAssertion(policyBuilderContext, encapsulatedAssertionElement, encass, encassName, guid); } else if (!isNoOpIfConfigMissing(encapsulatedAssertionElement)) { Element guidElement = getSingleChildElement(encapsulatedAssertionElement, ENCAPSULATED_ASSERTION_CONFIG_GUID, true); Element nameElement = getSingleChildElement(encapsulatedAssertionElement, ENCAPSULATED_ASSERTION_CONFIG_NAME, true); throw new EntityBuilderException("No encassName specified for encass in policy: '" + policy.getPath() + "' GUID: '" + (guidElement != null ? guidElement.getAttribute(STRING_VALUE) : null) + "' Name: '" + (nameElement != null ? nameElement.getAttribute(STRING_VALUE) : null) + "'"); } else { LOGGER.log(Level.FINE, "No encassName specified for encass in policy: \"{0}\". Since NoOp is true, this will be treated as a No Op.", policy.getPath()); } }  }
EncapsulatedAssertionBuilder implements PolicyAssertionBuilder { @Override public void buildAssertionElement(Element encapsulatedAssertionElement, PolicyBuilderContext policyBuilderContext) throws DocumentParseException { final Bundle bundle = policyBuilderContext.getBundle(); final AnnotatedBundle annotatedBundle = policyBuilderContext.getAnnotatedBundle(); final Policy policy = policyBuilderContext.getPolicy(); if (encapsulatedAssertionElement.hasAttribute(ENCASS_NAME)) { final String encassName = encapsulatedAssertionElement.getAttribute(ENCASS_NAME); Encass encass = getEncass(bundle, encassName, annotatedBundle); final String guid = findEncassReferencedGuid(policy, encass, encapsulatedAssertionElement, encassName); updateEncapsulatedAssertion(policyBuilderContext, encapsulatedAssertionElement, encass, encassName, guid); } else if (!isNoOpIfConfigMissing(encapsulatedAssertionElement)) { Element guidElement = getSingleChildElement(encapsulatedAssertionElement, ENCAPSULATED_ASSERTION_CONFIG_GUID, true); Element nameElement = getSingleChildElement(encapsulatedAssertionElement, ENCAPSULATED_ASSERTION_CONFIG_NAME, true); throw new EntityBuilderException("No encassName specified for encass in policy: '" + policy.getPath() + "' GUID: '" + (guidElement != null ? guidElement.getAttribute(STRING_VALUE) : null) + "' Name: '" + (nameElement != null ? nameElement.getAttribute(STRING_VALUE) : null) + "'"); } else { LOGGER.log(Level.FINE, "No encassName specified for encass in policy: \"{0}\". Since NoOp is true, this will be treated as a No Op.", policy.getPath()); } }  @Override void buildAssertionElement(Element encapsulatedAssertionElement, PolicyBuilderContext policyBuilderContext); @Override String getAssertionTagName(); }
EncapsulatedAssertionBuilder implements PolicyAssertionBuilder { @Override public void buildAssertionElement(Element encapsulatedAssertionElement, PolicyBuilderContext policyBuilderContext) throws DocumentParseException { final Bundle bundle = policyBuilderContext.getBundle(); final AnnotatedBundle annotatedBundle = policyBuilderContext.getAnnotatedBundle(); final Policy policy = policyBuilderContext.getPolicy(); if (encapsulatedAssertionElement.hasAttribute(ENCASS_NAME)) { final String encassName = encapsulatedAssertionElement.getAttribute(ENCASS_NAME); Encass encass = getEncass(bundle, encassName, annotatedBundle); final String guid = findEncassReferencedGuid(policy, encass, encapsulatedAssertionElement, encassName); updateEncapsulatedAssertion(policyBuilderContext, encapsulatedAssertionElement, encass, encassName, guid); } else if (!isNoOpIfConfigMissing(encapsulatedAssertionElement)) { Element guidElement = getSingleChildElement(encapsulatedAssertionElement, ENCAPSULATED_ASSERTION_CONFIG_GUID, true); Element nameElement = getSingleChildElement(encapsulatedAssertionElement, ENCAPSULATED_ASSERTION_CONFIG_NAME, true); throw new EntityBuilderException("No encassName specified for encass in policy: '" + policy.getPath() + "' GUID: '" + (guidElement != null ? guidElement.getAttribute(STRING_VALUE) : null) + "' Name: '" + (nameElement != null ? nameElement.getAttribute(STRING_VALUE) : null) + "'"); } else { LOGGER.log(Level.FINE, "No encassName specified for encass in policy: \"{0}\". Since NoOp is true, this will be treated as a No Op.", policy.getPath()); } }  @Override void buildAssertionElement(Element encapsulatedAssertionElement, PolicyBuilderContext policyBuilderContext); @Override String getAssertionTagName(); static final String ZERO_GUID; }