01: /**
02: * Licensed to the Apache Software Foundation (ASF) under one
03: * or more contributor license agreements. See the NOTICE file
04: * distributed with this work for additional information
05: * regarding copyright ownership. The ASF licenses this file
06: * to you under the Apache License, Version 2.0 (the
07: * "License"); you may not use this file except in compliance
08: * with the License. You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing,
13: * software distributed under the License is distributed on an
14: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15: * KIND, either express or implied. See the License for the
16: * specific language governing permissions and limitations
17: * under the License.
18: */package org.apache.cxf.ws.security.wss4j;
19:
20: import java.io.IOException;
21: import java.io.InputStream;
22:
23: import javax.xml.parsers.ParserConfigurationException;
24: import javax.xml.soap.MessageFactory;
25: import javax.xml.soap.SOAPException;
26: import javax.xml.soap.SOAPMessage;
27:
28: import org.w3c.dom.Document;
29:
30: import org.xml.sax.SAXException;
31:
32: import org.apache.cxf.binding.soap.Soap11;
33: import org.apache.cxf.helpers.DOMUtils;
34: import org.apache.cxf.test.AbstractCXFTest;
35: import org.apache.ws.security.WSConstants;
36:
37: public abstract class AbstractSecurityTest extends AbstractCXFTest {
38: public AbstractSecurityTest() {
39: super ();
40:
41: addNamespace("wsse", WSConstants.WSSE_NS);
42: addNamespace("ds", WSConstants.SIG_NS);
43: addNamespace("s", Soap11.getInstance().getNamespace());
44: addNamespace("xenc", WSConstants.ENC_NS);
45: addNamespace("wsu", WSConstants.WSU_NS);
46: }
47:
48: protected Document readDocument(String name) throws SAXException,
49: IOException, ParserConfigurationException {
50: InputStream inStream = getClass().getResourceAsStream(name);
51: return DOMUtils.readXml(inStream);
52: }
53:
54: protected SOAPMessage readSAAJDocument(String name)
55: throws SAXException, IOException,
56: ParserConfigurationException, SOAPException {
57: InputStream inStream = getClass().getResourceAsStream(name);
58: return MessageFactory.newInstance().createMessage(null,
59: inStream);
60: }
61: }
|