You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by gn...@apache.org on 2006/02/14 23:30:45 UTC

svn commit: r377862 - in /incubator/servicemix/trunk/servicemix-core/src: main/java/org/apache/servicemix/jbi/framework/ test/java/org/apache/servicemix/jbi/installation/ test/java/org/apache/servicemix/jbi/management/task/

Author: gnodet
Date: Tue Feb 14 14:30:43 2006
New Revision: 377862

URL: http://svn.apache.org/viewcvs?rev=377862&view=rev
Log:
Fix test cases

Modified:
    incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/AdminCommandsService.java
    incubator/servicemix/trunk/servicemix-core/src/test/java/org/apache/servicemix/jbi/installation/InstallationTest.java
    incubator/servicemix/trunk/servicemix-core/src/test/java/org/apache/servicemix/jbi/management/task/InstallComponentTaskTest.java
    incubator/servicemix/trunk/servicemix-core/src/test/java/org/apache/servicemix/jbi/management/task/JbiTaskSupport.java

Modified: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/AdminCommandsService.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/AdminCommandsService.java?rev=377862&r1=377861&r2=377862&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/AdminCommandsService.java (original)
+++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/AdminCommandsService.java Tue Feb 14 14:30:43 2006
@@ -15,7 +15,6 @@
  */
 package org.apache.servicemix.jbi.framework;
 
-import org.apache.servicemix.jbi.container.JBIContainer;
 import org.apache.servicemix.jbi.management.BaseSystemService;
 import org.apache.servicemix.jbi.management.OperationInfoHelper;
 import org.apache.servicemix.jbi.management.ParameterHelper;
