01: /*
02: * Copyright 2007 the original author or authors.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16:
17: package org.springframework.ws.soap;
18:
19: import java.util.Iterator;
20: import javax.xml.namespace.QName;
21: import javax.xml.transform.Transformer;
22: import javax.xml.transform.TransformerFactory;
23:
24: import org.custommonkey.xmlunit.XMLTestCase;
25:
26: public abstract class AbstractSoapElementTestCase extends XMLTestCase {
27:
28: private SoapElement soapElement;
29:
30: protected Transformer transformer;
31:
32: protected final void setUp() throws Exception {
33: TransformerFactory transformerFactory = TransformerFactory
34: .newInstance();
35: transformer = transformerFactory.newTransformer();
36: soapElement = createSoapElement();
37: }
38:
39: protected abstract SoapElement createSoapElement() throws Exception;
40:
41: public void testAttributes() throws Exception {
42: QName name = new QName("http://springframework.org/spring-ws",
43: "attribute");
44: String value = "value";
45: soapElement.addAttribute(name, value);
46: assertEquals("Invalid attribute value", value, soapElement
47: .getAttributeValue(name));
48: Iterator allAttributes = soapElement.getAllAttibutes();
49: assertTrue("Iterator is empty", allAttributes.hasNext());
50:
51: }
52:
53: }
|