Hi Sergey, Dan, thanks for the background information. There were a few things I noticed too late. I added back the original uri handling for CXF-3958 so that all test cases are working.
Although my second fix handles the existing jaxrs systests and Oli's new test case that I added for CXF-4150 yesterday, we need another approach to handle other possible cases. So, I will be making another change. Regards, aki 2012/3/1 Daniel Kulp <[email protected]>: > On Thursday, March 01, 2012 10:01:59 PM Sergey Beryozkin wrote: >> Hi Aki, >> >> Thanks for fixing this issue. >> As far as I recall, the written uris property was added to address >> https://issues.apache.org/jira/browse/CXF-3958 >> >> I can get the test added asap just to confirm the fix you provided will >> also do for CXF-3958 > > Well, it was modified for CXF-3958, not added. > > However, with this change, I am seeing test failures which Jenkins is seeing > as well: > > https://builds.apache.org/view/A-F/view/CXF/job/CXF-Trunk-JDK15/org.apache.cxf.systests$cxf-systests-jaxrs/3065/testReport/ > > So that definitely needs to be addresed. > > Dan > > >> >> Thanks, Sergey >> >> On 01/03/12 17:58, [email protected] wrote: >> > Author: ay >> > Date: Thu Mar 1 17:58:19 2012 >> > New Revision: 1295714 >> > >> > URL: http://svn.apache.org/viewvc?rev=1295714&view=rev >> > Log: >> > [CXF-4150] Transform feature's OutTransformWriter may not correctly >> > generate namespace declarations> >> > Added: >> > cxf/trunk/api/src/test/java/org/apache/cxf/staxutils/resources/wstrus >> > tReqSTRC.xml (with props) >> > cxf/trunk/api/src/test/java/org/apache/cxf/staxutils/resources/wstru >> > stReqSTRCIn1.xml (with props)> >> > Modified: >> > cxf/trunk/api/src/main/java/org/apache/cxf/staxutils/transform/OutTra >> > nsformWriter.java >> > cxf/trunk/api/src/test/java/org/apache/cxf/staxutils/transform/InTra >> > nsformReaderTest.java >> > cxf/trunk/api/src/test/java/org/apache/cxf/staxutils/transform/OutTr >> > ansformWriterTest.java> >> > Modified: >> > cxf/trunk/api/src/main/java/org/apache/cxf/staxutils/transform/OutTransfo >> > rmWriter.java URL: >> > http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/s >> > taxutils/transform/OutTransformWriter.java?rev=1295714&r1=1295713&r2=12957 >> > 14&view=diff >> > ========================================================================= >> > ===== --- >> > cxf/trunk/api/src/main/java/org/apache/cxf/staxutils/transform/OutTransfo >> > rmWriter.java (original) +++ >> > cxf/trunk/api/src/main/java/org/apache/cxf/staxutils/transform/OutTransfo >> > rmWriter.java Thu Mar 1 17:58:19 2012 @@ -20,8 +20,6 @@ package >> > org.apache.cxf.staxutils.transfo >> > >> > import java.util.ArrayList; >> > import java.util.HashMap; >> > >> > -import java.util.HashSet; >> > -import java.util.LinkedList; >> > >> > import java.util.List; >> > import java.util.Map; >> > import java.util.Set; >> > >> > @@ -43,7 +41,6 @@ public class OutTransformWriter extends >> > >> > private QNamesMap attributesMap; >> > private Map<QName, ElementProperty> appendMap = new HashMap<QName, >> > ElementProperty>(5); private Map<String, String> nsMap = new >> > HashMap<String, String>(5);> >> > - private List<Set<String>> writtenUris = new >> > LinkedList<Set<String>>();> >> > private Set<QName> dropElements; >> > private Stack<List<ParsingEvent>> pushedAheadEvents = new >> > Stack<List<ParsingEvent>>();> >> > @@ -96,7 +93,7 @@ public class OutTransformWriter extends >> > >> > uri = value != null ? value : uri; >> > >> > - if (writtenUris.get(0).contains(uri)) { >> > + if (prefix.equals(getPrefix(uri))) { >> > >> > return; >> > >> > } >> > >> > @@ -108,7 +105,6 @@ public class OutTransformWriter extends >> > >> > } >> > super.writeNamespace(prefix, uri); >> > >> > } >> > >> > - writtenUris.get(0).add(uri); >> > >> > } >> > >> > @Override >> > >> > @@ -117,13 +113,6 @@ public class OutTransformWriter extends >> > >> > if (matchesDropped(false)) { >> > >> > return; >> > >> > } >> > >> > - Set<String> s; >> > - if (writtenUris.isEmpty()) { >> > - s = new HashSet<String>(); >> > - } else { >> > - s = new HashSet<String>(writtenUris.get(0)); >> > - } >> > - writtenUris.add(0, s); >> > >> > final QName theName = new QName(uri, local, prefix); >> > final ElementProperty appendProp = appendMap.remove(theName); >> > >> > @@ -243,9 +232,7 @@ public class OutTransformWriter extends >> > >> > } else if (dropDepth> 0) { >> > >> > dropDepth = 0; >> > >> > } >> > >> > - if (!writtenUris.isEmpty()) { >> > - writtenUris.remove(0); >> > - } >> > + >> > >> > QName theName = elementsStack.pop(); >> > final boolean dropped = dropElements.contains(theName); >> > if (!dropped) { >> > >> > Added: >> > cxf/trunk/api/src/test/java/org/apache/cxf/staxutils/resources/wstrustReq >> > STRC.xml URL: >> > http://svn.apache.org/viewvc/cxf/trunk/api/src/test/java/org/apache/cxf/s >> > taxutils/resources/wstrustReqSTRC.xml?rev=1295714&view=auto >> > ========================================================================= >> > ===== Binary file - no diff available. >> > >> > Propchange: >> > cxf/trunk/api/src/test/java/org/apache/cxf/staxutils/resources/wstrustReq >> > STRC.xml >> > ------------------------------------------------------------------------- >> > -----> >> > svn:mime-type = application/xml >> > >> > Added: >> > cxf/trunk/api/src/test/java/org/apache/cxf/staxutils/resources/wstrustReq >> > STRCIn1.xml URL: >> > http://svn.apache.org/viewvc/cxf/trunk/api/src/test/java/org/apache/cxf/s >> > taxutils/resources/wstrustReqSTRCIn1.xml?rev=1295714&view=auto >> > ========================================================================= >> > ===== Binary file - no diff available. >> > >> > Propchange: >> > cxf/trunk/api/src/test/java/org/apache/cxf/staxutils/resources/wstrustReq >> > STRCIn1.xml >> > ------------------------------------------------------------------------- >> > -----> >> > svn:mime-type = application/xml >> > >> > Modified: >> > cxf/trunk/api/src/test/java/org/apache/cxf/staxutils/transform/InTransfor >> > mReaderTest.java URL: >> > http://svn.apache.org/viewvc/cxf/trunk/api/src/test/java/org/apache/cxf/s >> > taxutils/transform/InTransformReaderTest.java?rev=1295714&r1=1295713&r2=12 >> > 95714&view=diff >> > ========================================================================= >> > ===== --- >> > cxf/trunk/api/src/test/java/org/apache/cxf/staxutils/transform/InTransfor >> > mReaderTest.java (original) +++ >> > cxf/trunk/api/src/test/java/org/apache/cxf/staxutils/transform/InTransfor >> > mReaderTest.java Thu Mar 1 17:58:19 2012 @@ -424,4 +424,18 @@ public >> > class InTransformReaderTest exten >> > >> > } >> > >> > + @Test >> > + public void testOldSTSTransform() throws Exception { >> > + Map<String, String> transformElements = new HashMap<String, >> > String>(); + >> > + >> > transformElements.put("{http://docs.oasis-open.org/ws-sx/ws-trust/200512} >> > *", + >> > "{http://schemas.xmlsoap.org/ws/2005/02/trust}*"); + >> > + >> > + >> > TransformTestUtils.transformInStreamAndCompare("../resources/wstrustReqST >> > RCIn1.xml", + >> > "../resources/wstrustReqSTRC.xml", + >> > transformElements, null, null, null, null); + >> > + } >> > + >> > >> > } >> > >> > Modified: >> > cxf/trunk/api/src/test/java/org/apache/cxf/staxutils/transform/OutTransfo >> > rmWriterTest.java URL: >> > http://svn.apache.org/viewvc/cxf/trunk/api/src/test/java/org/apache/cxf/s >> > taxutils/transform/OutTransformWriterTest.java?rev=1295714&r1=1295713&r2=1 >> > 295714&view=diff >> > ========================================================================= >> > ===== --- >> > cxf/trunk/api/src/test/java/org/apache/cxf/staxutils/transform/OutTransfo >> > rmWriterTest.java (original) +++ >> > cxf/trunk/api/src/test/java/org/apache/cxf/staxutils/transform/OutTransfo >> > rmWriterTest.java Thu Mar 1 17:58:19 2012 @@ -396,4 +396,14 @@ public >> > class OutTransformWriterTest exte >> > >> > } >> > >> > + @Test >> > + public void testOldSTSTransform() throws Exception { >> > + Map<String, String> transformElements = new HashMap<String, >> > String>(); + >> > transformElements.put("{http://docs.oasis-open.org/ws-sx/ws-trust/200512} >> > *", + >> > "{http://schemas.xmlsoap.org/ws/2005/02/trust}*"); + >> > + >> > TransformTestUtils.transformOutStreamAndCompare("../resources/wstrustReqS >> > TRCIn1.xml", + >> > "../resources/wstrustReqSTRC.xml", + >> > transformElements, null, null, null, null); + } >> > >> > } > -- > Daniel Kulp > [email protected] - http://dankulp.com/blog > Talend Community Coder - http://coders.talend.com
