cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1420351 - in /cxf/dosgi/trunk/dsw/cxf-dsw/src: main/java/org/apache/cxf/dosgi/dsw/ main/java/org/apache/cxf/dosgi/dsw/handlers/ main/java/org/apache/cxf/dosgi/dsw/qos/ main/java/org/apache/cxf/dosgi/dsw/service/ main/java/org/apache/cxf/do...
Date Tue, 11 Dec 2012 19:29:45 GMT
Author: dkulp
Date: Tue Dec 11 19:29:42 2012
New Revision: 1420351

URL: http://svn.apache.org/viewvc?rev=1420351&view=rev
Log:
Fix rest of checkstyle/pmd things in cxf-dsw

Modified:
    cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/Constants.java
    cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/AbstractPojoConfigurationTypeHandler.java
    cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceManager.java
    cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSPojoConfigurationTypeHandler.java
    cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSUtils.java
    cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/PojoConfigurationTypeHandler.java
    cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentManagerImpl.java
    cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentUtils.java
    cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/EventAdminHelper.java
    cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/ImportRegistrationImpl.java
    cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminCore.java
    cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/util/Utils.java
    cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/ActivatorTest.java
    cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/hooks/ServiceHookUtilsTest.java
    cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/UtilsTest.java

Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/Constants.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/Constants.java?rev=1420351&r1=1420350&r2=1420351&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/Constants.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/Constants.java Tue
Dec 11 19:29:42 2012
@@ -20,7 +20,7 @@ package org.apache.cxf.dosgi.dsw;
 
 import org.osgi.service.remoteserviceadmin.RemoteConstants;
 
