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/01/24 11:39:37 UTC

svn commit: r371887 [2/2] - in /incubator/servicemix/trunk/servicemix-core/src: main/java/org/apache/servicemix/jbi/container/ main/java/org/apache/servicemix/jbi/framework/ test/java/org/apache/servicemix/jbi/installation/ test/resources/org/apache/se...

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=371887&r1=371886&r2=371887&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 Jan 24 02:39:21 2006
@@ -15,29 +15,15 @@
  */
 package org.apache.servicemix.jbi.installation;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.servicemix.jbi.container.JBIContainer;
-import org.apache.servicemix.jbi.util.FileUtil;
-import org.easymock.MockControl;
-
 import javax.jbi.component.Bootstrap;
 import javax.jbi.component.Component;
 import javax.jbi.component.ComponentLifeCycle;
-import javax.jbi.management.AdminServiceMBean;
-import javax.jbi.management.InstallationServiceMBean;
 import javax.jbi.management.InstallerMBean;
 import javax.jbi.management.LifeCycleMBean;
 import javax.management.MBeanServerInvocationHandler;
 import javax.management.ObjectName;
 
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.InputStream;
-import java.util.jar.JarOutputStream;
-import java.util.zip.ZipEntry;
-
-import junit.framework.TestCase;
+import org.easymock.MockControl;
 
 
 /**
@@ -45,72 +31,7 @@
  * JbiTaskTest
  * @version $Revision$
  */
-public class InstallationTest extends TestCase {
-    
-    private static Log logger = LogFactory.getLog(InstallationTest.class);
-    
-    protected JBIContainer container;
-   
-    /*
-     * @see TestCase#setUp()
-     */
-    protected void setUp() throws Exception {
-        super.setUp();
-    }
-    
-    /*
-     * @see TestCase#tearDown()
-     */
-    protected void tearDown() throws Exception {
-        super.tearDown();
-        try {
-            shutdownContainer();
-        } catch (Exception e) {
-            logger.info("Error shutting down container", e);
-        }
-    }
-    
-    protected void startContainer(boolean clean) throws Exception {
-        shutdownContainer();
-        if (clean) {
-            FileUtil.deleteFile(new File("testWDR"));
-        }
-        container = new JBIContainer();
-        container.setCreateMBeanServer(true);
-        container.setMonitorInstallationDirectory(false);
-        container.setRootDir("testWDR");
-        container.init();
-        container.start();
-    }
-    
-    protected void shutdownContainer() throws Exception {
-        if (container != null) {
-            container.shutDown();
-        }
-    }
-    
-    protected File createInstallerArchive(String jbi) throws Exception {
-        InputStream is = getClass().getResourceAsStream(jbi + "-jbi.xml");
-        File jar = File.createTempFile("jbi", "zip");
-        JarOutputStream jos = new JarOutputStream(new FileOutputStream(jar));
-        jos.putNextEntry(new ZipEntry("META-INF/jbi.xml"));
-        byte[] buffer = new byte[is.available()];
-        is.read(buffer);
-        jos.write(buffer);
-        jos.closeEntry();
-        jos.close();
-        is.close();
-        return jar;
-    }
-    
-    protected InstallationServiceMBean getInstallationService() throws Exception {
-        return container.getInstallationService();
-    }
-    
-    protected AdminServiceMBean getAdminService() throws Exception {
-        return container.getManagementContext();
-    }
-    
+public class InstallationTest extends AbstractManagementTest {
     
     /**
      * Installer should not be persistent across restart

Added: incubator/servicemix/trunk/servicemix-core/src/test/resources/org/apache/servicemix/jbi/installation/sa1-jbi.xml
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/test/resources/org/apache/servicemix/jbi/installation/sa1-jbi.xml?rev=371887&view=auto
==============================================================================
--- incubator/servicemix/trunk/servicemix-core/src/test/resources/org/apache/servicemix/jbi/installation/sa1-jbi.xml (added)
+++ incubator/servicemix/trunk/servicemix-core/src/test/resources/org/apache/servicemix/jbi/installation/sa1-jbi.xml Tue Jan 24 02:39:21 2006
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jbi xmlns="http://java.sun.com/xml/ns/jbi" 
+     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+     xsi:schemaLocation="http://java.sun.com/xml/ns/jbi" 
+     version="1.0">
+  <component type="service-engine">
+    <identification>
+      <name>component2</name>
+      <description>component2</description>
+    </identification>
+    <component-class-name description="component2">org.apache.servicemix.jbi.installation.Component2</component-class-name>
+    <component-class-path>
+    </component-class-path>
+    <bootstrap-class-name>org.apache.servicemix.jbi.installation.Bootstrap2</bootstrap-class-name>
+    <bootstrap-class-path>
+    </bootstrap-class-path>
+  </component>
+</jbi>
\ No newline at end of file