You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by ve...@apache.org on 2013/01/27 13:07:54 UTC
svn commit: r1439063 - in
/webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om:
./ factory/
Author: veithen
Date: Sun Jan 27 12:07:54 2013
New Revision: 1439063
URL: http://svn.apache.org/viewvc?rev=1439063&view=rev
Log:
Consolidated test cases for createOMAttribute.
Added:
webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/factory/TestCreateOMAttributeInterfaces.java (with props)
Modified:
webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java
webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/factory/TestCreateOMAttributeNullPrefixNoNamespace.java
webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/factory/TestCreateOMAttributeWithInvalidNamespace.java
Modified: webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java?rev=1439063&r1=1439062&r2=1439063&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java (original)
+++ webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java Sun Jan 27 12:07:54 2013
@@ -348,6 +348,7 @@ public class OMTestSuiteBuilder extends
addTest(new org.apache.axiom.ts.om.element.TestWriteTextTo(metaFactory));
addTest(new org.apache.axiom.ts.om.element.TestWriteTextToWithNonTextNodes(metaFactory));
addTest(new org.apache.axiom.ts.om.factory.TestCreateOMAttributeGeneratedPrefix(metaFactory));
+ addTest(new org.apache.axiom.ts.om.factory.TestCreateOMAttributeInterfaces(metaFactory));
addTest(new org.apache.axiom.ts.om.factory.TestCreateOMAttributeNullPrefixNoNamespace(metaFactory));
addTest(new org.apache.axiom.ts.om.factory.TestCreateOMAttributeWithInvalidNamespace(metaFactory));
addTest(new org.apache.axiom.ts.om.factory.TestCreateOMCommentWithoutParent(metaFactory));
Added: webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/factory/TestCreateOMAttributeInterfaces.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/factory/TestCreateOMAttributeInterfaces.java?rev=1439063&view=auto
==============================================================================
--- webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/factory/TestCreateOMAttributeInterfaces.java (added)
+++ webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/factory/TestCreateOMAttributeInterfaces.java Sun Jan 27 12:07:54 2013
@@ -0,0 +1,49 @@
+/*
+ * 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.ts.om.factory;
+
+import org.apache.axiom.om.OMAttribute;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.om.OMSerializable;
+import org.apache.axiom.ts.AxiomTestCase;
+import org.w3c.dom.Attr;
+import org.w3c.dom.EntityReference;
+import org.w3c.dom.Text;
+
+/**
+ * Tests that the {@link OMAttribute} instances created by
+ * {@link OMFactory#createOMAttribute(String, OMNamespace, String)} only implement the expected
+ * interfaces. An {@link OMAttribute} is neither an {@link OMNode} nor an {@link OMContainer}. For
+ * the latter this is in contrast to DOM where an {@link Attr} node is a parent node (containing
+ * {@link Text} and {@link EntityReference} nodes).
+ */
+public class TestCreateOMAttributeInterfaces extends AxiomTestCase {
+ public TestCreateOMAttributeInterfaces(OMMetaFactory metaFactory) {
+ super(metaFactory);
+ }
+
+ protected void runTest() throws Throwable {
+ OMFactory factory = metaFactory.getOMFactory();
+ OMNamespace ns = factory.createOMNamespace("urn:test", "p");
+ OMAttribute attr = factory.createOMAttribute("attr", ns, "value");
+ assertFalse(attr instanceof OMSerializable);
+ }
+}
Propchange: webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/factory/TestCreateOMAttributeInterfaces.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/factory/TestCreateOMAttributeNullPrefixNoNamespace.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/factory/TestCreateOMAttributeNullPrefixNoNamespace.java?rev=1439063&r1=1439062&r2=1439063&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/factory/TestCreateOMAttributeNullPrefixNoNamespace.java (original)
+++ webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/factory/TestCreateOMAttributeNullPrefixNoNamespace.java Sun Jan 27 12:07:54 2013
@@ -22,7 +22,6 @@ import org.apache.axiom.om.OMAttribute;
import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMMetaFactory;
import org.apache.axiom.om.OMNamespace;
-import org.apache.axiom.om.OMSerializable;
import org.apache.axiom.ts.AxiomTestCase;
/**
@@ -41,10 +40,5 @@ public class TestCreateOMAttributeNullPr
OMNamespace ns = factory.createOMNamespace("", null);
OMAttribute attr = factory.createOMAttribute("attr", ns, "value");
assertNull(attr.getNamespace());
-
- // An OMAttribute is neither an OMNode nor an OMContainer. For the latter this is in
- // contrast to DOM where an Attr node is a parent node (containing Text and EntityReference
- // nodes).
- assertFalse(attr instanceof OMSerializable);
}
}
Modified: webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/factory/TestCreateOMAttributeWithInvalidNamespace.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/factory/TestCreateOMAttributeWithInvalidNamespace.java?rev=1439063&r1=1439062&r2=1439063&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/factory/TestCreateOMAttributeWithInvalidNamespace.java (original)
+++ webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/factory/TestCreateOMAttributeWithInvalidNamespace.java Sun Jan 27 12:07:54 2013
@@ -23,6 +23,11 @@ import org.apache.axiom.om.OMMetaFactory
import org.apache.axiom.om.OMNamespace;
import org.apache.axiom.ts.AxiomTestCase;
+/**
+ * Tests that {@link OMFactory#createOMAttribute(String, OMNamespace, String)} throws an exception
+ * if the specified namespace is invalid, i.e. if the {@link OMNamespace} object specifies a prefix
+ * for an empty namespace.
+ */
public class TestCreateOMAttributeWithInvalidNamespace extends AxiomTestCase {
public TestCreateOMAttributeWithInvalidNamespace(OMMetaFactory metaFactory) {
super(metaFactory);