cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dav...@apache.org
Subject svn commit: r898744 [2/3] - in /cxf/dosgi/trunk: discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/ discovery/local/src/test/java/org/apache/cxf/dosgi/discovery/local/ dsw/cxf-dsw/ dsw/cxf-dsw/src/main/java/org/...
Date Wed, 13 Jan 2010 13:28:39 GMT
Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/TestUtils.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/TestUtils.java?rev=898744&r1=898743&r2=898744&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/TestUtils.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/TestUtils.java Wed Jan 13 13:28:38 2010
@@ -19,25 +19,20 @@
 
 package org.apache.cxf.dosgi.dsw;
 
-import java.util.ArrayList;
-import java.util.List;
-
-import org.easymock.classextension.EasyMock;
-import org.osgi.service.discovery.ServiceEndpointDescription;
 
 public final class TestUtils {
-    private TestUtils() {
-    }
-
-    public static ServiceEndpointDescription mockServiceDescription(String... interfaceNames) {
-        List<String> iList = new ArrayList<String>();
-        for (String iName : interfaceNames) {
-            iList.add(iName);
-        }
-        
-        ServiceEndpointDescription sd = EasyMock.createNiceMock(ServiceEndpointDescription.class);
-        sd.getProvidedInterfaces();
-        EasyMock.expectLastCall().andReturn(iList);
-        return sd;
-    }
+//    private TestUtils() {
+//    }
+//
+//    public static ServiceEndpointDescription mockServiceDescription(String... interfaceNames) {
+//        List<String> iList = new ArrayList<String>();
+//        for (String iName : interfaceNames) {
+//            iList.add(iName);
+//        }
+//        
+//        ServiceEndpointDescription sd = EasyMock.createNiceMock(ServiceEndpointDescription.class);
+//        sd.getProvidedInterfaces();
+//        EasyMock.expectLastCall().andReturn(iList);
+//        return sd;
+//    }
 }

Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/decorator/InterfaceRuleTest.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/decorator/InterfaceRuleTest.java?rev=898744&r1=898743&r2=898744&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/decorator/InterfaceRuleTest.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/decorator/InterfaceRuleTest.java Wed Jan 13 13:28:38 2010
@@ -35,128 +35,128 @@
         assertTrue(true);
     }
     
-//    public void testInterfaceRuleGetBundle() {
-//        Bundle b = EasyMock.createMock(Bundle.class);
-//        EasyMock.replay(b);
-//        InterfaceRule ir = new InterfaceRule(b, "org.apache.Foo");
-//        assertSame(b, ir.getBundle());
-//    }
-//    
-//    public void testInterfaceRule1() {
-//        InterfaceRule ir = new InterfaceRule(null, "org.apache.Foo");
-//        ir.addProperty("x", "y", String.class.getName());        
-//        
-//        final Map<String, Object> serviceProps = new HashMap<String, Object>();
-//        serviceProps.put(Constants.OBJECTCLASS, new String [] {"a.b.C", "org.apache.Foo"});
-//        ServiceReference sref = mockServiceReference(serviceProps);
-//
-//        Map<String, Object> m = new HashMap<String, Object>();
-//        m.put("a", "b");
-//        ir.apply(sref, m);
-//        Map<String, Object> expected = new HashMap<String, Object>();
-//        expected.put("a", "b");
-//        expected.put("x", "y");
-//        assertEquals(expected, m);
-//    }
-//    
-//    public void testInterfaceRule2() {
-//        InterfaceRule ir = new InterfaceRule(null, "org.apache.F(.*)");
-//        ir.addPropMatch("boo", "baah");
-//        ir.addProperty("x", "1", Integer.class.getName());        
-//        ir.addProperty("aaa.bbb", "true", Boolean.class.getName());        
-//        
-//        final Map<String, Object> serviceProps = new HashMap<String, Object>();
-//        serviceProps.put("boo", "baah");
-//        serviceProps.put(Constants.OBJECTCLASS, new String [] {"a.b.C", "org.apache.Foo"});
-//        ServiceReference sref = mockServiceReference(serviceProps);
-//
-//        Map<String, Object> m = new HashMap<String, Object>();
-//        ir.apply(sref, m);
-//        Map<String, Object> expected = new HashMap<String, Object>();
-//        expected.put("x", new Integer(1));
-//        expected.put("aaa.bbb", Boolean.TRUE);
-//        assertEquals(expected, m);
-//    }
-//
-//    public void testInterfaceRule3() {
-//        InterfaceRule ir = new InterfaceRule(null, "org.apache.F(.*)");
-//        ir.addProperty("x", "y", String.class.getName());        
-//        
-//        final Map<String, Object> serviceProps = new HashMap<String, Object>();
-//        serviceProps.put("boo", "baah");
-//        serviceProps.put(Constants.OBJECTCLASS, new String [] {"org.apache.Boo"});
-//        ServiceReference sref = mockServiceReference(serviceProps);
-//
-//        Map<String, Object> m = new HashMap<String, Object>();
-//        ir.apply(sref, m);
-//        assertEquals(0, m.size());
-//    }
-//
-//    public void testInterfaceRule4() {
-//        InterfaceRule ir = new InterfaceRule(null, "org.apache.F(.*)");
-//        ir.addPropMatch("boo", "baah");
-//        ir.addProperty("x", "y", String.class.getName());        
-//        
-//        final Map<String, Object> serviceProps = new HashMap<String, Object>();
-//        serviceProps.put(Constants.OBJECTCLASS, new String [] {"org.apache.Foo"});
-//        ServiceReference sref = mockServiceReference(serviceProps);
-//
-//        Map<String, Object> m = new HashMap<String, Object>();
-//        ir.apply(sref, m);
-//        assertEquals(0, m.size());
-//    }
-//
-//    public void testInterfaceRule5() {
-//        InterfaceRule ir = new InterfaceRule(null, "org.apache.Foo");
-//        ir.addPropMatch("test.int", "42");
-//        ir.addProperty("x", "1", Long.class.getName());        
-//        
-//        final Map<String, Object> serviceProps = new HashMap<String, Object>();
-//        serviceProps.put("test.int", new Integer(42));
-//        serviceProps.put(Constants.OBJECTCLASS, new String [] {"org.apache.Foo"});
-//        ServiceReference sref = mockServiceReference(serviceProps);
-//
-//        Map<String, Object> m = new HashMap<String, Object>();
-//        m.put("x", "foo");
-//        m.put("aaa.bbb", Boolean.TRUE);
-//        ir.apply(sref, m);
-//        Map<String, Object> expected = new HashMap<String, Object>();
-//        expected.put("x", new Long(1));
-//        expected.put("aaa.bbb", Boolean.TRUE);
-//        assertEquals(expected, m);
-//    }
-//    
-//    public void testInterfaceRule6() {
-//        InterfaceRule ir = new InterfaceRule(null, "org.apache.Foo");
-//        ir.addPropMatch("test.int", "42");
-//        ir.addProperty("x", "1", Long.class.getName());        
-//        
-//        final Map<String, Object> serviceProps = new HashMap<String, Object>();
-//        serviceProps.put("test.int", new Integer(51));
-//        serviceProps.put(Constants.OBJECTCLASS, new String [] {"org.apache.Foo"});
-//        ServiceReference sref = mockServiceReference(serviceProps);
-//
-//        Map<String, Object> m = new HashMap<String, Object>();
-//        m.put("x", "foo");
-//        m.put("aaa.bbb", Boolean.TRUE);
-//        ir.apply(sref, m);
-//        Map<String, Object> expected = new HashMap<String, Object>();
-//        expected.put("x", "foo");
-//        expected.put("aaa.bbb", Boolean.TRUE);
-//        assertEquals(expected, m);
-//    }
-//
-//    private ServiceReference mockServiceReference(final Map<String, Object> serviceProps) {
-//        ServiceReference sref = EasyMock.createMock(ServiceReference.class);
-//        EasyMock.expect(sref.getProperty((String) EasyMock.anyObject())).andAnswer(new IAnswer<Object>() {            
-//            public Object answer() throws Throwable {
-//                return serviceProps.get(EasyMock.getCurrentArguments()[0]);
-//            }
-//        }).anyTimes();
-//        EasyMock.expect(sref.getPropertyKeys()).
-//            andReturn(serviceProps.keySet().toArray(new String [] {})).anyTimes();
-//        
-//        EasyMock.replay(sref);
-//        return sref;
-//    }
+    public void testInterfaceRuleGetBundle() {
+        Bundle b = EasyMock.createMock(Bundle.class);
+        EasyMock.replay(b);
+        InterfaceRule ir = new InterfaceRule(b, "org.apache.Foo");
+        assertSame(b, ir.getBundle());
+    }
+    
+    public void testInterfaceRule1() {
+        InterfaceRule ir = new InterfaceRule(null, "org.apache.Foo");
+        ir.addProperty("x", "y", String.class.getName());        
+        
+        final Map<String, Object> serviceProps = new HashMap<String, Object>();
+        serviceProps.put(Constants.OBJECTCLASS, new String [] {"a.b.C", "org.apache.Foo"});
+        ServiceReference sref = mockServiceReference(serviceProps);
+
+        Map<String, Object> m = new HashMap<String, Object>();
+        m.put("a", "b");
+        ir.apply(sref, m);
+        Map<String, Object> expected = new HashMap<String, Object>();
+        expected.put("a", "b");
+        expected.put("x", "y");
+        assertEquals(expected, m);
+    }
+    
+    public void testInterfaceRule2() {
+        InterfaceRule ir = new InterfaceRule(null, "org.apache.F(.*)");
+        ir.addPropMatch("boo", "baah");
+        ir.addProperty("x", "1", Integer.class.getName());        
+        ir.addProperty("aaa.bbb", "true", Boolean.class.getName());        
+        
+        final Map<String, Object> serviceProps = new HashMap<String, Object>();
+        serviceProps.put("boo", "baah");
+        serviceProps.put(Constants.OBJECTCLASS, new String [] {"a.b.C", "org.apache.Foo"});
+        ServiceReference sref = mockServiceReference(serviceProps);
+
+        Map<String, Object> m = new HashMap<String, Object>();
+        ir.apply(sref, m);
+        Map<String, Object> expected = new HashMap<String, Object>();
+        expected.put("x", new Integer(1));
+        expected.put("aaa.bbb", Boolean.TRUE);
+        assertEquals(expected, m);
+    }
+
+    public void testInterfaceRule3() {
+        InterfaceRule ir = new InterfaceRule(null, "org.apache.F(.*)");
+        ir.addProperty("x", "y", String.class.getName());        
+        
+        final Map<String, Object> serviceProps = new HashMap<String, Object>();
+        serviceProps.put("boo", "baah");
+        serviceProps.put(Constants.OBJECTCLASS, new String [] {"org.apache.Boo"});
+        ServiceReference sref = mockServiceReference(serviceProps);
+
+        Map<String, Object> m = new HashMap<String, Object>();
+        ir.apply(sref, m);
+        assertEquals(0, m.size());
+    }
+
+    public void testInterfaceRule4() {
+        InterfaceRule ir = new InterfaceRule(null, "org.apache.F(.*)");
+        ir.addPropMatch("boo", "baah");
+        ir.addProperty("x", "y", String.class.getName());        
+        
+        final Map<String, Object> serviceProps = new HashMap<String, Object>();
+        serviceProps.put(Constants.OBJECTCLASS, new String [] {"org.apache.Foo"});
+        ServiceReference sref = mockServiceReference(serviceProps);
+
+        Map<String, Object> m = new HashMap<String, Object>();
+        ir.apply(sref, m);
+        assertEquals(0, m.size());
+    }
+
+    public void testInterfaceRule5() {
+        InterfaceRule ir = new InterfaceRule(null, "org.apache.Foo");
+        ir.addPropMatch("test.int", "42");
+        ir.addProperty("x", "1", Long.class.getName());        
+        
+        final Map<String, Object> serviceProps = new HashMap<String, Object>();
+        serviceProps.put("test.int", new Integer(42));
+        serviceProps.put(Constants.OBJECTCLASS, new String [] {"org.apache.Foo"});
+        ServiceReference sref = mockServiceReference(serviceProps);
+
+        Map<String, Object> m = new HashMap<String, Object>();
+        m.put("x", "foo");
+        m.put("aaa.bbb", Boolean.TRUE);
+        ir.apply(sref, m);
+        Map<String, Object> expected = new HashMap<String, Object>();
+        expected.put("x", new Long(1));
+        expected.put("aaa.bbb", Boolean.TRUE);
+        assertEquals(expected, m);
+    }
+    
+    public void testInterfaceRule6() {
+        InterfaceRule ir = new InterfaceRule(null, "org.apache.Foo");
+        ir.addPropMatch("test.int", "42");
+        ir.addProperty("x", "1", Long.class.getName());        
+        
+        final Map<String, Object> serviceProps = new HashMap<String, Object>();
+        serviceProps.put("test.int", new Integer(51));
+        serviceProps.put(Constants.OBJECTCLASS, new String [] {"org.apache.Foo"});
+        ServiceReference sref = mockServiceReference(serviceProps);
+
+        Map<String, Object> m = new HashMap<String, Object>();
+        m.put("x", "foo");
+        m.put("aaa.bbb", Boolean.TRUE);
+        ir.apply(sref, m);
+        Map<String, Object> expected = new HashMap<String, Object>();
+        expected.put("x", "foo");
+        expected.put("aaa.bbb", Boolean.TRUE);
+        assertEquals(expected, m);
+    }
+
+    private ServiceReference mockServiceReference(final Map<String, Object> serviceProps) {
+        ServiceReference sref = EasyMock.createMock(ServiceReference.class);
+        EasyMock.expect(sref.getProperty((String) EasyMock.anyObject())).andAnswer(new IAnswer<Object>() {            
+            public Object answer() throws Throwable {
+                return serviceProps.get(EasyMock.getCurrentArguments()[0]);
+            }
+        }).anyTimes();
+        EasyMock.expect(sref.getPropertyKeys()).
+            andReturn(serviceProps.keySet().toArray(new String [] {})).anyTimes();
+        
+        EasyMock.replay(sref);
+        return sref;
+    }
 }

Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecoratorImplTest.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecoratorImplTest.java?rev=898744&r1=898743&r2=898744&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecoratorImplTest.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecoratorImplTest.java Wed Jan 13 13:28:38 2010
@@ -44,254 +44,254 @@
         assertTrue(true);
     }
     
