Java Code Examples for org.apache.cxf.staxutils.StaxUtils#read()
The following examples show how to use
org.apache.cxf.staxutils.StaxUtils#read() .
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: WadlGeneratorTest.java From cxf with Apache License 2.0 | 6 votes |
@Test public void testSingleRootResource() throws Exception { WadlGenerator wg = new WadlGenerator(); wg.setApplicationTitle("My Application"); wg.setNamespacePrefix("ns"); ClassResourceInfo cri = ResourceUtils.createClassResourceInfo(BookStore.class, BookStore.class, true, true); Message m = mockMessage("http://localhost:8080/baz", "/bookstore/1", WadlGenerator.WADL_QUERY, cri); Response r = handleRequest(wg, m); checkResponse(r); Document doc = StaxUtils.read(new StringReader(r.getEntity().toString())); checkDocs(doc.getDocumentElement(), "My Application", "", ""); checkGrammars(doc.getDocumentElement(), "thebook", "books", "thebook2s", "thebook2", "thechapter"); List<Element> els = getWadlResourcesInfo(doc, "http://localhost:8080/baz", 1); checkBookStoreInfo(els.get(0), "ns1:thebook", "ns1:thebook2", "ns1:thechapter", "ns1:books"); }
Example 2
Source File: ClientServerTest.java From cxf with Apache License 2.0 | 6 votes |
@Test public void testGetWSDLWithGzip() throws Exception { String url = "http://localhost:" + PORT + "/SoapContext/SoapPortWithGzip?wsdl"; HttpURLConnection httpConnection = getHttpConnection(url); httpConnection.setRequestProperty("Accept-Encoding", "gzip, deflate"); httpConnection.connect(); assertEquals(200, httpConnection.getResponseCode()); assertEquals("text/xml;charset=utf-8", stripSpaces(httpConnection.getContentType().toLowerCase())); assertEquals("OK", httpConnection.getResponseMessage()); assertEquals("gzip", httpConnection.getContentEncoding()); InputStream in = httpConnection.getInputStream(); assertNotNull(in); GZIPInputStream inputStream = new GZIPInputStream(in); Document doc = StaxUtils.read(inputStream); assertNotNull(doc); inputStream.close(); }
Example 3
Source File: SoapPayloadConverterTest.java From syndesis with Apache License 2.0 | 6 votes |
@Test public void convertXmlToValidCxfPayload() throws IOException, XMLStreamException { // read XML bytes as an XML Document ByteArrayInputStream bis = new ByteArrayInputStream(IOUtils.readBytesFromStream(inputStream)); StaxUtils.read(bis); bis.reset(); // convert XML to CxfPayload final Exchange exchange = createExchangeWithBody(bis); final Message in = exchange.getIn(); requestConverter.process(exchange); final Object body = in.getBody(); Assertions.assertThat(body).isInstanceOf(CxfPayload.class); @SuppressWarnings("unchecked") final CxfPayload<Source> cxfPayload = (CxfPayload<Source>) body; // validate every header and body part XML for (Source headerPart : cxfPayload.getHeaders()) { validateXml(headerPart); } for (Source bodyPart : cxfPayload.getBodySources()) { validateXml(bodyPart); } }
Example 4
Source File: CustomizationParserTest.java From cxf with Apache License 2.0 | 6 votes |
@Test public void testInternalizeBinding3() throws Exception { Element wsdlDoc = getDocumentElement("resources/test.wsdl"); Element jaxwsBinding = getDocumentElement("resources/external_jaxws_embed_jaxb_date.xml"); parser.setWSDLNode(wsdlDoc); parser.internalizeBinding(jaxwsBinding, wsdlDoc, ""); String base = "wsdl:definitions/wsdl:types/xsd:schema/xsd:annotation/xsd:appinfo/"; String[] checkingPoints = new String[]{base + "jaxb:globalBindings/jaxb:javaType"}; File file = new File(output, "custom_test.wsdl"); StaxUtils.writeTo(wsdlDoc, new FileOutputStream(file)); Document testNode = StaxUtils.read(file); checking(testNode, checkingPoints); }
Example 5
Source File: DispatchXMLClientServerTest.java From cxf with Apache License 2.0 | 6 votes |
@Test public void testDOMSourcePAYLOAD() throws Exception { URL wsdl = getClass().getResource("/wsdl/hello_world_xml_wrapped.wsdl"); assertNotNull(wsdl); XMLService service = new XMLService(wsdl, SERVICE_NAME); assertNotNull(service); InputStream is = getClass().getResourceAsStream("/messages/XML_GreetMeDocLiteralReq.xml"); Document doc = StaxUtils.read(is); DOMSource reqMsg = new DOMSource(doc); assertNotNull(reqMsg); Dispatch<DOMSource> disp = service.createDispatch(PORT_NAME, DOMSource.class, Service.Mode.PAYLOAD); disp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://localhost:" + port + "/XMLService/XMLDispatchPort"); DOMSource result = disp.invoke(reqMsg); assertNotNull(result); Node respDoc = result.getNode(); assertEquals("greetMeResponse", respDoc.getFirstChild().getLocalName()); assertEquals("Hello tli", respDoc.getFirstChild().getTextContent()); }
Example 6
Source File: XMLStreamDataReader.java From cxf with Apache License 2.0 | 6 votes |
public DOMSource read(XMLStreamReader reader) { // Use a DOMSource for now, we should really use a StaxSource/SAXSource though for // performance reasons try { XMLStreamReader reader2 = reader; if (reader2 instanceof DepthXMLStreamReader) { reader2 = ((DepthXMLStreamReader)reader2).getReader(); } if (reader2 instanceof W3CDOMStreamReader) { W3CDOMStreamReader domreader = (W3CDOMStreamReader)reader2; DOMSource o = new DOMSource(domreader.getCurrentElement()); domreader.consumeFrame(); return o; } Document document = StaxUtils.read(reader); if (reader.hasNext()) { //need to actually consume the END_ELEMENT reader.next(); } return new DOMSource(document); } catch (XMLStreamException e) { throw new Fault("COULD_NOT_READ_XML_STREAM_CAUSED_BY", LOG, e, e.getClass().getCanonicalName(), e.getMessage()); } }
Example 7
Source File: IDLToWSDLTest.java From cxf with Apache License 2.0 | 6 votes |
@Test public void testCXF4541() throws Exception { File input = new File(getClass().getResource("/idl/missing_struct_member.idl").toURI()); String[] args = new String[] { "-mns[org::bash=http://www.bash.org]", "-o", output.toString(), input.toString() }; IDLToWSDL.run(args); File fs = new File(output, "org_bash.xsd"); assertTrue(fs.getName() + " was not created.", fs.exists()); Document doc = StaxUtils.read(new FileInputStream(fs)); NodeList l = doc.getDocumentElement().getElementsByTagNameNS("http://www.w3.org/2001/XMLSchema", "element"); for (int x = 0; x < l.getLength(); x++) { Element el = (Element)l.item(x); if ("bar".equals(el.getAttribute("name")) && el.getAttribute("type").contains("string")) { return; } } fail("Did not find foo element"); }
Example 8
Source File: EndpointReferenceTest.java From cxf with Apache License 2.0 | 6 votes |
@Test public void testEndpointGetEndpointReferenceW3C() throws Exception { GreeterImpl greeter = new GreeterImpl(); try (EndpointImpl endpoint = new EndpointImpl(getBus(), greeter, (String)null)) { endpoint.publish("http://localhost:8080/test"); InputStream is = getClass().getResourceAsStream("resources/hello_world_soap_http_infoset.xml"); Document doc = StaxUtils.read(is); Element referenceParameters = fetchElementByNameAttribute(doc.getDocumentElement(), "wsa:ReferenceParameters", ""); EndpointReference endpointReference = endpoint.getEndpointReference(W3CEndpointReference.class, referenceParameters); assertNotNull(endpointReference); assertTrue(endpointReference instanceof W3CEndpointReference); //A returned W3CEndpointReferenceMUST also contain the specified referenceParameters. //W3CEndpointReference wer = (W3CEndpointReference)endpointReference; endpoint.stop(); } }
Example 9
Source File: DispatchTest.java From cxf with Apache License 2.0 | 6 votes |
@Test public void testFindOperationWithSource() throws Exception { ServiceImpl service = new ServiceImpl(getBus(), getClass().getResource("/wsdl/hello_world.wsdl"), SERVICE_NAME, null); Dispatch<Source> disp = service.createDispatch(PORT_NAME, Source.class, Service.Mode.MESSAGE); disp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, ADDRESS); disp.getRequestContext().put("find.dispatch.operation", Boolean.TRUE); d.setMessageObserver(new MessageReplayObserver("/org/apache/cxf/jaxws/sayHiResponse.xml")); BindingOperationVerifier bov = new BindingOperationVerifier(); ((DispatchImpl<?>)disp).getClient().getOutInterceptors().add(bov); Document doc = StaxUtils.read(getResourceAsStream("/org/apache/cxf/jaxws/sayHi2.xml")); DOMSource source = new DOMSource(doc); Source res = disp.invoke(source); assertNotNull(res); BindingOperationInfo boi = bov.getBindingOperationInfo(); assertNotNull(boi); assertEquals(new QName("http://apache.org/hello_world_soap_http", "sayHi"), boi.getName()); }
Example 10
Source File: WadlGeneratorTest.java From cxf with Apache License 2.0 | 6 votes |
@Test public void testExternalSchemaCustomPrefix() throws Exception { WadlGenerator wg = new WadlGenerator(); wg.setExternalLinks(Collections.singletonList("http://books")); wg.setUseJaxbContextForQnames(false); ClassResourceInfo cri = ResourceUtils.createClassResourceInfo(BookStore.class, BookStore.class, true, true); Message m = mockMessage("http://localhost:8080/baz", "/bookstore/1", WadlGenerator.WADL_QUERY, cri); Response r = handleRequest(wg, m); checkResponse(r); Document doc = StaxUtils.read(new StringReader(r.getEntity().toString())); checkGrammarsWithLinks(doc.getDocumentElement(), Collections.singletonList("http://books")); List<Element> els = getWadlResourcesInfo(doc, "http://localhost:8080/baz", 1); checkBookStoreInfo(els.get(0), "p1:thesuperbook", "p1:thesuperbook2", "p1:thesuperchapter"); }
Example 11
Source File: SignatureWhitespaceTest.java From cxf with Apache License 2.0 | 5 votes |
@org.junit.Test public void testAddedCommentsInSOAPBody() throws Exception { SpringBusFactory bf = new SpringBusFactory(); URL busFile = SignatureWhitespaceTest.class.getResource("client.xml"); Bus bus = bf.createBus(busFile.toString()); BusFactory.setDefaultBus(bus); BusFactory.setThreadDefaultBus(bus); URL wsdl = SignatureWhitespaceTest.class.getResource("DoubleItAction.wsdl"); Service service = Service.create(wsdl, SERVICE_QNAME); QName portQName = new QName(NAMESPACE, "DoubleItSignaturePort2"); Dispatch<StreamSource> dispatch = service.createDispatch(portQName, StreamSource.class, Service.Mode.MESSAGE); // Creating a DOMSource Object for the request URL requestFile = SignatureWhitespaceTest.class.getResource("request-with-comment.xml"); StreamSource request = new StreamSource(new File(requestFile.getPath())); updateAddressPort(dispatch, test.getPort()); // Make a successful request StreamSource response = dispatch.invoke(request); assertNotNull(response); Document doc = StaxUtils.read(response.getInputStream()); assertEquals("50", doc.getElementsByTagNameNS(null, "doubledNumber").item(0).getTextContent()); ((java.io.Closeable)dispatch).close(); }
Example 12
Source File: PutTest.java From cxf with Apache License 2.0 | 5 votes |
private CreateResponse createTeacher() throws XMLStreamException { Document createTeacherXML = StaxUtils.read( getClass().getResourceAsStream("/xml/createTeacher.xml")); Create request = new Create(); request.setRepresentation(new Representation()); request.getRepresentation().setAny(createTeacherXML.getDocumentElement()); ResourceFactory rf = TestUtils.createResourceFactoryClient(PORT); return rf.create(request); }
Example 13
Source File: ValidationServer.java From cxf with Apache License 2.0 | 5 votes |
@Override public Source invoke(Source request) { try { Document doc = StaxUtils.read(request); String name = doc.getDocumentElement().getLocalName(); if ("SomeRequest".equals(name)) { String v = DOMUtils.getFirstElement(doc.getDocumentElement()).getTextContent(); return new StreamSource(new StringReader(getResponse(v))); } } catch (XMLStreamException e) { e.printStackTrace(); } return null; }
Example 14
Source File: FilterEvaluationTest.java From cxf with Apache License 2.0 | 5 votes |
@Test public void simpleFilterEvaluationPositive() throws Exception { Reader reader = new CharArrayReader("<tt><in>1</in></tt>".toCharArray()); Document doc = StaxUtils.read(reader); FilterType filter = new FilterType(); filter.getContent().add("//tt"); Assert.assertTrue(FilteringUtil.doesConformToFilter(doc.getDocumentElement(), filter)); }
Example 15
Source File: SamlTokenTest.java From steady with Apache License 2.0 | 4 votes |
private SoapMessage makeInvocation( Map<String, Object> outProperties, List<String> xpaths, Map<String, Object> inProperties, Map<String, String> inMessageProperties ) throws Exception { Document doc = readDocument("wsse-request-clean.xml"); WSS4JOutInterceptor ohandler = new WSS4JOutInterceptor(); PhaseInterceptor<SoapMessage> handler = ohandler.createEndingInterceptor(); SoapMessage msg = new SoapMessage(new MessageImpl()); Exchange ex = new ExchangeImpl(); ex.setInMessage(msg); SOAPMessage saajMsg = MessageFactory.newInstance().createMessage(); SOAPPart part = saajMsg.getSOAPPart(); part.setContent(new DOMSource(doc)); saajMsg.saveChanges(); msg.setContent(SOAPMessage.class, saajMsg); for (String key : outProperties.keySet()) { msg.put(key, outProperties.get(key)); } handler.handleMessage(msg); doc = part; for (String xpath : xpaths) { assertValid(xpath, doc); } byte[] docbytes = getMessageBytes(doc); XMLStreamReader reader = StaxUtils.createXMLStreamReader(new ByteArrayInputStream(docbytes)); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setValidating(false); dbf.setIgnoringComments(false); dbf.setIgnoringElementContentWhitespace(true); dbf.setNamespaceAware(true); DocumentBuilder db = dbf.newDocumentBuilder(); db.setEntityResolver(new NullResolver()); doc = StaxUtils.read(db, reader, false); WSS4JInInterceptor inHandler = new WSS4JInInterceptor(inProperties); SoapMessage inmsg = new SoapMessage(new MessageImpl()); inmsg.put(SecurityConstants.SAML_ROLE_ATTRIBUTENAME, "role"); for (String inMessageProperty : inMessageProperties.keySet()) { inmsg.put(inMessageProperty, inMessageProperties.get(inMessageProperty)); } ex.setInMessage(inmsg); inmsg.setContent(SOAPMessage.class, saajMsg); inHandler.handleMessage(inmsg); return inmsg; }
Example 16
Source File: WSS4JInOutTest.java From steady with Apache License 2.0 | 4 votes |
@Test public void testCustomProcessorObject() throws Exception { Document doc = readDocument("wsse-request-clean.xml"); WSS4JOutInterceptor ohandler = new WSS4JOutInterceptor(); PhaseInterceptor<SoapMessage> handler = ohandler.createEndingInterceptor(); SoapMessage msg = new SoapMessage(new MessageImpl()); Exchange ex = new ExchangeImpl(); ex.setInMessage(msg); SOAPMessage saajMsg = MessageFactory.newInstance().createMessage(); SOAPPart part = saajMsg.getSOAPPart(); part.setContent(new DOMSource(doc)); saajMsg.saveChanges(); msg.setContent(SOAPMessage.class, saajMsg); msg.put(WSHandlerConstants.ACTION, WSHandlerConstants.SIGNATURE); msg.put(WSHandlerConstants.SIG_PROP_FILE, "outsecurity.properties"); msg.put(WSHandlerConstants.USER, "myalias"); msg.put("password", "myAliasPassword"); handler.handleMessage(msg); doc = part; assertValid("//wsse:Security", doc); assertValid("//wsse:Security/ds:Signature", doc); byte[] docbytes = getMessageBytes(doc); XMLStreamReader reader = StaxUtils.createXMLStreamReader(new ByteArrayInputStream(docbytes)); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setValidating(false); dbf.setIgnoringComments(false); dbf.setIgnoringElementContentWhitespace(true); dbf.setNamespaceAware(true); DocumentBuilder db = dbf.newDocumentBuilder(); db.setEntityResolver(new NullResolver()); doc = StaxUtils.read(db, reader, false); final Map<String, Object> properties = new HashMap<String, Object>(); final Map<QName, Object> customMap = new HashMap<QName, Object>(); customMap.put( new QName( WSConstants.SIG_NS, WSConstants.SIG_LN ), CustomProcessor.class ); properties.put( WSS4JInInterceptor.PROCESSOR_MAP, customMap ); WSS4JInInterceptor inHandler = new WSS4JInInterceptor(properties); SoapMessage inmsg = new SoapMessage(new MessageImpl()); ex.setInMessage(inmsg); inmsg.setContent(SOAPMessage.class, saajMsg); inHandler.setProperty(WSHandlerConstants.ACTION, WSHandlerConstants.SIGNATURE); inHandler.handleMessage(inmsg); WSSecurityEngineResult result = (WSSecurityEngineResult) inmsg.get(WSS4JInInterceptor.SIGNATURE_RESULT); assertNotNull(result); Object obj = result.get("foo"); assertNotNull(obj); assertEquals(obj.getClass().getName(), CustomProcessor.class.getName()); }
Example 17
Source File: WadlGenerator.java From cxf with Apache License 2.0 | 4 votes |
public Response getExistingWadl(Message m, UriInfo ui, MediaType mt) { Endpoint ep = m.getExchange().getEndpoint(); if (ep != null) { String loc = (String)ep.get(JAXRSUtils.DOC_LOCATION); if (loc != null) { try { InputStream is = ResourceUtils.getResourceStream(loc, (Bus)ep.get(Bus.class.getName())); if (is != null) { Object contextProp = m.getContextualProperty(CONVERT_WADL_RESOURCES_TO_DOM); boolean doConvertResourcesToDOM = contextProp == null ? convertResourcesToDOM : PropertyUtils.isTrue(contextProp); if (!doConvertResourcesToDOM || isJson(mt)) { return Response.ok(is, mt).build(); } Document wadlDoc = StaxUtils.read(is); Element appEl = wadlDoc.getDocumentElement(); List<Element> grammarEls = DOMUtils.getChildrenWithName(appEl, WadlGenerator.WADL_NS, "grammars"); if (grammarEls.size() == 1) { handleExistingDocRefs(DOMUtils.getChildrenWithName(grammarEls.get(0), WadlGenerator.WADL_NS, "include"), "href", loc, "", m, ui); } List<Element> resourcesEls = DOMUtils.getChildrenWithName(appEl, WadlGenerator.WADL_NS, "resources"); if (resourcesEls.size() == 1) { DOMUtils.setAttribute(resourcesEls.get(0), "base", getBaseURI(m, ui)); List<Element> resourceEls = DOMUtils.getChildrenWithName(resourcesEls.get(0), WadlGenerator.WADL_NS, "resource"); handleExistingDocRefs(resourceEls, "type", loc, "", m, ui); return finalizeExistingWadlResponse(wadlDoc, m, ui, mt); } } } catch (Exception ex) { throw ExceptionUtils.toInternalServerErrorException(ex, null); } } } return null; }
Example 18
Source File: SamlTokenTest.java From steady with Apache License 2.0 | 4 votes |
private SoapMessage makeInvocation( Map<String, Object> outProperties, List<String> xpaths, Map<String, Object> inProperties, Map<String, String> inMessageProperties ) throws Exception { Document doc = readDocument("wsse-request-clean.xml"); WSS4JOutInterceptor ohandler = new WSS4JOutInterceptor(); PhaseInterceptor<SoapMessage> handler = ohandler.createEndingInterceptor(); SoapMessage msg = new SoapMessage(new MessageImpl()); Exchange ex = new ExchangeImpl(); ex.setInMessage(msg); SOAPMessage saajMsg = MessageFactory.newInstance().createMessage(); SOAPPart part = saajMsg.getSOAPPart(); part.setContent(new DOMSource(doc)); saajMsg.saveChanges(); msg.setContent(SOAPMessage.class, saajMsg); for (String key : outProperties.keySet()) { msg.put(key, outProperties.get(key)); } handler.handleMessage(msg); doc = part; for (String xpath : xpaths) { assertValid(xpath, doc); } byte[] docbytes = getMessageBytes(doc); XMLStreamReader reader = StaxUtils.createXMLStreamReader(new ByteArrayInputStream(docbytes)); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setValidating(false); dbf.setIgnoringComments(false); dbf.setIgnoringElementContentWhitespace(true); dbf.setNamespaceAware(true); DocumentBuilder db = dbf.newDocumentBuilder(); db.setEntityResolver(new NullResolver()); doc = StaxUtils.read(db, reader, false); WSS4JInInterceptor inHandler = new WSS4JInInterceptor(inProperties); SoapMessage inmsg = new SoapMessage(new MessageImpl()); inmsg.put(SecurityConstants.SAML_ROLE_ATTRIBUTENAME, "role"); for (String inMessageProperty : inMessageProperties.keySet()) { inmsg.put(inMessageProperty, inMessageProperties.get(inMessageProperty)); } ex.setInMessage(inmsg); inmsg.setContent(SOAPMessage.class, saajMsg); inHandler.handleMessage(inmsg); return inmsg; }
Example 19
Source File: WSS4JInOutTest.java From steady with Apache License 2.0 | 4 votes |
@Test public void testCustomProcessorObject() throws Exception { Document doc = readDocument("wsse-request-clean.xml"); WSS4JOutInterceptor ohandler = new WSS4JOutInterceptor(); PhaseInterceptor<SoapMessage> handler = ohandler.createEndingInterceptor(); SoapMessage msg = new SoapMessage(new MessageImpl()); Exchange ex = new ExchangeImpl(); ex.setInMessage(msg); SOAPMessage saajMsg = MessageFactory.newInstance().createMessage(); SOAPPart part = saajMsg.getSOAPPart(); part.setContent(new DOMSource(doc)); saajMsg.saveChanges(); msg.setContent(SOAPMessage.class, saajMsg); msg.put(WSHandlerConstants.ACTION, WSHandlerConstants.SIGNATURE); msg.put(WSHandlerConstants.SIG_PROP_FILE, "outsecurity.properties"); msg.put(WSHandlerConstants.USER, "myalias"); msg.put("password", "myAliasPassword"); handler.handleMessage(msg); doc = part; assertValid("//wsse:Security", doc); assertValid("//wsse:Security/ds:Signature", doc); byte[] docbytes = getMessageBytes(doc); XMLStreamReader reader = StaxUtils.createXMLStreamReader(new ByteArrayInputStream(docbytes)); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setValidating(false); dbf.setIgnoringComments(false); dbf.setIgnoringElementContentWhitespace(true); dbf.setNamespaceAware(true); DocumentBuilder db = dbf.newDocumentBuilder(); db.setEntityResolver(new NullResolver()); doc = StaxUtils.read(db, reader, false); final Map<String, Object> properties = new HashMap<String, Object>(); final Map<QName, Object> customMap = new HashMap<QName, Object>(); customMap.put( new QName( WSConstants.SIG_NS, WSConstants.SIG_LN ), CustomProcessor.class ); properties.put( WSS4JInInterceptor.PROCESSOR_MAP, customMap ); WSS4JInInterceptor inHandler = new WSS4JInInterceptor(properties); SoapMessage inmsg = new SoapMessage(new MessageImpl()); ex.setInMessage(inmsg); inmsg.setContent(SOAPMessage.class, saajMsg); inHandler.setProperty(WSHandlerConstants.ACTION, WSHandlerConstants.SIGNATURE); inHandler.handleMessage(inmsg); WSSecurityEngineResult result = (WSSecurityEngineResult) inmsg.get(WSS4JInInterceptor.SIGNATURE_RESULT); assertNotNull(result); Object obj = result.get("foo"); assertNotNull(obj); assertEquals(obj.getClass().getName(), CustomProcessor.class.getName()); }
Example 20
Source File: AbstractSecurityTest.java From cxf with Apache License 2.0 | 4 votes |
/** * Reads a classpath resource into a Document. * @param name the name of the classpath resource */ protected Document readDocument(String name) throws Exception, ParserConfigurationException { InputStream inStream = getClass().getResourceAsStream(name); return StaxUtils.read(inStream); }