You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by co...@apache.org on 2017/02/14 09:49:34 UTC
[29/51] [partial] cxf git commit: Remove all trailing whitespaces
http://git-wip-us.apache.org/repos/asf/cxf/blob/8cea7c87/core/src/test/java/org/apache/cxf/service/model/InterfaceInfoTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/cxf/service/model/InterfaceInfoTest.java b/core/src/test/java/org/apache/cxf/service/model/InterfaceInfoTest.java
index c65412d..e839e9e 100644
--- a/core/src/test/java/org/apache/cxf/service/model/InterfaceInfoTest.java
+++ b/core/src/test/java/org/apache/cxf/service/model/InterfaceInfoTest.java
@@ -26,7 +26,7 @@ import org.junit.Before;
import org.junit.Test;
public class InterfaceInfoTest extends Assert {
-
+
private InterfaceInfo interfaceInfo;
@Before
@@ -34,7 +34,7 @@ public class InterfaceInfoTest extends Assert {
interfaceInfo = new InterfaceInfo(new ServiceInfo(), new QName(
"http://apache.org/hello_world_soap_http", "interfaceTest"));
}
-
+
@Test
public void testName() throws Exception {
assertEquals(interfaceInfo.getName().getLocalPart(), "interfaceTest");
@@ -47,7 +47,7 @@ public class InterfaceInfoTest extends Assert {
assertEquals(interfaceInfo.getName().getNamespaceURI(),
"http://apache.org/hello_world_soap_http1");
}
-
+
@Test
public void testOperation() throws Exception {
QName name = new QName("urn:test:ns", "sayHi");
@@ -59,7 +59,7 @@ public class InterfaceInfoTest extends Assert {
try {
interfaceInfo.addOperation(name);
} catch (IllegalArgumentException e) {
- assertEquals(e.getMessage(),
+ assertEquals(e.getMessage(),
"An operation with name [{urn:test:ns}sayHi] already exists in this service");
duplicatedOperationName = true;
}
@@ -78,5 +78,5 @@ public class InterfaceInfoTest extends Assert {
fail("should get NullPointerException");
}
}
-
+
}
http://git-wip-us.apache.org/repos/asf/cxf/blob/8cea7c87/core/src/test/java/org/apache/cxf/service/model/MessageInfoTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/cxf/service/model/MessageInfoTest.java b/core/src/test/java/org/apache/cxf/service/model/MessageInfoTest.java
index 5bc9f01..1e41f5d 100644
--- a/core/src/test/java/org/apache/cxf/service/model/MessageInfoTest.java
+++ b/core/src/test/java/org/apache/cxf/service/model/MessageInfoTest.java
@@ -26,27 +26,27 @@ import org.junit.Before;
import org.junit.Test;
public class MessageInfoTest extends Assert {
-
+
private MessageInfo messageInfo;
-
+
@Before
public void setUp() throws Exception {
messageInfo = new MessageInfo(null, MessageInfo.Type.INPUT,
new QName("http://apache.org/hello_world_soap_http", "testMessage"));
}
-
+
@Test
public void testName() throws Exception {
assertEquals(messageInfo.getName().getLocalPart(), "testMessage");
assertEquals(messageInfo.getName().getNamespaceURI(),
"http://apache.org/hello_world_soap_http");
}
-
+
@Test
public void testMessagePartInfo() throws Exception {
QName qname = new QName(
"http://apache.org/hello_world_soap_http", "testMessagePart");
-
+
messageInfo.addMessagePart(qname);
assertEquals(messageInfo.getMessageParts().size(), 1);
MessagePartInfo messagePartInfo = messageInfo.getMessagePart(qname);
http://git-wip-us.apache.org/repos/asf/cxf/blob/8cea7c87/core/src/test/java/org/apache/cxf/service/model/MessagePartInfoTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/cxf/service/model/MessagePartInfoTest.java b/core/src/test/java/org/apache/cxf/service/model/MessagePartInfoTest.java
index 684545f..bc76049 100644
--- a/core/src/test/java/org/apache/cxf/service/model/MessagePartInfoTest.java
+++ b/core/src/test/java/org/apache/cxf/service/model/MessagePartInfoTest.java
@@ -27,13 +27,13 @@ import org.junit.Before;
import org.junit.Test;
public class MessagePartInfoTest extends Assert {
-
-
+
+
private MessagePartInfo messagePartInfo;
-
+
@Before
public void setUp() throws Exception {
-
+
MessageInfo msg = new MessageInfo(null,
MessageInfo.Type.INPUT,
new QName("http://apache.org/hello_world_soap_http/types",
@@ -42,7 +42,7 @@ public class MessagePartInfoTest extends Assert {
"http://apache.org/hello_world_soap_http", "testMessagePart"), msg);
messagePartInfo.setElement(true);
}
-
+
@Test
public void testName() throws Exception {
assertEquals(messagePartInfo.getName().getLocalPart(), "testMessagePart");
@@ -53,7 +53,7 @@ public class MessagePartInfoTest extends Assert {
assertEquals(messagePartInfo.getName().getLocalPart(), "testMessagePart1");
assertEquals(messagePartInfo.getName().getNamespaceURI(),
"http://apache.org/hello_world_soap_http1");
-
+
}
@Test
@@ -66,7 +66,7 @@ public class MessagePartInfoTest extends Assert {
"http://apache.org/hello_world_soap_http/types");
assertNull(messagePartInfo.getTypeQName());
}
-
+
@Test
public void testType() {
messagePartInfo.setTypeQName(new QName(
http://git-wip-us.apache.org/repos/asf/cxf/blob/8cea7c87/core/src/test/java/org/apache/cxf/service/model/OperationInfoTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/cxf/service/model/OperationInfoTest.java b/core/src/test/java/org/apache/cxf/service/model/OperationInfoTest.java
index 7c840af..a3561bd 100644
--- a/core/src/test/java/org/apache/cxf/service/model/OperationInfoTest.java
+++ b/core/src/test/java/org/apache/cxf/service/model/OperationInfoTest.java
@@ -28,12 +28,12 @@ import org.junit.Test;
public class OperationInfoTest extends Assert {
private OperationInfo operationInfo;
-
+
@Before
public void setUp() throws Exception {
operationInfo = new OperationInfo(null, new QName("urn:test:ns", "operationTest"));
}
-
+
@Test
public void testName() throws Exception {
assertNull(operationInfo.getInterface());
@@ -47,7 +47,7 @@ public class OperationInfoTest extends Assert {
assertEquals(e.getMessage(), "Operation Name cannot be null.");
}
}
-
+
@Test
public void testInput() throws Exception {
assertFalse(operationInfo.hasInput());
@@ -62,7 +62,7 @@ public class OperationInfoTest extends Assert {
inputMessage.getName().getNamespaceURI());
assertEquals(operationInfo.getInputName(), "input");
}
-
+
@Test
public void testOutput() throws Exception {
assertFalse(operationInfo.hasOutput());
@@ -77,7 +77,7 @@ public class OperationInfoTest extends Assert {
outputMessage.getName().getNamespaceURI());
assertEquals(operationInfo.getOutputName(), "output");
}
-
+
@Test
public void testOneWay() throws Exception {
assertFalse(operationInfo.isOneWay());
@@ -87,7 +87,7 @@ public class OperationInfoTest extends Assert {
operationInfo.setInput("input", inputMessage);
assertTrue(operationInfo.isOneWay());
}
-
+
@Test
public void testFault() throws Exception {
assertEquals(operationInfo.getFaults().size(), 0);
@@ -99,7 +99,7 @@ public class OperationInfoTest extends Assert {
assertNotNull(fault);
assertEquals(fault.getFaultName().getLocalPart(), "fault");
assertEquals(fault.getName().getLocalPart(), "faultMessage");
- assertEquals(fault.getName().getNamespaceURI(),
+ assertEquals(fault.getName().getNamespaceURI(),
"http://apache.org/hello_world_soap_http");
operationInfo.removeFault(faultName);
assertEquals(operationInfo.getFaults().size(), 0);
@@ -114,10 +114,10 @@ public class OperationInfoTest extends Assert {
operationInfo.addFault(faultName, null);
fail("should get IllegalArgumentException");
} catch (IllegalArgumentException e) {
- assertEquals(e.getMessage(),
+ assertEquals(e.getMessage(),
"A fault with name [{urn:test:ns}fault] already exists in this operation");
}
}
-
-
+
+
}
http://git-wip-us.apache.org/repos/asf/cxf/blob/8cea7c87/core/src/test/java/org/apache/cxf/staxutils/DepthRestrictingStreamReaderTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/cxf/staxutils/DepthRestrictingStreamReaderTest.java b/core/src/test/java/org/apache/cxf/staxutils/DepthRestrictingStreamReaderTest.java
index 690a717..7d78232 100644
--- a/core/src/test/java/org/apache/cxf/staxutils/DepthRestrictingStreamReaderTest.java
+++ b/core/src/test/java/org/apache/cxf/staxutils/DepthRestrictingStreamReaderTest.java
@@ -27,90 +27,90 @@ import org.junit.Assert;
import org.junit.Test;
public class DepthRestrictingStreamReaderTest extends Assert {
-
+
@Test
public void testReaderOK() throws Exception {
- XMLStreamReader reader =
+ XMLStreamReader reader =
StaxUtils.createXMLStreamReader(getClass().getResourceAsStream("./resources/amazon.xml"));
-
+
DepthRestrictingStreamReader dr = new DepthRestrictingStreamReader(reader,
- 7,
+ 7,
4,
4);
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
StaxUtils.copy(dr, bos);
assertTrue(bos.toString().contains("ItemLookup"));
}
-
+
@Test
public void testReaderOKComplex() throws Exception {
- XMLStreamReader reader =
+ XMLStreamReader reader =
StaxUtils.createXMLStreamReader(getClass().getResourceAsStream("./resources/wstrustReqSTRC.xml"));
-
+
DepthRestrictingStreamReader dr = new DepthRestrictingStreamReader(reader,
- -1,
+ -1,
8,
3);
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
StaxUtils.copy(dr, bos);
assertTrue(bos.toString().contains("RequestSecurityTokenResponse"));
}
-
+
@Test(expected = DepthExceededStaxException.class)
public void testElementCountExceeded() throws Exception {
- XMLStreamReader reader =
+ XMLStreamReader reader =
StaxUtils.createXMLStreamReader(getClass().getResourceAsStream("./resources/amazon.xml"));
-
+
DepthRestrictingStreamReader dr = new DepthRestrictingStreamReader(reader,
- 6,
+ 6,
4,
4);
StaxUtils.copy(dr, new ByteArrayOutputStream());
}
-
+
@Test(expected = DepthExceededStaxException.class)
public void testElementLevelExceeded() throws Exception {
- XMLStreamReader reader =
+ XMLStreamReader reader =
StaxUtils.createXMLStreamReader(getClass().getResourceAsStream("./resources/amazon.xml"));
-
+
DepthRestrictingStreamReader dr = new DepthRestrictingStreamReader(reader,
- 7,
+ 7,
3,
4);
StaxUtils.copy(dr, new ByteArrayOutputStream());
}
-
+
@Test(expected = DepthExceededStaxException.class)
public void testElementLevelExceededComplex() throws Exception {
- XMLStreamReader reader =
+ XMLStreamReader reader =
StaxUtils.createXMLStreamReader(getClass().getResourceAsStream("./resources/wstrustReqSTRC.xml"));
-
+
DepthRestrictingStreamReader dr = new DepthRestrictingStreamReader(reader,
- -1,
+ -1,
7,
3);
StaxUtils.copy(dr, new ByteArrayOutputStream());
}
-
+
@Test(expected = DepthExceededStaxException.class)
public void testInnerElementCountExceeded() throws Exception {
- XMLStreamReader reader =
+ XMLStreamReader reader =
StaxUtils.createXMLStreamReader(getClass().getResourceAsStream("./resources/amazon.xml"));
-
+
DepthRestrictingStreamReader dr = new DepthRestrictingStreamReader(reader,
- 7,
+ 7,
4,
3);
StaxUtils.copy(dr, new ByteArrayOutputStream());
}
-
+
@Test(expected = DepthExceededStaxException.class)
public void testInnerElementCountExceededComplex() throws Exception {
- XMLStreamReader reader =
+ XMLStreamReader reader =
StaxUtils.createXMLStreamReader(getClass().getResourceAsStream("./resources/wstrustReqSTRC.xml"));
-
+
DepthRestrictingStreamReader dr = new DepthRestrictingStreamReader(reader,
- -1,
+ -1,
7,
2);
StaxUtils.copy(dr, new ByteArrayOutputStream());
http://git-wip-us.apache.org/repos/asf/cxf/blob/8cea7c87/core/src/test/java/org/apache/cxf/staxutils/DepthXMLStreamReaderTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/cxf/staxutils/DepthXMLStreamReaderTest.java b/core/src/test/java/org/apache/cxf/staxutils/DepthXMLStreamReaderTest.java
index b3554bb..502b845 100644
--- a/core/src/test/java/org/apache/cxf/staxutils/DepthXMLStreamReaderTest.java
+++ b/core/src/test/java/org/apache/cxf/staxutils/DepthXMLStreamReaderTest.java
@@ -25,14 +25,14 @@ import org.junit.Assert;
import org.junit.Test;
public class DepthXMLStreamReaderTest extends Assert {
-
+
@Test
public void testReader() throws Exception {
- XMLStreamReader reader =
+ XMLStreamReader reader =
StaxUtils.createXMLStreamReader(getClass().getResourceAsStream("./resources/amazon.xml"));
-
+
DepthXMLStreamReader dr = new DepthXMLStreamReader(reader);
-
+
StaxUtils.toNextElement(dr);
assertEquals("ItemLookup", dr.getLocalName());
assertEquals(XMLStreamReader.START_ELEMENT, reader.getEventType());
@@ -54,7 +54,7 @@ public class DepthXMLStreamReaderTest extends Assert {
dr.next();
assertEquals("1E5AY4ZG53H4AMC8QH82", dr.getText());
-
+
dr.close();
}
}
http://git-wip-us.apache.org/repos/asf/cxf/blob/8cea7c87/core/src/test/java/org/apache/cxf/staxutils/FragmentStreamReaderTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/cxf/staxutils/FragmentStreamReaderTest.java b/core/src/test/java/org/apache/cxf/staxutils/FragmentStreamReaderTest.java
index 0d85779..cb0981f 100644
--- a/core/src/test/java/org/apache/cxf/staxutils/FragmentStreamReaderTest.java
+++ b/core/src/test/java/org/apache/cxf/staxutils/FragmentStreamReaderTest.java
@@ -30,30 +30,30 @@ public class FragmentStreamReaderTest extends Assert {
@Test
public void testReader() throws Exception {
- XMLStreamReader reader =
+ XMLStreamReader reader =
StaxUtils.createXMLStreamReader(getClass().getResourceAsStream("./resources/amazon.xml"));
-
+
DepthXMLStreamReader dr = new DepthXMLStreamReader(reader);
-
+
StaxUtils.toNextElement(dr);
assertEquals("ItemLookup", dr.getLocalName());
assertEquals(XMLStreamReader.START_ELEMENT, reader.getEventType());
-
+
FragmentStreamReader fsr = new FragmentStreamReader(dr);
assertTrue(fsr.hasNext());
-
+
assertEquals(XMLStreamReader.START_DOCUMENT, fsr.getEventType());
-
+
fsr.next();
assertEquals("ItemLookup", fsr.getLocalName());
assertEquals("ItemLookup", dr.getLocalName());
assertEquals(XMLStreamReader.START_ELEMENT, reader.getEventType());
-
+
fsr.close();
}
-
-
+
+
@Test
public void testEvents() throws Exception {
String test = "<foo><foo2/></foo>";
@@ -70,14 +70,14 @@ public class FragmentStreamReaderTest extends Assert {
reader = new FragmentStreamReader(reader, false);
assertEvents(reader, 7, 1, 1, 2, 2, 8);
-
+
//test a partial stream, skip over the startdoc even prior to creating
//the FragmentStreamReader to make sure the event could be generated
reader = StaxUtils.createXMLStreamReader(new StringReader(test));
reader.next();
reader = new FragmentStreamReader(reader);
assertEvents(reader, 7, 1, 1, 2, 2, 8);
-
+
reader = StaxUtils.createXMLStreamReader(new StringReader(test));
reader.next();
reader = new FragmentStreamReader(reader, true);
@@ -88,7 +88,7 @@ public class FragmentStreamReaderTest extends Assert {
reader = new FragmentStreamReader(reader, false);
assertEvents(reader, 1, 1, 2, 2);
}
-
+
private void assertEvents(XMLStreamReader reader, int initial, int ... events) throws Exception {
assertEquals(initial, reader.getEventType());
for (int x : events) {
http://git-wip-us.apache.org/repos/asf/cxf/blob/8cea7c87/core/src/test/java/org/apache/cxf/staxutils/PartialXMLStreamReaderTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/cxf/staxutils/PartialXMLStreamReaderTest.java b/core/src/test/java/org/apache/cxf/staxutils/PartialXMLStreamReaderTest.java
index 7415edf..b376eb4 100644
--- a/core/src/test/java/org/apache/cxf/staxutils/PartialXMLStreamReaderTest.java
+++ b/core/src/test/java/org/apache/cxf/staxutils/PartialXMLStreamReaderTest.java
@@ -34,8 +34,8 @@ public class PartialXMLStreamReaderTest extends Assert {
@Test
public void testReader() throws Exception {
- String test =
- "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">"
+ String test =
+ "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">"
+ "<soap:Header>"
+ "<ns2:SoapHeaderIn xmlns:ns4=\"http://cxf.apache.org/transform/fault\" "
+ "xmlns:ns3=\"http://cxf.apache.org/transform/header/element\" "
@@ -53,22 +53,22 @@ public class PartialXMLStreamReaderTest extends Assert {
+ "xmlns:ns3=\"http://cxf.apache.org/transform/header/element\" "
+ "xmlns:ns4=\"http://cxf.apache.org/transform/fault\" />"
+ "</soap:Body></soap:Envelope>";
-
- XMLStreamReader reader =
+
+ XMLStreamReader reader =
StaxUtils.createXMLStreamReader(new StringReader(test));
QName bodyTag = new QName("http://schemas.xmlsoap.org/soap/envelope/", "Body");
PartialXMLStreamReader filteredReader = new PartialXMLStreamReader(reader, bodyTag);
-
+
Document doc = StaxUtils.read(filteredReader);
-
+
assertNotNull(doc);
-
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
+
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
XMLStreamWriter writer = StaxUtils.createXMLStreamWriter(bos);
StaxUtils.copy(doc, writer);
writer.flush();
String value = bos.toString();
-
+
assertTrue(("<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">"
+ "<soap:Header>"
+ "<ns2:SoapHeaderIn xmlns=\"http://cxf.apache.org/transform/test\" "
@@ -82,7 +82,7 @@ public class PartialXMLStreamReaderTest extends Assert {
+ "<soap:Body/>"
+ "</soap:Envelope>").
equals(value.trim()));
-
+
}
}
http://git-wip-us.apache.org/repos/asf/cxf/blob/8cea7c87/core/src/test/java/org/apache/cxf/staxutils/PropertiesExpandingStreamReaderTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/cxf/staxutils/PropertiesExpandingStreamReaderTest.java b/core/src/test/java/org/apache/cxf/staxutils/PropertiesExpandingStreamReaderTest.java
index c975895..93eb19a 100644
--- a/core/src/test/java/org/apache/cxf/staxutils/PropertiesExpandingStreamReaderTest.java
+++ b/core/src/test/java/org/apache/cxf/staxutils/PropertiesExpandingStreamReaderTest.java
@@ -42,10 +42,10 @@ public class PropertiesExpandingStreamReaderTest extends Assert {
XMLStreamReader reader = new PropertiesExpandingStreamReader(
StaxUtils.createXMLStreamReader(getTestStream("./resources/sysprops.xml")), map);
Document doc = StaxUtils.read(reader);
- Element abc = DOMUtils.getChildrenWithName(doc.getDocumentElement(),
+ Element abc = DOMUtils.getChildrenWithName(doc.getDocumentElement(),
"http://foo/bar", "abc").iterator().next();
assertEquals("fooBAR-VALUEfoo", abc.getTextContent());
- Element def = DOMUtils.getChildrenWithName(doc.getDocumentElement(),
+ Element def = DOMUtils.getChildrenWithName(doc.getDocumentElement(),
"http://foo/bar", "def").iterator().next();
assertEquals("ggggg", def.getTextContent());
assertEquals("BLAH-VALUE2", def.getAttribute("myAttr"));
http://git-wip-us.apache.org/repos/asf/cxf/blob/8cea7c87/core/src/test/java/org/apache/cxf/staxutils/StaxStreamFilterTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/cxf/staxutils/StaxStreamFilterTest.java b/core/src/test/java/org/apache/cxf/staxutils/StaxStreamFilterTest.java
index ae5b2a3..47b83fc 100644
--- a/core/src/test/java/org/apache/cxf/staxutils/StaxStreamFilterTest.java
+++ b/core/src/test/java/org/apache/cxf/staxutils/StaxStreamFilterTest.java
@@ -29,9 +29,9 @@ import org.junit.Assert;
import org.junit.Test;
public class StaxStreamFilterTest extends Assert {
- public static final QName SOAP_ENV =
+ public static final QName SOAP_ENV =
new QName("http://schemas.xmlsoap.org/soap/envelope/", "Envelope");
- public static final QName SOAP_BODY =
+ public static final QName SOAP_BODY =
new QName("http://schemas.xmlsoap.org/soap/envelope/", "Body");
@Test
@@ -40,12 +40,12 @@ public class StaxStreamFilterTest extends Assert {
String soapMessage = "./resources/sayHiRpcLiteralReq.xml";
XMLStreamReader reader = StaxUtils.createXMLStreamReader(getTestStream(soapMessage));
reader = StaxUtils.createFilteredReader(reader, filter);
-
+
DepthXMLStreamReader dr = new DepthXMLStreamReader(reader);
StaxUtils.toNextElement(dr);
QName sayHi = new QName("http://apache.org/hello_world_rpclit", "sayHi");
-
+
assertEquals(sayHi, dr.getName());
}
@@ -55,7 +55,7 @@ public class StaxStreamFilterTest extends Assert {
String soapMessage = "./resources/greetMeRpcLitReq.xml";
XMLStreamReader reader = StaxUtils.createXMLStreamReader(getTestStream(soapMessage));
reader = StaxUtils.createFilteredReader(reader, filter);
-
+
DepthXMLStreamReader dr = new DepthXMLStreamReader(reader);
StaxUtils.toNextElement(dr);
@@ -72,16 +72,16 @@ public class StaxStreamFilterTest extends Assert {
StaxUtils.nextEvent(dr);
StaxUtils.toNextText(dr);
assertEquals("this is element 1", dr.getText());
-
+
StaxUtils.toNextElement(dr);
assertEquals(new QName("http://apache.org/hello_world_rpclit/types", "elem1"), dr.getName());
assertEquals(XMLStreamConstants.END_ELEMENT, dr.getEventType());
StaxUtils.nextEvent(dr);
StaxUtils.toNextElement(dr);
-
+
assertEquals(new QName("http://apache.org/hello_world_rpclit/types", "elem2"), dr.getName());
- }
+ }
private InputStream getTestStream(String file) {
return getClass().getResourceAsStream(file);
http://git-wip-us.apache.org/repos/asf/cxf/blob/8cea7c87/core/src/test/java/org/apache/cxf/staxutils/StaxUtilsTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/cxf/staxutils/StaxUtilsTest.java b/core/src/test/java/org/apache/cxf/staxutils/StaxUtilsTest.java
index eda6049..8ac46da 100644
--- a/core/src/test/java/org/apache/cxf/staxutils/StaxUtilsTest.java
+++ b/core/src/test/java/org/apache/cxf/staxutils/StaxUtilsTest.java
@@ -86,7 +86,7 @@ public class StaxUtilsTest extends Assert {
assertTrue(StaxUtils.toNextElement(reader));
assertEquals("Body", reader.getLocalName());
}
-
+
@Test
public void testToNextTag() throws Exception {
String soapMessage = "./resources/headerSoapReq.xml";
@@ -95,24 +95,24 @@ public class StaxUtilsTest extends Assert {
reader.nextTag();
StaxUtils.toNextTag(reader, new QName("http://schemas.xmlsoap.org/soap/envelope/", "Body"));
assertEquals("Body", reader.getLocalName());
- }
-
+ }
+
@Test
public void testCopy() throws Exception {
-
+
// do the stream copying
- String soapMessage = "./resources/headerSoapReq.xml";
+ String soapMessage = "./resources/headerSoapReq.xml";
ByteArrayOutputStream baos = new ByteArrayOutputStream();
XMLStreamReader reader = StaxUtils.createXMLStreamReader(getTestStream(soapMessage));
XMLStreamWriter writer = StaxUtils.createXMLStreamWriter(baos);
StaxUtils.copy(reader, writer);
writer.flush();
baos.flush();
-
+
// write output to a string
- String output = baos.toString();
+ String output = baos.toString();
baos.close();
-
+
// re-read the input xml doc to a string
InputStreamReader inputStreamReader = new InputStreamReader(getTestStream(soapMessage));
StringWriter stringWriter = new StringWriter();
@@ -130,14 +130,14 @@ public class StaxUtilsTest extends Assert {
input = input.substring(beginIndex);
beginIndex = output.indexOf("<soap:Envelope");
output = output.substring(beginIndex);
-
+
output = output.replaceAll("\r\n", "\n");
input = input.replaceAll("\r\n", "\n");
-
+
// compare the input and output string
assertEquals(input, output);
}
-
+
@Test
public void testCXF2468() throws Exception {
Document doc = DOMUtils.newDocument();
@@ -154,28 +154,28 @@ public class StaxUtilsTest extends Assert {
swriter.flush();
assertTrue("No xsi namespace: " + sw.toString(), sw.toString().contains("XMLSchema-instance"));
}
-
+
@Test
public void testNonNamespaceAwareParser() throws Exception {
String xml = "<blah xmlns=\"http://blah.org/\" xmlns:snarf=\"http://snarf.org\">"
+ "<foo snarf:blop=\"blop\">foo</foo></blah>";
-
+
StringReader reader = new StringReader(xml);
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(false);
dbf.setValidating(false);
Document doc = dbf.newDocumentBuilder().parse(new InputSource(reader));
Source source = new DOMSource(doc);
-
+
dbf.setNamespaceAware(true);
reader = new StringReader(xml);
Document docNs = dbf.newDocumentBuilder().parse(new InputSource(reader));
Source sourceNs = new DOMSource(docNs);
-
-
+
+
XMLStreamReader sreader = StaxUtils.createXMLStreamReader(source);
-
+
StringWriter sw = new StringWriter();
XMLStreamWriter swriter = StaxUtils.createXMLStreamWriter(sw);
@@ -183,14 +183,14 @@ public class StaxUtilsTest extends Assert {
StaxUtils.copy(sreader, swriter);
swriter.flush();
swriter.close();
-
+
String output = sw.toString();
- assertTrue(output.contains("blah"));
- assertTrue(output.contains("foo"));
- assertTrue(output.contains("snarf"));
- assertTrue(output.contains("blop"));
-
-
+ assertTrue(output.contains("blah"));
+ assertTrue(output.contains("foo"));
+ assertTrue(output.contains("snarf"));
+ assertTrue(output.contains("blop"));
+
+
sreader = StaxUtils.createXMLStreamReader(sourceNs);
sw = new StringWriter();
swriter = StaxUtils.createXMLStreamWriter(sw);
@@ -198,36 +198,36 @@ public class StaxUtilsTest extends Assert {
StaxUtils.copy(sreader, swriter);
swriter.flush();
swriter.close();
-
+
output = sw.toString();
- assertTrue(output.contains("blah"));
- assertTrue(output.contains("foo"));
- assertTrue(output.contains("snarf"));
- assertTrue(output.contains("blop"));
+ assertTrue(output.contains("blah"));
+ assertTrue(output.contains("foo"));
+ assertTrue(output.contains("snarf"));
+ assertTrue(output.contains("blop"));
+
-
sreader = StaxUtils.createXMLStreamReader(source);
-
+
ByteArrayOutputStream bout = new ByteArrayOutputStream();
swriter = StaxUtils.createXMLStreamWriter(bout);
- StaxUtils.copy(sreader, swriter);
+ StaxUtils.copy(sreader, swriter);
swriter.flush();
swriter.close();
-
+
output = bout.toString();
- assertTrue(output.contains("blah"));
- assertTrue(output.contains("foo"));
- assertTrue(output.contains("snarf"));
- assertTrue(output.contains("blop"));
+ assertTrue(output.contains("blah"));
+ assertTrue(output.contains("foo"));
+ assertTrue(output.contains("snarf"));
+ assertTrue(output.contains("blop"));
}
-
+
@Test
public void testEmptyNamespace() throws Exception {
String testString = "<ns1:a xmlns:ns1=\"http://www.apache.org/\"><s1 xmlns=\"\">"
+ "abc</s1><s2 xmlns=\"\">def</s2></ns1:a>";
-
+
cycleString(testString);
-
+
testString = "<a xmlns=\"http://www.apache.org/\"><s1 xmlns=\"\">"
+ "abc</s1><s2 xmlns=\"\">def</s2></a>";
cycleString(testString);
@@ -235,36 +235,36 @@ public class StaxUtilsTest extends Assert {
testString = "<a xmlns=\"http://www.apache.org/\"><s1 xmlns=\"\">"
+ "abc</s1><s2>def</s2></a>";
cycleString(testString);
-
+
testString = "<ns1:a xmlns:ns1=\"http://www.apache.org/\"><s1>"
+ "abc</s1><s2 xmlns=\"\">def</s2></ns1:a>";
-
+
cycleString(testString);
}
-
+
private void cycleString(String s) throws Exception {
StringReader reader = new StringReader(s);
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
Document doc = dbf.newDocumentBuilder().parse(new InputSource(reader));
String orig = StaxUtils.toString(doc.getDocumentElement());
-
+
StringWriter sw = new StringWriter();
XMLStreamWriter swriter = StaxUtils.createXMLStreamWriter(sw);
//should not throw an exception
StaxUtils.writeDocument(doc, swriter, false, true);
swriter.flush();
swriter.close();
-
+
String output = sw.toString();
assertEquals(s, output);
-
+
W3CDOMStreamWriter domwriter = new W3CDOMStreamWriter();
StaxUtils.writeDocument(doc, domwriter, false, true);
output = StaxUtils.toString(domwriter.getDocument().getDocumentElement());
assertEquals(orig, output);
}
-
+
@Test
public void testRootPI() throws Exception {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
@@ -279,7 +279,7 @@ public class StaxUtilsTest extends Assert {
assertTrue(output.contains("<?pi in='the sky'?>"));
assertTrue(output.contains("<?e excl='gads'?>"));
}
-
+
@Test
public void testRootPInoProlog() throws Exception {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
@@ -294,10 +294,10 @@ public class StaxUtilsTest extends Assert {
assertFalse(output.contains("<?pi in='the sky'?>"));
assertFalse(output.contains("<?e excl='gads'?>"));
}
-
+
@Test
public void testDefaultPrefix() throws Exception {
- String soapMessage = "./resources/AddRequest.xml";
+ String soapMessage = "./resources/AddRequest.xml";
ByteArrayOutputStream baos = new ByteArrayOutputStream();
XMLStreamReader reader = StaxUtils.createXMLStreamReader(getTestStream(soapMessage));
XMLStreamWriter writer = StaxUtils.createXMLStreamWriter(baos);
@@ -387,31 +387,31 @@ public class StaxUtilsTest extends Assert {
StaxUtils.writeEvent(event, xwriter);
}
xwriter.flush();
-
+
String s = swriter.toString();
int idx = s.indexOf("xmlns:a");
idx = s.indexOf("xmlns:a", idx + 1);
- assertEquals(-1, idx);
- }
-
+ assertEquals(-1, idx);
+ }
+
@Test
public void testCopyWithEmptyNamespace() throws Exception {
StringBuilder in = new StringBuilder();
in.append("<foo xmlns=\"http://example.com/\">");
in.append("<bar xmlns=\"\"/>");
in.append("</foo>");
-
+
XMLStreamReader reader = StaxUtils.createXMLStreamReader(
new ByteArrayInputStream(in.toString().getBytes()));
-
+
Writer out = new StringWriter();
XMLStreamWriter writer = StaxUtils.createXMLStreamWriter(out);
StaxUtils.copy(reader, writer);
writer.close();
-
+
assertEquals(in.toString(), out.toString());
}
-
+
@Test
public void testQName() throws Exception {
StringBuilder in = new StringBuilder();
@@ -423,7 +423,7 @@ public class StaxUtilsTest extends Assert {
XMLStreamReader reader = StaxUtils.createXMLStreamReader(
new ByteArrayInputStream(in.toString().getBytes()));
-
+
QName qname = new QName("http://example.com/", "Bar");
assertEquals(XMLStreamReader.START_ELEMENT, reader.next());
assertEquals(XMLStreamReader.START_ELEMENT, reader.next());
@@ -441,7 +441,7 @@ public class StaxUtilsTest extends Assert {
// ignore
}
}
-
+
@Test
public void testCopyFromTheMiddle() throws Exception {
String innerXml =
@@ -477,5 +477,5 @@ public class StaxUtilsTest extends Assert {
//System.out.println(innerXml);
//System.out.println(sw.toString());
assertEquals(innerXml, sw.toString());
- }
+ }
}
http://git-wip-us.apache.org/repos/asf/cxf/blob/8cea7c87/core/src/test/java/org/apache/cxf/staxutils/W3CDOMStreamReaderTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/cxf/staxutils/W3CDOMStreamReaderTest.java b/core/src/test/java/org/apache/cxf/staxutils/W3CDOMStreamReaderTest.java
index 40b0be4..41af065 100644
--- a/core/src/test/java/org/apache/cxf/staxutils/W3CDOMStreamReaderTest.java
+++ b/core/src/test/java/org/apache/cxf/staxutils/W3CDOMStreamReaderTest.java
@@ -39,8 +39,8 @@ import org.junit.Test;
public class W3CDOMStreamReaderTest extends Assert {
-
- private static final String RESULT =
+
+ private static final String RESULT =
"<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\">"
+ "<SOAP-ENV:Header/><SOAP-ENV:Body/>"
+ "<Test xmlns=\"http://example.org/types\">"
@@ -69,7 +69,7 @@ public class W3CDOMStreamReaderTest extends Assert {
assertTrue(StaxUtils.toString(writer.getDocument()).endsWith(RESULT));
}
-
+
@Test
public void testTopLevelText() throws Exception {
ByteArrayInputStream is = new ByteArrayInputStream(
http://git-wip-us.apache.org/repos/asf/cxf/blob/8cea7c87/core/src/test/java/org/apache/cxf/staxutils/transform/DelegatingNamespaceContextTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/cxf/staxutils/transform/DelegatingNamespaceContextTest.java b/core/src/test/java/org/apache/cxf/staxutils/transform/DelegatingNamespaceContextTest.java
index 52b3ebe..dd477fb 100644
--- a/core/src/test/java/org/apache/cxf/staxutils/transform/DelegatingNamespaceContextTest.java
+++ b/core/src/test/java/org/apache/cxf/staxutils/transform/DelegatingNamespaceContextTest.java
@@ -33,7 +33,7 @@ public class DelegatingNamespaceContextTest extends Assert {
@Test
public void testSomeAddsAndGets() throws Exception {
DelegatingNamespaceContext dnc = getTestDelegatingNamespaceContext();
-
+
dnc.down(); //1
dnc.addPrefix("p1", "urn:foo1");
dnc.addPrefix("p2", "urn:foo2");
@@ -45,7 +45,7 @@ public class DelegatingNamespaceContextTest extends Assert {
assertEquals("p2", dnc.getPrefix("urn:foo2"));
verifyPrefixes(dnc.getPrefixes("urn:foo1"), new String[]{"p1"});
verifyPrefixes(dnc.getPrefixes("urn:foo2"), new String[]{"p2"});
-
+
dnc.down(); //2
dnc.addPrefix("p11", "urn:foo1");
dnc.addPrefix("p2", "urn:foo22");
@@ -81,9 +81,9 @@ public class DelegatingNamespaceContextTest extends Assert {
verifyPrefixes(dnc.getPrefixes("urn:foo1"), new String[]{"p1"});
verifyPrefixes(dnc.getPrefixes("urn:foo2"), new String[]{"p2"});
verifyPrefixes(dnc.getPrefixes("urn:foo3"), new String[]{});
-
+
dnc.up(); //0
-
+
try {
dnc.up(); //-1
fail("not allowed to go up");
@@ -95,7 +95,7 @@ public class DelegatingNamespaceContextTest extends Assert {
@Test
public void testSomeAddsWithDuplicatedPrefixName() throws Exception {
DelegatingNamespaceContext dnc = getTestDelegatingNamespaceContext();
-
+
dnc.down(); // 1
dnc.addPrefix("p00", "urn:foo0");
dnc.addPrefix("p1", "urn:foo1");
@@ -143,6 +143,6 @@ public class DelegatingNamespaceContextTest extends Assert {
}
assertTrue(tmp.isEmpty());
}
-
-
+
+
}
http://git-wip-us.apache.org/repos/asf/cxf/blob/8cea7c87/core/src/test/java/org/apache/cxf/staxutils/transform/InTransformReaderTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/cxf/staxutils/transform/InTransformReaderTest.java b/core/src/test/java/org/apache/cxf/staxutils/transform/InTransformReaderTest.java
index f1022d5..191e02f 100644
--- a/core/src/test/java/org/apache/cxf/staxutils/transform/InTransformReaderTest.java
+++ b/core/src/test/java/org/apache/cxf/staxutils/transform/InTransformReaderTest.java
@@ -42,220 +42,220 @@ public class InTransformReaderTest extends Assert {
public void testReadWithDefaultNamespace() throws Exception {
InputStream is = new ByteArrayInputStream("<test xmlns=\"http://bar\"/>".getBytes());
XMLStreamReader reader = StaxUtils.createXMLStreamReader(is);
- reader = new InTransformReader(reader,
+ reader = new InTransformReader(reader,
Collections.singletonMap("{http://bar}test", "test2"),
null, null, null, false);
-
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
+
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
StaxUtils.copy(reader, bos);
String value = bos.toString();
- assertTrue("<test2 xmlns=\"\"/>".equals(value));
+ assertTrue("<test2 xmlns=\"\"/>".equals(value));
}
-
+
@Test
public void testReplaceSimpleElement() throws Exception {
InputStream is = new ByteArrayInputStream(
"<ns:test xmlns:ns=\"http://bar\"><ns:a>1</ns:a></ns:test>".getBytes());
XMLStreamReader reader = StaxUtils.createXMLStreamReader(is);
- reader = new InTransformReader(reader,
+ reader = new InTransformReader(reader,
null,
Collections.singletonMap("{http://bar}a", "{http://bar}a=1 2 3"),
- null,
+ null,
null, false);
-
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
+
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
StaxUtils.copy(reader, bos);
String value = bos.toString();
- assertEquals("<ns:test xmlns:ns=\"http://bar\"><ns:a>1 2 3</ns:a></ns:test>", value);
+ assertEquals("<ns:test xmlns:ns=\"http://bar\"><ns:a>1 2 3</ns:a></ns:test>", value);
}
-
+
@Test
public void testTransformAndReplaceSimpleElement() throws Exception {
InputStream is = new ByteArrayInputStream(
"<ns:test xmlns:ns=\"http://bar\"><ns:a>1</ns:a></ns:test>".getBytes());
XMLStreamReader reader = StaxUtils.createXMLStreamReader(is);
- reader = new InTransformReader(reader,
+ reader = new InTransformReader(reader,
Collections.singletonMap("{http://bar}*", "{http://foo}*"),
Collections.singletonMap("{http://bar}a", "{http://bar}a=1 2 3"),
- null,
+ null,
null, false);
-
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
+
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
StaxUtils.copy(reader, bos);
String value = bos.toString();
assertEquals(
- "<ns:test xmlns:ns=\"http://foo\"><ns:a>1 2 3</ns:a></ns:test>", value);
+ "<ns:test xmlns:ns=\"http://foo\"><ns:a>1 2 3</ns:a></ns:test>", value);
}
-
+
@Test
public void testReadWithParentDefaultNamespace() throws Exception {
InputStream is = new ByteArrayInputStream(
"<test xmlns=\"http://bar\"><ns:subtest xmlns:ns=\"http://bar1\"/></test>".getBytes());
XMLStreamReader reader = StaxUtils.createXMLStreamReader(is);
- reader = new InTransformReader(reader,
- Collections.singletonMap("{http://bar1}subtest", "subtest"),
+ reader = new InTransformReader(reader,
+ Collections.singletonMap("{http://bar1}subtest", "subtest"),
null, null, null, false);
-
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
+
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
StaxUtils.copy(reader, bos);
String value = bos.toString();
assertEquals("<test xmlns=\"http://bar\"><subtest xmlns=\"\"/></test>",
- value);
+ value);
}
-
+
// additional test cases
@Test
public void testReadWithComplexRequestSameNamespace() throws Exception {
- XMLStreamReader reader =
+ XMLStreamReader reader =
StaxUtils.createXMLStreamReader(
- InTransformReader.class.getResourceAsStream("../resources/complexReqIn1.xml"));
+ InTransformReader.class.getResourceAsStream("../resources/complexReqIn1.xml"));
Map<String, String> inMap = new HashMap<String, String>();
- inMap.put("{http://cxf.apache.org/transform/header/element}*",
+ inMap.put("{http://cxf.apache.org/transform/header/element}*",
"{http://cxf.apache.org/transform/header/element}*");
-
- reader = new InTransformReader(reader,
+
+ reader = new InTransformReader(reader,
inMap, null, null,
null, false);
-
- XMLStreamReader reader2 =
+
+ XMLStreamReader reader2 =
StaxUtils.createXMLStreamReader(
InTransformReader.class.getResourceAsStream("../resources/complexReq1.xml"));
TransformTestUtils.verifyReaders(reader2, reader, true, true);
}
-
+
@Test
public void testReadWithComplexRequestMultipleNamespace() throws Exception {
- XMLStreamReader reader =
+ XMLStreamReader reader =
StaxUtils.createXMLStreamReader(
- InTransformReader.class.getResourceAsStream("../resources/complexReqIn2.xml"));
-
+ InTransformReader.class.getResourceAsStream("../resources/complexReqIn2.xml"));
+
Map<String, String> inMap = new HashMap<String, String>();
- inMap.put("{http://cxf.apache.org/transform/header/element}*",
+ inMap.put("{http://cxf.apache.org/transform/header/element}*",
"{http://cxf.apache.org/transform/header/otherelement}*");
- inMap.put("{http://cxf.apache.org/transform/test}*",
+ inMap.put("{http://cxf.apache.org/transform/test}*",
"{http://cxf.apache.org/transform/othertest}*");
-
- reader = new InTransformReader(reader,
+
+ reader = new InTransformReader(reader,
inMap, null, null,
null, false);
-
- XMLStreamReader reader2 =
+
+ XMLStreamReader reader2 =
StaxUtils.createXMLStreamReader(
- InTransformReader.class.getResourceAsStream("../resources/complexReq2.xml"));
+ InTransformReader.class.getResourceAsStream("../resources/complexReq2.xml"));
TransformTestUtils.verifyReaders(reader2, reader, true, true);
}
-
+
@Test
public void testReadWithComplexTransformationNamespace() throws Exception {
- XMLStreamReader reader =
+ XMLStreamReader reader =
StaxUtils.createXMLStreamReader(
- InTransformReader.class.getResourceAsStream("../resources/complexReqIn3.xml"));
-
+ InTransformReader.class.getResourceAsStream("../resources/complexReqIn3.xml"));
+
Map<String, String> inMap = new HashMap<String, String>();
- inMap.put("{http://cxf.apache.org/transform/header/element}*",
+ inMap.put("{http://cxf.apache.org/transform/header/element}*",
"{http://cxf.apache.org/transform/header/otherelement}*");
- inMap.put("{http://cxf.apache.org/transform/test}*",
+ inMap.put("{http://cxf.apache.org/transform/test}*",
"{http://cxf.apache.org/transform/othertest}*");
- inMap.put("{http://schemas.xmlsoap.org/soap/envelope/}Envelope",
+ inMap.put("{http://schemas.xmlsoap.org/soap/envelope/}Envelope",
"{http://schemas.xmlsoap.org/soap/envelope/}TheEnvelope");
-
+
// set the block original reader flag to true
- reader = new InTransformReader(reader,
+ reader = new InTransformReader(reader,
inMap, null, null,
null, true);
- XMLStreamReader reader2 =
+ XMLStreamReader reader2 =
StaxUtils.createXMLStreamReader(
- InTransformReader.class.getResourceAsStream("../resources/complexReq3.xml"));
+ InTransformReader.class.getResourceAsStream("../resources/complexReq3.xml"));
TransformTestUtils.verifyReaders(reader2, reader, true, true);
}
@Test
public void testReadPartialWithComplexRequestSameNamespace() throws Exception {
- XMLStreamReader reader =
+ XMLStreamReader reader =
StaxUtils.createXMLStreamReader(
- InTransformReader.class.getResourceAsStream("../resources/complexReqIn1.xml"));
+ InTransformReader.class.getResourceAsStream("../resources/complexReqIn1.xml"));
Map<String, String> inMap = new HashMap<String, String>();
- inMap.put("{http://cxf.apache.org/transform/header/element}*",
+ inMap.put("{http://cxf.apache.org/transform/header/element}*",
"{http://cxf.apache.org/transform/header/element}*");
-
- reader = new InTransformReader(reader,
+
+ reader = new InTransformReader(reader,
inMap, null, null,
null, false);
-
+
QName bodyTag = new QName("http://schemas.xmlsoap.org/soap/envelope/", "Body");
PartialXMLStreamReader filteredReader = new PartialXMLStreamReader(reader, bodyTag);
-
- XMLStreamReader reader2 =
+
+ XMLStreamReader reader2 =
StaxUtils.createXMLStreamReader(
- InTransformReader.class.getResourceAsStream("../resources/complexReq1partial.xml"));
+ InTransformReader.class.getResourceAsStream("../resources/complexReq1partial.xml"));
TransformTestUtils.verifyReaders(reader2, filteredReader, false, true);
}
-
+
@Test
public void testPartialReadWithComplexRequestMultipleNamespace() throws Exception {
- XMLStreamReader reader =
+ XMLStreamReader reader =
StaxUtils.createXMLStreamReader(
- InTransformReader.class.getResourceAsStream("../resources/complexReqIn2.xml"));
-
+ InTransformReader.class.getResourceAsStream("../resources/complexReqIn2.xml"));
+
Map<String, String> inMap = new HashMap<String, String>();
- inMap.put("{http://cxf.apache.org/transform/header/element}*",
+ inMap.put("{http://cxf.apache.org/transform/header/element}*",
"{http://cxf.apache.org/transform/header/otherelement}*");
- inMap.put("{http://cxf.apache.org/transform/test}*",
+ inMap.put("{http://cxf.apache.org/transform/test}*",
"{http://cxf.apache.org/transform/othertest}*");
-
- reader = new InTransformReader(reader,
+
+ reader = new InTransformReader(reader,
inMap, null, null,
null, false);
-
+
QName bodyTag = new QName("http://schemas.xmlsoap.org/soap/envelope/", "Body");
PartialXMLStreamReader filteredReader = new PartialXMLStreamReader(reader, bodyTag);
-
- XMLStreamReader reader2 =
+
+ XMLStreamReader reader2 =
StaxUtils.createXMLStreamReader(
- InTransformReader.class.getResourceAsStream("../resources/complexReq2partial.xml"));
+ InTransformReader.class.getResourceAsStream("../resources/complexReq2partial.xml"));
TransformTestUtils.verifyReaders(reader2, filteredReader, false, true);
}
-
+
@Test
public void testPartialReadWithComplexTransformationNamespace() throws Exception {
- XMLStreamReader reader =
+ XMLStreamReader reader =
StaxUtils.createXMLStreamReader(
- InTransformReader.class.getResourceAsStream("../resources/complexReqIn3.xml"));
-
+ InTransformReader.class.getResourceAsStream("../resources/complexReqIn3.xml"));
+
Map<String, String> inMap = new HashMap<String, String>();
- inMap.put("{http://cxf.apache.org/transform/header/element}*",
+ inMap.put("{http://cxf.apache.org/transform/header/element}*",
"{http://cxf.apache.org/transform/header/otherelement}*");
- inMap.put("{http://cxf.apache.org/transform/test}*",
+ inMap.put("{http://cxf.apache.org/transform/test}*",
"{http://cxf.apache.org/transform/othertest}*");
- inMap.put("{http://schemas.xmlsoap.org/soap/envelope/}Envelope",
+ inMap.put("{http://schemas.xmlsoap.org/soap/envelope/}Envelope",
"{http://schemas.xmlsoap.org/soap/envelope/}TheEnvelope");
-
+
// set the block original reader flag to true
- reader = new InTransformReader(reader,
+ reader = new InTransformReader(reader,
inMap, null, null,
null, true);
-
+
QName bodyTag = new QName("http://schemas.xmlsoap.org/soap/envelope/", "Body");
PartialXMLStreamReader filteredReader = new PartialXMLStreamReader(reader, bodyTag);
-
- XMLStreamReader reader2 =
+
+ XMLStreamReader reader2 =
StaxUtils.createXMLStreamReader(
- InTransformReader.class.getResourceAsStream("../resources/complexReq3partial.xml"));
+ InTransformReader.class.getResourceAsStream("../resources/complexReq3partial.xml"));
TransformTestUtils.verifyReaders(reader2, filteredReader, false, true);
}
-
-
+
+
@Test
public void testReadWithReplaceAppend() throws Exception {
Map<String, String> transformElements = new HashMap<String, String>();
transformElements.put("requestValue",
"{http://cxf.apache.org/hello_world_soap_http/types}requestType");
-
+
Map<String, String> appendElements = new HashMap<String, String>();
appendElements.put("requestValue",
"{http://cxf.apache.org/hello_world_soap_http/types}greetMe");
- TransformTestUtils.transformInStreamAndCompare("../resources/greetMeReqIn1.xml",
+ TransformTestUtils.transformInStreamAndCompare("../resources/greetMeReqIn1.xml",
"../resources/greetMeReq.xml",
transformElements, appendElements, null, null, null);
}
@@ -267,21 +267,21 @@ public class InTransformReaderTest extends Assert {
"{http://cxf.apache.org/hello_world_soap_http/types}requestType");
transformElements.put("{http://cxf.apache.org/hello_world_soap_http/types}requestDate",
"");
-
+
Map<String, String> appendElements = new HashMap<String, String>();
appendElements.put("requestValue",
"{http://cxf.apache.org/hello_world_soap_http/types}greetMe");
-
+
List<String> dropElements = new ArrayList<>();
dropElements.add("value");
-
+
Map<String, String> transformAttributes = new HashMap<String, String>();
transformAttributes.put("num", "");
transformAttributes.put("nombre", "{http://cxf.apache.org/hello_world_soap_http/types}name");
-
- TransformTestUtils.transformInStreamAndCompare("../resources/greetMeReqIn2.xml",
+
+ TransformTestUtils.transformInStreamAndCompare("../resources/greetMeReqIn2.xml",
"../resources/greetMeReq.xml",
- transformElements, appendElements, dropElements,
+ transformElements, appendElements, dropElements,
transformAttributes, null);
}
@@ -291,7 +291,7 @@ public class InTransformReaderTest extends Assert {
transformElements.put("*",
"{http://cxf.apache.org/hello_world_soap_http/types}*");
- TransformTestUtils.transformInStreamAndCompare("../resources/greetMeReqIn3.xml",
+ TransformTestUtils.transformInStreamAndCompare("../resources/greetMeReqIn3.xml",
"../resources/greetMeReq.xml",
transformElements, null, null, null, null);
}
@@ -302,20 +302,20 @@ public class InTransformReaderTest extends Assert {
transformAttributes.put("{http://www.w3.org/2001/XMLSchema-instance}type",
"");
- TransformTestUtils.transformInStreamAndCompare("../resources/greetMeReqIn4.xml",
+ TransformTestUtils.transformInStreamAndCompare("../resources/greetMeReqIn4.xml",
"../resources/greetMeReq.xml",
null, null, null, transformAttributes, null);
}
-
+
@Test
public void testReadWithAppendPreInclude1() throws Exception {
Map<String, String> appendElements = new HashMap<String, String>();
appendElements.put("{http://xml.amazon.com/AWSECommerceService/2004-08-01}ItemId",
"{http://xml.amazon.com/AWSECommerceService/2004-08-01}IdType=ASIN");
- TransformTestUtils.transformInStreamAndCompare("../resources/amazonIn1.xml",
+ TransformTestUtils.transformInStreamAndCompare("../resources/amazonIn1.xml",
"../resources/amazon.xml",
null, appendElements, null, null, null);
-
+
}
@Test
@@ -323,10 +323,10 @@ public class InTransformReaderTest extends Assert {
Map<String, String> appendElements = new HashMap<String, String>();
appendElements.put("{http://xml.amazon.com/AWSECommerceService/2004-08-01}ItemId",
"{http://xml.amazon.com/AWSECommerceService/2004-08-01}IdType=ASIN");
- TransformTestUtils.transformInStreamAndCompare("../resources/amazonIn1nospace.xml",
+ TransformTestUtils.transformInStreamAndCompare("../resources/amazonIn1nospace.xml",
"../resources/amazon.xml",
null, appendElements, null, null, null);
-
+
}
@Test
@@ -337,7 +337,7 @@ public class InTransformReaderTest extends Assert {
Map<String, String> appendElements = new HashMap<String, String>();
appendElements.put("{http://apache.org/cxf/calculator/types}add",
"{http://www.w3.org/2003/05/soap-envelope}Body");
- TransformTestUtils.transformInStreamAndCompare("../resources/AddRequestIn2.xml",
+ TransformTestUtils.transformInStreamAndCompare("../resources/AddRequestIn2.xml",
"../resources/AddRequest2.xml",
transformElements, appendElements, null, null, null);
}
@@ -350,7 +350,7 @@ public class InTransformReaderTest extends Assert {
Map<String, String> appendElements = new HashMap<String, String>();
appendElements.put("{http://apache.org/cxf/calculator/types}add",
"{http://www.w3.org/2003/05/soap-envelope}Body");
- TransformTestUtils.transformInStreamAndCompare("../resources/AddRequestIn2nospace.xml",
+ TransformTestUtils.transformInStreamAndCompare("../resources/AddRequestIn2nospace.xml",
"../resources/AddRequest2.xml",
transformElements, appendElements, null, null, null);
}
@@ -360,10 +360,10 @@ public class InTransformReaderTest extends Assert {
Map<String, String> appendElements = new HashMap<String, String>();
appendElements.put("{http://xml.amazon.com/AWSECommerceService/2004-08-01}Request/",
"{http://xml.amazon.com/AWSECommerceService/2004-08-01}ItemId=0486411214");
- TransformTestUtils.transformInStreamAndCompare("../resources/amazonIn2.xml",
+ TransformTestUtils.transformInStreamAndCompare("../resources/amazonIn2.xml",
"../resources/amazon.xml",
null, appendElements, null, null, null);
-
+
}
@Test
@@ -371,10 +371,10 @@ public class InTransformReaderTest extends Assert {
Map<String, String> appendElements = new HashMap<String, String>();
appendElements.put("{http://xml.amazon.com/AWSECommerceService/2004-08-01}Request/",
"{http://xml.amazon.com/AWSECommerceService/2004-08-01}ItemId=0486411214");
- TransformTestUtils.transformInStreamAndCompare("../resources/amazonIn2nospace.xml",
+ TransformTestUtils.transformInStreamAndCompare("../resources/amazonIn2nospace.xml",
"../resources/amazon.xml",
null, appendElements, null, null, null);
-
+
}
@Test
@@ -382,10 +382,10 @@ public class InTransformReaderTest extends Assert {
Map<String, String> appendElements = new HashMap<String, String>();
appendElements.put("{http://www.w3.org/2003/05/soap-envelope}Body/",
"{http://apache.org/cxf/calculator/types}add");
- TransformTestUtils.transformInStreamAndCompare("../resources/AddRequestIn1.xml",
+ TransformTestUtils.transformInStreamAndCompare("../resources/AddRequestIn1.xml",
"../resources/AddRequest.xml",
null, appendElements, null, null, null);
-
+
}
@Test
@@ -393,10 +393,10 @@ public class InTransformReaderTest extends Assert {
Map<String, String> appendElements = new HashMap<String, String>();
appendElements.put("{http://www.w3.org/2003/05/soap-envelope}Body/",
"{http://apache.org/cxf/calculator/types}add");
- TransformTestUtils.transformInStreamAndCompare("../resources/AddRequestIn1nospace.xml",
+ TransformTestUtils.transformInStreamAndCompare("../resources/AddRequestIn1nospace.xml",
"../resources/AddRequest.xml",
null, appendElements, null, null, null);
-
+
}
@Test
@@ -418,10 +418,10 @@ public class InTransformReaderTest extends Assert {
List<String> dropElements = new ArrayList<>();
dropElements.add("param");
- TransformTestUtils.transformInStreamAndCompare("../resources/AddRequestIn3.xml",
+ TransformTestUtils.transformInStreamAndCompare("../resources/AddRequestIn3.xml",
"../resources/AddRequest3.xml",
transformElements, appendElements, dropElements, null, null);
-
+
}
@Test
@@ -430,12 +430,12 @@ public class InTransformReaderTest extends Assert {
transformElements.put("{http://docs.oasis-open.org/ws-sx/ws-trust/200512}*",
"{http://schemas.xmlsoap.org/ws/2005/02/trust}*");
-
- TransformTestUtils.transformInStreamAndCompare("../resources/wstrustReqSTRCIn1.xml",
+
+ TransformTestUtils.transformInStreamAndCompare("../resources/wstrustReqSTRCIn1.xml",
"../resources/wstrustReqSTRC.xml",
transformElements, null, null, null, null);
-
+
}
@Test
@@ -444,7 +444,7 @@ public class InTransformReaderTest extends Assert {
transformElements.put("{urn:abc}*",
"{urn:a}*");
- TransformTestUtils.transformInStreamAndCompare("../resources/multiNSIn1.xml",
+ TransformTestUtils.transformInStreamAndCompare("../resources/multiNSIn1.xml",
"../resources/multiNS.xml",
transformElements, null, null, null, null);
}
@@ -454,10 +454,10 @@ public class InTransformReaderTest extends Assert {
Map<String, String> transformElements = new HashMap<String, String>();
transformElements.put("{http://bar.com/foo}*",
"{http://bar.com/foobar}*");
- TransformTestUtils.transformInStreamAndCompare("../resources/multiNS2In1.xml",
+ TransformTestUtils.transformInStreamAndCompare("../resources/multiNS2In1.xml",
"../resources/multiNS2.xml",
transformElements, null, null, null, null);
-
+
}
}