-//    public void testServiceDecorator() {
-//        final BundleListener[] bundleListener = new BundleListener[1]; 
-//        
-//        BundleContext bc = EasyMock.createMock(BundleContext.class);
-//        bc.addBundleListener((BundleListener) EasyMock.anyObject());
-//        EasyMock.expectLastCall().andAnswer(new IAnswer<Object>() {            
-//            public Object answer() throws Throwable {
-//                bundleListener[0] = (BundleListener) EasyMock.getCurrentArguments()[0];
-//                return null;
-//            }
-//        });
-//        EasyMock.replay(bc);
-//        
-//        ServiceDecoratorImpl sd = new ServiceDecoratorImpl(bc);
-//        EasyMock.verify(bc);
-//        assertNotNull(bundleListener[0]);
-//        
-//        EasyMock.reset(bc);
-//        bc.removeBundleListener(bundleListener[0]);
-//        EasyMock.replay(bc);
-//        sd.shutdown();
-//        
-//        EasyMock.verify(bc);
-//    }
-//    
-//    public void testGetDecoratorElements() {
-//        Bundle b = EasyMock.createMock(Bundle.class);
-//        EasyMock.expect(b.findEntries("OSGI-INF/remote-service", "*.xml", false)).andReturn(
-//            Collections.enumeration(Arrays.asList(getClass().getResource("/test-resources/sd.xml")))).anyTimes();
-//        EasyMock.replay(b);
-//
-//        List<Element> elements = ServiceDecoratorImpl.getDecorationElements(b);
-//        assertEquals(1, elements.size());
-//        assertEquals("service-decoration", elements.get(0).getName());
-//        assertEquals("http://cxf.apache.org/xmlns/service-decoration/1.0.0", elements.get(0).getNamespaceURI());
-//    }
-//
-//    public void testGetDecoratorElements2() {
-//        Bundle b = EasyMock.createMock(Bundle.class);
-//        EasyMock.expect(b.findEntries("OSGI-INF/remote-service", "*.xml", false)).andReturn(null).anyTimes();
-//        EasyMock.replay(b);
-//
-//        List<Element> elements = ServiceDecoratorImpl.getDecorationElements(b);
-//        assertEquals(0, elements.size());
-//    }
-//
-//    public void testAddRemoveDecorations() {
-//        URL res = getClass().getResource("/test-resources/sd.xml");
-//        final Map<String, Object> serviceProps = new HashMap<String, Object>();
-//        serviceProps.put(Constants.OBJECTCLASS, new String [] {"org.acme.foo.Bar"});
-//        serviceProps.put("test.prop", "xyz");
-//        
-//        Bundle b = EasyMock.createMock(Bundle.class);
-//        EasyMock.expect(b.findEntries("OSGI-INF/remote-service", "*.xml", false)).andReturn(
-//            Collections.enumeration(Arrays.asList(res))).anyTimes();
-//        EasyMock.replay(b);
-//
-//        BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
-//        EasyMock.replay(bc);
-//        ServiceDecoratorImpl sd = new ServiceDecoratorImpl(bc);
-//        assertEquals("Precondition failed", 0, sd.decorations.size());
-//        sd.addDecorations(b);
-//        assertEquals(1, sd.decorations.size());
-//        
-//        Map<String, Object> target = new HashMap<String, Object>();
-//        ServiceReference sref = EasyMock.createMock(ServiceReference.class);
-//        EasyMock.expect(sref.getProperty((String) EasyMock.anyObject())).andAnswer(new IAnswer<Object>() {
-//            public Object answer() throws Throwable {
-//                return serviceProps.get(EasyMock.getCurrentArguments()[0]);
-//            }
-//        }).anyTimes();
-//        EasyMock.replay(sref);
-//        sd.decorate(sref, target);
-//        
-//        Map<String, Object> expected = new HashMap<String, Object>();
-//        expected.put("test.too", "ahaha");
-//        assertEquals(expected, target);
-//        
-//        // remove it again
-//        sd.removeDecorations(b);
-//        assertEquals(0, sd.decorations.size());
-//        Map<String, Object> target2 = new HashMap<String, Object>();
-//        sd.decorate(sref, target2);        
-//        Map<String, Object> expected2 = new HashMap<String, Object>();
-//        assertEquals(expected2, target2);
-//    }
-//   
-//    public void testAddDecorations() {
-//        URL res = getClass().getResource("/test-resources/sd.xml");
-//        final Map<String, Object> serviceProps = new HashMap<String, Object>();
-//        serviceProps.put(Constants.OBJECTCLASS, new String [] {"org.acme.foo.Bar"});
-//        serviceProps.put("test.prop", "xyz");
-//        
-//        Map<String, Object> target = testDecorate(serviceProps, res);
-//        Map<String, Object> expected = new HashMap<String, Object>();
-//        expected.put("test.too", "ahaha");
-//        assertEquals(expected, target);
-//    }
-//    
-//    public void testAddDecorations1() {
-//        URL r1 = getClass().getResource("/test-resources/sd1.xml");
-//        URL r2 = getClass().getResource("/test-resources/sd2.xml");
-//        
-//        Map<String, Object> serviceProps = new HashMap<String, Object>();
-//        serviceProps.put(Constants.OBJECTCLASS, new String [] {"org.test.A"});
-//
-//        Map<String, Object> actual = testDecorate(serviceProps, r1, r2);
-//        Map<String, Object> expected = new HashMap<String, Object>();
-//        expected.put("A", "B");
-//        expected.put("C", new Integer(2));
-//        assertEquals(expected, actual);
-//    }
-//
-//    public void testAddDecorations2() {
-//        URL r1 = getClass().getResource("/test-resources/sd1.xml");
-//        URL r2 = getClass().getResource("/test-resources/sd2.xml");
-//        
-//        Map<String, Object> serviceProps = new HashMap<String, Object>();
-//        serviceProps.put(Constants.OBJECTCLASS, new String [] {"org.test.D"});
-//
-//        Map<String, Object> actual = testDecorate(serviceProps, r1, r2);
-//        Map<String, Object> expected = new HashMap<String, Object>();
-//        assertEquals(expected, actual);
-//    }
-//
-//    public void testAddDecorations3() {
-//        URL r1 = getClass().getResource("/test-resources/sd1.xml");
-//        URL r2 = getClass().getResource("/test-resources/sd2.xml");
-//        
-//        Map<String, Object> serviceProps = new HashMap<String, Object>();
-//        serviceProps.put(Constants.OBJECTCLASS, new String [] {"org.test.B"});
-//        serviceProps.put("x", "y");
-//
-//        Map<String, Object> actual = testDecorate(serviceProps, r1, r2);
-//        Map<String, Object> expected = new HashMap<String, Object>();
-//        expected.put("bool", Boolean.TRUE);
-//        assertEquals(expected, actual);
-//    }
-//
-//    public void testAddDecorations4() {
-//        URL r1 = getClass().getResource("/test-resources/sd1.xml");
-//        URL r2 = getClass().getResource("/test-resources/sd2.xml");
-//        
-//        Map<String, Object> serviceProps = new HashMap<String, Object>();
-//        serviceProps.put(Constants.OBJECTCLASS, new String [] {"org.test.C"});
-//        serviceProps.put("x", "z");
-//
-//        Map<String, Object> actual = testDecorate(serviceProps, r1, r2);
-//        Map<String, Object> expected = new HashMap<String, Object>();
-//        expected.put("bool", Boolean.FALSE);
-//        assertEquals(expected, actual);
-//    }
-//
-//    public void testAddDecorations5() {
-//        URL r1 = getClass().getResource("/test-resources/sd1.xml");
-//        URL r2 = getClass().getResource("/test-resources/sd2.xml");
-//        
-//        Map<String, Object> serviceProps = new HashMap<String, Object>();
-//        serviceProps.put(Constants.OBJECTCLASS, new String [] {"org.test.C"});
-//        serviceProps.put("x", "x");
-//
-//        Map<String, Object> actual = testDecorate(serviceProps, r1, r2);
-//        Map<String, Object> expected = new HashMap<String, Object>();
-//        assertEquals(expected, actual);
-//    }
-//
-//    public void testAddDecorations6() {
-//        URL r1 = getClass().getResource("/test-resources/sd0.xml");
-//        
-//        Map<String, Object> serviceProps = new HashMap<String, Object>();
-//        serviceProps.put(Constants.OBJECTCLASS, new String [] {"org.test.D"});
-//
-//        Map<String, Object> actual = testDecorate(serviceProps, r1);
-//        Map<String, Object> expected = new HashMap<String, Object>();
-//        assertEquals(expected, actual);
-//    }
-//
-//    public void testAddDecorations7() {
-//        URL r1 = getClass().getResource("/test-resources/sd-1.xml");
-//        
-//        Map<String, Object> serviceProps = new HashMap<String, Object>();
-//        serviceProps.put(Constants.OBJECTCLASS, new String [] {"org.test.D"});
-//
-//        Map<String, Object> actual = testDecorate(serviceProps, r1);
-//        Map<String, Object> expected = new HashMap<String, Object>();
-//        assertEquals(expected, actual);
-//    }
-//
-//    private Map<String, Object> testDecorate(final Map<String, Object> serviceProps, URL ... resources) {
-//        Bundle b = EasyMock.createMock(Bundle.class);
-//        EasyMock.expect(b.findEntries("OSGI-INF/remote-service", "*.xml", false)).andReturn(
-//            Collections.enumeration(Arrays.asList(resources))).anyTimes();
-//        EasyMock.replay(b);
-//
-//        BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
-//        EasyMock.replay(bc);
-//        ServiceDecoratorImpl sd = new ServiceDecoratorImpl(bc);
-//        sd.addDecorations(b);
-//        
-//        Map<String, Object> target = new HashMap<String, Object>();
-//        ServiceReference sref = EasyMock.createMock(ServiceReference.class);
-//        EasyMock.expect(sref.getProperty((String) EasyMock.anyObject())).andAnswer(new IAnswer<Object>() {
-//            public Object answer() throws Throwable {
-//                return serviceProps.get(EasyMock.getCurrentArguments()[0]);
-//            }
-//        }).anyTimes();
-//        EasyMock.replay(sref);
-//        sd.decorate(sref, target);
-//        return target;
-//    }
-//    
-//    public void testBundleListener() {
-//        final BundleListener[] bundleListener = new BundleListener[1]; 
-//        
-//        BundleContext bc = EasyMock.createMock(BundleContext.class);
-//        bc.addBundleListener((BundleListener) EasyMock.anyObject());
-//        EasyMock.expectLastCall().andAnswer(new IAnswer<Object>() {            
-//            public Object answer() throws Throwable {
-//                bundleListener[0] = (BundleListener) EasyMock.getCurrentArguments()[0];
-//                return null;
-//            }
-//        });
-//        EasyMock.replay(bc);
-//        
-//        final List<String> called = new ArrayList<String>();
-//        new ServiceDecoratorImpl(bc) {
-//            @Override
-//            void addDecorations(Bundle bundle) {
-//                called.add("addDecorations");
-//            }
-//
-//            @Override
-//            void removeDecorations(Bundle bundle) {
-//                called.add("removeDecorations");
-//            }            
-//        };
-//        
-//        Bundle b = EasyMock.createMock(Bundle.class);
-//        EasyMock.replay(b);
-//        
-//        assertEquals("Precondition failed", 0, called.size());
-//        bundleListener[0].bundleChanged(new BundleEvent(BundleEvent.INSTALLED, b));
-//        assertEquals(0, called.size());
-//        
-//        bundleListener[0].bundleChanged(new BundleEvent(BundleEvent.STARTED, b));
-//        assertEquals(Arrays.asList("addDecorations"), called);
-//        
-//        bundleListener[0].bundleChanged(new BundleEvent(BundleEvent.STOPPING, b));
-//        assertEquals(Arrays.asList("addDecorations", "removeDecorations"), called);
-//    }
+    public void testServiceDecorator() {
+        final BundleListener[] bundleListener = new BundleListener[1]; 
+        
+        BundleContext bc = EasyMock.createMock(BundleContext.class);
+        bc.addBundleListener((BundleListener) EasyMock.anyObject());
+        EasyMock.expectLastCall().andAnswer(new IAnswer<Object>() {            
+            public Object answer() throws Throwable {
+                bundleListener[0] = (BundleListener) EasyMock.getCurrentArguments()[0];
+                return null;
+            }
+        });
+        EasyMock.replay(bc);
+        
+        ServiceDecoratorImpl sd = new ServiceDecoratorImpl(bc);
+        EasyMock.verify(bc);
+        assertNotNull(bundleListener[0]);
+        
+        EasyMock.reset(bc);
+        bc.removeBundleListener(bundleListener[0]);
+        EasyMock.replay(bc);
+        sd.shutdown();
+        
+        EasyMock.verify(bc);
+    }
+    
+    public void testGetDecoratorElements() {
+        Bundle b = EasyMock.createMock(Bundle.class);
+        EasyMock.expect(b.findEntries("OSGI-INF/remote-service", "*.xml", false)).andReturn(
+            Collections.enumeration(Arrays.asList(getClass().getResource("/test-resources/sd.xml")))).anyTimes();
+        EasyMock.replay(b);
+
+        List<Element> elements = ServiceDecoratorImpl.getDecorationElements(b);
+        assertEquals(1, elements.size());
+        assertEquals("service-decoration", elements.get(0).getName());
+        assertEquals("http://cxf.apache.org/xmlns/service-decoration/1.0.0", elements.get(0).getNamespaceURI());
+    }
+
+    public void testGetDecoratorElements2() {
+        Bundle b = EasyMock.createMock(Bundle.class);
+        EasyMock.expect(b.findEntries("OSGI-INF/remote-service", "*.xml", false)).andReturn(null).anyTimes();
+        EasyMock.replay(b);
+
+        List<Element> elements = ServiceDecoratorImpl.getDecorationElements(b);
+        assertEquals(0, elements.size());
+    }
+
+    public void testAddRemoveDecorations() {
+        URL res = getClass().getResource("/test-resources/sd.xml");
+        final Map<String, Object> serviceProps = new HashMap<String, Object>();
+        serviceProps.put(Constants.OBJECTCLASS, new String [] {"org.acme.foo.Bar"});
+        serviceProps.put("test.prop", "xyz");
+        
+        Bundle b = EasyMock.createMock(Bundle.class);
+        EasyMock.expect(b.findEntries("OSGI-INF/remote-service", "*.xml", false)).andReturn(
+            Collections.enumeration(Arrays.asList(res))).anyTimes();
+        EasyMock.replay(b);
+
+        BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
+        EasyMock.replay(bc);
+        ServiceDecoratorImpl sd = new ServiceDecoratorImpl(bc);
+        assertEquals("Precondition failed", 0, sd.decorations.size());
+        sd.addDecorations(b);
+        assertEquals(1, sd.decorations.size());
+        
+        Map<String, Object> target = new HashMap<String, Object>();
+        ServiceReference sref = EasyMock.createMock(ServiceReference.class);
+        EasyMock.expect(sref.getProperty((String) EasyMock.anyObject())).andAnswer(new IAnswer<Object>() {
+            public Object answer() throws Throwable {
+                return serviceProps.get(EasyMock.getCurrentArguments()[0]);
+            }
+        }).anyTimes();
+        EasyMock.replay(sref);
+        sd.decorate(sref, target);
+        
+        Map<String, Object> expected = new HashMap<String, Object>();
+        expected.put("test.too", "ahaha");
+        assertEquals(expected, target);
+        
+        // remove it again
+        sd.removeDecorations(b);
+        assertEquals(0, sd.decorations.size());
+        Map<String, Object> target2 = new HashMap<String, Object>();
+        sd.decorate(sref, target2);        
+        Map<String, Object> expected2 = new HashMap<String, Object>();
+        assertEquals(expected2, target2);
+    }
+   
+    public void testAddDecorations() {
+        URL res = getClass().getResource("/test-resources/sd.xml");
+        final Map<String, Object> serviceProps = new HashMap<String, Object>();
+        serviceProps.put(Constants.OBJECTCLASS, new String [] {"org.acme.foo.Bar"});
+        serviceProps.put("test.prop", "xyz");
+        
+        Map<String, Object> target = testDecorate(serviceProps, res);
+        Map<String, Object> expected = new HashMap<String, Object>();
+        expected.put("test.too", "ahaha");
+        assertEquals(expected, target);
+    }
+    
+    public void testAddDecorations1() {
+        URL r1 = getClass().getResource("/test-resources/sd1.xml");
+        URL r2 = getClass().getResource("/test-resources/sd2.xml");
+        
+        Map<String, Object> serviceProps = new HashMap<String, Object>();
+        serviceProps.put(Constants.OBJECTCLASS, new String [] {"org.test.A"});
+
+        Map<String, Object> actual = testDecorate(serviceProps, r1, r2);
+        Map<String, Object> expected = new HashMap<String, Object>();
+        expected.put("A", "B");
+        expected.put("C", new Integer(2));
+        assertEquals(expected, actual);
+    }
+
+    public void testAddDecorations2() {
+        URL r1 = getClass().getResource("/test-resources/sd1.xml");
+        URL r2 = getClass().getResource("/test-resources/sd2.xml");
+        
+        Map<String, Object> serviceProps = new HashMap<String, Object>();
+        serviceProps.put(Constants.OBJECTCLASS, new String [] {"org.test.D"});
+
+        Map<String, Object> actual = testDecorate(serviceProps, r1, r2);
+        Map<String, Object> expected = new HashMap<String, Object>();
+        assertEquals(expected, actual);
+    }
+
+    public void testAddDecorations3() {
+        URL r1 = getClass().getResource("/test-resources/sd1.xml");
+        URL r2 = getClass().getResource("/test-resources/sd2.xml");
+        
+        Map<String, Object> serviceProps = new HashMap<String, Object>();
+        serviceProps.put(Constants.OBJECTCLASS, new String [] {"org.test.B"});
+        serviceProps.put("x", "y");
+
+        Map<String, Object> actual = testDecorate(serviceProps, r1, r2);
+        Map<String, Object> expected = new HashMap<String, Object>();
+        expected.put("bool", Boolean.TRUE);
+        assertEquals(expected, actual);
+    }
+
+    public void testAddDecorations4() {
+        URL r1 = getClass().getResource("/test-resources/sd1.xml");
+        URL r2 = getClass().getResource("/test-resources/sd2.xml");
+        
+        Map<String, Object> serviceProps = new HashMap<String, Object>();
+        serviceProps.put(Constants.OBJECTCLASS, new String [] {"org.test.C"});
+        serviceProps.put("x", "z");
+
+        Map<String, Object> actual = testDecorate(serviceProps, r1, r2);
+        Map<String, Object> expected = new HashMap<String, Object>();
+        expected.put("bool", Boolean.FALSE);
+        assertEquals(expected, actual);
+    }
+
+    public void testAddDecorations5() {
+        URL r1 = getClass().getResource("/test-resources/sd1.xml");
+        URL r2 = getClass().getResource("/test-resources/sd2.xml");
+        
+        Map<String, Object> serviceProps = new HashMap<String, Object>();
+        serviceProps.put(Constants.OBJECTCLASS, new String [] {"org.test.C"});
+        serviceProps.put("x", "x");
+
+        Map<String, Object> actual = testDecorate(serviceProps, r1, r2);
+        Map<String, Object> expected = new HashMap<String, Object>();
+        assertEquals(expected, actual);
+    }
+
+    public void testAddDecorations6() {
+        URL r1 = getClass().getResource("/test-resources/sd0.xml");
+        
+        Map<String, Object> serviceProps = new HashMap<String, Object>();
+        serviceProps.put(Constants.OBJECTCLASS, new String [] {"org.test.D"});
+
+        Map<String, Object> actual = testDecorate(serviceProps, r1);
+        Map<String, Object> expected = new HashMap<String, Object>();
+        assertEquals(expected, actual);
+    }
+
+    public void testAddDecorations7() {
+        URL r1 = getClass().getResource("/test-resources/sd-1.xml");
+        
+        Map<String, Object> serviceProps = new HashMap<String, Object>();
+        serviceProps.put(Constants.OBJECTCLASS, new String [] {"org.test.D"});
+
+        Map<String, Object> actual = testDecorate(serviceProps, r1);
+        Map<String, Object> expected = new HashMap<String, Object>();
+        assertEquals(expected, actual);
+    }
+
+    private Map<String, Object> testDecorate(final Map<String, Object> serviceProps, URL ... resources) {
+        Bundle b = EasyMock.createMock(Bundle.class);
+        EasyMock.expect(b.findEntries("OSGI-INF/remote-service", "*.xml", false)).andReturn(
+            Collections.enumeration(Arrays.asList(resources))).anyTimes();
+        EasyMock.replay(b);
+
+        BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
+        EasyMock.replay(bc);
+        ServiceDecoratorImpl sd = new ServiceDecoratorImpl(bc);
+        sd.addDecorations(b);
+        
+        Map<String, Object> target = new HashMap<String, Object>();
+        ServiceReference sref = EasyMock.createMock(ServiceReference.class);
+        EasyMock.expect(sref.getProperty((String) EasyMock.anyObject())).andAnswer(new IAnswer<Object>() {
+            public Object answer() throws Throwable {
+                return serviceProps.get(EasyMock.getCurrentArguments()[0]);
+            }
+        }).anyTimes();
+        EasyMock.replay(sref);
+        sd.decorate(sref, target);
+        return target;
+    }
+    
+    public void testBundleListener() {
+        final BundleListener[] bundleListener = new BundleListener[1]; 
+        
+        BundleContext bc = EasyMock.createMock(BundleContext.class);
+        bc.addBundleListener((BundleListener) EasyMock.anyObject());
+        EasyMock.expectLastCall().andAnswer(new IAnswer<Object>() {            
+            public Object answer() throws Throwable {
+                bundleListener[0] = (BundleListener) EasyMock.getCurrentArguments()[0];
+                return null;
+            }
+        });
+        EasyMock.replay(bc);
+        
+        final List<String> called = new ArrayList<String>();
+        new ServiceDecoratorImpl(bc) {
+            @Override
+            void addDecorations(Bundle bundle) {
+                called.add("addDecorations");
+            }
+
+            @Override
+            void removeDecorations(Bundle bundle) {
+                called.add("removeDecorations");
+            }            
+        };
+        
+        Bundle b = EasyMock.createMock(Bundle.class);
+        EasyMock.replay(b);
+        
+        assertEquals("Precondition failed", 0, called.size());
+        bundleListener[0].bundleChanged(new BundleEvent(BundleEvent.INSTALLED, b));
+        assertEquals(0, called.size());
+        
+        bundleListener[0].bundleChanged(new BundleEvent(BundleEvent.STARTED, b));
+        assertEquals(Arrays.asList("addDecorations"), called);
+        
+        bundleListener[0].bundleChanged(new BundleEvent(BundleEvent.STOPPING, b));
+        assertEquals(Arrays.asList("addDecorations", "removeDecorations"), called);
+    }
 }

Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ClientServiceFactoryTest.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ClientServiceFactoryTest.java?rev=898744&r1=898743&r2=898744&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ClientServiceFactoryTest.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ClientServiceFactoryTest.java Wed Jan 13 13:28:38 2010
@@ -23,49 +23,48 @@
 
 import junit.framework.TestCase;
 