@@ -31,7 +30,6 @@
 import java.util.Properties;
 
 public class AdminCommandsService extends BaseSystemService implements AdminCommandsServiceMBean {
-    private JBIContainer container;
 
     /**
      * @return a description of this

Modified: incubator/servicemix/trunk/servicemix-core/src/test/java/org/apache/servicemix/jbi/installation/InstallationTest.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/test/java/org/apache/servicemix/jbi/installation/InstallationTest.java?rev=377862&r1=377861&r2=377862&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-core/src/test/java/org/apache/servicemix/jbi/installation/InstallationTest.java (original)
+++ incubator/servicemix/trunk/servicemix-core/src/test/java/org/apache/servicemix/jbi/installation/InstallationTest.java Tue Feb 14 14:30:43 2006
@@ -117,6 +117,8 @@
         ExtMockControl componentMock = ExtMockControl.createControl(Component.class);
         Component component = (Component) componentMock.getMock();
         Component1.setDelegate(component);
+        ExtMockControl lifecycleMock = ExtMockControl.createControl(ComponentLifeCycle.class);
+        ComponentLifeCycle lifecycle = (ComponentLifeCycle) lifecycleMock.getMock();
         
         // configure bootstrap
         bootstrapMock.reset();
@@ -127,6 +129,8 @@
         bootstrapMock.replay();
         // configure component
         componentMock.reset();
+        component.getLifeCycle();
+        componentMock.setReturnValue(lifecycle);
         componentMock.replay();
         // test component installation
         startContainer(true);
@@ -170,7 +174,14 @@
         bootstrapMock.replay();
         // configure component
         componentMock.reset();
+        component.getLifeCycle();
+        componentMock.setReturnValue(lifecycle);
         componentMock.replay();
+        // Configure lifecycle
+        lifecycleMock.reset();
+        lifecycle.getExtensionMBeanName();
+        lifecycleMock.setDefaultReturnValue(null);
+        lifecycleMock.replay();
         // start container
         startContainer(false);
         lifecycleMBean = (LifeCycleMBean)  MBeanServerInvocationHandler.newProxyInstance(container.getMBeanServer(), lifecycleName, LifeCycleMBean.class, false);
@@ -178,6 +189,7 @@
         // check mocks
         bootstrapMock.verify();
         componentMock.verify();
+        lifecycleMock.verify();
     }
 
     /**
@@ -204,9 +216,13 @@
         bootstrapMock.replay();
         // configure component
         componentMock.reset();
+        component.getLifeCycle();
+        componentMock.setReturnValue(lifecycle);
         componentMock.replay();
         // configure lifecycle
         lifecycleMock.reset();
+        lifecycle.getExtensionMBeanName();
+        lifecycleMock.setDefaultReturnValue(null);
         lifecycleMock.replay();
         // test component installation
         startContainer(true);
@@ -268,10 +284,12 @@
         // configure component
         componentMock.reset();
         component.getLifeCycle();
-        componentMock.setReturnValue(lifecycle);
+        componentMock.setDefaultReturnValue(lifecycle);
         componentMock.replay();
         // configure lifecycle
         lifecycleMock.reset();
+        lifecycle.getExtensionMBeanName();
+        lifecycleMock.setDefaultReturnValue(null);
         lifecycle.init(null);
         lifecycleMock.setMatcher(MockControl.ALWAYS_MATCHER);
         lifecycle.start();
@@ -299,6 +317,8 @@
         ExtMockControl componentMock = ExtMockControl.createControl(Component.class);
         Component component = (Component) componentMock.getMock();
         Component1.setDelegate(component);
+        ExtMockControl lifecycleMock = ExtMockControl.createControl(ComponentLifeCycle.class);
+        ComponentLifeCycle lifecycle = (ComponentLifeCycle) lifecycleMock.getMock();
         
         // configure bootstrap
         bootstrapMock.reset();
@@ -309,7 +329,14 @@
         bootstrapMock.replay();
         // configure component
         componentMock.reset();
+        component.getLifeCycle();
+        componentMock.setDefaultReturnValue(lifecycle);
         componentMock.replay();
+        // configure lifecycle
+        lifecycleMock.reset();
+        lifecycle.getExtensionMBeanName();
+        lifecycleMock.setDefaultReturnValue(null);
+        lifecycleMock.replay();
         // test component installation
         startContainer(true);
         String installJarUrl = createInstallerArchive("component1").getAbsolutePath();

Modified: incubator/servicemix/trunk/servicemix-core/src/test/java/org/apache/servicemix/jbi/management/task/InstallComponentTaskTest.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/test/java/org/apache/servicemix/jbi/management/task/InstallComponentTaskTest.java?rev=377862&r1=377861&r2=377862&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-core/src/test/java/org/apache/servicemix/jbi/management/task/InstallComponentTaskTest.java (original)
+++ incubator/servicemix/trunk/servicemix-core/src/test/java/org/apache/servicemix/jbi/management/task/InstallComponentTaskTest.java Tue Feb 14 14:30:43 2006
@@ -49,7 +49,7 @@
     }
     
     public void testInstallation() throws Exception {
-        URL url = getClass().getClassLoader().getResource("org/servicemix/jbi/installation/testarchive.jar");
+        URL url = getClass().getClassLoader().getResource("org/apache/servicemix/jbi/installation/testarchive.jar");
         if (url != null) {
             String file = url.getFile();
             installComponentTask.setFile(file);

Modified: incubator/servicemix/trunk/servicemix-core/src/test/java/org/apache/servicemix/jbi/management/task/JbiTaskSupport.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/test/java/org/apache/servicemix/jbi/management/task/JbiTaskSupport.java?rev=377862&r1=377861&r2=377862&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-core/src/test/java/org/apache/servicemix/jbi/management/task/JbiTaskSupport.java (original)
+++ incubator/servicemix/trunk/servicemix-core/src/test/java/org/apache/servicemix/jbi/management/task/JbiTaskSupport.java Tue Feb 14 14:30:43 2006
@@ -38,6 +38,10 @@
         container.init();
         container.start();
         
+        // Need to sleep as the jmx remote connector 
+        // is started in another thread
+        Thread.sleep(10000);
+        
         remoteConnection = new JbiTask(){};
         remoteConnection.init();
     }