Http2AssertionBuilder implements PolicyAssertionBuilder { @Override public void buildAssertionElement(Element assertionElement, PolicyBuilderContext policyBuilderContext) { final Bundle bundle = policyBuilderContext.getBundle(); final Element http2ClientNameEle = getSingleChildElement(assertionElement, HTTP2_CLIENT_CONFIG_NAME, true); if (http2ClientNameEle != null) { final String http2ClientName = http2ClientNameEle.getAttributes().getNamedItem(STRING_VALUE).getTextContent(); http2ClientNameEle.setAttribute(STRING_VALUE, bundle.applyUniqueName(http2ClientName, ENVIRONMENT)); final GenericEntity http2Client = bundle.getGenericEntities().get(http2ClientName); final String id = getIdFromAnnotableEntity(http2Client, policyBuilderContext.getIdGenerator()); Element http2ClientGoidElement = createElementWithAttribute( policyBuilderContext.getPolicyDocument(), HTTP2_CLIENT_CONFIG_GOID, GOID_VALUE, id ); assertionElement.insertBefore(http2ClientGoidElement, http2ClientNameEle); } }  @Override void buildAssertionElement(Element assertionElement, PolicyBuilderContext policyBuilderContext); @Override String getAssertionTagName();  }
@Test void testPrepareHttp2AssertionClientConfigIds() { bundle.getGenericEntities().put("http2client", createHttp2ClientConfigWithAnnotation(AnnotationType.BUNDLE_HINTS, "a2097d7f50280e9411c277aafedc180d")); Element http2RoutingAssertionElement = createHttp2Assertion(document); policyBuilderContext = new PolicyBuilderContext("path.xml", document, bundle, new IdGenerator()); policyBuilderContext.withPolicy(policy); http2AssertionBuilder.buildAssertionElement(http2RoutingAssertionElement, policyBuilderContext); final Element clientConfigId = getSingleChildElement(http2RoutingAssertionElement, HTTP2_CLIENT_CONFIG_GOID, true); assertNotNull(clientConfigId); assertEquals("a2097d7f50280e9411c277aafedc180d", clientConfigId.getAttributes().getNamedItem(GOID_VALUE).getTextContent()); final Element clientConfigName = getSingleChildElement(http2RoutingAssertionElement, HTTP2_CLIENT_CONFIG_NAME, true); assertNotNull(clientConfigName); assertEquals("::" + projectInfo.getGroupName() + "::" + "http2client" + "::1.0", clientConfigName.getAttributes().getNamedItem(STRING_VALUE).getTextContent()); }