Java Code Examples for org.apache.neethi.PolicyReference#setURI()
The following examples show how to use
org.apache.neethi.PolicyReference#setURI() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Wsdl11AttachmentPolicyProvider.java From cxf with Apache License 2.0 | 6 votes |
Policy resolveLocal(PolicyReference ref, DescriptionInfo di) { String uri = ref.getURI().substring(1); String absoluteURI = di.getBaseURI(); if (absoluteURI == null) { absoluteURI = Integer.toString(di.hashCode()) + ref.getURI(); } else { absoluteURI = absoluteURI + ref.getURI(); } Policy resolved = registry.lookup(absoluteURI); if (null != resolved) { return resolved; } ReferenceResolver resolver = new LocalServiceModelReferenceResolver(di, builder); resolved = resolver.resolveReference(uri); if (null != resolved) { ref.setURI(absoluteURI); registry.register(absoluteURI, resolved); } return resolved; }
Example 2
Source File: ExternalAttachmentProvider.java From cxf with Apache License 2.0 | 5 votes |
Policy resolveLocal(PolicyReference ref, Document doc) { String relativeURI = ref.getURI().substring(1); String absoluteURI = doc.getBaseURI() + ref.getURI(); Policy resolved = registry.lookup(absoluteURI); if (null != resolved) { return resolved; } ReferenceResolver resolver = new LocalDocumentReferenceResolver(doc, builder); resolved = resolver.resolveReference(relativeURI); if (null != resolved) { ref.setURI(absoluteURI); registry.register(absoluteURI, resolved); } return resolved; }
Example 3
Source File: PolicyEngineTest.java From cxf with Apache License 2.0 | 5 votes |
@Test public void testAddAssertions() { engine = new PolicyEngineImpl(); Collection<Assertion> assertions = new ArrayList<>(); Assertion a = control.createMock(Assertion.class); EasyMock.expect(a.getType()).andReturn(Constants.TYPE_ASSERTION); EasyMock.expect(a.isOptional()).andReturn(true); control.replay(); engine.addAssertions(a, false, assertions); assertTrue(assertions.isEmpty()); control.verify(); control.reset(); EasyMock.expect(a.getType()).andReturn(Constants.TYPE_ASSERTION); control.replay(); engine.addAssertions(a, true, assertions); assertEquals(1, assertions.size()); assertSame(a, assertions.iterator().next()); control.verify(); assertions.clear(); Policy p = new Policy(); a = new PrimitiveAssertion(new QName("http://x.y.z", "a")); p.addAssertion(a); // id has no # engine.getRegistry().register("ab", p); // local reference is an id + # PolicyReference pr = new PolicyReference(); pr.setURI("#ab"); engine.addAssertions(pr, false, assertions); assertEquals(1, assertions.size()); assertSame(a, assertions.iterator().next()); }