You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by ve...@apache.org on 2010/09/29 19:33:11 UTC
svn commit: r1002765 - in
/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/util/stax/dialect:
DialectTest.java IsCharactersOnCDATASectionTestCase.java
IsCharactersTestCase.java
Author: veithen
Date: Wed Sep 29 17:33:10 2010
New Revision: 1002765
URL: http://svn.apache.org/viewvc?rev=1002765&view=rev
Log:
Added a dialect test case to check the return value of XMLStreamReader#isCharacters(). This increases the test coverage for the XLXP1 dialect.
Added:
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/util/stax/dialect/IsCharactersTestCase.java (with props)
Modified:
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/util/stax/dialect/DialectTest.java
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/util/stax/dialect/IsCharactersOnCDATASectionTestCase.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=1002765&r1=1002764&r2=1002765&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 Wed Sep 29 17:33:10 2010
@@ -137,6 +137,17 @@ public class DialectTest extends TestSui
// return true in this case.
addDialectTest(new HasTextTestCase(XMLStreamConstants.CDATA, true));
addDialectTest(new IsCharactersOnCDATASectionTestCase());
+ addDialectTest(new IsCharactersTestCase(XMLStreamConstants.START_ELEMENT, false));
+ addDialectTest(new IsCharactersTestCase(XMLStreamConstants.END_ELEMENT, false));
+ addDialectTest(new IsCharactersTestCase(XMLStreamConstants.PROCESSING_INSTRUCTION, false));
+ addDialectTest(new IsCharactersTestCase(XMLStreamConstants.CHARACTERS, true));
+ addDialectTest(new IsCharactersTestCase(XMLStreamConstants.COMMENT, false));
+ addDialectTest(new IsCharactersTestCase(XMLStreamConstants.SPACE, false));
+ addDialectTest(new IsCharactersTestCase(XMLStreamConstants.START_DOCUMENT, false));
+ addDialectTest(new IsCharactersTestCase(XMLStreamConstants.END_DOCUMENT, false));
+ addDialectTest(new IsCharactersTestCase(XMLStreamConstants.ENTITY_REFERENCE, false));
+ addDialectTest(new IsCharactersTestCase(XMLStreamConstants.DTD, false));
+ addDialectTest(new IsCharactersTestCase(XMLStreamConstants.CDATA, false));
addDialectTest(new IsStandaloneTestCase());
addDialectTest(new MaskedNamespaceTestCase());
addDialectTest(new NextAfterEndDocumentTestCase());
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/util/stax/dialect/IsCharactersOnCDATASectionTestCase.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/util/stax/dialect/IsCharactersOnCDATASectionTestCase.java?rev=1002765&r1=1002764&r2=1002765&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/util/stax/dialect/IsCharactersOnCDATASectionTestCase.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/util/stax/dialect/IsCharactersOnCDATASectionTestCase.java Wed Sep 29 17:33:10 2010
@@ -23,6 +23,12 @@ import java.io.StringReader;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamReader;
+/**
+ * Checks that {@link XMLStreamReader#isCharacters()} returns <code>true</code> if the parser is
+ * coalescing and the event is produced by a CDATA section. Note that in this case, the event is of
+ * type {@link javax.xml.stream.XMLStreamConstants#CHARACTERS}. Thus this is a different test than
+ * {@link IsCharactersTestCase}.
+ */
public class IsCharactersOnCDATASectionTestCase extends DialectTestCase {
protected void runTest() throws Throwable {
XMLInputFactory factory = newNormalizedXMLInputFactory();
Added: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/util/stax/dialect/IsCharactersTestCase.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/util/stax/dialect/IsCharactersTestCase.java?rev=1002765&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/util/stax/dialect/IsCharactersTestCase.java (added)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/util/stax/dialect/IsCharactersTestCase.java Wed Sep 29 17:33:10 2010
@@ -0,0 +1,31 @@
+/*
+ * 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 javax.xml.stream.XMLStreamReader;
+
+public class IsCharactersTestCase extends BooleanPropertyTestCase {
+ public IsCharactersTestCase(int event, boolean expected) {
+ super(event, expected);
+ }
+
+ protected boolean invoke(XMLStreamReader reader) {
+ return reader.isCharacters();
+ }
+}
Propchange: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/util/stax/dialect/IsCharactersTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native