+import org.apache.cxf.dosgi.dsw.hooks.TestService;
 import org.apache.cxf.dosgi.dsw.service.ImportRegistrationImpl;
 import org.easymock.EasyMock;
 import org.easymock.IMocksControl;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
 import org.osgi.framework.ServiceReference;
 import org.osgi.framework.ServiceRegistration;
-import org.osgi.service.discovery.ServiceEndpointDescription;
 import org.osgi.service.remoteserviceadmin.EndpointDescription;
 import org.osgi.service.remoteserviceadmin.RemoteConstants;
-import org.osgi.service.remoteserviceadmin.RemoteServiceAdmin;
 
 public class ClientServiceFactoryTest extends TestCase {
     
-    public void testDUMMY(){
-        assertTrue(true);
-    }
-    
     public void testGetService() {
-//        Object myTestProxyObject = new Object();
-//        
-//        IMocksControl control = EasyMock.createNiceControl();
-//        BundleContext dswContext = control.createMock(BundleContext.class);
-//        Map map = new HashMap();
-//        map.put(RemoteConstants.SERVICE_REMOTE_URI, "http://google.de");
-//        EndpointDescription ed = new EndpointDescription(map);
-//        ConfigurationTypeHandler handler = control.createMock(ConfigurationTypeHandler.class);
-//
-//        ImportRegistrationImpl iri = control.createMock(ImportRegistrationImpl.class);
-//        
-//        BundleContext requestingContext = control.createMock(BundleContext.class);
-//        Bundle requestingBundle = control.createMock(Bundle.class);
-//        EasyMock.expect(requestingBundle.getBundleContext()).andReturn(requestingContext);
-//        
-//        ServiceReference sr = control.createMock(ServiceReference.class);
-//        ServiceRegistration sreg = control.createMock(ServiceRegistration.class);
-//        EasyMock.expect(sreg.getReference()).andReturn(sr);
-//        
-//        handler.createProxy(sr, dswContext, requestingContext, String.class, ed);
-//        EasyMock.expectLastCall().andReturn(myTestProxyObject);        
-//        control.replay();       
-//        
-//        ClientServiceFactory csf = new ClientServiceFactory(dswContext, String.class, ed, handler,iri);
-//        assertSame(myTestProxyObject, csf.getService(requestingBundle, sreg));
+        Object myTestProxyObject = new Object();
+        
+        IMocksControl control = EasyMock.createNiceControl();
+        BundleContext dswContext = control.createMock(BundleContext.class);
+        Map<String, Object> map = new HashMap<String,Object>();
+        map.put(RemoteConstants.ENDPOINT_ID, "http://google.de");
+        map.put(RemoteConstants.SERVICE_IMPORTED_CONFIGS, "myGreatConfiguration");
+        map.put(Constants.OBJECTCLASS, new String[]{"my.class"});
+        
+        EndpointDescription ed = new EndpointDescription(map);
+        ConfigurationTypeHandler handler = control.createMock(ConfigurationTypeHandler.class);
+
+        ImportRegistrationImpl iri = new ImportRegistrationImpl(ed, null);
+        
+        BundleContext requestingContext = control.createMock(BundleContext.class);
+        Bundle requestingBundle = control.createMock(Bundle.class);
+        EasyMock.expect(requestingBundle.getBundleContext()).andReturn(requestingContext);
+        
+        ServiceReference sr = control.createMock(ServiceReference.class);
+        ServiceRegistration sreg = control.createMock(ServiceRegistration.class);
+        EasyMock.expect(sreg.getReference()).andReturn(sr);
+        
+        handler.createProxy(sr, dswContext, requestingContext, String.class, ed);
+        EasyMock.expectLastCall().andReturn(myTestProxyObject);        
+        control.replay();       
+        
+        ClientServiceFactory csf = new ClientServiceFactory(dswContext, String.class, ed, handler,iri);
+        assertSame(myTestProxyObject, csf.getService(requestingBundle, sreg));
     }
 }

Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ConfigTypeHandlerFactoryTest.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ConfigTypeHandlerFactoryTest.java?rev=898744&r1=898743&r2=898744&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ConfigTypeHandlerFactoryTest.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ConfigTypeHandlerFactoryTest.java Wed Jan 13 13:28:38 2010
@@ -1,176 +1,142 @@
 /** 
-  * 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. 
-  */
+ * 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.cxf.dosgi.dsw.handlers;
 
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
 import junit.framework.TestCase;
 
