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/09/15 18:53:48 UTC

svn commit: r1523457 - in /webservices/axiom/trunk/systests/osgi-tests/src/test/java/org/apache/axiom/test: FactoryTest.java OMAbstractFactoryTest.java ServiceTest.java StAXOMBuilderTest.java

Author: veithen
Date: Sun Sep 15 16:53:48 2013
New Revision: 1523457

URL: http://svn.apache.org/r1523457
Log:
Consolidated test cases.

Added:
    webservices/axiom/trunk/systests/osgi-tests/src/test/java/org/apache/axiom/test/FactoryTest.java
      - copied, changed from r1523428, webservices/axiom/trunk/systests/osgi-tests/src/test/java/org/apache/axiom/test/OMAbstractFactoryTest.java
Removed:
    webservices/axiom/trunk/systests/osgi-tests/src/test/java/org/apache/axiom/test/OMAbstractFactoryTest.java
    webservices/axiom/trunk/systests/osgi-tests/src/test/java/org/apache/axiom/test/ServiceTest.java
    webservices/axiom/trunk/systests/osgi-tests/src/test/java/org/apache/axiom/test/StAXOMBuilderTest.java

Copied: webservices/axiom/trunk/systests/osgi-tests/src/test/java/org/apache/axiom/test/FactoryTest.java (from r1523428, webservices/axiom/trunk/systests/osgi-tests/src/test/java/org/apache/axiom/test/OMAbstractFactoryTest.java)
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/systests/osgi-tests/src/test/java/org/apache/axiom/test/FactoryTest.java?p2=webservices/axiom/trunk/systests/osgi-tests/src/test/java/org/apache/axiom/test/FactoryTest.java&p1=webservices/axiom/trunk/systests/osgi-tests/src/test/java/org/apache/axiom/test/OMAbstractFactoryTest.java&r1=1523428&r2=1523457&rev=1523457&view=diff
==============================================================================
--- webservices/axiom/trunk/systests/osgi-tests/src/test/java/org/apache/axiom/test/OMAbstractFactoryTest.java (original)
+++ webservices/axiom/trunk/systests/osgi-tests/src/test/java/org/apache/axiom/test/FactoryTest.java Sun Sep 15 16:53:48 2013
@@ -18,13 +18,20 @@
  */
 package org.apache.axiom.test;
 
+import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.ops4j.pax.exam.CoreOptions.frameworkProperty;
 import static org.ops4j.pax.exam.CoreOptions.junitBundles;
 import static org.ops4j.pax.exam.CoreOptions.options;
 import static org.ops4j.pax.exam.CoreOptions.url;
 
+import java.io.StringReader;
+
+import javax.inject.Inject;
+
 import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMXMLBuilderFactory;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.ops4j.pax.exam.Configuration;
@@ -32,10 +39,12 @@ import org.ops4j.pax.exam.Option;
 import org.ops4j.pax.exam.junit.PaxExam;
 import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
 import org.ops4j.pax.exam.spi.reactors.PerClass;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
 
 @RunWith(PaxExam.class)
 @ExamReactorStrategy(PerClass.class)
-public class OMAbstractFactoryTest {
+public class FactoryTest {
     @Configuration
     public static Option[] configuration() {
         return options(
@@ -46,22 +55,50 @@ public class OMAbstractFactoryTest {
                 url("link:classpath:org.apache.james.apache-mime4j-core.link"),
                 url("link:classpath:org.apache.ws.commons.axiom.axiom-api.link"),
                 url("link:classpath:org.apache.ws.commons.axiom.axiom-impl.link"),
+                url("link:classpath:org.apache.ws.commons.axiom.axiom-dom.link"),
                 junitBundles(),
                 frameworkProperty("foo").value("bar"));
     }
     
+    @Inject
+    private BundleContext context;
+    
     @Test
-    public void testgetOMFactory() throws Exception {
+    public void testGetOMFactory() throws Exception {
         assertNotNull(OMAbstractFactory.getOMFactory());
     }
 
     @Test
-    public void testgetSOAP11Factory() throws Exception {
+    public void testGetSOAP11Factory() throws Exception {
         assertNotNull(OMAbstractFactory.getSOAP11Factory());
     }
 
     @Test
-    public void testgetSOAP12Factory() throws Exception {
+    public void testGetSOAP12Factory() throws Exception {
         assertNotNull(OMAbstractFactory.getSOAP12Factory());
     }
+
+    @Test
+    public void testLLOMMetaFactoryServicePresent() throws Exception {
+        ServiceReference[] omfactRefs = context
+                .getServiceReferences("org.apache.axiom.om.OMMetaFactory", "(implementationName=llom)");
+        assertNotNull(omfactRefs);
+        assertEquals(1, omfactRefs.length);
+    }
+    
+    @Test
+    public void testDOOMMetaFactoryServicePresent() throws Exception {
+        ServiceReference[] omfactRefs = context
+                .getServiceReferences("org.apache.axiom.om.OMMetaFactory", "(implementationName=doom)");
+        assertNotNull(omfactRefs);
+        assertEquals(1, omfactRefs.length);
+    }
+    
+    @Test
+    public void testCreateOMBuilder() throws Exception {
+        OMElement oe = OMXMLBuilderFactory.createOMBuilder(new StringReader(
+                "<a:testElement xmlns:a=\"http://test/namespace\"/>")).getDocumentElement();
+        assertEquals("testElement",oe.getLocalName());
+        assertEquals("http://test/namespace", oe.getNamespace().getNamespaceURI());
+    }
 }