You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2014/04/02 08:26:14 UTC
[18/21] git commit: Cleanup some tests
Cleanup some tests
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/d504ce8a
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/d504ce8a
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/d504ce8a
Branch: refs/heads/2.7.x-fixes
Commit: d504ce8a300ab15d4dc768a12a2cb73d8e7507b7
Parents: 881ef57
Author: Daniel Kulp <dk...@apache.org>
Authored: Mon Mar 31 15:42:13 2014 -0400
Committer: Daniel Kulp <dk...@apache.org>
Committed: Wed Apr 2 02:18:15 2014 -0400
----------------------------------------------------------------------
.../systest/exception/GenericExceptionTest.java | 31 +++++++++++++-------
.../mtom_bindingtype/MTOMBindingTypeTest.java | 5 ++--
2 files changed, 23 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cxf/blob/d504ce8a/systests/uncategorized/src/test/java/org/apache/cxf/systest/exception/GenericExceptionTest.java
----------------------------------------------------------------------
diff --git a/systests/uncategorized/src/test/java/org/apache/cxf/systest/exception/GenericExceptionTest.java b/systests/uncategorized/src/test/java/org/apache/cxf/systest/exception/GenericExceptionTest.java
index aa38573..f90f76d 100644
--- a/systests/uncategorized/src/test/java/org/apache/cxf/systest/exception/GenericExceptionTest.java
+++ b/systests/uncategorized/src/test/java/org/apache/cxf/systest/exception/GenericExceptionTest.java
@@ -21,12 +21,18 @@ package org.apache.cxf.systest.exception;
import java.io.InputStream;
import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import javax.xml.ws.soap.SOAPBinding;
-import org.apache.cxf.helpers.IOUtils;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+
+import org.apache.cxf.helpers.XPathUtils;
+import org.apache.cxf.staxutils.StaxUtils;
import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
import org.junit.BeforeClass;
@@ -48,17 +54,20 @@ public class GenericExceptionTest extends AbstractBusClientServerTestBase {
URL wsdlURL = new URL(address + "?wsdl");
//check wsdl element
InputStream ins = wsdlURL.openStream();
- String wsdlContent = IOUtils.toString(ins).replaceAll(" ", " ");
-
- int objIndex = wsdlContent
- .indexOf("type=\"tns:objectWithGenerics\"/>");
- int aIndex = wsdlContent.indexOf("name=\"a\" type=\"xs:anyType\"/>");
- int bIndex = wsdlContent.indexOf("name=\"b\" type=\"xs:anyType\"/>");
-
- assertTrue(objIndex > -1);
- assertTrue(aIndex > -1);
- assertTrue(bIndex > -1);
+ Document doc = StaxUtils.read(ins);
+
+ Map<String, String> ns = new HashMap<String, String>();
+ ns.put("xsd", "http://www.w3.org/2001/XMLSchema");
+ ns.put("wsdl", "http://schemas.xmlsoap.org/wsdl/");
+ ns.put("tns", "http://cxf.apache.org/test/HelloService");
+ XPathUtils xpu = new XPathUtils(ns);
+
+
+ Node nd = xpu.getValueNode("//xsd:complexType[@name='objectWithGenerics']", doc);
+ assertNotNull(nd);
+ assertNotNull(xpu.getValueNode("//xsd:element[@name='a']", nd));
+ assertNotNull(xpu.getValueNode("//xsd:element[@name='b']", nd));
Service service = Service.create(wsdlURL, serviceName);
service.addPort(new QName("http://cxf.apache.org/test/HelloService", "HelloPort"),
http://git-wip-us.apache.org/repos/asf/cxf/blob/d504ce8a/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_bindingtype/MTOMBindingTypeTest.java
----------------------------------------------------------------------
diff --git a/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_bindingtype/MTOMBindingTypeTest.java b/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_bindingtype/MTOMBindingTypeTest.java
index 6022eef..f50919e 100644
--- a/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_bindingtype/MTOMBindingTypeTest.java
+++ b/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_bindingtype/MTOMBindingTypeTest.java
@@ -23,18 +23,19 @@ import java.awt.Image;
import java.io.ByteArrayOutputStream;
import java.io.PrintWriter;
import java.net.URL;
+
import javax.imageio.ImageIO;
import javax.xml.namespace.QName;
import javax.xml.ws.BindingProvider;
import javax.xml.ws.Holder;
import javax.xml.ws.soap.SOAPBinding;
-
import org.apache.cxf.interceptor.LoggingInInterceptor;
import org.apache.cxf.interceptor.LoggingOutInterceptor;
import org.apache.cxf.systest.mtom_feature.Hello;
import org.apache.cxf.systest.mtom_feature.HelloService;
import org.apache.cxf.systest.mtom_feature.ImageHelper;
import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
+
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -90,7 +91,7 @@ public class MTOMBindingTypeTest extends AbstractBusClientServerTestBase {
port.detail(photo, image);
- String expected = "<xop:Include xmlns:xop=";
+ String expected = "<xop:Include ";
assertTrue(output.toString().indexOf(expected) != -1);
assertTrue(input.toString().indexOf(expected) != -1);