+import org.apache.cxf.dosgi.dsw.Constants;
+import org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminCore;
+import org.easymock.EasyMock;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.remoteserviceadmin.EndpointDescription;
+import org.osgi.service.remoteserviceadmin.RemoteConstants;
 
 public class ConfigTypeHandlerFactoryTest extends TestCase {
-    
-    public void testDUMMY(){
-        assertTrue(true);
-    }
-    
-//    public void testGetDefaultHandler() {
-//        BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
-//        EasyMock.replay(bc);
-//        
-//        ConfigTypeHandlerFactory f = ConfigTypeHandlerFactory.getInstance();
-//        
-//        ServiceEndpointDescription sd = new ServiceEndpointDescriptionImpl("MyInterface");
-//        CxfRemoteServiceAdmin dp = new RemoteServiceAdminCore(bc);
-//        ConfigurationTypeHandler handler = f.getHandler(bc, sd, dp, new HashMap<String, Object>());
-//        assertTrue(handler instanceof PojoConfigurationTypeHandler);        
-//        assertSame(dp, ((PojoConfigurationTypeHandler) handler).getDistributionProvider());
-//    }
-//    
-//    
-//    public void testGetJaxrsHandlerNoIntents() {
-//        BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
-//        EasyMock.replay(bc);
-//        
-//        ConfigTypeHandlerFactory f = ConfigTypeHandlerFactory.getInstance();
-//        Map<String, Object> props = new HashMap<String, Object>();
-//        props.put(Constants.EXPORTED_CONFIGS, Constants.RS_CONFIG_TYPE);
-//        
-//        ServiceEndpointDescription sd = new ServiceEndpointDescriptionImpl("MyInterface", props);
-//        CxfRemoteServiceAdmin dp = new RemoteServiceAdminCore(bc);
-//        ConfigurationTypeHandler handler = f.getHandler(bc, sd, dp, new HashMap<String, Object>());
-//        assertTrue(handler instanceof JaxRSPojoConfigurationTypeHandler);        
-//        assertSame(dp, ((PojoConfigurationTypeHandler) handler).getDistributionProvider());
-//    }
-//    
-//    public void testGetJaxrsHandlerHttpIntents() {
-//        BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
-//        EasyMock.replay(bc);
-//        
-//        ConfigTypeHandlerFactory f = ConfigTypeHandlerFactory.getInstance();
-//        Map<String, Object> props = new HashMap<String, Object>();
-//        props.put(Constants.EXPORTED_CONFIGS, Constants.RS_CONFIG_TYPE);
-//        props.put(Constants.EXPORTED_INTENTS, "HTTP");
-//        
-//        ServiceEndpointDescription sd = new ServiceEndpointDescriptionImpl("MyInterface", props);
-//        CxfRemoteServiceAdmin dp = new RemoteServiceAdminCore(bc);
-//        ConfigurationTypeHandler handler = f.getHandler(bc, sd, dp, new HashMap<String, Object>());
-//        assertTrue(handler instanceof JaxRSPojoConfigurationTypeHandler);        
-//        assertSame(dp, ((PojoConfigurationTypeHandler) handler).getDistributionProvider());
-//    }
-//    
-//    public void testJaxrsPropertyIgnored() {
-//        BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
-//        EasyMock.replay(bc);
-//        
-//        ConfigTypeHandlerFactory f = ConfigTypeHandlerFactory.getInstance();
-//        Map<String, Object> props = new HashMap<String, Object>();
-//        props.put(Constants.EXPORTED_CONFIGS, Constants.RS_CONFIG_TYPE);
-//        props.put(Constants.EXPORTED_INTENTS, "SOAP HTTP");
-//        
-//        ServiceEndpointDescription sd = new ServiceEndpointDescriptionImpl("MyInterface", props);
-//        CxfRemoteServiceAdmin dp = new RemoteServiceAdminCore(bc);
-//        ConfigurationTypeHandler handler = f.getHandler(bc, sd, dp, new HashMap<String, Object>());
-//        assertTrue(handler instanceof PojoConfigurationTypeHandler);
-//        assertTrue(!(handler instanceof JaxRSPojoConfigurationTypeHandler));
-//        assertSame(dp, ((PojoConfigurationTypeHandler) handler).getDistributionProvider());
-//    }
-//    
-//    public void testGetPojoHandler() {
-//        BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
-//        EasyMock.replay(bc);
-//
-//        ConfigTypeHandlerFactory f = ConfigTypeHandlerFactory.getInstance();
-//        
-//        Map<String, Object> sdProps = new HashMap<String, Object>();
-//        sdProps.put("osgi.remote.configuration.type", Constants.WS_CONFIG_TYPE);
-//        ServiceEndpointDescription sd = new ServiceEndpointDescriptionImpl(
-//                Collections.singletonList("MyInterface"), sdProps);
-//
-//        CxfRemoteServiceAdmin dp = new RemoteServiceAdminCore(bc);
-//        ConfigurationTypeHandler handler = f.getHandler(bc, sd, dp, new HashMap<String, Object>());
-//        assertTrue(handler instanceof PojoConfigurationTypeHandler);        
-//        assertSame(dp, ((PojoConfigurationTypeHandler) handler).getDistributionProvider());
-//    }
-//    
-//    public void testGetPojoHandler2() {
-//        BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
-//        EasyMock.replay(bc);
-//
-//        ConfigTypeHandlerFactory f = ConfigTypeHandlerFactory.getInstance();
-//        
-//        Map<String, Object> sdProps = new HashMap<String, Object>();
-//        // use default for this: sdProps.put(Constants.CONFIG_TYPE_PROPERTY, Constants.POJO_CONFIG_TYPE);
-//        sdProps.put(Constants.WS_ADDRESS_PROPERTY, "http://localhost:9876/abcd");
-//        ServiceEndpointDescription sd = new ServiceEndpointDescriptionImpl(
-//                Collections.singletonList("MyInterface"), sdProps);
-//
-//        CxfRemoteServiceAdmin dp = new RemoteServiceAdminCore(bc);
-//        ConfigurationTypeHandler handler = f.getHandler(bc, sd, dp, new HashMap<String, Object>());
-//        assertTrue(handler instanceof PojoConfigurationTypeHandler);        
-//        assertSame(dp, ((PojoConfigurationTypeHandler) handler).getDistributionProvider());
-//    }
-//
-//    public void testGetHttpServiceHandler() {
-//        BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
-//        EasyMock.replay(bc);
-//        
-//        ConfigTypeHandlerFactory f = ConfigTypeHandlerFactory.getInstance();
-//        
-//        Map<String, Object> sdProps = new HashMap<String, Object>();
-//        sdProps.put("osgi.remote.configuration.type", Constants.WS_CONFIG_TYPE);
-//        sdProps.put(Constants.WS_HTTP_SERVICE_CONTEXT, "/abc");
-//        ServiceEndpointDescription sd = new ServiceEndpointDescriptionImpl(
-//                Collections.singletonList("MyInterface"), sdProps);
-//        
-//        CxfRemoteServiceAdmin dp = new RemoteServiceAdminCore(bc);
-//        ConfigurationTypeHandler handler = f.getHandler(bc, sd, dp, new HashMap<String, Object>());
-//        assertTrue(handler instanceof HttpServiceConfigurationTypeHandler);
-//        assertSame(dp, ((HttpServiceConfigurationTypeHandler) handler).getDistributionProvider());                
-//    }
-//    
-//    public void testGetWSDLHandler() {
-//        BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
-//        EasyMock.replay(bc);
-//
-//        ConfigTypeHandlerFactory f = ConfigTypeHandlerFactory.getInstance();
-//        
-//        Map<String, Object> sdProps = new HashMap<String, Object>();
-//        sdProps.put("osgi.remote.configuration.type", Constants.WSDL_CONFIG_TYPE);
-//        ServiceEndpointDescription sd = new ServiceEndpointDescriptionImpl(
-//                Collections.singletonList("MyInterface"), sdProps);
-//        
-//        CxfRemoteServiceAdmin dp = new RemoteServiceAdminCore(bc);
-//        ConfigurationTypeHandler handler = f.getHandler(bc, sd, dp, new HashMap<String, Object>());
-//        assertTrue(handler instanceof WsdlConfigurationTypeHandler);        
-//        assertSame(dp, ((WsdlConfigurationTypeHandler) handler).getDistributionProvider());
-//    }
-//    
-//    public void testUnsupportedConfiguration() {
-//        BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
-//        EasyMock.replay(bc);
-//        
-//        ConfigTypeHandlerFactory f = ConfigTypeHandlerFactory.getInstance();
-//        
-//        Map<String, Object> sdProps = new HashMap<String, Object>();
-//        sdProps.put("osgi.remote.configuration.type", "foobar");
-//        ServiceEndpointDescription sd = new ServiceEndpointDescriptionImpl(
-//                Collections.singletonList("MyInterface"), sdProps);
-//        
-//        assertNull("Should not get a handler as this an unsupported config type", 
-//                f.getHandler(bc, sd, null, new HashMap<String, Object>()));        
-//    }
+
+    public void testGetJaxrsHandlerNoIntents() {
+        BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
+        EasyMock.replay(bc);
+
+        List<String> configs = new ArrayList<String>();
+        Map<String, Object> serviceProps = new HashMap<String, Object>();
+
+        ConfigTypeHandlerFactory f = ConfigTypeHandlerFactory.getInstance();
+
+        configs.add(Constants.RS_CONFIG_TYPE);
+
+        ConfigurationTypeHandler handler = f.getHandler(bc, configs, serviceProps, null);
+        assertTrue(handler instanceof JaxRSPojoConfigurationTypeHandler);
+    }
+
+    public void testGetJaxrsHandlerHttpIntents() {
+        BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
+        EasyMock.replay(bc);
+
+        List<String> configs = new ArrayList<String>();
+        Map<String, Object> serviceProps = new HashMap<String, Object>();
+
+        ConfigTypeHandlerFactory f = ConfigTypeHandlerFactory.getInstance();
+        configs.add(Constants.RS_CONFIG_TYPE);
+        serviceProps.put(Constants.EXPORTED_INTENTS, "HTTP");
+
+        ConfigurationTypeHandler handler = f.getHandler(bc, configs, serviceProps, null);
+        assertTrue(handler instanceof JaxRSPojoConfigurationTypeHandler);
+    }
+
+    public void testJaxrsPropertyIgnored() {
+        BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
+        EasyMock.replay(bc);
+
+        List<String> configs = new ArrayList<String>();
+        Map<String, Object> serviceProps = new HashMap<String, Object>();
+
+        ConfigTypeHandlerFactory f = ConfigTypeHandlerFactory.getInstance();
+        configs.add(Constants.RS_CONFIG_TYPE);
+        serviceProps.put(Constants.EXPORTED_INTENTS, "SOAP HTTP");
+
+        ConfigurationTypeHandler handler = f.getHandler(bc, configs, serviceProps, null);
+        assertTrue(handler instanceof PojoConfigurationTypeHandler);
+        assertTrue(!(handler instanceof JaxRSPojoConfigurationTypeHandler));
+    }
+
+    public void testGetPojoHandler() {
+        BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
+        EasyMock.replay(bc);
+
+        List<String> configs = new ArrayList<String>();
+        Map<String, Object> serviceProps = new HashMap<String, Object>();
+
+        ConfigTypeHandlerFactory f = ConfigTypeHandlerFactory.getInstance();
+        configs.add(Constants.WS_CONFIG_TYPE);
+
+        ConfigurationTypeHandler handler = f.getHandler(bc, configs, serviceProps, null);
+        assertTrue(handler instanceof PojoConfigurationTypeHandler);
+    }
+
+    public void testGetHttpServiceHandler() {
+        BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
+        EasyMock.replay(bc);
+
+        ConfigTypeHandlerFactory f = ConfigTypeHandlerFactory.getInstance();
+
+        List<String> configs = new ArrayList<String>();
+        Map<String, Object> serviceProps = new HashMap<String, Object>();
+
+        configs.add(Constants.WS_CONFIG_TYPE);
+        serviceProps.put(Constants.WS_HTTP_SERVICE_CONTEXT, "/abc");
+
+        ConfigurationTypeHandler handler = f.getHandler(bc, configs, serviceProps, null);
+        assertTrue(handler instanceof HttpServiceConfigurationTypeHandler);
+    }
+
+    public void testGetWSDLHandler() {
+        BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
+        EasyMock.replay(bc);
+
+        ConfigTypeHandlerFactory f = ConfigTypeHandlerFactory.getInstance();
+
+        List<String> configs = new ArrayList<String>();
+        Map<String, Object> serviceProps = new HashMap<String, Object>();
+        configs.add(Constants.WSDL_CONFIG_TYPE);
+
+        ConfigurationTypeHandler handler = f.getHandler(bc, configs, serviceProps, null);
+
+        assertTrue(handler instanceof WsdlConfigurationTypeHandler);
+    }
+
+    public void testUnsupportedConfiguration() {
+        BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
+        EasyMock.replay(bc);
+
+        ConfigTypeHandlerFactory f = ConfigTypeHandlerFactory.getInstance();
+
+        List<String> configs = new ArrayList<String>();
+        Map<String, Object> serviceProps = new HashMap<String, Object>();
+        configs.add("notSupportedConfig");
+
+        assertNull("Should not get a handler as this an unsupported config type", f.getHandler(bc, configs,
+                                                                                               serviceProps,
+                                                                                               null));
+    }
 }

Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceConfigurationTypeHandlerTest.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceConfigurationTypeHandlerTest.java?rev=898744&r1=898743&r2=898744&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceConfigurationTypeHandlerTest.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceConfigurationTypeHandlerTest.java Wed Jan 13 13:28:38 2010
@@ -18,31 +18,8 @@
   */
 package org.apache.cxf.dosgi.dsw.handlers;
 
