Author: veithen
Date: Mon Sep 27 19:44:39 2010
New Revision: 1001890
URL: http://svn.apache.org/viewvc?rev=1001890&view=rev
Log:
Increased the test coverage for StAX dialects.
Added:
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/util/stax/dialect/EnableCDataReportingTestCase.java
(with props)
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/util/stax/dialect/GetLocalNameOnStartDocumentTestCase.java
(with props)
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/util/stax/dialect/GetPrefixWithNoPrefixTestCase.java
(with props)
Modified:
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/util/stax/dialect/DialectTest.java
Modified:
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/util/stax/dialect/DialectTest.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/util/stax/dialect/DialectTest.java?rev=1001890&r1=1001889&r2=1001890&view=diff
==============================================================================
---
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/util/stax/dialect/DialectTest.java
(original)
+++
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/util/stax/dialect/DialectTest.java
Mon Sep 27 19:44:39 2010
@@ -42,6 +42,7 @@ public class DialectTest extends TestSui
addDialectTest(new DisallowDoctypeDeclWithDenialOfServiceTestCase());
addDialectTest(new DisallowDoctypeDeclWithExternalSubsetTestCase());
addDialectTest(new DisallowDoctypeDeclWithInternalSubsetTestCase());
+ addDialectTest(new EnableCDataReportingTestCase());
addDialectTest(new GetCharacterEncodingSchemeTestCase());
addDialectTest(new GetEncodingExternalTestCase());
addDialectTest(new GetEncodingFromDetectionTestCase("UTF-8", "UTF-8"));
@@ -51,7 +52,9 @@ public class DialectTest extends TestSui
addDialectTest(new
GetEncodingFromDetectionTestCase("UnicodeLittleUnmarked", "UTF-16LE"));
addDialectTest(new GetEncodingTestCase());
addDialectTest(new GetEncodingWithCharacterStreamTestCase());
+ addDialectTest(new GetLocalNameOnStartDocumentTestCase());
addDialectTest(new GetNamespaceContextImplicitNamespacesTestCase());
+ addDialectTest(new GetPrefixWithNoPrefixTestCase());
addDialectTest(new GetTextInPrologTestCase());
addDialectTest(new GetVersionTestCase());
addDialectTest(new IsCharactersOnCDATASectionTestCase());
Added:
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/util/stax/dialect/EnableCDataReportingTestCase.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/util/stax/dialect/EnableCDataReportingTestCase.java?rev=1001890&view=auto
==============================================================================
---
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/util/stax/dialect/EnableCDataReportingTestCase.java
(added)
+++
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/util/stax/dialect/EnableCDataReportingTestCase.java
Mon Sep 27 19:44:39 2010
@@ -0,0 +1,34 @@
+/*
+ * 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
+ *
+ * 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.axiom.util.stax.dialect;
+
+import java.io.StringReader;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+public class EnableCDataReportingTestCase extends DialectTestCase {
+ protected void runTest() throws Throwable {
+ XMLInputFactory factory =
getDialect().enableCDataReporting(newNormalizedXMLInputFactory());
+ XMLStreamReader reader = factory.createXMLStreamReader(new
StringReader("<a><![CDATA[test]]></a>"));
+ reader.nextTag();
+ assertEquals(XMLStreamReader.CDATA, reader.next());
+ assertEquals("test", reader.getText());
+ }
+}
Propchange:
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/util/stax/dialect/EnableCDataReportingTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/util/stax/dialect/GetLocalNameOnStartDocumentTestCase.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/util/stax/dialect/GetLocalNameOnStartDocumentTestCase.java?rev=1001890&view=auto
==============================================================================
---
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/util/stax/dialect/GetLocalNameOnStartDocumentTestCase.java
(added)
+++
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/util/stax/dialect/GetLocalNameOnStartDocumentTestCase.java
Mon Sep 27 19:44:39 2010
@@ -0,0 +1,37 @@
+/*
+ * 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
+ *
+ * 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.axiom.util.stax.dialect;
+
+import java.io.StringReader;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+public class GetLocalNameOnStartDocumentTestCase extends DialectTestCase {
+ protected void runTest() throws Throwable {
+ XMLInputFactory factory = newNormalizedXMLInputFactory();
+ XMLStreamReader reader = factory.createXMLStreamReader(new
StringReader("<root/>"));
+ try {
+ reader.getLocalName();
+ fail("Expected IllegalStateException");
+ } catch (IllegalStateException ex) {
+ // Expected
+ }
+ }
+}
Propchange:
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/util/stax/dialect/GetLocalNameOnStartDocumentTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/util/stax/dialect/GetPrefixWithNoPrefixTestCase.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/util/stax/dialect/GetPrefixWithNoPrefixTestCase.java?rev=1001890&view=auto
==============================================================================
---
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/util/stax/dialect/GetPrefixWithNoPrefixTestCase.java
(added)
+++
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/util/stax/dialect/GetPrefixWithNoPrefixTestCase.java
Mon Sep 27 19:44:39 2010
@@ -0,0 +1,40 @@
+/*
+ * 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
+ *
+ * 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.axiom.util.stax.dialect;
+
+import java.io.StringReader;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+/**
+ * Checks that {...@link XMLStreamReader#getPrefix()} returns
<code>null</code> (instead of
+ * <code>""</code>) if an element has no prefix.
+ */
+public class GetPrefixWithNoPrefixTestCase extends DialectTestCase {
+ protected void runTest() throws Throwable {
+ XMLInputFactory factory = newNormalizedXMLInputFactory();
+ XMLStreamReader reader = factory.createXMLStreamReader(new
StringReader(
+ "<root><child xmlns=\"urn:ns\"/></root>"));
+ reader.next();
+ assertNull(reader.getPrefix());
+ reader.next();
+ assertNull(reader.getPrefix());
+ }
+}
Propchange:
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/util/stax/dialect/GetPrefixWithNoPrefixTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native