-public class Constants {
+public final class Constants {
     // Constants from RFC 119, they should ultimately be picked up from an OSGi class.
     @Deprecated
     public static final String EXPORTED_INTERFACES = RemoteConstants.SERVICE_EXPORTED_INTERFACES;
@@ -125,4 +125,8 @@ public class Constants {
     public static final String INTENT_NAME_PROP = "org.apache.cxf.dosgi.IntentName";
     public static final String HTTP_BASE = "httpBase";
     public static final String CXF_SERVLET_ALIAS = "cxfServletAlias";
+    
+    private Constants() {
+        //never constructed
+    }
 }

Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/AbstractPojoConfigurationTypeHandler.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/AbstractPojoConfigurationTypeHandler.java?rev=1420351&r1=1420350&r2=1420351&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/AbstractPojoConfigurationTypeHandler.java
(original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/AbstractPojoConfigurationTypeHandler.java
Tue Dec 11 19:29:42 2012
@@ -240,17 +240,17 @@ public abstract class AbstractPojoConfig
         List<Object> providers = ClassUtils.loadProviderClasses(callingContext, sd,
propName);
         boolean in = propName.contains("in.interceptors");
         boolean out = propName.contains("out.interceptors");
-        boolean in_fault = propName.contains("in.fault.interceptors");
-        boolean out_fault = propName.contains("out.fault.interceptors");
+        boolean inFault = propName.contains("in.fault.interceptors");
+        boolean outFault = propName.contains("out.fault.interceptors");
         for (int i = 0; i < providers.size(); i++) {
             Interceptor<?> interceptor = (Interceptor<?>)providers.get(i);
             if (in) {
                 factory.getInInterceptors().add(interceptor);
             } else if (out) {
                 factory.getOutInterceptors().add(interceptor);
-            } else if (in_fault) {
+            } else if (inFault) {
                 factory.getInFaultInterceptors().add(interceptor);
-            } else if (out_fault) {
+            } else if (outFault) {
                 factory.getOutFaultInterceptors().add(interceptor);
             }
         }

Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceManager.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceManager.java?rev=1420351&r1=1420350&r2=1420351&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceManager.java
(original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceManager.java
Tue Dec 11 19:29:42 2012
@@ -49,12 +49,15 @@ public class HttpServiceManager {
     private String cxfServletAlias;
 
     public HttpServiceManager(BundleContext bundleContext, String httpBase, String cxfServletAlias)
{
-        this(bundleContext, httpBase, cxfServletAlias, new ServiceTracker(bundleContext,
HttpService.class.getName(), null));
+        this(bundleContext, httpBase, cxfServletAlias, 
+             new ServiceTracker(bundleContext, HttpService.class.getName(), null));
         this.tracker.open();
     }
 
     // Only for tests
-    public HttpServiceManager(BundleContext bundleContext, String httpBase, String cxfServletAlias,
ServiceTracker tracker) {
+    public HttpServiceManager(BundleContext bundleContext, 
+                              String httpBase, String cxfServletAlias, 
+                              ServiceTracker tracker) {
         this.bundleContext = bundleContext;
         this.tracker = tracker;
         this.httpBase = getWithDefault(httpBase, "http://" + LocalHostUtil.getLocalIp() +
":8181");

Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSPojoConfigurationTypeHandler.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSPojoConfigurationTypeHandler.java?rev=1420351&r1=1420350&r2=1420351&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSPojoConfigurationTypeHandler.java
(original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSPojoConfigurationTypeHandler.java
Tue Dec 11 19:29:42 2012
@@ -112,8 +112,7 @@ public class JaxRSPojoConfigurationTypeH
             bean.setProviders(providers);
         }
         Thread.currentThread().setContextClassLoader(JAXRSClientFactoryBean.class.getClassLoader());
-        Object proxy = getProxy(bean.create(), iClass);
-        return proxy;
+        return getProxy(bean.create(), iClass);
     }
     
     public ExportResult createServer(ServiceReference sref,

Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSUtils.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSUtils.java?rev=1420351&r1=1420350&r2=1420351&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSUtils.java
(original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSUtils.java
Tue Dec 11 19:29:42 2012
@@ -34,7 +34,7 @@ import org.osgi.framework.ServiceReferen
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class JaxRSUtils {
+public final class JaxRSUtils {
 
     public static final String MODEL_FOLDER = "/OSGI-INF/cxf/jaxrs/";
     public static final String DEFAULT_MODEL = "/OSGI-INF/cxf/jaxrs/model.xml";
@@ -49,6 +49,9 @@ public class JaxRSUtils {
             + ")";
     private static final Logger LOG = LoggerFactory.getLogger(JaxRSUtils.class);
 
+    private JaxRSUtils() {
+        //never contructed
+    }
 
     @SuppressWarnings("rawtypes")
     static List<Object> getProviders(BundleContext callingContext, BundleContext dswBC,
Map sd) {

Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/PojoConfigurationTypeHandler.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/PojoConfigurationTypeHandler.java?rev=1420351&r1=1420350&r2=1420351&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/PojoConfigurationTypeHandler.java
(original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/PojoConfigurationTypeHandler.java
Tue Dec 11 19:29:42 2012
@@ -76,8 +76,7 @@ public class PojoConfigurationTypeHandle
             intentManager.applyIntents(factory.getFeatures(), factory.getClientFactoryBean(),
sd);
 
             Thread.currentThread().setContextClassLoader(ClientProxyFactoryBean.class.getClassLoader());
-            Object proxy = getProxy(factory.create(), iClass);
-            return proxy;
+            return getProxy(factory.create(), iClass);
         } catch (Exception e) {
             LOG.warn("proxy creation failed", e);
         } finally {

Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentManagerImpl.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentManagerImpl.java?rev=1420351&r1=1420350&r2=1420351&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentManagerImpl.java
(original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentManagerImpl.java
Tue Dec 11 19:29:42 2012
@@ -64,7 +64,7 @@ public class IntentManagerImpl implement
             appliedIntents.add(defaultBindingName);
         }
         appliedIntents.addAll(addSynonymIntents(appliedIntents, intentMap));
-        return appliedIntents.toArray(new String[0]);
+        return appliedIntents.toArray(new String[appliedIntents.size()]);
     }
     
     private boolean processIntent(List<Feature> features, AbstractEndpointFactory factory,

Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentUtils.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentUtils.java?rev=1420351&r1=1420350&r2=1420351&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentUtils.java
(original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentUtils.java
Tue Dec 11 19:29:42 2012
@@ -31,8 +31,11 @@ import org.apache.cxf.dosgi.dsw.util.Osg
 import org.apache.cxf.dosgi.dsw.util.Utils;
 import org.osgi.service.remoteserviceadmin.RemoteConstants;
 
-public class IntentUtils {
-
+public final class IntentUtils {
+    private IntentUtils() {
+        //never constructed
+    }
+    
     public static String formatIntents(String[] intents) {
         StringBuilder sb = new StringBuilder();
         boolean first = true;

Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/EventAdminHelper.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/EventAdminHelper.java?rev=1420351&r1=1420350&r2=1420351&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/EventAdminHelper.java
(original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/EventAdminHelper.java
Tue Dec 11 19:29:42 2012
@@ -133,26 +133,36 @@ public class EventAdminHelper {
     }
 
     static String remoteServiceAdminEventTypeToString(int type) {
+        String retval = null;
         switch (type) {
         case RemoteServiceAdminEvent.EXPORT_ERROR:
-            return "EXPORT_ERROR";
+            retval = "EXPORT_ERROR";
+            break;
         case RemoteServiceAdminEvent.EXPORT_REGISTRATION:
-            return "EXPORT_REGISTRATION";
+            retval = "EXPORT_REGISTRATION";
+            break;
         case RemoteServiceAdminEvent.EXPORT_UNREGISTRATION:
-            return "EXPORT_UNREGISTRATION";
+            retval = "EXPORT_UNREGISTRATION";
+            break;
         case RemoteServiceAdminEvent.EXPORT_WARNING:
-            return "EXPORT_WARNING";
+            retval = "EXPORT_WARNING";
+            break;
         case RemoteServiceAdminEvent.IMPORT_ERROR:
-            return "IMPORT_ERROR";
+            retval = "IMPORT_ERROR";
+            break;
         case RemoteServiceAdminEvent.IMPORT_REGISTRATION:
-            return "IMPORT_REGISTRATION";
+            retval = "IMPORT_REGISTRATION";
+            break;
         case RemoteServiceAdminEvent.IMPORT_UNREGISTRATION:
-            return "IMPORT_UNREGISTRATION";
+            retval = "IMPORT_UNREGISTRATION";
+            break;
         case RemoteServiceAdminEvent.IMPORT_WARNING:
-            return "IMPORT_WARNING";    
+            retval = "IMPORT_WARNING";
+            break;
         default:
-            return "UNKNOWN_EVENT";
+            retval = "UNKNOWN_EVENT";
         }
+        return retval;
     }
 
 }

Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/ImportRegistrationImpl.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/ImportRegistrationImpl.java?rev=1420351&r1=1420350&r2=1420351&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/ImportRegistrationImpl.java
(original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/ImportRegistrationImpl.java
Tue Dec 11 19:29:42 2012
@@ -177,7 +177,7 @@ public class ImportRegistrationImpl impl
         return exception != null;
     }
 
-    private void _setImportedServiceRegistration(ServiceRegistration proxyRegistration) {
+    private void setImportedServiceRegistrationInternal(ServiceRegistration proxyRegistration)
{
         importedService = proxyRegistration;
     }
 
@@ -186,9 +186,9 @@ public class ImportRegistrationImpl impl
             throw new IllegalStateException("this method may only be called on the parent
!");
         }
 
-        _setImportedServiceRegistration(proxyRegistration);
+        setImportedServiceRegistrationInternal(proxyRegistration);
         for (ImportRegistrationImpl ir : childs) {
-            ir._setImportedServiceRegistration(proxyRegistration);
+            ir.setImportedServiceRegistrationInternal(proxyRegistration);
         }
     }
 

Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminCore.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminCore.java?rev=1420351&r1=1420350&r2=1420351&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminCore.java
(original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminCore.java
Tue Dec 11 19:29:42 2012
@@ -55,9 +55,9 @@ public class RemoteServiceAdminCore impl
 
     private static final Logger LOG = LoggerFactory.getLogger(RemoteServiceAdminCore.class);
 
-    private final LinkedHashMap<ServiceReference, Collection<ExportRegistration>>
exportedServices 
+    private final Map<ServiceReference, Collection<ExportRegistration>> exportedServices

         = new LinkedHashMap<ServiceReference, Collection<ExportRegistration>>();
-    private final LinkedHashMap<EndpointDescription, Collection<ImportRegistrationImpl>>
importedServices
+    private final Map<EndpointDescription, Collection<ImportRegistrationImpl>>
importedServices
         = new LinkedHashMap<EndpointDescription, Collection<ImportRegistrationImpl>>();
 
     private BundleContext bctx;
@@ -100,8 +100,7 @@ public class RemoteServiceAdminCore impl
                 return copyExportRegistration(serviceReference);
             }
             LOG.info("interfaces selected for export: " + interfaces);
-            LinkedHashMap<String, ExportRegistrationImpl> exportRegs 
-                = new LinkedHashMap<String, ExportRegistrationImpl>(1);
+            Map<String, ExportRegistrationImpl> exportRegs = new LinkedHashMap<String,
ExportRegistrationImpl>(1);
             Object serviceObject = bctx.getService(serviceReference);
             BundleContext callingContext = serviceReference.getBundle().getBundleContext();
             ConfigurationTypeHandler handler = null;

Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/util/Utils.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/util/Utils.java?rev=1420351&r1=1420350&r2=1420351&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/util/Utils.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/util/Utils.java Tue
Dec 11 19:29:42 2012
@@ -25,9 +25,12 @@ import java.util.List;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class Utils {
+public final class Utils {
 
     private static final Logger LOG = LoggerFactory.getLogger(Utils.class);
+    private Utils() {
+        //never constructed
+    }
     
     @SuppressWarnings("rawtypes")
     public static String[] normalizeStringPlus(Object object) {

Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/ActivatorTest.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/ActivatorTest.java?rev=1420351&r1=1420350&r2=1420351&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/ActivatorTest.java
(original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/ActivatorTest.java
Tue Dec 11 19:29:42 2012
@@ -34,7 +34,7 @@ import org.osgi.service.remoteserviceadm
 public class ActivatorTest extends TestCase {
     private BundleContext getMockBundleContext(IMocksControl control) {
         Bundle b = control.createMock(Bundle.class);
-        Hashtable<String, String> ht = new Hashtable<String, String>();
+        Dictionary<String, String> ht = new Hashtable<String, String>();
         EasyMock.expect(b.getHeaders()).andReturn(ht).anyTimes();        
         BundleContext bc = control.createMock(BundleContext.class);
 

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=1420351&r1=1420350&r2=1420351&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
Tue Dec 11 19:29:42 2012
@@ -26,88 +26,92 @@ public class ServiceHookUtilsTest extend
         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);
-//        BundleContext callingContext = control.createMock(BundleContext.class);
-//        ServiceEndpointDescription sd = new ServiceEndpointDescriptionImpl("java.lang.String");
-//        Object service = "hi";
-//
-//        ConfigurationTypeHandler handler = control.createMock(ConfigurationTypeHandler.class);
-//        handler.createServer(serviceReference, dswContext, callingContext, sd, String.class,
service);
-//        EasyMock.expectLastCall().andReturn(srvr);
-//        control.replay();
-//        
-//        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);
-//        BundleContext callingContext = control.createMock(BundleContext.class);
-//        ServiceEndpointDescription sd = mockServiceDescription(control, "Foo");
-//        Object service = "hi";
-//
-//        ConfigurationTypeHandler handler = control.createMock(ConfigurationTypeHandler.class);
-//        handler.createServer(serviceReference, dswContext, callingContext, sd, String.class,
service);
-//        EasyMock.expectLastCall().andReturn(srvr);
-//        control.replay();
-//        
-//        assertNull(ServiceHookUtils.createServer(handler, serviceReference, dswContext,
callingContext, sd, service));        
-//    }
-//    
-//    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(), 
-//            (Dictionary<?, ?>) EasyMock.anyObject()))
-//                .andAnswer(new IAnswer<ServiceRegistration>() {
-//                    public ServiceRegistration answer() throws Throwable {
-//                        assertTrue(EasyMock.getCurrentArguments()[1] instanceof ServicePublication);
-//                        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, 
-//                                                              String... interfaceNames)
{
-//        List<String> iList = new ArrayList<String>();
-//        for (String iName : interfaceNames) {
-//            iList.add(iName);
-//        }
-//        ServiceEndpointDescription sd = control.createMock(ServiceEndpointDescription.class);
-//        sd.getProvidedInterfaces();
-//        EasyMock.expectLastCall().andReturn(iList);
-//        return sd;
-//    }
+/*
+    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);
+        BundleContext callingContext = control.createMock(BundleContext.class);
+        ServiceEndpointDescription sd = new ServiceEndpointDescriptionImpl("java.lang.String");
+        Object service = "hi";
+
+        ConfigurationTypeHandler handler = control.createMock(ConfigurationTypeHandler.class);
+        handler.createServer(serviceReference, dswContext, callingContext, sd, String.class,
service);
+        EasyMock.expectLastCall().andReturn(srvr);
+        control.replay();
+        
+        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);
+        BundleContext callingContext = control.createMock(BundleContext.class);
+        ServiceEndpointDescription sd = mockServiceDescription(control, "Foo");
+        Object service = "hi";
+
+        ConfigurationTypeHandler handler = control.createMock(ConfigurationTypeHandler.class);
+        handler.createServer(serviceReference, dswContext, callingContext, sd, String.class,
service);
+        EasyMock.expectLastCall().andReturn(srvr);
+        control.replay();
+        
+        assertNull(ServiceHookUtils.createServer(handler, serviceReference, dswContext,
+                                                 callingContext, sd, service));        
+    }
+    
+    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(), 
+            (Dictionary<?, ?>) EasyMock.anyObject()))
+                .andAnswer(new IAnswer<ServiceRegistration>() {
+                    public ServiceRegistration answer() throws Throwable {
+                        assertTrue(EasyMock.getCurrentArguments()[1] instanceof ServicePublication);
+                        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, 
+                                                              String... interfaceNames) {
+        List<String> iList = new ArrayList<String>();
+        for (String iName : interfaceNames) {
+            iList.add(iName);
+        }
+        ServiceEndpointDescription sd = control.createMock(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/service/UtilsTest.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/UtilsTest.java?rev=1420351&r1=1420350&r2=1420351&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/UtilsTest.java
(original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/UtilsTest.java
Tue Dec 11 19:29:42 2012
@@ -80,99 +80,93 @@ public class UtilsTest {
         Properties copy = new Properties();
         copy.putAll(original);
 
-        { // nothing should change here
-            Properties overload = new Properties();
-            OsgiUtils.overlayProperties(copy, overload);
-
-            assertEquals(original.size(), copy.size());
-            for (Object key : Collections.list(original.keys())) {
-                assertEquals(original.get(key), copy.get(key));
-            }
+        // nothing should change here
+        Properties overload = new Properties();
+        OsgiUtils.overlayProperties(copy, overload);
+
+        assertEquals(original.size(), copy.size());
+        for (Object key : Collections.list(original.keys())) {
+            assertEquals(original.get(key), copy.get(key));
         }
         
         copy.clear();
         copy.putAll(original);
         
-        { // a property should be added
-            Properties overload = new Properties();
-            overload.put("new", "prop");
+        // a property should be added
+        overload = new Properties();
+        overload.put("new", "prop");
             
-            OsgiUtils.overlayProperties(copy, overload);
+        OsgiUtils.overlayProperties(copy, overload);
 
-            assertEquals(original.size() + 1, copy.size());
-            for (Object key : Collections.list(original.keys())) {
-                assertEquals(original.get(key), copy.get(key));
-            }
-            assertNotNull(overload.get("new"));
-            assertEquals("prop", overload.get("new"));
+        assertEquals(original.size() + 1, copy.size());
+        for (Object key : Collections.list(original.keys())) {
+            assertEquals(original.get(key), copy.get(key));
         }
-        
+        assertNotNull(overload.get("new"));
+        assertEquals("prop", overload.get("new"));
+
         copy.clear();
         copy.putAll(original);
         
-        { // only one property should be added
-            Properties overload = new Properties();
-            overload.put("new", "prop");
-            overload.put("NEW", "prop");
+        // only one property should be added
+        overload = new Properties();
+        overload.put("new", "prop");
+        overload.put("NEW", "prop");
             
-            OsgiUtils.overlayProperties(copy, overload);
+        OsgiUtils.overlayProperties(copy, overload);
 
-            assertEquals(original.size() + 1, copy.size());
-            for (Object key : Collections.list(original.keys())) {
-                assertEquals(original.get(key), copy.get(key));
-            }
-            assertNotNull(overload.get("new"));
-            assertEquals("prop", overload.get("new"));
+        assertEquals(original.size() + 1, copy.size());
+        for (Object key : Collections.list(original.keys())) {
+            assertEquals(original.get(key), copy.get(key));
         }
+        assertNotNull(overload.get("new"));
+        assertEquals("prop", overload.get("new"));
         
         copy.clear();
         copy.putAll(original);
         
-        { // nothing should change here
-            Properties overload = new Properties();
-            overload.put(Constants.OBJECTCLASS, "assd");
-            overload.put(Constants.SERVICE_ID, "asasdasd");
-            OsgiUtils.overlayProperties(copy, overload);
-
-            assertEquals(original.size(), copy.size());
-            for (Object key : Collections.list(original.keys())) {
-                assertEquals(original.get(key), copy.get(key));
-            }
+        // nothing should change here
+        overload = new Properties();
+        overload.put(Constants.OBJECTCLASS, "assd");
+        overload.put(Constants.SERVICE_ID, "asasdasd");
+        OsgiUtils.overlayProperties(copy, overload);
+
+        assertEquals(original.size(), copy.size());
+        for (Object key : Collections.list(original.keys())) {
+            assertEquals(original.get(key), copy.get(key));
         }
         
         copy.clear();
         copy.putAll(original);
         
-        { // overwrite own prop
-            Properties overload = new Properties();
-            overload.put("MyProp", "newValue");
-            OsgiUtils.overlayProperties(copy, overload);
-
-            assertEquals(original.size(), copy.size());
-            for (Object key : Collections.list(original.keys())) {
-                if (!"MyProp".equals(key)) {
-                    assertEquals(original.get(key), copy.get(key));
-                }
+        // overwrite own prop
+        overload = new Properties();
+        overload.put("MyProp", "newValue");
+        OsgiUtils.overlayProperties(copy, overload);
+
+        assertEquals(original.size(), copy.size());
+        for (Object key : Collections.list(original.keys())) {
+            if (!"MyProp".equals(key)) {
+                assertEquals(original.get(key), copy.get(key));
             }
-            assertEquals("newValue", copy.get("MyProp"));
         }
+        assertEquals("newValue", copy.get("MyProp"));
         
         copy.clear();
         copy.putAll(original);
         
-        { // overwrite own prop in different case
-            Properties overload = new Properties();
-            overload.put("MYPROP", "newValue");
-            OsgiUtils.overlayProperties(copy, overload);
-
-            assertEquals(original.size(), copy.size());
-            for (Object key : Collections.list(original.keys())) {
-                if (!"MyProp".equals(key)) {
-                    assertEquals(original.get(key), copy.get(key));
-                }
+        // overwrite own prop in different case
+        overload = new Properties();
+        overload.put("MYPROP", "newValue");
+        OsgiUtils.overlayProperties(copy, overload);
+
+        assertEquals(original.size(), copy.size());
+        for (Object key : Collections.list(original.keys())) {
+            if (!"MyProp".equals(key)) {
+                assertEquals(original.get(key), copy.get(key));
             }
-            assertEquals("newValue", copy.get("MyProp"));
         }
+        assertEquals("newValue", copy.get("MyProp"));
 
     }
 



Mime
View raw message