-import java.net.InetAddress;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
 import junit.framework.TestCase;
 
-import org.apache.cxf.dosgi.dsw.Constants;
-import org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminCore;
-import org.apache.cxf.dosgi.dsw.service.ServiceEndpointDescriptionImpl;
-import org.apache.cxf.endpoint.AbstractEndpointFactory;
-import org.apache.cxf.endpoint.Server;
-import org.apache.cxf.feature.AbstractFeature;
-import org.apache.cxf.frontend.ServerFactoryBean;
-import org.apache.cxf.service.factory.ReflectionServiceFactoryBean;
-import org.apache.cxf.transport.Destination;
-import org.apache.cxf.ws.addressing.AttributedURIType;
-import org.apache.cxf.ws.addressing.EndpointReferenceType;
-import org.easymock.IAnswer;
-import org.easymock.classextension.EasyMock;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.discovery.ServiceEndpointDescription;
-import org.osgi.service.http.HttpService;
-
 public class HttpServiceConfigurationTypeHandlerTest extends TestCase {
     
     public void testDUMMY(){

Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSUtilsTest.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSUtilsTest.java?rev=898744&r1=898743&r2=898744&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSUtilsTest.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSUtilsTest.java Wed Jan 13 13:28:38 2010
@@ -1,21 +1,21 @@
 /** 
-  * 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. 
-  */
+ * 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.cxf.dosgi.dsw.handlers;
 
 import java.util.HashMap;
@@ -25,162 +25,184 @@
 import junit.framework.TestCase;
 
 import org.apache.cxf.dosgi.dsw.Constants;
-import org.apache.cxf.dosgi.dsw.service.ServiceEndpointDescriptionImpl;
 import org.apache.cxf.jaxrs.provider.AegisElementProvider;
 import org.apache.cxf.jaxrs.provider.JAXBElementProvider;
 import org.easymock.EasyMock;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceReference;
-import org.osgi.service.discovery.ServiceEndpointDescription;
+import org.osgi.service.remoteserviceadmin.EndpointDescription;
+import org.osgi.service.remoteserviceadmin.RemoteConstants;
 
-public class JaxRSUtilsTest extends TestCase  {
+public class JaxRSUtilsTest extends TestCase {
+
+    private void addRequiredProps(Map<String, Object> props) {
+        props.put(RemoteConstants.ENDPOINT_ID, "http://google.de");
+        props.put(RemoteConstants.SERVICE_IMPORTED_CONFIGS, "myGreatConfiguration");
+        props.put(org.osgi.framework.Constants.OBJECTCLASS, new String[] {
+            "my.class"
+        });
+    }
+
+    public void testNoGlobalProviders() {
+        Map<String, Object> props = new HashMap<String, Object>();
+
+        addRequiredProps(props);
+
+        props.put(Constants.RS_PROVIDER_GLOBAL_PROP_KEY, "false");
+
+        EndpointDescription sd = new EndpointDescription(props);
+
+        assertEquals(0, JaxRSUtils.getProviders(null, null, sd).size());
+    }
+
+    public void testAegisProvider() {
+        Map<String, Object> props = new HashMap<String, Object>();
+        props.put(Constants.RS_DATABINDING_PROP_KEY, "aegis");
+        props.put(Constants.RS_PROVIDER_GLOBAL_PROP_KEY, "false");
+
+        addRequiredProps(props);
+        EndpointDescription sd = new EndpointDescription(props);
+
+        List<Object> providers = JaxRSUtils.getProviders(null, null, sd);
+        assertEquals(1, providers.size());
+        assertEquals(AegisElementProvider.class.getName(), providers.get(0).getClass().getName());
+    }
+
+    public void testServiceProviders() {
+        Map<String, Object> props = new HashMap<String, Object>();
+        props.put(Constants.RS_PROVIDER_PROP_KEY, new Object[] {
+            new AegisElementProvider()
+        });
+        props.put(Constants.RS_PROVIDER_GLOBAL_PROP_KEY, "false");
+        addRequiredProps(props);
+        EndpointDescription sd = new EndpointDescription(props);
+
+        List<Object> providers = JaxRSUtils.getProviders(null, null, sd);
+        assertEquals(1, providers.size());
+        assertEquals(AegisElementProvider.class.getName(), providers.get(0).getClass().getName());
+    }
+
+    public void testServiceProviderProperty() throws Exception {
+
+        BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
+        Bundle bundle = EasyMock.createNiceMock(Bundle.class);
+        bc.getBundle();
+        EasyMock.expectLastCall().andReturn(bundle).times(2);
+        bundle.loadClass(AegisElementProvider.class.getName());
+        EasyMock.expectLastCall().andReturn(AegisElementProvider.class);
+        bundle.loadClass(JAXBElementProvider.class.getName());
+        EasyMock.expectLastCall().andReturn(JAXBElementProvider.class);
+        EasyMock.replay(bc, bundle);
+
+        Map<String, Object> props = new HashMap<String, Object>();
+        props.put(Constants.RS_PROVIDER_PROP_KEY,
+                  "\r\n org.apache.cxf.jaxrs.provider.AegisElementProvider , \r\n"
+                      + "org.apache.cxf.jaxrs.provider.JAXBElementProvider\r\n");
+
+        props.put(Constants.RS_PROVIDER_GLOBAL_PROP_KEY, "false");
+        addRequiredProps(props);
+        EndpointDescription sd = new EndpointDescription(props);
+
+        List<Object> providers = JaxRSUtils.getProviders(bc, null, sd);
+        assertEquals(2, providers.size());
+        assertEquals(AegisElementProvider.class.getName(), providers.get(0).getClass().getName());
+        assertEquals(JAXBElementProvider.class.getName(), providers.get(1).getClass().getName());
+    }
+
+    public void testServiceProviderStrings() throws Exception {
+
+        BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
+        Bundle bundle = EasyMock.createNiceMock(Bundle.class);
+        bc.getBundle();
+        EasyMock.expectLastCall().andReturn(bundle).times(2);
+        bundle.loadClass(AegisElementProvider.class.getName());
+        EasyMock.expectLastCall().andReturn(AegisElementProvider.class);
+        bundle.loadClass(JAXBElementProvider.class.getName());
+        EasyMock.expectLastCall().andReturn(JAXBElementProvider.class);
+        EasyMock.replay(bc, bundle);
+
+        Map<String, Object> props = new HashMap<String, Object>();
+        props.put(Constants.RS_PROVIDER_PROP_KEY, new String[] {
+            "\r\n org.apache.cxf.jaxrs.provider.AegisElementProvider",
+            "org.apache.cxf.jaxrs.provider.JAXBElementProvider\r\n"
+        });
+
+        props.put(Constants.RS_PROVIDER_GLOBAL_PROP_KEY, "false");
+        addRequiredProps(props);
+        EndpointDescription sd = new EndpointDescription(props);
+
+        List<Object> providers = JaxRSUtils.getProviders(bc, null, sd);
+        assertEquals(2, providers.size());
+        assertEquals(AegisElementProvider.class.getName(), providers.get(0).getClass().getName());
+        assertEquals(JAXBElementProvider.class.getName(), providers.get(1).getClass().getName());
+    }
+
+    public void testCustomGlobalProvider() throws Exception {
+        ServiceReference sref = EasyMock.createNiceMock(ServiceReference.class);
+        BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
+        bc.getServiceReferences(null, JaxRSUtils.PROVIDERS_FILTER);
+        EasyMock.expectLastCall().andReturn(new ServiceReference[] {
+            sref
+        });
+        sref.getProperty(Constants.RS_PROVIDER_EXPECTED_PROP_KEY);
+        EasyMock.expectLastCall().andReturn(false);
+        bc.getService(sref);
+        AegisElementProvider p = new AegisElementProvider();
+        EasyMock.expectLastCall().andReturn(p);
+        EasyMock.replay(bc, sref);
+        Map<String, Object> props = new HashMap<String, Object>();
+        addRequiredProps(props);
+        EndpointDescription sd = new EndpointDescription(props);
+
+        List<Object> providers = JaxRSUtils.getProviders(bc, null, sd);
+        assertEquals(1, providers.size());
+        assertSame(p, providers.get(0));
+    }
+
+    public void testNoCustomGlobalProvider() throws Exception {
+        ServiceReference sref = EasyMock.createNiceMock(ServiceReference.class);
+        BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
+        bc.getServiceReferences(null, JaxRSUtils.PROVIDERS_FILTER);
+        EasyMock.expectLastCall().andReturn(new ServiceReference[] {
+            sref
+        });
+        sref.getProperty(Constants.RS_PROVIDER_PROP_KEY);
+        EasyMock.expectLastCall().andReturn(false);
+        bc.getService(sref);
+        AegisElementProvider p = new AegisElementProvider();
+        EasyMock.expectLastCall().andReturn(p);
+        EasyMock.replay(bc);
+        Map<String, Object> props = new HashMap<String, Object>();
+        props.put(Constants.RS_PROVIDER_EXPECTED_PROP_KEY, "true");
+        addRequiredProps(props);
+        EndpointDescription sd = new EndpointDescription(props);
+
+        List<Object> providers = JaxRSUtils.getProviders(bc, null, sd);
+        assertEquals(0, providers.size());
+    }
+
+    public void testCustomGlobalProviderExpected() throws Exception {
+        ServiceReference sref = EasyMock.createNiceMock(ServiceReference.class);
+        BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
+        bc.getServiceReferences(null, JaxRSUtils.PROVIDERS_FILTER);
+        EasyMock.expectLastCall().andReturn(new ServiceReference[] {
+            sref
+        });
+        sref.getProperty(Constants.RS_PROVIDER_PROP_KEY);
+        EasyMock.expectLastCall().andReturn(true);
+        bc.getService(sref);
+        AegisElementProvider p = new AegisElementProvider();
+        EasyMock.expectLastCall().andReturn(p);
+        EasyMock.replay(bc, sref);
+        Map<String, Object> props = new HashMap<String, Object>();
+        props.put(Constants.RS_PROVIDER_EXPECTED_PROP_KEY, "true");
+        addRequiredProps(props);
+        EndpointDescription sd = new EndpointDescription(props);
+
+        List<Object> providers = JaxRSUtils.getProviders(bc, null, sd);
+        assertEquals(1, providers.size());
+        assertSame(p, providers.get(0));
+    }
 
-    
-    public void testDUMMY(){
-        assertTrue(true);
-    }
-    
-//	public void testNoGlobalProviders() {
-//		Map<String, Object> props = new HashMap<String, Object>();
-//        props.put(Constants.RS_PROVIDER_GLOBAL_PROP_KEY, "false");
-//        ServiceEndpointDescription sd = new ServiceEndpointDescriptionImpl("MyInterface", props);
-//        
-//        assertEquals(0, JaxRSUtils.getProviders(null, null, sd).size());
-//	}
-//	
-//	public void testAegisProvider() {
-//		Map<String, Object> props = new HashMap<String, Object>();
-//        props.put(Constants.RS_DATABINDING_PROP_KEY, "aegis");
-//        props.put(Constants.RS_PROVIDER_GLOBAL_PROP_KEY, "false");
-//        ServiceEndpointDescription sd = new ServiceEndpointDescriptionImpl("MyInterface", props);
-//        
-//        List<Object> providers = JaxRSUtils.getProviders(null, null, sd);
-//        assertEquals(1, providers.size());
-//        assertEquals(AegisElementProvider.class.getName(), providers.get(0).getClass().getName());
-//	}
-//	
-//	public void testServiceProviders() {
-//		Map<String, Object> props = new HashMap<String, Object>();
-//        props.put(Constants.RS_PROVIDER_PROP_KEY, new Object[]{new AegisElementProvider()});
-//        props.put(Constants.RS_PROVIDER_GLOBAL_PROP_KEY, "false");
-//        ServiceEndpointDescription sd = new ServiceEndpointDescriptionImpl("MyInterface", props);
-//        
-//        List<Object> providers = JaxRSUtils.getProviders(null, null, sd);
-//        assertEquals(1, providers.size());
-//        assertEquals(AegisElementProvider.class.getName(), providers.get(0).getClass().getName());
-//	}
-//	
-//	
-//	public void testServiceProviderProperty() throws Exception {
-//		
-//		BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
-//		Bundle bundle = EasyMock.createNiceMock(Bundle.class);
-//		bc.getBundle();
-//		EasyMock.expectLastCall().andReturn(bundle).times(2);
-//		bundle.loadClass(AegisElementProvider.class.getName());
-//		EasyMock.expectLastCall().andReturn(AegisElementProvider.class);
-//		bundle.loadClass(JAXBElementProvider.class.getName());
-//		EasyMock.expectLastCall().andReturn(JAXBElementProvider.class);
-//		EasyMock.replay(bc, bundle);
-//		
-//		Map<String, Object> props = new HashMap<String, Object>();
-//        props.put(Constants.RS_PROVIDER_PROP_KEY, 
-//        		"\r\n org.apache.cxf.jaxrs.provider.AegisElementProvider , \r\n" 
-//        		+ "org.apache.cxf.jaxrs.provider.JAXBElementProvider\r\n");
-//        
-//        props.put(Constants.RS_PROVIDER_GLOBAL_PROP_KEY, "false");
-//        ServiceEndpointDescription sd = new ServiceEndpointDescriptionImpl("MyInterface", props);
-//        
-//        List<Object> providers = JaxRSUtils.getProviders(bc, null, sd);
-//        assertEquals(2, providers.size());
-//        assertEquals(AegisElementProvider.class.getName(), providers.get(0).getClass().getName());
-//        assertEquals(JAXBElementProvider.class.getName(), providers.get(1).getClass().getName());
-//	}
-//	
-//    public void testServiceProviderStrings() throws Exception {
-//		
-//		BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
-//		Bundle bundle = EasyMock.createNiceMock(Bundle.class);
-//		bc.getBundle();
-//		EasyMock.expectLastCall().andReturn(bundle).times(2);
-//		bundle.loadClass(AegisElementProvider.class.getName());
-//		EasyMock.expectLastCall().andReturn(AegisElementProvider.class);
-//		bundle.loadClass(JAXBElementProvider.class.getName());
-//		EasyMock.expectLastCall().andReturn(JAXBElementProvider.class);
-//		EasyMock.replay(bc, bundle);
-//		
-//		Map<String, Object> props = new HashMap<String, Object>();
-//        props.put(Constants.RS_PROVIDER_PROP_KEY,
-//        		  new String[] {
-//        		    "\r\n org.apache.cxf.jaxrs.provider.AegisElementProvider", 
-//        		    "org.apache.cxf.jaxrs.provider.JAXBElementProvider\r\n"
-//                  });
-//        
-//        props.put(Constants.RS_PROVIDER_GLOBAL_PROP_KEY, "false");
-//        ServiceEndpointDescription sd = new ServiceEndpointDescriptionImpl("MyInterface", props);
-//        
-//        List<Object> providers = JaxRSUtils.getProviders(bc, null, sd);
-//        assertEquals(2, providers.size());
-//        assertEquals(AegisElementProvider.class.getName(), providers.get(0).getClass().getName());
-//        assertEquals(JAXBElementProvider.class.getName(), providers.get(1).getClass().getName());
-//	}
-//	
-//	public void testCustomGlobalProvider() throws Exception {
-//		ServiceReference sref = EasyMock.createNiceMock(ServiceReference.class);
-//		BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
-//		bc.getServiceReferences(null, JaxRSUtils.PROVIDERS_FILTER);
-//		EasyMock.expectLastCall().andReturn(new ServiceReference[]{sref});
-//		sref.getProperty(Constants.RS_PROVIDER_EXPECTED_PROP_KEY);
-//		EasyMock.expectLastCall().andReturn(false);
-//		bc.getService(sref);
-//		AegisElementProvider p = new AegisElementProvider();
-//		EasyMock.expectLastCall().andReturn(p);
-//		EasyMock.replay(bc, sref);
-//        ServiceEndpointDescription sd = new ServiceEndpointDescriptionImpl("MyInterface");
-//        
-//        List<Object> providers = JaxRSUtils.getProviders(bc, null, sd);
-//        assertEquals(1, providers.size());
-//        assertSame(p, providers.get(0));
-//	}
-//	
-//	public void testNoCustomGlobalProvider() throws Exception {
-//		ServiceReference sref = EasyMock.createNiceMock(ServiceReference.class);
-//		BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
-//		bc.getServiceReferences(null, JaxRSUtils.PROVIDERS_FILTER);
-//		EasyMock.expectLastCall().andReturn(new ServiceReference[]{sref});
-//		sref.getProperty(Constants.RS_PROVIDER_PROP_KEY);
-//		EasyMock.expectLastCall().andReturn(false);
-//		bc.getService(sref);
-//		AegisElementProvider p = new AegisElementProvider();
-//		EasyMock.expectLastCall().andReturn(p);
-//		EasyMock.replay(bc);
-//		Map<String, Object> props = new HashMap<String, Object>();
-//        props.put(Constants.RS_PROVIDER_EXPECTED_PROP_KEY, "true");
-//        ServiceEndpointDescription sd = new ServiceEndpointDescriptionImpl("MyInterface", props);
-//        
-//        List<Object> providers = JaxRSUtils.getProviders(bc, null, sd);
-//        assertEquals(0, providers.size());
-//	}
-//	
-//	public void testCustomGlobalProviderExpected() throws Exception {
-//		ServiceReference sref = EasyMock.createNiceMock(ServiceReference.class);
-//		BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
-//		bc.getServiceReferences(null, JaxRSUtils.PROVIDERS_FILTER);
-//		EasyMock.expectLastCall().andReturn(new ServiceReference[]{sref});
-//		sref.getProperty(Constants.RS_PROVIDER_PROP_KEY);
-//		EasyMock.expectLastCall().andReturn(true);
-//		bc.getService(sref);
-//		AegisElementProvider p = new AegisElementProvider();
-//		EasyMock.expectLastCall().andReturn(p);
-//		EasyMock.replay(bc, sref);
-//		Map<String, Object> props = new HashMap<String, Object>();
-//        props.put(Constants.RS_PROVIDER_EXPECTED_PROP_KEY, "true");
-//        ServiceEndpointDescription sd = new ServiceEndpointDescriptionImpl("MyInterface", props);
-//        
-//        List<Object> providers = JaxRSUtils.getProviders(bc, null, sd);
-//        assertEquals(1, providers.size());
-//        assertSame(p, providers.get(0));
-//	}
-//	
 }

Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/WsdlConfigurationTypeHandlerTest.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/WsdlConfigurationTypeHandlerTest.java?rev=898744&r1=898743&r2=898744&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/WsdlConfigurationTypeHandlerTest.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/WsdlConfigurationTypeHandlerTest.java Wed Jan 13 13:28:38 2010
@@ -1,5 +1,5 @@
 /** 
-  * Licensed to the Apache Software Foundation (ASF) under one 
+s  * 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 
@@ -18,23 +18,8 @@
   */
 package org.apache.cxf.dosgi.dsw.handlers;
 
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-import javax.xml.ws.Service;
-
 import junit.framework.TestCase;
 
-import org.apache.cxf.dosgi.dsw.Constants;
-import org.apache.cxf.dosgi.dsw.TestUtils;
-import org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminCore;
-import org.easymock.classextension.EasyMock;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.discovery.ServiceEndpointDescription;
-
 public class WsdlConfigurationTypeHandlerTest extends TestCase {
     
     public void testDUMMY(){

Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/hooks/CxfFindListenerHookTest.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/hooks/CxfFindListenerHookTest.java?rev=898744&r1=898743&r2=898744&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/hooks/CxfFindListenerHookTest.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/hooks/CxfFindListenerHookTest.java Wed Jan 13 13:28:38 2010
@@ -18,37 +18,9 @@
   */
 package org.apache.cxf.dosgi.dsw.hooks;
 
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Dictionary;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.cxf.dosgi.dsw.service.ServiceEndpointDescriptionImpl;
-import org.easymock.classextension.EasyMock;
-import org.easymock.classextension.IMocksControl;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Filter;
-import org.osgi.framework.ServiceReference;
-import org.osgi.framework.ServiceRegistration;
-import org.osgi.framework.hooks.service.ListenerHook;
-import org.osgi.service.discovery.DiscoveredServiceNotification;
-import org.osgi.service.discovery.DiscoveredServiceTracker;
-import org.osgi.service.discovery.ServiceEndpointDescription;
-import org.osgi.service.discovery.ServicePublication;
-
 import org.junit.Assert;
-import org.junit.Before;
 import org.junit.Test;
 
-import static org.osgi.service.discovery.DiscoveredServiceNotification.AVAILABLE;
-import static org.osgi.service.discovery.DiscoveredServiceNotification.UNAVAILABLE;
-
 public class CxfFindListenerHookTest extends Assert {
 
     @Test

Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/hooks/CxfPublishHookTest.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/hooks/CxfPublishHookTest.java?rev=898744&r1=898743&r2=898744&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/hooks/CxfPublishHookTest.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/hooks/CxfPublishHookTest.java Wed Jan 13 13:28:38 2010
@@ -18,34 +18,8 @@
  */
 package org.apache.cxf.dosgi.dsw.hooks;
 
-import static org.apache.cxf.dosgi.dsw.Constants.WS_ADDRESS_PROPERTY;
-import static org.osgi.service.discovery.ServicePublication.ENDPOINT_LOCATION;
-import static org.osgi.service.discovery.ServicePublication.SERVICE_INTERFACE_NAME;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Dictionary;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.cxf.dosgi.dsw.handlers.ConfigurationTypeHandler;
-import org.apache.cxf.endpoint.Server;
-import org.easymock.IAnswer;
-import org.easymock.classextension.EasyMock;
-import org.easymock.classextension.IMocksControl;
 import org.junit.Assert;
-import org.junit.Before;
 import org.junit.Test;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
-import org.osgi.framework.ServiceReference;
-import org.osgi.framework.ServiceRegistration;
-import org.osgi.service.discovery.ServiceEndpointDescription;
-import org.osgi.service.discovery.ServicePublication;
 
 public class CxfPublishHookTest extends Assert {
 

Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/hooks/ServiceHookUtilsTest.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/hooks/ServiceHookUtilsTest.java?rev=898744&r1=898743&r2=898744&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/hooks/ServiceHookUtilsTest.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/hooks/ServiceHookUtilsTest.java Wed Jan 13 13:28:38 2010
@@ -18,30 +18,8 @@
   */
 package org.apache.cxf.dosgi.dsw.hooks;
 
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Dictionary;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-
 import junit.framework.TestCase;
 
-import org.apache.cxf.dosgi.dsw.handlers.ConfigurationTypeHandler;
-import org.apache.cxf.dosgi.dsw.service.ServiceEndpointDescriptionImpl;
-import org.apache.cxf.endpoint.Server;
-import org.easymock.EasyMock;
-import org.easymock.IAnswer;
-import org.easymock.IMocksControl;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.osgi.framework.ServiceRegistration;
-import org.osgi.service.discovery.ServiceEndpointDescription;
-import org.osgi.service.discovery.ServicePublication;
-
 public class ServiceHookUtilsTest extends TestCase {
     
     public void testDUMMY(){

Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/ImportRegistrationImplTest.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/ImportRegistrationImplTest.java?rev=898744&r1=898743&r2=898744&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/ImportRegistrationImplTest.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/ImportRegistrationImplTest.java Wed Jan 13 13:28:38 2010
@@ -104,17 +104,37 @@
         assertEquals(ed,i2.getImportedEndpointDescription());
         assertEquals(ed,i3.getImportedEndpointDescription());
         
+        c.verify();
+        c.reset();
+        
+        rsac.removeImportRegistration(EasyMock.eq(i3));
+        EasyMock.expectLastCall().once();
+        
+        c.replay();
+        
         i3.close();
         i3.close(); // shouldn't change anything
-        assertEquals(ed,i3.getImportedEndpointDescription());
         
+        assertNull(i3.getImportedEndpointDescription());
         
-        i1.close();
         
+        c.verify();
         c.reset();
+        
         rsac.removeImportRegistration(EasyMock.eq(i1));
         EasyMock.expectLastCall().once();
         
+        c.replay();
+        
+        
+        i1.close();
+        
+        c.verify();
+        c.reset();
+        
+        rsac.removeImportRegistration(EasyMock.eq(i2));
+        EasyMock.expectLastCall().once();
+        
         sr.unregister();
         EasyMock.expectLastCall().once();
         
@@ -133,8 +153,6 @@
         EndpointDescription ed = c.createMock(EndpointDescription.class);
         RemoteServiceAdminCore rsac = c.createMock(RemoteServiceAdminCore.class);
         
-        
-        
         c.replay();
         
         ImportRegistrationImpl i1 = new ImportRegistrationImpl(ed,rsac);
@@ -148,11 +166,24 @@
         assertEquals(i1, i2.getParent());
         assertEquals(i1, i3.getParent());
         
-        i2.close();
+        c.verify();
+        c.reset();
+        
+        rsac.removeImportRegistration(EasyMock.eq(i2));
+        EasyMock.expectLastCall().once();
+        
+        c.replay();
         
+        i2.close();
+
+        c.verify();
         c.reset();
+        
         rsac.removeImportRegistration(EasyMock.eq(i1));
         EasyMock.expectLastCall().once();
+        rsac.removeImportRegistration(EasyMock.eq(i3));
+        EasyMock.expectLastCall().once();
+        
         c.replay();
         i3.closeAll();
         c.verify();



Mime
View raw message