Return-Path: X-Original-To: apmail-cxf-commits-archive@www.apache.org Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5773810577 for ; Fri, 4 Apr 2014 15:02:31 +0000 (UTC) Received: (qmail 71446 invoked by uid 500); 4 Apr 2014 15:01:58 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 71048 invoked by uid 500); 4 Apr 2014 15:01:47 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 70615 invoked by uid 99); 4 Apr 2014 15:01:38 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 Apr 2014 15:01:38 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 3FEC694A9CD; Fri, 4 Apr 2014 15:01:37 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: dkulp@apache.org To: commits@cxf.apache.org Date: Fri, 04 Apr 2014 15:01:42 -0000 Message-Id: <6a36ee97be3e4b13a7132f241c13ccbe@git.apache.org> In-Reply-To: <00536f2213b14ce7a6093b285eae532d@git.apache.org> References: <00536f2213b14ce7a6093b285eae532d@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [06/16] git commit: Updates to get some of the tests passed with the Moxy profile Updates to get some of the tests passed with the Moxy profile Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/b8eb4c06 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/b8eb4c06 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/b8eb4c06 Branch: refs/heads/2.7.x-fixes Commit: b8eb4c0667056920e700d90c421beb0d0fdde6e3 Parents: 0940d45 Author: Sergey Beryozkin Authored: Fri Mar 28 17:46:11 2014 +0000 Committer: Daniel Kulp Committed: Fri Apr 4 09:57:40 2014 -0400 ---------------------------------------------------------------------- .../jaxrs/JAXRSClientServerBookTest.java | 21 ++++++++++++++------ .../jaxrs/JAXRSClientServerSpringBookTest.java | 14 +++++++++++-- 2 files changed, 27 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/b8eb4c06/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java ---------------------------------------------------------------------- diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java index 8990b06..b0575bf 100644 --- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java +++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java @@ -2053,7 +2053,8 @@ public class JAXRSClientServerBookTest extends AbstractBusClientServerTestBase { InputStream expected = getClass().getResourceAsStream("resources/expected_add_book.txt"); - assertEquals(getStringFromInputStream(expected), post.getResponseBodyAsString()); + assertEquals(stripXmlInstructionIfNeeded(getStringFromInputStream(expected)), + stripXmlInstructionIfNeeded(post.getResponseBodyAsString())); } finally { // Release current connection to the connection pool once you are done post.releaseConnection(); @@ -2087,8 +2088,8 @@ public class JAXRSClientServerBookTest extends AbstractBusClientServerTestBase { int result = httpclient.executeMethod(put); assertEquals(200, result); InputStream expected = getClass().getResourceAsStream("resources/expected_update_book.txt"); - assertEquals(getStringFromInputStream(expected), - getStringFromInputStream(put.getResponseBodyAsStream())); + assertEquals(stripXmlInstructionIfNeeded(getStringFromInputStream(expected)), + stripXmlInstructionIfNeeded(getStringFromInputStream(put.getResponseBodyAsStream()))); } finally { // Release current connection to the connection pool once you are // done @@ -2135,8 +2136,8 @@ public class JAXRSClientServerBookTest extends AbstractBusClientServerTestBase { int result = httpclient.executeMethod(put); assertEquals(200, result); InputStream expected = getClass().getResourceAsStream("resources/expected_update_book.txt"); - assertEquals(getStringFromInputStream(expected), - getStringFromInputStream(put.getResponseBodyAsStream())); + assertEquals(stripXmlInstructionIfNeeded(getStringFromInputStream(expected)), + stripXmlInstructionIfNeeded(getStringFromInputStream(put.getResponseBodyAsStream()))); } finally { // Release current connection to the connection pool once you are // done @@ -2463,7 +2464,7 @@ public class JAXRSClientServerBookTest extends AbstractBusClientServerTestBase { assertEquals(expectedStatus, result); String content = getStringFromInputStream(get.getResponseBodyAsStream()); assertEquals("Expected value is wrong", - expectedValue, content); + stripXmlInstructionIfNeeded(expectedValue), stripXmlInstructionIfNeeded(content)); if (expectedStatus == 200) { assertEquals("123", get.getResponseHeader("BookId").getValue()); assertNotNull(get.getResponseHeader("Date")); @@ -2480,6 +2481,14 @@ public class JAXRSClientServerBookTest extends AbstractBusClientServerTestBase { } } + private String stripXmlInstructionIfNeeded(String str) { + if (str != null && str.startsWith(""); + str = str.substring(index + 2); + } + return str; + } + private void getAndCompareStrings(String address, String[] expectedValue, String acceptType, http://git-wip-us.apache.org/repos/asf/cxf/blob/b8eb4c06/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java ---------------------------------------------------------------------- diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java index 5d54975..90e5d2d 100644 --- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java +++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java @@ -576,7 +576,8 @@ public class JAXRSClientServerSpringBookTest extends AbstractBusClientServerTest InputStream in = connect.getInputStream(); InputStream expected = getClass().getResourceAsStream(resource); - assertEquals(getStringFromInputStream(expected), getStringFromInputStream(in)); + assertEquals(stripXmlInstructionIfNeeded(getStringFromInputStream(expected)), + stripXmlInstructionIfNeeded(getStringFromInputStream(in))); } private void getBookAegis(String endpointAddress, String type) throws Exception { @@ -829,7 +830,8 @@ public class JAXRSClientServerSpringBookTest extends AbstractBusClientServerTest if (expectedStatus != 400) { InputStream expected = getClass().getResourceAsStream(expectedResource); - assertEquals(getStringFromInputStream(expected), post.getResponseBodyAsString()); + assertEquals(stripXmlInstructionIfNeeded(getStringFromInputStream(expected)), + stripXmlInstructionIfNeeded(post.getResponseBodyAsString())); } else { assertTrue(post.getResponseBodyAsString() .contains("Cannot find the declaration of element")); @@ -840,6 +842,14 @@ public class JAXRSClientServerSpringBookTest extends AbstractBusClientServerTest } } + private String stripXmlInstructionIfNeeded(String str) { + if (str != null && str.startsWith(""); + str = str.substring(index + 2); + } + return str; + } + private String getStringFromInputStream(InputStream in) throws Exception { CachedOutputStream bos = new CachedOutputStream(); IOUtils.copy(in, bos);