ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1796371 - in /webservices/axiom/trunk: systests/old-tests/src/test/java/org/apache/axiom/om/impl/builder/ testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/ testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/
Date Sat, 27 May 2017 09:23:58 GMT
Author: veithen
Date: Sat May 27 09:23:58 2017
New Revision: 1796371

URL: http://svn.apache.org/viewvc?rev=1796371&view=rev
Log:
AXIOM-311: Migrate StAXOMBuilderTest.

Added:
    webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestClose.java
  (with props)
Removed:
    webservices/axiom/trunk/systests/old-tests/src/test/java/org/apache/axiom/om/impl/builder/
Modified:
    webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java

Modified: webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java?rev=1796371&r1=1796370&r2=1796371&view=diff
==============================================================================
--- webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java
(original)
+++ webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java
Sat May 27 09:23:58 2017
@@ -263,6 +263,7 @@ public class OMTestSuiteBuilder extends
             }
         }
         addTest(new org.apache.axiom.ts.om.element.TestCloneOMElementNamespaceRepairing(metaFactory));
+        addTest(new org.apache.axiom.ts.om.element.TestClose(metaFactory));
         addTest(new org.apache.axiom.ts.om.element.TestDeclareDefaultNamespace1(metaFactory));
         addTest(new org.apache.axiom.ts.om.element.TestDeclareDefaultNamespace2(metaFactory));
         addTest(new org.apache.axiom.ts.om.element.TestDeclareDefaultNamespaceConflict1(metaFactory));

Added: webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestClose.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestClose.java?rev=1796371&view=auto
==============================================================================
--- webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestClose.java
(added)
+++ webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestClose.java
Sat May 27 09:23:58 2017
@@ -0,0 +1,60 @@
+/*
+ * 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.element;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import java.util.Iterator;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.om.OMNode;
+import org.apache.axiom.ts.AxiomTestCase;
+import org.apache.axiom.ts.om.XMLSampleAdapter;
+import org.apache.axiom.ts.xml.XMLSample;
+
+public class TestClose extends AxiomTestCase {
+    public TestClose(OMMetaFactory metaFactory) {
+        super(metaFactory);
+    }
+
+    @Override
+    protected void runTest() throws Throwable {
+        OMElement rootElement = XMLSample.SIMPLE.getAdapter(XMLSampleAdapter.class).getDocumentElement(metaFactory);
+        
+        // get the first OMElement child
+        OMNode omnode = rootElement.getFirstOMChild();
+        while (!(omnode instanceof OMElement)) {
+            omnode = omnode.getNextOMSibling();
+        }
+        // Close the element after building the element
+        OMElement omElement = (OMElement) omnode;
+        omElement.close(true);
+        
+        Iterator<OMNode> children = ((OMElement) omnode).getChildren();
+        int childrenCount = 0;
+        while (children.hasNext()) {
+            if (children.next() instanceof OMElement) {
+                childrenCount++;
+            }
+        }
+        
+        assertThat(childrenCount).isEqualTo(2);
+    }
+}

Propchange: webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestClose.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message