Title: [1038] trunk/core/src/main/java/org/servicemix/components: Remove old ServiceMixComponent which does not work
- Revision
- 1038
- Author
- gnt
- Date
- 2005-12-07 09:26:41 -0500 (Wed, 07 Dec 2005)
Log Message
Remove old ServiceMixComponent which does not work
Modified Paths
Removed Paths
Diff
Modified: trunk/core/src/main/java/org/servicemix/jbi/container/SpringServiceUnitContainer.java (1037 => 1038)
--- trunk/core/src/main/java/org/servicemix/jbi/container/SpringServiceUnitContainer.java 2005-12-07 14:23:43 UTC (rev 1037)
+++ trunk/core/src/main/java/org/servicemix/jbi/container/SpringServiceUnitContainer.java 2005-12-07 14:26:41 UTC (rev 1038)
@@ -1,119 +1,26 @@
package org.servicemix.jbi.container;
-import org.springframework.beans.BeansException;
-import org.springframework.beans.factory.BeanFactory;
-import org.springframework.beans.factory.DisposableBean;
-import javax.jbi.JBIException;
-import java.util.Iterator;
-import java.util.List;
-
-
/**
* Used to hold a Server Unit configuration. The components
* are registered into the JBI container using the Service Unit
* Manager life cycle methods.
*
+ * @org.xbean.XBean element="serviceunit" rootElement="true"
+ * description="A deployable service unit container"
* @version $Revision$
*/
public class SpringServiceUnitContainer {
- private List activationSpecs;
- private BeanFactory beanFactory;
- private String[] componentNames;
- private String[] deployArchives;
+ private ActivationSpec[] activationSpecs;
- public void start(JBIContainer container) throws Exception {
- // lets iterate through all the component names and register them
- if (componentNames != null) {
- for (int i = 0; i < componentNames.length; i++) {
- String componentName = componentNames[i];
- container.activateComponent(new ActivationSpec(componentName, lookupBean(componentName)));
- }
- }
- if (activationSpecs != null) {
- for (Iterator iter = activationSpecs.iterator(); iter.hasNext();) {
- ActivationSpec activationSpec = (ActivationSpec) iter.next();
- container.activateComponent(activationSpec);
- }
- }
- if (deployArchives != null) {
- for (int i = 0; i < deployArchives.length; i++) {
- String archive = deployArchives[i];
- container.installArchive(archive);
- }
- }
- }
-
- public void stop(JBIContainer container) throws JBIException {
- if (beanFactory instanceof DisposableBean) {
- DisposableBean disposable = (DisposableBean) beanFactory;
- try {
- disposable.destroy();
- }
- catch (Exception e) {
- throw new JBIException("Failed to dispose of the Spring BeanFactory due to: " + e, e);
- }
- }
- }
-
-// /**
-// * Returns the component or POJO registered with the given component ID.
-// *
-// * @param id
-// * @return the Component
-// */
-// public Object getBean(String id) {
-// Object bean = getComponent(id);
-// if (bean instanceof ComponentAdaptor) {
-// ComponentAdaptor adaptor = (ComponentAdaptor) bean;
-// return adaptor.getLifeCycle();
-// }
-// return bean;
-// }
-
-
- // Properties
- //-------------------------------------------------------------------------
- public BeanFactory getBeanFactory() {
- return beanFactory;
- }
-
- public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
- this.beanFactory = beanFactory;
- }
-
- public String[] getComponentNames() {
- return componentNames;
- }
- public void setComponentNames(String[] componentNames) {
- this.componentNames = componentNames;
- }
-
- public List getActivationSpecs() {
+ public ActivationSpec[] getActivationSpecs() {
return activationSpecs;
}
- public void setActivationSpecs(List activationSpecs) throws JBIException {
+
+ public void setActivationSpecs(ActivationSpec[] activationSpecs) {
this.activationSpecs = activationSpecs;
}
- public String[] getDeployArchives() {
- return deployArchives;
- }
- public void setDeployArchives(String[] deployArchives) {
- this.deployArchives = deployArchives;
- }
-
- // Implementation methods
- //-------------------------------------------------------------------------
- protected Object lookupBean(String componentName) {
- Object bean = beanFactory.getBean(componentName);
- if (bean == null) {
- throw new IllegalArgumentException("Component name: " + componentName
- + " is not found in the Spring BeanFactory");
- }
- return bean;
- }
-
}
Deleted: trunk/core/src/test/java/org/servicemix/components/servicemix/ServiceMixComponent2Test.java (1037 => 1038)
--- trunk/core/src/test/java/org/servicemix/components/servicemix/ServiceMixComponent2Test.java 2005-12-07 14:23:43 UTC (rev 1037)
+++ trunk/core/src/test/java/org/servicemix/components/servicemix/ServiceMixComponent2Test.java 2005-12-07 14:26:41 UTC (rev 1038)
@@ -1,47 +0,0 @@
-/**
- *
- * Copyright 2005 Unity Systems, LLC. http://www.unity-systems.com
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.servicemix.components.servicemix;
-
-import org.servicemix.tck.TestSupport;
-import org.springframework.context.support.AbstractXmlApplicationContext;
-import org.xbean.spring.context.ClassPathXmlApplicationContext;
-
-import java.net.URL;
-
-/**
- *
- * @version $Revision$
- */
-public class ServiceMixComponent2Test extends TestSupport {
-
- public void testSendMessagesToJmsThenOutofJmsToReceiver() throws Exception {
-
- // Install the service assembly
- String resource = "au1.zip";
- URL componentResource = getClass().getResource(resource);
- assertNotNull("The component JAR "+resource+" is missing from the classpath", componentResource);
- jbi.installArchive(componentResource.toExternalForm());
-
- Thread.sleep(1000*10);
- }
-
- protected AbstractXmlApplicationContext createBeanFactory() {
- return new ClassPathXmlApplicationContext("org/servicemix/components/servicemix/example.xml");
- }
-
-}
Deleted: trunk/core/src/test/java/org/servicemix/components/servicemix/ServiceMixComponentTest.java (1037 => 1038)
--- trunk/core/src/test/java/org/servicemix/components/servicemix/ServiceMixComponentTest.java 2005-12-07 14:23:43 UTC (rev 1037)
+++ trunk/core/src/test/java/org/servicemix/components/servicemix/ServiceMixComponentTest.java 2005-12-07 14:26:41 UTC (rev 1038)
@@ -1,130 +0,0 @@
-/**
- *
- * Copyright 2005 Unity Systems, LLC. http://www.unity-systems.com
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.servicemix.components.servicemix;
-
-import org.servicemix.client.DefaultServiceMixClient;
-import org.servicemix.client.ServiceMixClient;
-import org.servicemix.jbi.container.JBIContainer;
-
-import javax.jbi.messaging.InOut;
-import javax.jbi.messaging.MessagingException;
-import javax.xml.namespace.QName;
-
-import java.io.File;
-import java.net.URI;
-import java.net.URL;
-
-import junit.framework.TestCase;
-
-/**
- *
- * @version $Revision$
- */
-public class ServiceMixComponentTest extends TestCase {
- protected JBIContainer container = new JBIContainer();
-
- private File tempRootDir;
-
- /*
- * @see TestCase#setUp()
- */
- protected void setUp() throws Exception {
- super.setUp();
- container.setCreateMBeanServer(false);
- container.setMonitorInstallationDirectory(false);
- tempRootDir = File.createTempFile("servicemix", "rootDir");
- tempRootDir.delete();
- File tempTemp = new File(tempRootDir.getAbsolutePath() + "/temp");
- if (!tempTemp.mkdirs())
- fail("Unable to create temporary working root directory ["
- + tempTemp.getAbsolutePath() + "]");
-
- System.out.println("Using temporary root directory ["
- + tempRootDir.getAbsolutePath() + "]");
-
- container.setRootDir(tempRootDir.getAbsolutePath());
- container.setMonitorInstallationDirectory(false);
- container.setUseMBeanServer(false);
- container.setCreateMBeanServer(false);
- container.setFlowName("st");
- container.init();
- container.start();
- }
-
- public void testComponentInstallation() throws Exception {
- ServiceMixComponent component = new ServiceMixComponent();
- container.activateComponent(component, "#ServiceMixComponent#");
- URL url = ""
- File path = new File(new URI(url.toString()));
- path = path.getParentFile();
- ServiceMixClient client = new DefaultServiceMixClient(container);
-
- for (int i = 0; i < 2; i++) {
- // Deploy and start su
- component.deploy("su1", path.getAbsolutePath());
- component.init("su1", path.getAbsolutePath());
- component.start("su1");
-
- // Send message
- InOut inout = client.createInOutExchange();
- inout.setService(new QName("http://servicemix.org/demo/", "chained"));
- client.send(inout);
-
- // Stop and undeploy
- component.stop("su1");
- component.shutDown("su1");
- component.undeploy("su1", path.getAbsolutePath());
-
- // Send message
- inout = client.createInOutExchange();
- inout.setService(new QName("http://servicemix.org/demo/", "chained"));
- try {
- client.send(inout);
- } catch (MessagingException e) {
- // Ok, the lw component is undeployed
- }
-
- }
- }
-
- /*
- * @see TestCase#tearDown()
- */
-
- protected void tearDown() throws Exception {
- super.tearDown();
- container.stop();
- container.shutDown();
- deleteDir(tempRootDir);
- }
-
- public static boolean deleteDir(File dir) {
- System.out.println("Deleting directory : " + dir.getAbsolutePath());
- if (dir.isDirectory()) {
- String[] children = dir.list();
- for (int i = 0; i < children.length; i++) {
- boolean success = deleteDir(new File(dir, children[i]));
- if (!success) {
- return false;
- }
- }
- }
- // The directory is now empty so delete it
- return dir.delete();
- }
-}