Author: veithen Date: Thu Apr 29 19:03:43 2010 New Revision: 939458 URL: http://svn.apache.org/viewvc?rev=939458&view=rev Log: WSCOMMONS-452: Moved the remaining code to Axiom.
Added: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/ds/WrappedTextNodeOMDataSourceFromDataSource.java - copied, changed from r939432, axis/axis2/java/transports/trunk/modules/base/src/main/java/org/apache/axis2/format/WrappedTextNodeOMDataSourceFromDataSource.java webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/ds/WrappedTextNodeOMDataSourceFromReader.java - copied, changed from r939432, axis/axis2/java/transports/trunk/modules/base/src/main/java/org/apache/axis2/format/WrappedTextNodeOMDataSourceFromReader.java webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/ds/WrappedTextNodeOMDataSourceTest.java - copied, changed from r939432, axis/axis2/java/transports/trunk/modules/base/src/test/java/org/apache/axis2/format/WrappedTextNodeOMDataSourceTest.java webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/util/CharacterStreamComparator.java - copied, changed from r939432, axis/axis2/java/transports/trunk/modules/base/src/test/java/org/apache/axis2/format/CharacterStreamComparator.java webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/util/ElementHelperTest.java - copied, changed from r939432, axis/axis2/java/transports/trunk/modules/base/src/test/java/org/apache/axis2/format/ElementHelperTest.java webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/util/RandomDataSource.java - copied, changed from r939432, axis/axis2/java/transports/trunk/modules/base/src/test/java/org/apache/axis2/format/RandomDataSource.java Modified: webservices/commons/trunk/modules/axiom/modules/axiom-tests/pom.xml Copied: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/ds/WrappedTextNodeOMDataSourceFromDataSource.java (from r939432, axis/axis2/java/transports/trunk/modules/base/src/main/java/org/apache/axis2/format/WrappedTextNodeOMDataSourceFromDataSource.java) URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/ds/WrappedTextNodeOMDataSourceFromDataSource.java?p2=webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/ds/WrappedTextNodeOMDataSourceFromDataSource.java&p1=axis/axis2/java/transports/trunk/modules/base/src/main/java/org/apache/axis2/format/WrappedTextNodeOMDataSourceFromDataSource.java&r1=939432&r2=939458&rev=939458&view=diff ============================================================================== --- axis/axis2/java/transports/trunk/modules/base/src/main/java/org/apache/axis2/format/WrappedTextNodeOMDataSourceFromDataSource.java (original) +++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/ds/WrappedTextNodeOMDataSourceFromDataSource.java Thu Apr 29 19:03:43 2010 @@ -1,23 +1,23 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ -package org.apache.axis2.format; +package org.apache.axiom.om.ds; import java.io.IOException; import java.io.InputStream; @@ -35,7 +35,6 @@ import javax.xml.stream.XMLStreamWriter; import org.apache.axiom.om.OMDataSourceExt; import org.apache.axiom.om.OMOutputFormat; -import org.apache.axiom.om.ds.OMDataSourceExtBase; import org.apache.axiom.om.impl.MTOMXMLStreamWriter; import org.apache.axiom.om.impl.serialize.StreamingOMSerializer; import org.apache.axiom.om.util.StAXUtils; @@ -57,14 +56,12 @@ public class WrappedTextNodeOMDataSource this.charset = charset; } - @Override public void serialize(OutputStream out, OMOutputFormat format) throws XMLStreamException { XMLStreamWriter writer = new MTOMXMLStreamWriter(out, format); serialize(writer); writer.flush(); } - @Override public void serialize(Writer writer, OMOutputFormat format) throws XMLStreamException { MTOMXMLStreamWriter xmlWriter = new MTOMXMLStreamWriter(StAXUtils.createXMLStreamWriter(writer)); @@ -73,7 +70,6 @@ public class WrappedTextNodeOMDataSource xmlWriter.flush(); } - @Override public void serialize(XMLStreamWriter xmlWriter) throws XMLStreamException { StreamingOMSerializer serializer = new StreamingOMSerializer(); serializer.serialize(getReader(), xmlWriter); Copied: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/ds/WrappedTextNodeOMDataSourceFromReader.java (from r939432, axis/axis2/java/transports/trunk/modules/base/src/main/java/org/apache/axis2/format/WrappedTextNodeOMDataSourceFromReader.java) URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/ds/WrappedTextNodeOMDataSourceFromReader.java?p2=webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/ds/WrappedTextNodeOMDataSourceFromReader.java&p1=axis/axis2/java/transports/trunk/modules/base/src/main/java/org/apache/axis2/format/WrappedTextNodeOMDataSourceFromReader.java&r1=939432&r2=939458&rev=939458&view=diff ============================================================================== --- axis/axis2/java/transports/trunk/modules/base/src/main/java/org/apache/axis2/format/WrappedTextNodeOMDataSourceFromReader.java (original) +++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/ds/WrappedTextNodeOMDataSourceFromReader.java Thu Apr 29 19:03:43 2010 @@ -1,23 +1,23 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ -package org.apache.axis2.format; +package org.apache.axiom.om.ds; import java.io.IOException; import java.io.Reader; @@ -31,7 +31,6 @@ import javax.xml.stream.XMLStreamWriter; import org.apache.axiom.om.OMDataSourceExt; import org.apache.axiom.om.OMOutputFormat; -import org.apache.axiom.om.ds.OMDataSourceExtBase; import org.apache.axiom.om.impl.MTOMXMLStreamWriter; import org.apache.axiom.om.impl.serialize.StreamingOMSerializer; import org.apache.axiom.om.util.StAXUtils; @@ -51,7 +50,6 @@ public class WrappedTextNodeOMDataSource this.reader = reader; } - @Override public void serialize(Writer writer, OMOutputFormat format) throws XMLStreamException { MTOMXMLStreamWriter xmlWriter = new MTOMXMLStreamWriter(StAXUtils.createXMLStreamWriter(writer)); @@ -60,7 +58,6 @@ public class WrappedTextNodeOMDataSource xmlWriter.flush(); } - @Override public void serialize(XMLStreamWriter xmlWriter) throws XMLStreamException { StreamingOMSerializer serializer = new StreamingOMSerializer(); serializer.serialize(getReader(), xmlWriter); Modified: webservices/commons/trunk/modules/axiom/modules/axiom-tests/pom.xml URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/pom.xml?rev=939458&r1=939457&r2=939458&view=diff ============================================================================== --- webservices/commons/trunk/modules/axiom/modules/axiom-tests/pom.xml (original) +++ webservices/commons/trunk/modules/axiom/modules/axiom-tests/pom.xml Thu Apr 29 19:03:43 2010 @@ -95,6 +95,12 @@ <version>${version}</version> <scope>test</scope> </dependency> + <dependency> + <groupId>commons-io</groupId> + <artifactId>commons-io</artifactId> + <version>1.4</version> + <scope>test</scope> + </dependency> </dependencies> <build> <plugins> Copied: webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/ds/WrappedTextNodeOMDataSourceTest.java (from r939432, axis/axis2/java/transports/trunk/modules/base/src/test/java/org/apache/axis2/format/WrappedTextNodeOMDataSourceTest.java) URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/ds/WrappedTextNodeOMDataSourceTest.java?p2=webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/ds/WrappedTextNodeOMDataSourceTest.java&p1=axis/axis2/java/transports/trunk/modules/base/src/test/java/org/apache/axis2/format/WrappedTextNodeOMDataSourceTest.java&r1=939432&r2=939458&rev=939458&view=diff ============================================================================== --- axis/axis2/java/transports/trunk/modules/base/src/test/java/org/apache/axis2/format/WrappedTextNodeOMDataSourceTest.java (original) +++ webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/ds/WrappedTextNodeOMDataSourceTest.java Thu Apr 29 19:03:43 2010 @@ -1,23 +1,23 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ -package org.apache.axis2.format; +package org.apache.axiom.om.ds; import java.io.StringReader; import java.util.Random; @@ -30,6 +30,7 @@ import org.apache.axiom.om.OMAbstractFac import org.apache.axiom.om.OMDataSource; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMSourcedElement; +import org.apache.axiom.om.ds.WrappedTextNodeOMDataSourceFromReader; import org.apache.axiom.om.impl.llom.OMSourcedElementImpl; public class WrappedTextNodeOMDataSourceTest extends TestCase { Copied: webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/util/CharacterStreamComparator.java (from r939432, axis/axis2/java/transports/trunk/modules/base/src/test/java/org/apache/axis2/format/CharacterStreamComparator.java) URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/util/CharacterStreamComparator.java?p2=webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/util/CharacterStreamComparator.java&p1=axis/axis2/java/transports/trunk/modules/base/src/test/java/org/apache/axis2/format/CharacterStreamComparator.java&r1=939432&r2=939458&rev=939458&view=diff ============================================================================== --- axis/axis2/java/transports/trunk/modules/base/src/test/java/org/apache/axis2/format/CharacterStreamComparator.java (original) +++ webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/util/CharacterStreamComparator.java Thu Apr 29 19:03:43 2010 @@ -1,23 +1,23 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ -package org.apache.axis2.format; +package org.apache.axiom.om.util; import java.io.IOException; import java.io.Reader; @@ -39,7 +39,6 @@ public class CharacterStreamComparator e this.in = in; } - @Override public void write(char[] buffer, int off, int len) throws IOException { while (len > 0) { int c = in.read(compareBuffer, 0, Math.min(compareBuffer.length, len)); @@ -57,11 +56,9 @@ public class CharacterStreamComparator e } } - @Override public void flush() throws IOException { } - @Override public void close() throws IOException { if (in.read() != -1) { Assert.fail("The two streams have different lengths"); Copied: webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/util/ElementHelperTest.java (from r939432, axis/axis2/java/transports/trunk/modules/base/src/test/java/org/apache/axis2/format/ElementHelperTest.java) URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/util/ElementHelperTest.java?p2=webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/util/ElementHelperTest.java&p1=axis/axis2/java/transports/trunk/modules/base/src/test/java/org/apache/axis2/format/ElementHelperTest.java&r1=939432&r2=939458&rev=939458&view=diff ============================================================================== --- axis/axis2/java/transports/trunk/modules/base/src/test/java/org/apache/axis2/format/ElementHelperTest.java (original) +++ webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/util/ElementHelperTest.java Thu Apr 29 19:03:43 2010 @@ -1,27 +1,26 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ -package org.apache.axis2.format; +package org.apache.axiom.om.util; import java.io.ByteArrayInputStream; import java.io.IOException; -import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import java.io.SequenceInputStream; @@ -42,6 +41,7 @@ import org.apache.axiom.om.OMAbstractFac import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMSourcedElement; +import org.apache.axiom.om.ds.WrappedTextNodeOMDataSourceFromDataSource; import org.apache.axiom.om.impl.builder.StAXOMBuilder; import org.apache.axiom.om.impl.llom.OMSourcedElementImpl; import org.apache.axiom.om.util.AXIOMUtil; @@ -84,12 +84,17 @@ public class ElementHelperTest extends T } public void testGetTextAsStreamWithoutCaching() throws Exception { + XMLInputFactory factory = XMLInputFactory.newInstance(); + if (factory.getClass().getName().equals("com.bea.xml.stream.MXParserFactory")) { + // Skip the test on the StAX reference implementation because it + // causes an out of memory error + return; + } DataSource ds = new RandomDataSource(654321, 64, 128, 20000000); - Vector<InputStream> v = new Vector<InputStream>(); + Vector/*<InputStream>*/ v = new Vector/*<InputStream>*/(); v.add(new ByteArrayInputStream("<a>".getBytes("ascii"))); v.add(ds.getInputStream()); v.add(new ByteArrayInputStream("</a>".getBytes("ascii"))); - XMLInputFactory factory = XMLInputFactory.newInstance(); factory.setProperty(XMLInputFactory.IS_COALESCING, Boolean.FALSE); XMLStreamReader reader = factory.createXMLStreamReader( new SequenceInputStream(v.elements()), "ascii"); Copied: webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/util/RandomDataSource.java (from r939432, axis/axis2/java/transports/trunk/modules/base/src/test/java/org/apache/axis2/format/RandomDataSource.java) URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/util/RandomDataSource.java?p2=webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/util/RandomDataSource.java&p1=axis/axis2/java/transports/trunk/modules/base/src/test/java/org/apache/axis2/format/RandomDataSource.java&r1=939432&r2=939458&rev=939458&view=diff ============================================================================== --- axis/axis2/java/transports/trunk/modules/base/src/test/java/org/apache/axis2/format/RandomDataSource.java (original) +++ webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/util/RandomDataSource.java Thu Apr 29 19:03:43 2010 @@ -1,23 +1,23 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ -package org.apache.axis2.format; +package org.apache.axiom.om.util; import java.io.IOException; import java.io.InputStream; @@ -52,7 +52,6 @@ public class RandomDataSource implements return new InputStream() { private int position; - @Override public int read() throws IOException { if (position == length) { return -1;