You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by am...@apache.org on 2013/06/05 02:40:58 UTC
svn commit: r1489675 [4/7] - in /cxf/dosgi/trunk: ./ discovery/
discovery/distributed/ discovery/distributed/cxf-discovery/
discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/
discovery/distributed/cxf-discovery/...
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=1489675&r1=1489674&r2=1489675&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 Jun 5 00:40:54 2013
@@ -30,24 +30,24 @@ import org.osgi.framework.Constants;
import org.osgi.framework.ServiceReference;
public class InterfaceRuleTest extends TestCase {
-
+
public void testDUMMY() {
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());
-
+ 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"});
+ serviceProps.put(Constants.OBJECTCLASS, new String[] {"a.b.C", "org.apache.Foo"});
ServiceReference sref = mockServiceReference(serviceProps);
Map<String, Object> m = new HashMap<String, Object>();
@@ -58,16 +58,16 @@ public class InterfaceRuleTest extends T
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());
-
+ 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"});
+ serviceProps.put(Constants.OBJECTCLASS, new String[] {"a.b.C", "org.apache.Foo"});
ServiceReference sref = mockServiceReference(serviceProps);
Map<String, Object> m = new HashMap<String, Object>();
@@ -80,11 +80,11 @@ public class InterfaceRuleTest extends T
public void testInterfaceRule3() {
InterfaceRule ir = new InterfaceRule(null, "org.apache.F(.*)");
- ir.addProperty("x", "y", String.class.getName());
-
+ 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"});
+ serviceProps.put(Constants.OBJECTCLASS, new String[] {"org.apache.Boo"});
ServiceReference sref = mockServiceReference(serviceProps);
Map<String, Object> m = new HashMap<String, Object>();
@@ -95,10 +95,10 @@ public class InterfaceRuleTest extends T
public void testInterfaceRule4() {
InterfaceRule ir = new InterfaceRule(null, "org.apache.F(.*)");
ir.addPropMatch("boo", "baah");
- ir.addProperty("x", "y", String.class.getName());
-
+ 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"});
+ serviceProps.put(Constants.OBJECTCLASS, new String[] {"org.apache.Foo"});
ServiceReference sref = mockServiceReference(serviceProps);
Map<String, Object> m = new HashMap<String, Object>();
@@ -109,11 +109,11 @@ public class InterfaceRuleTest extends T
public void testInterfaceRule5() {
InterfaceRule ir = new InterfaceRule(null, "org.apache.Foo");
ir.addPropMatch("test.int", "42");
- ir.addProperty("x", "1", Long.class.getName());
-
+ ir.addProperty("x", "1", Long.class.getName());
+
final Map<String, Object> serviceProps = new HashMap<String, Object>();
serviceProps.put("test.int", 42);
- serviceProps.put(Constants.OBJECTCLASS, new String [] {"org.apache.Foo"});
+ serviceProps.put(Constants.OBJECTCLASS, new String[] {"org.apache.Foo"});
ServiceReference sref = mockServiceReference(serviceProps);
Map<String, Object> m = new HashMap<String, Object>();
@@ -125,15 +125,15 @@ public class InterfaceRuleTest extends T
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());
-
+ ir.addProperty("x", "1", Long.class.getName());
+
final Map<String, Object> serviceProps = new HashMap<String, Object>();
serviceProps.put("test.int", 51);
- serviceProps.put(Constants.OBJECTCLASS, new String [] {"org.apache.Foo"});
+ serviceProps.put(Constants.OBJECTCLASS, new String[] {"org.apache.Foo"});
ServiceReference sref = mockServiceReference(serviceProps);
Map<String, Object> m = new HashMap<String, Object>();
@@ -148,14 +148,14 @@ public class InterfaceRuleTest extends T
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>() {
+ 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.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=1489675&r1=1489674&r2=1489675&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 Jun 5 00:40:54 2013
@@ -39,32 +39,32 @@ import org.osgi.framework.Constants;
import org.osgi.framework.ServiceReference;
public class ServiceDecoratorImplTest extends TestCase {
-
+
public void testServiceDecorator() {
- final BundleListener[] bundleListener = new BundleListener[1];
-
+ final BundleListener[] bundleListener = new BundleListener[1];
+
BundleContext bc = EasyMock.createMock(BundleContext.class);
bc.addBundleListener((BundleListener) EasyMock.anyObject());
- EasyMock.expectLastCall().andAnswer(new IAnswer<Object>() {
+ 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() {
URL sdURL = getClass().getResource("/test-resources/sd.xml");
Bundle b = EasyMock.createMock(Bundle.class);
@@ -90,12 +90,12 @@ public class ServiceDecoratorImplTest ex
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(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.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);
@@ -104,7 +104,7 @@ public class ServiceDecoratorImplTest ex
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>() {
@@ -114,38 +114,38 @@ public class ServiceDecoratorImplTest ex
}).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);
+ 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(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"});
+ 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>();
@@ -157,9 +157,9 @@ public class ServiceDecoratorImplTest ex
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"});
+ 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>();
@@ -169,9 +169,9 @@ public class ServiceDecoratorImplTest ex
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(Constants.OBJECTCLASS, new String[] {"org.test.B"});
serviceProps.put("x", "y");
Map<String, Object> actual = testDecorate(serviceProps, r1, r2);
@@ -183,9 +183,9 @@ public class ServiceDecoratorImplTest ex
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(Constants.OBJECTCLASS, new String[] {"org.test.C"});
serviceProps.put("x", "z");
Map<String, Object> actual = testDecorate(serviceProps, r1, r2);
@@ -197,9 +197,9 @@ public class ServiceDecoratorImplTest ex
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(Constants.OBJECTCLASS, new String[] {"org.test.C"});
serviceProps.put("x", "x");
Map<String, Object> actual = testDecorate(serviceProps, r1, r2);
@@ -209,9 +209,9 @@ public class ServiceDecoratorImplTest ex
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"});
+ serviceProps.put(Constants.OBJECTCLASS, new String[] {"org.test.D"});
Map<String, Object> actual = testDecorate(serviceProps, r1);
Map<String, Object> expected = new HashMap<String, Object>();
@@ -220,9 +220,9 @@ public class ServiceDecoratorImplTest ex
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"});
+ serviceProps.put(Constants.OBJECTCLASS, new String[] {"org.test.D"});
Map<String, Object> actual = testDecorate(serviceProps, r1);
Map<String, Object> expected = new HashMap<String, Object>();
@@ -239,7 +239,7 @@ public class ServiceDecoratorImplTest ex
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>() {
@@ -251,20 +251,20 @@ public class ServiceDecoratorImplTest ex
sd.decorate(sref, target);
return target;
}
-
+
public void testBundleListener() {
- final BundleListener[] bundleListener = new BundleListener[1];
-
+ final BundleListener[] bundleListener = new BundleListener[1];
+
BundleContext bc = EasyMock.createMock(BundleContext.class);
bc.addBundleListener((BundleListener) EasyMock.anyObject());
- EasyMock.expectLastCall().andAnswer(new IAnswer<Object>() {
+ 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
@@ -275,19 +275,19 @@ public class ServiceDecoratorImplTest ex
@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=1489675&r1=1489674&r2=1489675&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 Jun 5 00:40:54 2013
@@ -36,34 +36,34 @@ import org.osgi.service.remoteserviceadm
import org.osgi.service.remoteserviceadmin.RemoteConstants;
public class ClientServiceFactoryTest extends TestCase {
-
+
public void testGetService() {
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();
-
+ 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=1489675&r1=1489674&r2=1489675&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 Jun 5 00:40:54 2013
@@ -33,7 +33,6 @@ import org.osgi.service.remoteserviceadm
import static org.junit.Assert.assertTrue;
-
public class ConfigTypeHandlerFactoryTest {
@Test
Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceManagerTest.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceManagerTest.java?rev=1489675&r1=1489674&r2=1489675&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceManagerTest.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceManagerTest.java Wed Jun 5 00:40:54 2013
@@ -44,9 +44,8 @@ import org.osgi.service.http.NamespaceEx
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.expectLastCall;
-
public class HttpServiceManagerTest extends TestCase {
-
+
public void testGetAbsoluteAddress() {
IMocksControl c = EasyMock.createControl();
BundleContext bundleContext = c.createMock(BundleContext.class);
@@ -55,14 +54,14 @@ public class HttpServiceManagerTest exte
String localIp = LocalHostUtil.getLocalIp();
String address1 = manager.getAbsoluteAddress(bundleContext, null, "/myservice");
- assertEquals("http://" + localIp + ":8181/cxf/myservice", address1);
-
+ assertEquals("http://" + localIp + ":8181/cxf/myservice", address1);
+
String address2 = manager.getAbsoluteAddress(bundleContext, "/mycontext", "/myservice");
- assertEquals("http://" + localIp + ":8181/mycontext/myservice", address2);
+ assertEquals("http://" + localIp + ":8181/mycontext/myservice", address2);
c.verify();
}
-
+
public void testRegisterAndUnregisterServlet() throws Exception {
IMocksControl c = EasyMock.createControl();
BundleContext dswContext = c.createMock(BundleContext.class);
@@ -80,25 +79,23 @@ public class HttpServiceManagerTest exte
ServiceReference sr = c.createMock(ServiceReference.class);
expect(sr.getProperty(EasyMock.eq("service.id"))).andReturn(12345L).atLeastOnce();
c.replay();
-
- HttpServiceManager h = new HttpServiceManager(dswContext, null, null, null) {
+ HttpServiceManager h = new HttpServiceManager(dswContext, null, null, null) {
@Override
protected HttpService getHttpService() {
return httpService;
}
-
};
Bus bus = h.registerServletAndGetBus("/myService", dswContext, sr);
Assert.assertNotNull(bus);
-
+
ServiceEvent event = new ServiceEvent(ServiceEvent.UNREGISTERING, sr);
captured.getValue().serviceChanged(event);
c.verify();
- }
+ }
static class DummyHttpService implements HttpService {
-
+
private ServletConfig config;
public DummyHttpService(ServletConfig config) {
@@ -117,12 +114,10 @@ public class HttpServiceManagerTest exte
}
public void unregister(String alias) {
-
}
public HttpContext createDefaultHttpContext() {
return EasyMock.createNiceMock(HttpContext.class);
}
-
}
}
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=1489675&r1=1489674&r2=1489675&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 Jun 5 00:40:54 2013
@@ -38,16 +38,12 @@ public class JaxRSUtilsTest extends Test
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"
- });
+ 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");
assertEquals(0, JaxRSUtils.getProviders(null, null, props).size());
@@ -80,7 +76,6 @@ public class JaxRSUtilsTest extends Test
}
public void testServiceProviderProperty() throws Exception {
-
BundleContext bc = EasyMock.createMock(BundleContext.class);
Bundle bundle = EasyMock.createMock(Bundle.class);
bc.getBundle();
@@ -106,7 +101,6 @@ public class JaxRSUtilsTest extends Test
}
public void testServiceProviderStrings() throws Exception {
-
BundleContext bc = EasyMock.createMock(BundleContext.class);
Bundle bundle = EasyMock.createMock(Bundle.class);
bc.getBundle();
@@ -137,9 +131,7 @@ public class JaxRSUtilsTest extends Test
ServiceReference sref = EasyMock.createNiceMock(ServiceReference.class);
BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
bc.getServiceReferences((String)null, JaxRSUtils.PROVIDERS_FILTER);
- EasyMock.expectLastCall().andReturn(new ServiceReference[] {
- sref
- });
+ EasyMock.expectLastCall().andReturn(new ServiceReference[] {sref});
sref.getProperty(Constants.RS_PROVIDER_EXPECTED_PROP_KEY);
EasyMock.expectLastCall().andReturn(false);
bc.getService(sref);
@@ -159,9 +151,7 @@ public class JaxRSUtilsTest extends Test
ServiceReference sref = EasyMock.createNiceMock(ServiceReference.class);
BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
bc.getServiceReferences((String)null, JaxRSUtils.PROVIDERS_FILTER);
- EasyMock.expectLastCall().andReturn(new ServiceReference[] {
- sref
- });
+ EasyMock.expectLastCall().andReturn(new ServiceReference[] {sref});
sref.getProperty(Constants.RS_PROVIDER_PROP_KEY);
EasyMock.expectLastCall().andReturn(false);
bc.getService(sref);
@@ -181,9 +171,7 @@ public class JaxRSUtilsTest extends Test
ServiceReference sref = EasyMock.createNiceMock(ServiceReference.class);
BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
bc.getServiceReferences((String)null, JaxRSUtils.PROVIDERS_FILTER);
- EasyMock.expectLastCall().andReturn(new ServiceReference[] {
- sref
- });
+ EasyMock.expectLastCall().andReturn(new ServiceReference[] {sref});
sref.getProperty(Constants.RS_PROVIDER_PROP_KEY);
EasyMock.expectLastCall().andReturn(true);
bc.getService(sref);
@@ -198,5 +186,4 @@ public class JaxRSUtilsTest extends Test
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/PojoConfigurationTypeHandlerTest.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/PojoConfigurationTypeHandlerTest.java?rev=1489675&r1=1489674&r2=1489675&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/PojoConfigurationTypeHandlerTest.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/PojoConfigurationTypeHandlerTest.java Wed Jun 5 00:40:54 2013
@@ -56,8 +56,8 @@ import org.osgi.framework.ServiceReferen
import org.osgi.service.remoteserviceadmin.EndpointDescription;
import org.osgi.service.remoteserviceadmin.RemoteConstants;
-
public class PojoConfigurationTypeHandlerTest extends TestCase {
+
public void testGetPojoAddressEndpointURI() {
IntentManager intentManager = new IntentManagerImpl(new IntentMap());
PojoConfigurationTypeHandler handler = new PojoConfigurationTypeHandler(null,
@@ -104,7 +104,7 @@ public class PojoConfigurationTypeHandle
assertEquals("/java/lang/String", handler.getServerAddress(sd, String.class));
}
- // todo: add test for data bindings
+ // todo: add test for data bindings
public void testCreateProxy() {
IMocksControl c = EasyMock.createNiceControl();
BundleContext bc1 = c.createMock(BundleContext.class);
@@ -139,7 +139,6 @@ public class PojoConfigurationTypeHandle
props.put(RemoteConstants.SERVICE_IMPORTED_CONFIGS, new String[]{"my.config"});
EndpointDescription endpoint = new EndpointDescription(props);
-
cpfb.setAddress((String)EasyMock.eq(props.get(RemoteConstants.ENDPOINT_ID)));
EasyMock.expectLastCall().atLeastOnce();
@@ -165,7 +164,7 @@ public class PojoConfigurationTypeHandle
@Override
public String[] applyIntents(List<Feature> features, AbstractEndpointFactory factory,
Map<String, Object> sd) {
- return new String []{};
+ return new String[]{};
}
};
PojoConfigurationTypeHandler p = new PojoConfigurationTypeHandler(dswContext, intentManager,
@@ -186,14 +185,12 @@ public class PojoConfigurationTypeHandle
ExportResult exportResult = p.createServer(sr, dswContext, callingContext, props, String.class, myService);
-
Map<String, Object> edProps = exportResult.getEndpointProps();
assertNotNull(edProps.get(RemoteConstants.SERVICE_IMPORTED_CONFIGS));
assertEquals(1, ((String[])edProps.get(RemoteConstants.SERVICE_IMPORTED_CONFIGS)).length);
assertEquals(Constants.WS_CONFIG_TYPE, ((String[])edProps.get(RemoteConstants.SERVICE_IMPORTED_CONFIGS))[0]);
assertEquals("http://alternate_host:80/myString", edProps.get(RemoteConstants.ENDPOINT_ID));
-
}
public void testAddressing() {
@@ -223,8 +220,8 @@ public class PojoConfigurationTypeHandle
IntentManager intentManager = EasyMock.createNiceMock(IntentManager.class);
EasyMock.replay(intentManager);
- PojoConfigurationTypeHandler handler = new PojoConfigurationTypeHandler(dswContext,
- intentManager,
+ PojoConfigurationTypeHandler handler = new PojoConfigurationTypeHandler(dswContext,
+ intentManager,
dummyHttpServiceManager()) {
@Override
protected ExportResult createServerFromFactory(ServerFactoryBean factory,
@@ -256,11 +253,11 @@ public class PojoConfigurationTypeHandle
IntentManager intentManager = EasyMock.createNiceMock(IntentManager.class);
EasyMock.replay(intentManager);
- PojoConfigurationTypeHandler handler = new PojoConfigurationTypeHandler(dswContext,
- intentManager,
+ PojoConfigurationTypeHandler handler = new PojoConfigurationTypeHandler(dswContext,
+ intentManager,
dummyHttpServiceManager()) {
@Override
- protected ExportResult createServerFromFactory(ServerFactoryBean factory,
+ protected ExportResult createServerFromFactory(ServerFactoryBean factory,
Map<String, Object> endpointProps) {
throw new TestException();
}
@@ -341,19 +338,19 @@ public class PojoConfigurationTypeHandle
Map<String, Object> sd = new HashMap<String, Object>();
sd.put(org.osgi.framework.Constants.SERVICE_ID, 42);
- Map<String, Object> props = pch.createEndpointProps(sd, String.class, new String [] {"org.apache.cxf.ws"},
- "http://localhost:12345", new String [] {"my_intent", "your_intent"});
+ Map<String, Object> props = pch.createEndpointProps(sd, String.class, new String[] {"org.apache.cxf.ws"},
+ "http://localhost:12345", new String[] {"my_intent", "your_intent"});
assertFalse(props.containsKey(org.osgi.framework.Constants.SERVICE_ID));
assertEquals(42, props.get(RemoteConstants.ENDPOINT_SERVICE_ID));
assertEquals("some_uuid1", props.get(RemoteConstants.ENDPOINT_FRAMEWORK_UUID));
assertEquals("http://localhost:12345", props.get(RemoteConstants.ENDPOINT_ID));
assertEquals(Arrays.asList("java.lang.String"),
- Arrays.asList((Object []) props.get(org.osgi.framework.Constants.OBJECTCLASS)));
+ Arrays.asList((Object[]) props.get(org.osgi.framework.Constants.OBJECTCLASS)));
assertEquals(Arrays.asList("org.apache.cxf.ws"),
- Arrays.asList((Object []) props.get(RemoteConstants.SERVICE_IMPORTED_CONFIGS)));
+ Arrays.asList((Object[]) props.get(RemoteConstants.SERVICE_IMPORTED_CONFIGS)));
assertEquals(Arrays.asList("my_intent", "your_intent"),
- Arrays.asList((Object []) props.get(RemoteConstants.SERVICE_INTENTS)));
+ Arrays.asList((Object[]) props.get(RemoteConstants.SERVICE_INTENTS)));
assertEquals("0.0.0", props.get("endpoint.package.version.java.lang"));
}
@@ -365,7 +362,6 @@ public class PojoConfigurationTypeHandle
intentManager,
dummyHttpServiceManager());
-
Object serviceBean = new MyJaxWsEchoServiceImpl();
ServiceReference sref = c.createMock(ServiceReference.class);
@@ -383,7 +379,6 @@ public class PojoConfigurationTypeHandle
Assert.assertEquals(new QName("http://jaxws.handlers.dsw.dosgi.cxf.apache.org/",
"MyJaxWsEchoServiceServiceSoapBinding"),
bindingName);
-
}
public void testCreateSimpleEndpointWithoutIntents() {
@@ -411,6 +406,7 @@ public class PojoConfigurationTypeHandle
}
public static class DummyIntentManager implements IntentManager {
+
@Override
public String[] applyIntents(List<Feature> features,
AbstractEndpointFactory factory,
@@ -420,7 +416,6 @@ public class PojoConfigurationTypeHandle
@Override
public void assertAllIntentsSupported(Map<String, Object> serviceProperties) {
-
}
}
Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/SecurityDelegatingHttpContextTest.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/SecurityDelegatingHttpContextTest.java?rev=1489675&r1=1489674&r2=1489675&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/SecurityDelegatingHttpContextTest.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/SecurityDelegatingHttpContextTest.java Wed Jun 5 00:40:54 2013
@@ -38,8 +38,8 @@ import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
import org.osgi.service.http.HttpContext;
-
public class SecurityDelegatingHttpContextTest extends TestCase {
+
protected HttpContext defaultHttpContext;
protected SecurityDelegatingHttpContext httpContext;
protected CommitResponseFilter commitFilter;
@@ -213,6 +213,7 @@ public class SecurityDelegatingHttpConte
}
class CommitResponseFilter implements Filter {
+
boolean called;
public void init(FilterConfig filterConfig) throws ServletException {
@@ -229,6 +230,7 @@ class CommitResponseFilter implements Fi
}
class DoNothingFilter implements Filter {
+
boolean called;
public void init(FilterConfig filterConfig) throws ServletException {
@@ -245,6 +247,7 @@ class DoNothingFilter implements Filter
}
class AccessDeniedFilter implements Filter {
+
boolean called;
public void init(FilterConfig filterConfig) throws ServletException {
Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ServiceInvocationHandlerTest.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ServiceInvocationHandlerTest.java?rev=1489675&r1=1489674&r2=1489675&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ServiceInvocationHandlerTest.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ServiceInvocationHandlerTest.java Wed Jun 5 00:40:54 2013
@@ -29,18 +29,19 @@ import java.util.Map;
import junit.framework.TestCase;
public class ServiceInvocationHandlerTest extends TestCase {
+
private static final Map<String, Method> OBJECT_METHODS = new HashMap<String, Method>(); {
for (Method m : Object.class.getMethods()) {
OBJECT_METHODS.put(m.getName(), m);
}
}
-
+
public void testInvoke() throws Throwable {
ServiceInvocationHandler sih = new ServiceInvocationHandler("hello", String.class);
- Method m = String.class.getMethod("length", new Class [] {});
- assertEquals(5, sih.invoke(null, m, new Object [] {}));
+ Method m = String.class.getMethod("length", new Class[] {});
+ assertEquals(5, sih.invoke(null, m, new Object[] {}));
}
-
+
public void testInvokeObjectMethod() throws Throwable {
final List<String> called = new ArrayList<String>();
ServiceInvocationHandler sih = new ServiceInvocationHandler("hi", String.class) {
@@ -57,18 +58,18 @@ public class ServiceInvocationHandlerTes
public String toString() {
called.add("toString");
return "somestring";
- }
+ }
};
Object proxy = Proxy.newProxyInstance(
- getClass().getClassLoader(), new Class [] {Runnable.class}, sih);
-
- assertEquals(true,
- sih.invoke(null, OBJECT_METHODS.get("equals"), new Object [] {proxy}));
- assertEquals(System.identityHashCode(sih),
- sih.invoke(null, OBJECT_METHODS.get("hashCode"), new Object [] {}));
- assertEquals("somestring",
- sih.invoke(null, OBJECT_METHODS.get("toString"), new Object [] {}));
- assertEquals(Arrays.asList("equals", "hashCode", "toString"), called);
+ getClass().getClassLoader(), new Class[] {Runnable.class}, sih);
+
+ assertEquals(true,
+ sih.invoke(null, OBJECT_METHODS.get("equals"), new Object[] {proxy}));
+ assertEquals(System.identityHashCode(sih),
+ sih.invoke(null, OBJECT_METHODS.get("hashCode"), new Object[] {}));
+ assertEquals("somestring",
+ sih.invoke(null, OBJECT_METHODS.get("toString"), new Object[] {}));
+ assertEquals(Arrays.asList("equals", "hashCode", "toString"), called);
}
}
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=1489675&r1=1489674&r2=1489675&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 Jun 5 00:40:54 2013
@@ -21,23 +21,23 @@ package org.apache.cxf.dosgi.dsw.handler
import junit.framework.TestCase;
public class WsdlConfigurationTypeHandlerTest extends TestCase {
-
+
public void testDUMMY() {
assertTrue(true);
}
-
+
// private Map<String, Object> handlerProps;
-//
+//
// @Override
// protected void setUp() throws Exception {
// super.setUp();
-//
+//
// handlerProps = new HashMap<String, Object>();
// handlerProps.put(Constants.DEFAULT_HOST_CONFIG, "somehost");
// handlerProps.put(Constants.DEFAULT_PORT_CONFIG, "54321");
// }
//
-// public void testCreateProxyPopulatesDistributionProvider() {
+// public void testCreateProxyPopulatesDistributionProvider() {
// ServiceReference sr = EasyMock.createNiceMock(ServiceReference.class);
// BundleContext dswContext = EasyMock.createNiceMock(BundleContext.class);
// BundleContext callingContext = EasyMock.createNiceMock(BundleContext.class);
@@ -46,7 +46,7 @@ public class WsdlConfigurationTypeHandle
// EasyMock.replay(dswContext);
// EasyMock.replay(callingContext);
// EasyMock.replay(sd);
-//
+//
// RemoteServiceAdminCore dp = new RemoteServiceAdminCore(dswContext);
// WsdlConfigurationTypeHandler w = new WsdlConfigurationTypeHandler(dswContext, dp, handlerProps) {
// @Override
@@ -55,15 +55,13 @@ public class WsdlConfigurationTypeHandle
// EasyMock.expect(svc.getPort(CharSequence.class)).andReturn("Hi").anyTimes();
// EasyMock.replay(svc);
// return svc;
-// }
+// }
// };
//
// assertEquals("Precondition failed", 0, dp.getRemoteServices().size());
// w.createProxy(sr, dswContext, callingContext, CharSequence.class, sd);
// assertEquals(1, dp.getRemoteServices().size());
// assertSame(sr, dp.getRemoteServices().iterator().next());
-//
+//
// }
-
-
}
Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/jaxws/MyJaxWsEchoServiceImpl.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/jaxws/MyJaxWsEchoServiceImpl.java?rev=1489675&r1=1489674&r2=1489675&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/jaxws/MyJaxWsEchoServiceImpl.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/jaxws/MyJaxWsEchoServiceImpl.java Wed Jun 5 00:40:54 2013
@@ -19,6 +19,7 @@
package org.apache.cxf.dosgi.dsw.handlers.jaxws;
public class MyJaxWsEchoServiceImpl implements MyJaxWsEchoService {
+
@Override
public String echo(String message) {
return message;
Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/simple/MySimpleEchoServiceImpl.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/simple/MySimpleEchoServiceImpl.java?rev=1489675&r1=1489674&r2=1489675&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/simple/MySimpleEchoServiceImpl.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/simple/MySimpleEchoServiceImpl.java Wed Jun 5 00:40:54 2013
@@ -19,6 +19,7 @@
package org.apache.cxf.dosgi.dsw.handlers.simple;
public class MySimpleEchoServiceImpl implements MySimpleEchoService {
+
@Override
public String echo(String message) {
return message;
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=1489675&r1=1489674&r2=1489675&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 Jun 5 00:40:54 2013
@@ -25,30 +25,28 @@ public class CxfFindListenerHookTest ext
@Test
public void testDUMMY() throws Exception {
-
}
-
+
// private IMocksControl control;
-//
+//
// @Before
// public void setUp() {
// control = EasyMock.createNiceControl();
// }
-
+
/* Todo this test doesn't apply at the moment since the ListenerHook doesn't
* have a serviceReferencesRequested() API (yet).
@Test
public void testSyncListenerHook() throws Exception {
-
Bundle bundle = control.createMock(Bundle.class);
- bundle.findEntries(EasyMock.eq("OSGI-INF/remote-service"),
+ bundle.findEntries(EasyMock.eq("OSGI-INF/remote-service"),
EasyMock.eq("*.xml"), EasyMock.anyBoolean());
EasyMock.expectLastCall().andReturn(Collections.enumeration(
Arrays.asList(getClass().getResource("/OSGI-INF/remote-service/remote-services.xml"))));
Dictionary<String, String> bundleHeaders = new Hashtable<String, String>();
- bundleHeaders.put(org.osgi.framework.Constants.BUNDLE_NAME,
+ bundleHeaders.put(org.osgi.framework.Constants.BUNDLE_NAME,
"Test Bundle");
- bundleHeaders.put(org.osgi.framework.Constants.BUNDLE_VERSION,
+ bundleHeaders.put(org.osgi.framework.Constants.BUNDLE_VERSION,
"1.0.0");
bundle.getHeaders();
EasyMock.expectLastCall().andReturn(bundleHeaders).anyTimes();
@@ -57,25 +55,25 @@ public class CxfFindListenerHookTest ext
final BundleContext requestingContext = control.createMock(BundleContext.class);
requestingContext.getBundle();
EasyMock.expectLastCall().andReturn(bundle).anyTimes();
-
+
BundleTestContext dswContext = new BundleTestContext(bundle);
- dswContext.addServiceReference(TestService.class.getName(),
+ dswContext.addServiceReference(TestService.class.getName(),
control.createMock(ServiceReference.class));
control.replay();
-
+
CxfListenerHook hook = new CxfListenerHook(dswContext, null);
-
+
// TODO : if the next call ends up being executed in a thread of its own then
// update the test accordingly, use Futures for ex
-
- hook.serviceReferencesRequested(requestingContext,
+
+ hook.serviceReferencesRequested(requestingContext,
TestService.class.getName(), null, true);
-
+
List<ServiceReference> registeredRefs = dswContext.getRegisteredReferences();
assertNotNull(registeredRefs);
- assertEquals(1, registeredRefs.size());
+ assertEquals(1, registeredRefs.size());
} */
-
+
// @Test
// public void testTrackerPropertiesOnlyClassInFilterWithMatchingInterface() throws Exception {
// String filter = "(objectClass=" + TestService.class.getName() + ")";
@@ -88,7 +86,7 @@ public class CxfFindListenerHookTest ext
//
// @Test
// public void testTrackerPropertiesGenericFilterWithMatchingInterface() throws Exception {
-// String filter = "(&(objectClass=" + TestService.class.getName()
+// String filter = "(&(objectClass=" + TestService.class.getName()
// + ")(colour=blue))";
// doTestTrackerPropertiesSet(filter,
// "osgi.remote.discovery.interest.filters",
@@ -109,7 +107,7 @@ public class CxfFindListenerHookTest ext
//
// @Test
// public void testTrackerPropertiesGenericFilterWithMatchingFilter() throws Exception {
-// String filter = "(&(objectClass=" + TestService.class.getName()
+// String filter = "(&(objectClass=" + TestService.class.getName()
// + ")(colour=blue))";
// doTestTrackerPropertiesSet(filter,
// "osgi.remote.discovery.interest.filters",
@@ -130,7 +128,7 @@ public class CxfFindListenerHookTest ext
//
// @Test
// public void testTrackerPropertiesGenericFilterWithMatchingBoth() throws Exception {
-// String filter = "(&(objectClass=" + TestService.class.getName()
+// String filter = "(&(objectClass=" + TestService.class.getName()
// + ")(colour=blue))";
// doTestTrackerPropertiesSet(filter,
// "osgi.remote.discovery.interest.filters",
@@ -145,36 +143,30 @@ public class CxfFindListenerHookTest ext
// Collection matchingInterfaces,
// Collection matchingFilters) throws Exception {
// Bundle bundle = control.createMock(Bundle.class);
-// Dictionary<String, String> bundleHeaders =
-// new Hashtable<String, String>();
-// bundleHeaders.put(org.osgi.framework.Constants.BUNDLE_NAME,
+// Dictionary<String, String> bundleHeaders = new Hashtable<String, String>();
+// bundleHeaders.put(org.osgi.framework.Constants.BUNDLE_NAME,
// "Test Bundle");
-// bundleHeaders.put(org.osgi.framework.Constants.BUNDLE_VERSION,
+// bundleHeaders.put(org.osgi.framework.Constants.BUNDLE_VERSION,
// "1.0.0");
// bundle.getHeaders();
// EasyMock.expectLastCall().andReturn(bundleHeaders).times(2);
// final String serviceClass = TestService.class.getName();
// bundle.loadClass(serviceClass);
// EasyMock.expectLastCall().andReturn(TestService.class).times(2);
-// final BundleContext requestingContext =
-// control.createMock(BundleContext.class);
-//
+// final BundleContext requestingContext = control.createMock(BundleContext.class);
+//
// BundleTestContext dswContext = new BundleTestContext(bundle);
-// ServiceRegistration serviceRegistration =
-// control.createMock(ServiceRegistration.class);
+// ServiceRegistration serviceRegistration = control.createMock(ServiceRegistration.class);
// dswContext.addServiceRegistration(serviceClass, serviceRegistration);
// serviceRegistration.unregister();
// EasyMock.expectLastCall().times(1);
-// ServiceReference serviceReference =
-// control.createMock(ServiceReference.class);
+// ServiceReference serviceReference = control.createMock(ServiceReference.class);
// dswContext.addServiceReference(serviceClass, serviceReference);
//
// final String trackerClass = DiscoveredServiceTracker.class.getName();
-// ServiceRegistration trackerRegistration =
-// control.createMock(ServiceRegistration.class);
+// ServiceRegistration trackerRegistration = control.createMock(ServiceRegistration.class);
// dswContext.addServiceRegistration(trackerClass, trackerRegistration);
-// ServiceReference trackerReference =
-// control.createMock(ServiceReference.class);
+// ServiceReference trackerReference = control.createMock(ServiceReference.class);
// dswContext.addServiceReference(trackerClass, trackerReference);
//
// List property = asList(propValue);
@@ -191,10 +183,10 @@ public class CxfFindListenerHookTest ext
// f.match(EasyMock.isA(Dictionary.class));
// EasyMock.expectLastCall().andReturn(true);
// }
-// }
+// }
//
// control.replay();
-//
+//
// CxfFindListenerHook hook = new CxfFindListenerHook(dswContext, null);
//
// ListenerHook.ListenerInfo info = new ListenerHook.ListenerInfo() {
@@ -208,7 +200,7 @@ public class CxfFindListenerHookTest ext
//
// public boolean isRemoved() {
// return false;
-// }
+// }
// };
// hook.added(Collections.singleton(info));
//
@@ -221,7 +213,7 @@ public class CxfFindListenerHookTest ext
// notifyAvailable(tracker, matchingInterfaces, matchingFilters, "1234");
// notifyAvailable(tracker, matchingInterfaces, matchingFilters, "5678");
// notifyAvailable(tracker, matchingInterfaces, matchingFilters, "1234");
-//
+//
// notifyUnAvailable(tracker, "1234");
// notifyUnAvailable(tracker, "5678");
//
@@ -229,15 +221,13 @@ public class CxfFindListenerHookTest ext
//
// control.verify();
//
-// Map<String, ServiceReference> registeredRefs =
-// dswContext.getRegisteredReferences();
+// Map<String, ServiceReference> registeredRefs = dswContext.getRegisteredReferences();
// assertNotNull(registeredRefs);
// assertEquals(2, registeredRefs.size());
// assertNotNull(registeredRefs.get(serviceClass));
// assertSame(serviceReference, registeredRefs.get(serviceClass));
//
-// Map<String, ServiceRegistration> registeredRegs =
-// dswContext.getRegisteredRegistrations();
+// Map<String, ServiceRegistration> registeredRegs = dswContext.getRegisteredRegistrations();
// assertNotNull(registeredRegs);
// assertEquals(2, registeredRegs.size());
// assertNotNull(registeredRegs.get(trackerClass));
@@ -246,14 +236,14 @@ public class CxfFindListenerHookTest ext
// List<Object> registeredServices = dswContext.getRegisteredServices();
// assertNotNull(registeredServices);
// assertEquals(2, registeredServices.size());
-// }
+// }
//
// @Test
// public void testConstructorAndGetters() {
// BundleContext bc = control.createMock(BundleContext.class);
// CxfRemoteServiceAdmin dp = control.createMock(CxfRemoteServiceAdmin.class);
// control.replay();
-//
+//
// CxfFindListenerHook clh = new CxfFindListenerHook(bc, dp);
// assertSame(bc, clh.getContext());
// assertSame(dp, clh.getDistributionProvider());
@@ -262,27 +252,27 @@ public class CxfFindListenerHookTest ext
// @Test
// public void testFindHook() {
// BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
-//
-// final List<String> lookupCalls = new ArrayList<String>();
+//
+// final List<String> lookupCalls = new ArrayList<String>();
// CxfFindListenerHook fh = new CxfFindListenerHook(bc, null) {
// @Override
// protected synchronized void lookupDiscoveryService(
// String interfaceName, String filterValue) {
// lookupCalls.add(interfaceName);
// lookupCalls.add(filterValue);
-// }
+// }
// };
-//
+//
// String clazz = "my.app.Class";
// String filter = "&(A=B)(C=D)";
// fh.find(null, clazz, filter, true, null);
-//
+//
// assertEquals(Arrays.asList(clazz, filter), lookupCalls);
// }
-//
+//
// private void notifyAvailable(DiscoveredServiceTracker tracker,
// Collection interfaces,
-// Collection filters,
+// Collection filters,
// String endpointId) {
// Map<String, Object> props = new Hashtable<String, Object>();
// props.put("osgi.remote.interfaces", "*");
@@ -290,11 +280,11 @@ public class CxfFindListenerHookTest ext
// tracker.serviceChanged(new Notification(AVAILABLE,
// TestService.class.getName(),
// interfaces,
-// filters,
+// filters,
// props));
// }
//
-// private void notifyUnAvailable(DiscoveredServiceTracker tracker,
+// private void notifyUnAvailable(DiscoveredServiceTracker tracker,
// String endpointId) {
// Map<String, Object> props = new Hashtable<String, Object>();
// props.put("osgi.remote.endpoint.id", endpointId);
@@ -321,14 +311,13 @@ public class CxfFindListenerHookTest ext
// private Collection interfaces;
// private Collection filters;
//
-// Notification(int type,
+// Notification(int type,
// String interfaceName,
// Collection interfaces,
-// Collection filters,
+// Collection filters,
// Map<String, Object> props) {
// this.type = type;
-// this.sed =
-// new ServiceEndpointDescriptionImpl(interfaceName, props);
+// this.sed = new ServiceEndpointDescriptionImpl(interfaceName, props);
// this.interfaces = interfaces;
// this.filters = filters;
// }
@@ -342,12 +331,11 @@ public class CxfFindListenerHookTest ext
// }
//
// public Collection getInterfaces() {
-// return interfaces;
+// return interfaces;
// }
//
// public Collection getFilters() {
-// return filters;
+// return filters;
// }
// }
-
}
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=1489675&r1=1489674&r2=1489675&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 Jun 5 00:40:54 2013
@@ -25,12 +25,11 @@ public class CxfPublishHookTest extends
@Test
public void testDUMMY() throws Exception {
-
}
//
// private IMocksControl control;
- //
+ //
// @Before
// public void setUp() {
// control = EasyMock.createNiceControl();
@@ -58,12 +57,12 @@ public class CxfPublishHookTest extends
// "http://localhost:9002/hello"};
// doTestPublishHook("multi-services.xml", serviceNames, addresses);
// }
- //
+ //
// @SuppressWarnings("unchecked")
// private void doTestPublishHook(String remoteServices,
// String[] serviceNames,
// String[] addresses) throws Exception {
- //
+ //
// Bundle bundle = control.createMock(Bundle.class);
// bundle.findEntries(EasyMock.eq("OSGI-INF/remote-service"),
// EasyMock.eq("*.xml"), EasyMock.anyBoolean());
@@ -79,7 +78,7 @@ public class CxfPublishHookTest extends
// BundleContext requestingContext = control.createMock(BundleContext.class);
// bundle.getBundleContext();
// EasyMock.expectLastCall().andReturn(requestingContext).anyTimes();
- //
+ //
// TestService serviceObject = new TestServiceImpl();
// Dictionary serviceProps = new Hashtable();
//
@@ -90,7 +89,7 @@ public class CxfPublishHookTest extends
// EasyMock.expectLastCall().andReturn(serviceNames).anyTimes();
// sref.getPropertyKeys();
// EasyMock.expectLastCall().andReturn(new String[]{}).anyTimes();
- //
+ //
// BundleTestContext dswContext = new BundleTestContext(bundle);
//
// ServiceRegistration[] serviceRegistrations =
@@ -104,7 +103,7 @@ public class CxfPublishHookTest extends
// dswContext.addServiceReference(serviceNames[i], sref);
// }
// dswContext.registerService(serviceNames, serviceObject, serviceProps);
- //
+ //
// Server server = control.createMock(Server.class);
//
// String publicationClass = ServicePublication.class.getName();
@@ -117,7 +116,7 @@ public class CxfPublishHookTest extends
// control.createMock(ServiceReference.class);
// dswContext.addServiceReference(publicationClass, publicationReference);
// control.replay();
- //
+ //
// TestPublishHook hook = new TestPublishHook(dswContext,
// serviceObject,
// server);
@@ -170,7 +169,7 @@ public class CxfPublishHookTest extends
//
// control.verify();
// }
- //
+ //
// @SuppressWarnings("unchecked")
// @Test
// public void testPublishMultipleTimes() {
@@ -201,11 +200,11 @@ public class CxfPublishHookTest extends
// sref.getBundle();
// EasyMock.expectLastCall().andReturn(bundle).anyTimes();
// sref.getProperty(Constants.OBJECTCLASS);
- // String [] serviceNames = {TestService.class.getName()};
+ // String[] serviceNames = {TestService.class.getName()};
// EasyMock.expectLastCall().andReturn(serviceNames).anyTimes();
// sref.getPropertyKeys();
// EasyMock.expectLastCall().andReturn(new String[]{}).anyTimes();
- //
+ //
// BundleTestContext dswContext = new BundleTestContext(bundle);
// ServiceRegistration[] serviceRegistrations =
// new ServiceRegistration[serviceNames.length];
@@ -217,7 +216,7 @@ public class CxfPublishHookTest extends
// dswContext.addServiceReference(serviceNames[i], sref);
// }
// dswContext.registerService(serviceNames, serviceObject, serviceProps);
- //
+ //
// final Server server = control.createMock(Server.class);
// control.replay();
//
@@ -235,23 +234,23 @@ public class CxfPublishHookTest extends
// assertEquals("Precondition failed", 0, hook.getEndpoints().get(sref).size());
// hook.publishEndpoint(sref);
// assertEquals(0, hook.getEndpoints().get(sref).size());
- //
+ //
// control.verify();
// }
//
// private static class TestPublishHook extends CxfPublishHook {
- //
+ //
// private boolean called;
// private TestService serviceObject;
// private Server server;
- //
+ //
// public TestPublishHook(BundleContext bc, TestService serviceObject,
// Server s) {
// super(bc, null);
// this.serviceObject = serviceObject;
// this.server = s;
// }
- //
+ //
// @Override
// protected ConfigurationTypeHandler getHandler(ServiceEndpointDescription sd,
// Map<String, Object> props) {
@@ -278,14 +277,14 @@ public class CxfPublishHookTest extends
// }
// return server;
// }
- //
+ //
// };
// }
- //
+ //
// public void setCalled() {
// called = true;
// }
- //
+ //
// public void verify() {
// Assert.assertTrue(called);
// }
@@ -293,8 +292,8 @@ public class CxfPublishHookTest extends
//
// public interface AdditionalInterface {
// }
- //
+ //
// private static class TestServiceImpl implements TestService, AdditionalInterface {
- //
+ //
// }
}
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=1489675&r1=1489674&r2=1489675&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 Jun 5 00:40:54 2013
@@ -21,15 +21,15 @@ package org.apache.cxf.dosgi.dsw.hooks;
import junit.framework.TestCase;
public class ServiceHookUtilsTest extends TestCase {
-
+
public void testDUMMY() {
assertTrue(true);
}
-
+
/*
public void testCreateServer() {
IMocksControl control = EasyMock.createNiceControl();
-
+
Server srvr = control.createMock(Server.class);
ServiceReference serviceReference = control.createMock(ServiceReference.class);
BundleContext dswContext = control.createMock(BundleContext.class);
@@ -41,14 +41,14 @@ public class ServiceHookUtilsTest extend
handler.createServer(serviceReference, dswContext, callingContext, sd, String.class, service);
EasyMock.expectLastCall().andReturn(srvr);
control.replay();
-
- assertSame(srvr,
+
+ assertSame(srvr,
ServiceHookUtils.createServer(handler, serviceReference, dswContext, callingContext, sd, service));
}
public void testNoServerWhenNoInterfaceSpecified() {
IMocksControl control = EasyMock.createNiceControl();
-
+
Server srvr = control.createMock(Server.class);
ServiceReference serviceReference = control.createMock(ServiceReference.class);
BundleContext dswContext = control.createMock(BundleContext.class);
@@ -60,47 +60,47 @@ public class ServiceHookUtilsTest extend
handler.createServer(serviceReference, dswContext, callingContext, sd, String.class, service);
EasyMock.expectLastCall().andReturn(srvr);
control.replay();
-
+
assertNull(ServiceHookUtils.createServer(handler, serviceReference, dswContext,
- callingContext, sd, service));
+ callingContext, sd, service));
}
-
- public void testPublish() throws Exception {
+
+ public void testPublish() throws Exception {
Map<String, Object> props = new HashMap<String, Object>();
props.put("foo", "bar");
props.put(ServicePublication.ENDPOINT_LOCATION, "http:localhost/xyz");
ServiceEndpointDescriptionImpl sed = new ServiceEndpointDescriptionImpl(String.class.getName(), props);
assertEquals(new URI("http:localhost/xyz"), sed.getLocation());
-
+
final Dictionary<String, Object> expectedProps = new Hashtable<String, Object>();
expectedProps.put(ServicePublication.SERVICE_PROPERTIES, props);
expectedProps.put(ServicePublication.SERVICE_INTERFACE_NAME, Collections.singleton(String.class.getName()));
expectedProps.put(ServicePublication.ENDPOINT_LOCATION, new URI("http:localhost/xyz"));
-
+
BundleContext bc = EasyMock.createMock(BundleContext.class);
EasyMock.expect(bc.registerService(
EasyMock.eq(ServicePublication.class.getName()),
- EasyMock.anyObject(),
+ EasyMock.anyObject(),
(Dictionary<?, ?>) EasyMock.anyObject()))
.andAnswer(new IAnswer<ServiceRegistration>() {
public ServiceRegistration answer() throws Throwable {
assertTrue(EasyMock.getCurrentArguments()[1] instanceof ServicePublication);
- Dictionary<?, ?> actualProps =
+ Dictionary<?, ?> actualProps =
(Dictionary<?, ?>) EasyMock.getCurrentArguments()[2];
UUID uuid = UUID.fromString(actualProps.get(ServicePublication.ENDPOINT_SERVICE_ID)
.toString());
expectedProps.put(ServicePublication.ENDPOINT_SERVICE_ID, uuid.toString());
assertEquals(expectedProps, actualProps);
return EasyMock.createMock(ServiceRegistration.class);
- }
+ }
});
EasyMock.replay(bc);
-
+
ServiceHookUtils.publish(bc, null, sed);
EasyMock.verify(bc);
}
-
- private ServiceEndpointDescription mockServiceDescription(IMocksControl control,
+
+ private ServiceEndpointDescription mockServiceDescription(IMocksControl control,
String... interfaceNames) {
List<String> iList = new ArrayList<String>();
for (String iName : interfaceNames) {
@@ -114,4 +114,3 @@ public class ServiceHookUtilsTest extend
*/
}
-
Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/hooks/TestService.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/hooks/TestService.java?rev=1489675&r1=1489674&r2=1489675&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/hooks/TestService.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/hooks/TestService.java Wed Jun 5 00:40:54 2013
@@ -19,5 +19,4 @@
package org.apache.cxf.dosgi.dsw.hooks;
public interface TestService {
-
}
Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/qos/IntentManagerImplTest.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/qos/IntentManagerImplTest.java?rev=1489675&r1=1489674&r2=1489675&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/qos/IntentManagerImplTest.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/qos/IntentManagerImplTest.java Wed Jun 5 00:40:54 2013
@@ -36,68 +36,67 @@ import org.easymock.classextension.EasyM
import org.easymock.classextension.IMocksControl;
import org.junit.Test;
-
public class IntentManagerImplTest extends Assert {
-
+
@Test
public void testIntents() throws Exception {
Map<String, Object> intents = new HashMap<String, Object>();
intents.put("A", new TestFeature("A"));
intents.put("SOAP", new TestFeature("SOAP"));
final IntentMap intentMap = new IntentMap(intents);
-
+
IMocksControl control = EasyMock.createNiceControl();
List<Feature> features = new ArrayList<Feature>();
AbstractEndpointFactory factory = control.createMock(AbstractEndpointFactory.class);
control.replay();
IntentManager intentManager = new IntentManagerImpl(intentMap, 10000);
-
+
Map<String, Object> props = new HashMap<String, Object>();
props.put("osgi.remote.requires.intents", "A");
List<String> effectiveIntents = Arrays.asList(intentManager.applyIntents(features, factory, props));
assertEquals(Arrays.asList("A", "SOAP"), effectiveIntents);
- }
-
+ }
+
@Test
public void testMultiIntents() {
final IntentMap intentMap = new IntentMap(new DefaultIntentMapFactory().create());
intentMap.put("confidentiality.message", new TestFeature("confidentiality.message"));
intentMap.put("transactionality", new TestFeature("transactionality"));
-
+
IMocksControl control = EasyMock.createNiceControl();
List<Feature> features = new ArrayList<Feature>();
AbstractEndpointFactory factory = control.createMock(AbstractEndpointFactory.class);
control.replay();
IntentManager intentManager = new IntentManagerImpl(intentMap);
-
+
Map<String, Object> props = new HashMap<String, Object>();
props.put("osgi.remote.requires.intents", "transactionality confidentiality.message");
List<String> effectiveIntents = Arrays.asList(intentManager.applyIntents(features, factory, props));
- assertTrue(effectiveIntents.contains("transactionality"));
- assertTrue(effectiveIntents.contains("confidentiality.message"));
+ assertTrue(effectiveIntents.contains("transactionality"));
+ assertTrue(effectiveIntents.contains("confidentiality.message"));
}
-
+
@Test
public void testFailedIntent() {
Map<String, Object> intents = new HashMap<String, Object>();
intents.put("A", new TestFeature("A"));
final IntentMap intentMap = new IntentMap(intents);
-
+
IMocksControl control = EasyMock.createNiceControl();
List<Feature> features = new ArrayList<Feature>();
AbstractEndpointFactory factory = control.createMock(AbstractEndpointFactory.class);
control.replay();
-
+
IntentManager intentManager = new IntentManagerImpl(intentMap);
Map<String, Object> props = new HashMap<String, Object>();
props.put("osgi.remote.requires.intents", "A B");
- // ServiceEndpointDescription sd =
- // new ServiceEndpointDescriptionImpl(Arrays.asList(String.class.getName()), props);
+ // ServiceEndpointDescription sd =
+ // new ServiceEndpointDescriptionImpl(Arrays.asList(String.class.getName()), props);
try {
intentManager.applyIntents(features, factory, props);
@@ -106,7 +105,7 @@ public class IntentManagerImplTest exten
assertEquals("B", iue.getIntent());
}
}
-
+
@Test
public void testInferIntents() {
Map<String, Object> intents = new HashMap<String, Object>();
@@ -117,28 +116,28 @@ public class IntentManagerImplTest exten
intents.put("A_alt", feat1);
intents.put("B", new TestFeature("B"));
final IntentMap intentMap = new IntentMap(intents);
-
+
IMocksControl control = EasyMock.createNiceControl();
List<Feature> features = new ArrayList<Feature>();
AbstractEndpointFactory factory = control.createMock(AbstractEndpointFactory.class);
control.replay();
IntentManager intentManager = new IntentManagerImpl(intentMap);
-
+
Map<String, Object> props = new HashMap<String, Object>();
props.put("osgi.remote.requires.intents", "A");
- // ServiceEndpointDescription sd =
- // new ServiceEndpointDescriptionImpl(Arrays.asList(String.class.getName()), props);
-
+ // ServiceEndpointDescription sd =
+ // new ServiceEndpointDescriptionImpl(Arrays.asList(String.class.getName()), props);
+
List<String> effectiveIntents = Arrays.asList(intentManager.applyIntents(features, factory, props));
assertEquals(4, effectiveIntents.size());
assertTrue(effectiveIntents.contains("Prov"));
assertTrue(effectiveIntents.contains("A"));
assertTrue(effectiveIntents.contains("A_alt"));
}
-
+
@Test
- public void testDefaultBindingIntent() {
+ public void testDefaultBindingIntent() {
IMocksControl control = EasyMock.createNiceControl();
Map<String, Object> intents = new HashMap<String, Object>();
@@ -157,11 +156,10 @@ public class IntentManagerImplTest exten
Map<String, Object> props = new HashMap<String, Object>();
props.put("osgi.remote.requires.intents", "A");
- // ServiceEndpointDescription sd =
- // new ServiceEndpointDescriptionImpl(Arrays.asList(String.class.getName()), props);
-
- List<String> effectiveIntents =
- Arrays.asList(intentManager.applyIntents(features, factory, props));
+ // ServiceEndpointDescription sd =
+ // new ServiceEndpointDescriptionImpl(Arrays.asList(String.class.getName()), props);
+
+ List<String> effectiveIntents = Arrays.asList(intentManager.applyIntents(features, factory, props));
assertEquals(3, effectiveIntents.size());
assertTrue(effectiveIntents.contains("A"));
assertTrue(effectiveIntents.contains("SOAP"));
@@ -189,19 +187,18 @@ public class IntentManagerImplTest exten
Map<String, Object> props = new HashMap<String, Object>();
props.put("osgi.remote.requires.intents", "A SOAP.1_2");
- // ServiceEndpointDescription sd =
- // new ServiceEndpointDescriptionImpl(Arrays.asList(String.class.getName()), props);
-
- List<String> effectiveIntents =
- Arrays.asList(intentManager.applyIntents(features, factory, props));
+ // ServiceEndpointDescription sd =
+ // new ServiceEndpointDescriptionImpl(Arrays.asList(String.class.getName()), props);
+
+ List<String> effectiveIntents = Arrays.asList(intentManager.applyIntents(features, factory, props));
assertEquals(2, effectiveIntents.size());
assertTrue(effectiveIntents.contains("A"));
- assertTrue(effectiveIntents.contains("SOAP.1_2"));
+ assertTrue(effectiveIntents.contains("SOAP.1_2"));
}
public void testInheritMasterIntentMapDefault() {
List<String> features = runTestInheritMasterIntentMap("A B");
-
+
assertEquals(2, features.size());
assertTrue(features.contains("appFeatureA"));
assertTrue(features.contains("masterFeatureB"));
@@ -209,7 +206,7 @@ public class IntentManagerImplTest exten
public void testInheritMasterIntentMap() {
List<String> features = runTestInheritMasterIntentMap("A B");
-
+
assertEquals(2, features.size());
assertTrue(features.contains("appFeatureA"));
assertTrue(features.contains("masterFeatureB"));
@@ -229,7 +226,7 @@ public class IntentManagerImplTest exten
Map<String, Object> props = new HashMap<String, Object>();
props.put("osgi.remote.requires.intents", requestedIntents);
-
+
IntentManagerImpl intentManager = new IntentManagerImpl(intentMap);
intentManager.applyIntents(features, factory, props);
@@ -239,7 +236,7 @@ public class IntentManagerImplTest exten
}
return featureNames;
}
-
+
@Test
public void testProvidedIntents() {
Map<String, Object> masterIntents = new HashMap<String, Object>();
@@ -252,22 +249,23 @@ public class IntentManagerImplTest exten
List<Feature> features = new ArrayList<Feature>();
AbstractEndpointFactory factory = control.createMock(AbstractEndpointFactory.class);
control.replay();
-
+
Map<String, Object> props = new HashMap<String, Object>();
props.put("osgi.remote.requires.intents", "B A");
-
+
IntentManager intentManager = new IntentManagerImpl(intentMap);
-
+
Set<String> effectiveIntents = new HashSet<String>(Arrays.asList(intentManager.applyIntents(features,
- factory,
+ factory,
props)));
- Set<String> expectedIntents = new HashSet<String>(Arrays.asList(new String [] {"A", "B", "SOAP"}));
+ Set<String> expectedIntents = new HashSet<String>(Arrays.asList(new String[] {"A", "B", "SOAP"}));
assertEquals(expectedIntents, effectiveIntents);
}
-
+
private static final class TestFeature extends AbstractFeature {
+
private final String name;
-
+
private TestFeature(String n) {
name = n;
}
Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/qos/IntentTrackerTest.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/qos/IntentTrackerTest.java?rev=1489675&r1=1489674&r2=1489675&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/qos/IntentTrackerTest.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/qos/IntentTrackerTest.java Wed Jun 5 00:40:54 2013
@@ -36,6 +36,7 @@ import org.osgi.framework.ServiceReferen
import static org.easymock.EasyMock.expect;
public class IntentTrackerTest {
+
private static final String MY_INTENT_NAME = "myIntent";
@Test
@@ -48,7 +49,7 @@ public class IntentTrackerTest {
final Capture<ServiceListener> capturedListener = new Capture<ServiceListener>();
bc.addServiceListener(EasyMock.capture(capturedListener), EasyMock.<String>anyObject());
EasyMock.expectLastCall().atLeastOnce();
- expect(bc.getServiceReferences(EasyMock.<String>anyObject(),
+ expect(bc.getServiceReferences(EasyMock.<String>anyObject(),
EasyMock.<String>anyObject())).andReturn(new ServiceReference[]{});
IntentMap intentMap = new IntentMap();
@@ -63,19 +64,18 @@ public class IntentTrackerTest {
IntentTracker tracker = new IntentTracker(bc, intentMap);
tracker.open();
-
+
Assert.assertFalse("IntentMap should not contain " + MY_INTENT_NAME, intentMap.containsKey(MY_INTENT_NAME));
ServiceListener listener = capturedListener.getValue();
-
+
// Simulate adding custom intent service
ServiceEvent event = new ServiceEvent(ServiceEvent.REGISTERED, reference);
listener.serviceChanged(event);
-
+
// our custom intent should now be available
Assert.assertTrue("IntentMap should contain " + MY_INTENT_NAME, intentMap.containsKey(MY_INTENT_NAME));
Assert.assertEquals(testIntent, intentMap.get(MY_INTENT_NAME));
-
+
c.verify();
-
}
}
Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/qos/IntentUtilsTest.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/qos/IntentUtilsTest.java?rev=1489675&r1=1489674&r2=1489675&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/qos/IntentUtilsTest.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/qos/IntentUtilsTest.java Wed Jun 5 00:40:54 2013
@@ -30,8 +30,8 @@ import org.junit.Assert;
import org.junit.Test;
import org.osgi.service.remoteserviceadmin.RemoteConstants;
-
public class IntentUtilsTest {
+
@Test
public void testMergeArrays() {
Assert.assertNull(IntentUtils.mergeArrays(null, null));
Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/DistributionProviderImplTest.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/DistributionProviderImplTest.java?rev=1489675&r1=1489674&r2=1489675&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/DistributionProviderImplTest.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/DistributionProviderImplTest.java Wed Jun 5 00:40:54 2013
@@ -21,20 +21,21 @@ package org.apache.cxf.dosgi.dsw.service
import junit.framework.TestCase;
public class DistributionProviderImplTest extends TestCase {
+
public void testDUMMY() {
assertTrue(true);
}
-
+
// public void testExposedServices() {
// BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
// EasyMock.replay(bc);
// RemoteServiceAdminCore dp = new RemoteServiceAdminCore(bc);
-//
+//
// assertEquals(0, dp.getExposedServices().size());
// assertEquals(0, dp.getRemoteServices().size());
// ServiceReference sr = new TestServiceReference();
// ServiceReference sr2 = new TestServiceReference();
-//
+//
// dp.addExposedService(sr, null);
// assertEquals(1, dp.getExposedServices().size());
// assertEquals(0, dp.getRemoteServices().size());
@@ -46,20 +47,20 @@ public class DistributionProviderImplTes
// assertSame(sr, dp.getExposedServices().iterator().next());
//
// dp.addExposedService(sr2, null);
-// assertEquals(2, dp.getExposedServices().size());
+// assertEquals(2, dp.getExposedServices().size());
// assertEquals(0, dp.getRemoteServices().size());
-// }
-//
+// }
+//
// public void testRemoteServices() {
// BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
// EasyMock.replay(bc);
// RemoteServiceAdminCore dp = new RemoteServiceAdminCore(bc);
-//
+//
// assertEquals(0, dp.getExposedServices().size());
-// assertEquals(0, dp.getRemoteServices().size());
+// assertEquals(0, dp.getRemoteServices().size());
// ServiceReference sr = new TestServiceReference();
// ServiceReference sr2 = new TestServiceReference();
-//
+//
// dp.addRemoteService(sr);
// assertEquals(0, dp.getExposedServices().size());
// assertEquals(1, dp.getRemoteServices().size());
@@ -71,20 +72,20 @@ public class DistributionProviderImplTes
// assertSame(sr, dp.getRemoteServices().iterator().next());
//
// dp.addRemoteService(sr2);
-// assertEquals(0, dp.getExposedServices().size());
+// assertEquals(0, dp.getExposedServices().size());
// assertEquals(2, dp.getRemoteServices().size());
// }
-//
+//
// public void testPublicationProperties() {
// BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
// EasyMock.replay(bc);
-//
+//
// RemoteServiceAdminCore dp = new RemoteServiceAdminCore(bc);
// ServiceReference sr = new TestServiceReference();
// ServiceReference sr2 = new TestServiceReference();
-//
+//
// assertNull(dp.getExposedProperties(sr));
-//
+//
// dp.addExposedService(sr, null);
// Map<String, String> pp = new HashMap<String, String>();
// pp.put("a", "b");
@@ -93,8 +94,9 @@ public class DistributionProviderImplTes
// assertEquals(0, dp.getExposedProperties(sr).size());
// assertEquals(pp, dp.getExposedProperties(sr2));
// }
-//
+//
// private static class TestServiceReference implements ServiceReference {
+
// public Bundle getBundle() {
// return null;
// }
@@ -113,8 +115,8 @@ public class DistributionProviderImplTes
//
// public boolean isAssignableTo(Bundle arg0, String arg1) {
// return false;
-// }
-//
+// }
+//
// public int compareTo(Object o) {
// return 0;
// }