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 2007/08/10 16:38:14 UTC
svn commit: r564607 [9/12] - in
/incubator/servicemix/trunk/core/servicemix-core/src:
main/java/org/apache/servicemix/ main/java/org/apache/servicemix/jbi/
main/java/org/apache/servicemix/jbi/framework/
main/java/org/apache/servicemix/jbi/framework/sup...
Modified: incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/expression/JAXPXPathExpressionTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/expression/JAXPXPathExpressionTest.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/expression/JAXPXPathExpressionTest.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/expression/JAXPXPathExpressionTest.java Fri Aug 10 07:37:46 2007
@@ -17,7 +17,6 @@
package org.apache.servicemix.expression;
import org.apache.servicemix.client.DefaultNamespaceContext;
-import org.apache.servicemix.expression.JAXPStringXPathExpression;
import org.apache.xalan.extensions.XPathFunctionResolverImpl;
@@ -36,9 +35,9 @@
try {
Class.forName("java.lang.annotation.AnnotationTypeMismatchException");
-
test = true;
} catch (ClassNotFoundException doNothing) {
+ // Expected if not java 5
}
if (test) {
Modified: incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/expression/XPathExpressionTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/expression/XPathExpressionTest.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/expression/XPathExpressionTest.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/expression/XPathExpressionTest.java Fri Aug 10 07:37:46 2007
@@ -16,18 +16,15 @@
*/
package org.apache.servicemix.expression;
-import org.apache.servicemix.expression.Expression;
-import org.apache.servicemix.expression.JaxenStringXPathExpression;
-import org.apache.servicemix.expression.XMLBeansStringXPathExpression;
-import org.apache.servicemix.jbi.jaxp.StringSource;
-import org.apache.servicemix.jbi.messaging.InOnlyImpl;
-import org.apache.servicemix.jbi.messaging.MessageExchangeImpl;
-import org.apache.servicemix.jbi.messaging.NormalizedMessageImpl;
-
import javax.jbi.messaging.MessagingException;
import javax.jbi.messaging.NormalizedMessage;
import junit.framework.TestCase;
+
+import org.apache.servicemix.jbi.jaxp.StringSource;
+import org.apache.servicemix.jbi.messaging.InOnlyImpl;
+import org.apache.servicemix.jbi.messaging.MessageExchangeImpl;
+import org.apache.servicemix.jbi.messaging.NormalizedMessageImpl;
/**
* @version $Revision$
Modified: incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/config/ComponentRouteTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/config/ComponentRouteTest.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/config/ComponentRouteTest.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/config/ComponentRouteTest.java Fri Aug 10 07:37:46 2007
@@ -17,8 +17,8 @@
package org.apache.servicemix.jbi.config;
import org.apache.servicemix.examples.AbstractSpringTestSupport;
-import org.springframework.context.support.AbstractXmlApplicationContext;
import org.apache.xbean.spring.context.ClassPathXmlApplicationContext;
+import org.springframework.context.support.AbstractXmlApplicationContext;
/**
* @version $Revision$
Modified: incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/config/ComponentRouteWithVanillaSpringTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/config/ComponentRouteWithVanillaSpringTest.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/config/ComponentRouteWithVanillaSpringTest.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/config/ComponentRouteWithVanillaSpringTest.java Fri Aug 10 07:37:46 2007
@@ -17,8 +17,8 @@
package org.apache.servicemix.jbi.config;
import org.apache.servicemix.examples.AbstractSpringTestSupport;
-import org.springframework.context.support.AbstractXmlApplicationContext;
import org.apache.xbean.spring.context.ClassPathXmlApplicationContext;
+import org.springframework.context.support.AbstractXmlApplicationContext;
/**
* @version $Revision$
Modified: incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/config/ContainerRouteTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/config/ContainerRouteTest.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/config/ContainerRouteTest.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/config/ContainerRouteTest.java Fri Aug 10 07:37:46 2007
@@ -17,8 +17,8 @@
package org.apache.servicemix.jbi.config;
import org.apache.servicemix.examples.AbstractSpringTestSupport;
-import org.springframework.context.support.AbstractXmlApplicationContext;
import org.apache.xbean.spring.context.ClassPathXmlApplicationContext;
+import org.springframework.context.support.AbstractXmlApplicationContext;
/**
* @version $Revision$
Modified: incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/config/ContainerRouteWithVanillaSpringTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/config/ContainerRouteWithVanillaSpringTest.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/config/ContainerRouteWithVanillaSpringTest.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/config/ContainerRouteWithVanillaSpringTest.java Fri Aug 10 07:37:46 2007
@@ -17,8 +17,8 @@
package org.apache.servicemix.jbi.config;
import org.apache.servicemix.examples.AbstractSpringTestSupport;
-import org.springframework.context.support.AbstractXmlApplicationContext;
import org.apache.xbean.spring.context.ClassPathXmlApplicationContext;
+import org.springframework.context.support.AbstractXmlApplicationContext;
/**
* @version $Revision$
Modified: incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/config/DebugClassPathXmlApplicationContext.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/config/DebugClassPathXmlApplicationContext.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/config/DebugClassPathXmlApplicationContext.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/config/DebugClassPathXmlApplicationContext.java Fri Aug 10 07:37:46 2007
@@ -16,13 +16,13 @@
*/
package org.apache.servicemix.jbi.config;
+import java.io.IOException;
+import java.util.List;
+
+import org.apache.xbean.spring.context.ClassPathXmlApplicationContext;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.context.ApplicationContext;
-import org.apache.xbean.spring.context.ClassPathXmlApplicationContext;
-
-import java.io.IOException;
-import java.util.List;
/**
* A debugging version of the class to add tracing of the generated XML.
Modified: incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/config/XmlParseTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/config/XmlParseTest.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/config/XmlParseTest.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/config/XmlParseTest.java Fri Aug 10 07:37:46 2007
@@ -16,15 +16,15 @@
*/
package org.apache.servicemix.jbi.config;
+import java.util.Arrays;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
import org.apache.servicemix.jbi.container.ActivationSpec;
import org.apache.servicemix.jbi.container.SubscriptionSpec;
import org.apache.servicemix.tck.SpringTestSupport;
import org.springframework.context.support.AbstractXmlApplicationContext;
-
-import javax.xml.namespace.QName;
-
-import java.util.Arrays;
-import java.util.List;
/**
*
Modified: incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/deployment/ComponentTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/deployment/ComponentTest.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/deployment/ComponentTest.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/deployment/ComponentTest.java Fri Aug 10 07:37:46 2007
@@ -20,19 +20,20 @@
import javax.xml.transform.dom.DOMSource;
+import org.w3c.dom.DocumentFragment;
+
import junit.framework.TestCase;
-import org.apache.servicemix.jbi.jaxp.SourceTransformer;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.w3c.dom.DocumentFragment;
+import org.apache.servicemix.jbi.jaxp.SourceTransformer;
/**
* @version $Revision$
*/
public class ComponentTest extends TestCase {
- private static final Log log = LogFactory.getLog(ComponentTest.class);
+ private static final Log LOG = LogFactory.getLog(ComponentTest.class);
protected SourceTransformer transformer = new SourceTransformer();
@@ -65,8 +66,8 @@
DocumentFragment fragment = descriptorExtension.getDescriptorExtension();
assertNotNull("fragment is null", fragment);
- log.info("Created document fragment: " + fragment);
- log.info("XML: " + transformer.toString(new DOMSource(fragment)));
+ LOG.info("Created document fragment: " + fragment);
+ LOG.info("XML: " + transformer.toString(new DOMSource(fragment)));
}
protected void assertArrayEquals(String text, Object[] expected, Object[] actual) {
Modified: incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/deployment/ServiceAssemblyTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/deployment/ServiceAssemblyTest.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/deployment/ServiceAssemblyTest.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/deployment/ServiceAssemblyTest.java Fri Aug 10 07:37:46 2007
@@ -43,21 +43,26 @@
assertNotNull("serviceUnits are null", serviceUnits);
assertEquals("serviceUnits size", 4, serviceUnits.length);
- assertEquals("getIdentification().getName() for 0", "TransformationSU_041207152821-0800_suId", serviceUnits[0].getIdentification().getName());
- assertEquals("getIdentification().getDescription() for 0", "Description of Serviceunit: TransformationSU", serviceUnits[0].getIdentification().getDescription());
+ assertEquals("getIdentification().getName() for 0", "TransformationSU_041207152821-0800_suId",
+ serviceUnits[0].getIdentification().getName());
+ assertEquals("getIdentification().getDescription() for 0", "Description of Serviceunit: TransformationSU",
+ serviceUnits[0].getIdentification().getDescription());
assertEquals("getTarget().getArtifactsZip() for 0", "TransformationSU.zip", serviceUnits[0].getTarget().getArtifactsZip());
assertEquals("getTarget().getComponentName() for 0", "SunTransformationEngine", serviceUnits[0].getTarget().getComponentName());
- assertEquals("getIdentification().getName() for 3", "SequencingEngineSU_041207152507-0800_suId", serviceUnits[3].getIdentification().getName());
- assertEquals("getIdentification().getDescription() for 3", "Description of Serviceunit: SequencingEngineSU", serviceUnits[3].getIdentification().getDescription());
+ assertEquals("getIdentification().getName() for 3", "SequencingEngineSU_041207152507-0800_suId", serviceUnits[3]
+ .getIdentification().getName());
+ assertEquals("getIdentification().getDescription() for 3", "Description of Serviceunit: SequencingEngineSU",
+ serviceUnits[3].getIdentification().getDescription());
assertEquals("getTarget().getArtifactsZip() for 3", "SequencingEngineSU.zip", serviceUnits[3].getTarget().getArtifactsZip());
assertEquals("getTarget().getComponentName() for 3", "SunSequencingEngine", serviceUnits[3].getTarget().getComponentName());
-
+
Connection[] connections = serviceAssembly.getConnections().getConnections();
assertNotNull("connections are null", connections);
assertEquals("connections size", 2, connections.length);
-
- assertEquals("getConsumer().getServiceName() for 0", new QName("urn:csi", "csi-service"), connections[0].getConsumer().getServiceName());
+
+ assertEquals("getConsumer().getServiceName() for 0", new QName("urn:csi", "csi-service"), connections[0].getConsumer()
+ .getServiceName());
}
}
Modified: incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/framework/ComponentNameSpaceTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/framework/ComponentNameSpaceTest.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/framework/ComponentNameSpaceTest.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/framework/ComponentNameSpaceTest.java Fri Aug 10 07:37:46 2007
@@ -21,8 +21,6 @@
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
-import org.apache.servicemix.jbi.framework.ComponentNameSpace;
-
import junit.framework.TestCase;
public class ComponentNameSpaceTest extends TestCase {
Modified: incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/framework/RegistryTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/framework/RegistryTest.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/framework/RegistryTest.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/framework/RegistryTest.java Fri Aug 10 07:37:46 2007
@@ -19,12 +19,13 @@
import javax.jbi.servicedesc.ServiceEndpoint;
import javax.xml.namespace.QName;
+import org.w3c.dom.DocumentFragment;
+
import junit.framework.TestCase;
import org.apache.servicemix.components.util.EchoComponent;
import org.apache.servicemix.jbi.container.JBIContainer;
import org.apache.servicemix.jbi.resolver.URIResolver;
-import org.w3c.dom.DocumentFragment;
public class RegistryTest extends TestCase {
Modified: incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/installation/AbstractManagementTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/installation/AbstractManagementTest.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/installation/AbstractManagementTest.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/installation/AbstractManagementTest.java Fri Aug 10 07:37:46 2007
@@ -40,16 +40,16 @@
public abstract class AbstractManagementTest extends TestCase {
protected Log logger = LogFactory.getLog(getClass());
-
+
protected JBIContainer container;
-
+
/*
* @see TestCase#setUp()
*/
protected void setUp() throws Exception {
super.setUp();
}
-
+
/*
* @see TestCase#tearDown()
*/
@@ -61,7 +61,7 @@
logger.info("Error shutting down container", e);
}
}
-
+
protected void startContainer(boolean clean) throws Exception {
shutdownContainer();
if (clean) {
@@ -74,23 +74,23 @@
container.init();
container.start();
}
-
+
protected void initContainer() {
container.setCreateMBeanServer(true);
container.setMonitorInstallationDirectory(false);
container.setMonitorDeploymentDirectory(false);
}
-
+
protected void shutdownContainer() throws Exception {
if (container != null) {
container.shutDown();
}
}
-
+
protected JBIContainer getContainer() {
return container;
}
-
+
protected File createInstallerArchive(String jbi) throws Exception {
InputStream is = getClass().getResourceAsStream(jbi + "-jbi.xml");
File jar = File.createTempFile("jbi", ".zip");
@@ -104,7 +104,7 @@
is.close();
return jar;
}
-
+
protected File createDummyArchive() throws Exception {
File jar = File.createTempFile("jbi", ".zip");
JarOutputStream jos = new JarOutputStream(new FileOutputStream(jar));
@@ -115,49 +115,49 @@
}
protected File createServiceAssemblyArchive(String saName, String suName, String compName) throws Exception {
- return createServiceAssemblyArchive(saName,
- new String[] { suName },
- new String[] { compName });
+ return createServiceAssemblyArchive(saName, new String[] {suName }, new String[] {compName });
}
-
+
protected File createServiceAssemblyArchive(String saName, String[] suName, String[] compName) throws Exception {
File jar = File.createTempFile("jbi", ".zip");
JarOutputStream jos = new JarOutputStream(new FileOutputStream(jar));
// Write jbi.xml
jos.putNextEntry(new ZipEntry("META-INF/jbi.xml"));
XMLOutputFactory xof = XMLOutputFactory.newInstance();
- //xof.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, Boolean.TRUE);
+ // xof.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES,
+ // Boolean.TRUE);
XMLStreamWriter xsw = xof.createXMLStreamWriter(new FilterOutputStream(jos) {
- public void close() {}
+ public void close() {
+ }
});
xsw.writeStartDocument();
xsw.writeStartElement("jbi");
xsw.writeAttribute("xmlns", "http://java.sun.com/xml/ns/jbi");
xsw.writeAttribute("version", "1.0");
- xsw.writeStartElement("service-assembly");
+ xsw.writeStartElement("service-assembly");
+ xsw.writeStartElement("identification");
+ xsw.writeStartElement("name");
+ xsw.writeCharacters(saName);
+ xsw.writeEndElement();
+ xsw.writeEndElement();
+ for (int i = 0; i < suName.length; i++) {
+ xsw.writeStartElement("service-unit");
xsw.writeStartElement("identification");
- xsw.writeStartElement("name");
- xsw.writeCharacters(saName);
- xsw.writeEndElement();
- xsw.writeEndElement();
- for (int i = 0; i < suName.length; i++) {
- xsw.writeStartElement("service-unit");
- xsw.writeStartElement("identification");
- xsw.writeStartElement("name");
- xsw.writeCharacters(suName[i]);
- xsw.writeEndElement();
- xsw.writeEndElement();
- xsw.writeStartElement("target");
- xsw.writeStartElement("artifacts-zip");
- xsw.writeCharacters(suName[i] + ".zip");
- xsw.writeEndElement();
- xsw.writeStartElement("component-name");
- xsw.writeCharacters(compName[i]);
- xsw.writeEndElement();
- xsw.writeEndElement();
- xsw.writeEndElement();
- }
- xsw.writeEndElement();
+ xsw.writeStartElement("name");
+ xsw.writeCharacters(suName[i]);
+ xsw.writeEndElement();
+ xsw.writeEndElement();
+ xsw.writeStartElement("target");
+ xsw.writeStartElement("artifacts-zip");
+ xsw.writeCharacters(suName[i] + ".zip");
+ xsw.writeEndElement();
+ xsw.writeStartElement("component-name");
+ xsw.writeCharacters(compName[i]);
+ xsw.writeEndElement();
+ xsw.writeEndElement();
+ xsw.writeEndElement();
+ }
+ xsw.writeEndElement();
xsw.writeEndElement();
xsw.writeEndDocument();
xsw.flush();
@@ -174,18 +174,17 @@
jos.close();
return jar;
}
-
+
protected InstallationServiceMBean getInstallationService() throws Exception {
return container.getInstallationService();
}
-
+
protected DeploymentServiceMBean getDeploymentService() throws Exception {
return container.getDeploymentService();
}
-
+
protected AdminServiceMBean getAdminService() throws Exception {
return container.getManagementContext();
}
-
-
+
}
Modified: incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/installation/Bootstrap1.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/installation/Bootstrap1.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/installation/Bootstrap1.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/installation/Bootstrap1.java Fri Aug 10 07:37:46 2007
@@ -43,9 +43,9 @@
/* (non-Javadoc)
* @see javax.jbi.component.Bootstrap#init(javax.jbi.component.InstallationContext)
*/
- public void init(InstallationContext installContext) throws JBIException {
- Bootstrap1.installContext = installContext;
- Bootstrap1.delegate.init(installContext);
+ public void init(InstallationContext ctx) throws JBIException {
+ Bootstrap1.installContext = ctx;
+ Bootstrap1.delegate.init(ctx);
}
/* (non-Javadoc)
Modified: incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/installation/BootstrapDelegate.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/installation/BootstrapDelegate.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/installation/BootstrapDelegate.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/installation/BootstrapDelegate.java Fri Aug 10 07:37:46 2007
@@ -23,38 +23,38 @@
public class BootstrapDelegate implements Bootstrap {
- private Bootstrap delegate;
-
- public BootstrapDelegate(Bootstrap delegate) {
- this.delegate = delegate;
- }
-
- public Bootstrap getDelegate() {
- return delegate;
- }
-
- public void setDelegate(Bootstrap delegate) {
- this.delegate = delegate;
- }
-
- public void cleanUp() throws JBIException {
- delegate.cleanUp();
- }
-
- public ObjectName getExtensionMBeanName() {
- return delegate.getExtensionMBeanName();
- }
-
- public void init(InstallationContext installContext) throws JBIException {
- delegate.init(installContext);
- }
-
- public void onInstall() throws JBIException {
- delegate.onInstall();
- }
-
- public void onUninstall() throws JBIException {
- delegate.onUninstall();
- }
-
+ private Bootstrap delegate;
+
+ public BootstrapDelegate(Bootstrap delegate) {
+ this.delegate = delegate;
+ }
+
+ public Bootstrap getDelegate() {
+ return delegate;
+ }
+
+ public void setDelegate(Bootstrap delegate) {
+ this.delegate = delegate;
+ }
+
+ public void cleanUp() throws JBIException {
+ delegate.cleanUp();
+ }
+
+ public ObjectName getExtensionMBeanName() {
+ return delegate.getExtensionMBeanName();
+ }
+
+ public void init(InstallationContext installContext) throws JBIException {
+ delegate.init(installContext);
+ }
+
+ public void onInstall() throws JBIException {
+ delegate.onInstall();
+ }
+
+ public void onUninstall() throws JBIException {
+ delegate.onUninstall();
+ }
+
}
Modified: incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/installation/Component1.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/installation/Component1.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/installation/Component1.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/installation/Component1.java Fri Aug 10 07:37:46 2007
@@ -16,55 +16,69 @@
*/
package org.apache.servicemix.jbi.installation;
-import org.w3c.dom.Document;
-import org.w3c.dom.DocumentFragment;
-
import javax.jbi.component.Component;
import javax.jbi.component.ComponentLifeCycle;
import javax.jbi.component.ServiceUnitManager;
import javax.jbi.messaging.MessageExchange;
import javax.jbi.servicedesc.ServiceEndpoint;
+import org.w3c.dom.Document;
+import org.w3c.dom.DocumentFragment;
+
public class Component1 implements Component {
private static Component delegate;
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see javax.jbi.component.Component#getLifeCycle()
*/
public ComponentLifeCycle getLifeCycle() {
return delegate.getLifeCycle();
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see javax.jbi.component.Component#getServiceDescription(javax.jbi.servicedesc.ServiceEndpoint)
*/
public Document getServiceDescription(ServiceEndpoint endpoint) {
return delegate.getServiceDescription(endpoint);
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see javax.jbi.component.Component#getServiceUnitManager()
*/
public ServiceUnitManager getServiceUnitManager() {
return delegate.getServiceUnitManager();
}
- /* (non-Javadoc)
- * @see javax.jbi.component.Component#isExchangeWithConsumerOkay(javax.jbi.servicedesc.ServiceEndpoint, javax.jbi.messaging.MessageExchange)
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.jbi.component.Component#isExchangeWithConsumerOkay(javax.jbi.servicedesc.ServiceEndpoint,
+ * javax.jbi.messaging.MessageExchange)
*/
public boolean isExchangeWithConsumerOkay(ServiceEndpoint endpoint, MessageExchange exchange) {
return delegate.isExchangeWithConsumerOkay(endpoint, exchange);
}
- /* (non-Javadoc)
- * @see javax.jbi.component.Component#isExchangeWithProviderOkay(javax.jbi.servicedesc.ServiceEndpoint, javax.jbi.messaging.MessageExchange)
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.jbi.component.Component#isExchangeWithProviderOkay(javax.jbi.servicedesc.ServiceEndpoint,
+ * javax.jbi.messaging.MessageExchange)
*/
public boolean isExchangeWithProviderOkay(ServiceEndpoint endpoint, MessageExchange exchange) {
return delegate.isExchangeWithProviderOkay(endpoint, exchange);
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see javax.jbi.component.Component#resolveEndpointReference(org.w3c.dom.DocumentFragment)
*/
public ServiceEndpoint resolveEndpointReference(DocumentFragment epr) {
@@ -79,7 +93,8 @@
}
/**
- * @param delegate The delegate to set.
+ * @param delegate
+ * The delegate to set.
*/
public static void setDelegate(Component delegate) {
Component1.delegate = delegate;
Modified: incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/installation/Component2.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/installation/Component2.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/installation/Component2.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/installation/Component2.java Fri Aug 10 07:37:46 2007
@@ -16,55 +16,69 @@
*/
package org.apache.servicemix.jbi.installation;
-import org.w3c.dom.Document;
-import org.w3c.dom.DocumentFragment;
-
import javax.jbi.component.Component;
import javax.jbi.component.ComponentLifeCycle;
import javax.jbi.component.ServiceUnitManager;
import javax.jbi.messaging.MessageExchange;
import javax.jbi.servicedesc.ServiceEndpoint;
+import org.w3c.dom.Document;
+import org.w3c.dom.DocumentFragment;
+
public class Component2 implements Component {
private static Component delegate;
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see javax.jbi.component.Component#getLifeCycle()
*/
public ComponentLifeCycle getLifeCycle() {
return delegate.getLifeCycle();
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see javax.jbi.component.Component#getServiceDescription(javax.jbi.servicedesc.ServiceEndpoint)
*/
public Document getServiceDescription(ServiceEndpoint endpoint) {
return delegate.getServiceDescription(endpoint);
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see javax.jbi.component.Component#getServiceUnitManager()
*/
public ServiceUnitManager getServiceUnitManager() {
return delegate.getServiceUnitManager();
}
- /* (non-Javadoc)
- * @see javax.jbi.component.Component#isExchangeWithConsumerOkay(javax.jbi.servicedesc.ServiceEndpoint, javax.jbi.messaging.MessageExchange)
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.jbi.component.Component#isExchangeWithConsumerOkay(javax.jbi.servicedesc.ServiceEndpoint,
+ * javax.jbi.messaging.MessageExchange)
*/
public boolean isExchangeWithConsumerOkay(ServiceEndpoint endpoint, MessageExchange exchange) {
return delegate.isExchangeWithConsumerOkay(endpoint, exchange);
}
- /* (non-Javadoc)
- * @see javax.jbi.component.Component#isExchangeWithProviderOkay(javax.jbi.servicedesc.ServiceEndpoint, javax.jbi.messaging.MessageExchange)
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.jbi.component.Component#isExchangeWithProviderOkay(javax.jbi.servicedesc.ServiceEndpoint,
+ * javax.jbi.messaging.MessageExchange)
*/
public boolean isExchangeWithProviderOkay(ServiceEndpoint endpoint, MessageExchange exchange) {
return delegate.isExchangeWithProviderOkay(endpoint, exchange);
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see javax.jbi.component.Component#resolveEndpointReference(org.w3c.dom.DocumentFragment)
*/
public ServiceEndpoint resolveEndpointReference(DocumentFragment epr) {
@@ -79,7 +93,8 @@
}
/**
- * @param delegate The delegate to set.
+ * @param delegate
+ * The delegate to set.
*/
public static void setDelegate(Component delegate) {
Component2.delegate = delegate;
Modified: incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/installation/ComponentDelegate.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/installation/ComponentDelegate.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/installation/ComponentDelegate.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/installation/ComponentDelegate.java Fri Aug 10 07:37:46 2007
@@ -27,42 +27,42 @@
public class ComponentDelegate implements Component {
- private Component delegate;
-
- public ComponentDelegate(Component delegate) {
- this.delegate = delegate;
- }
-
- public Component getDelegate() {
- return delegate;
- }
-
- public void setDelegate(Component delegate) {
- this.delegate = delegate;
- }
-
- public ComponentLifeCycle getLifeCycle() {
- return delegate.getLifeCycle();
- }
-
- public Document getServiceDescription(ServiceEndpoint endpoint) {
- return delegate.getServiceDescription(endpoint);
- }
-
- public ServiceUnitManager getServiceUnitManager() {
- return delegate.getServiceUnitManager();
- }
-
- public boolean isExchangeWithConsumerOkay(ServiceEndpoint endpoint, MessageExchange exchange) {
- return delegate.isExchangeWithConsumerOkay(endpoint, exchange);
- }
-
- public boolean isExchangeWithProviderOkay(ServiceEndpoint endpoint, MessageExchange exchange) {
- return delegate.isExchangeWithProviderOkay(endpoint, exchange);
- }
-
- public ServiceEndpoint resolveEndpointReference(DocumentFragment epr) {
- return delegate.resolveEndpointReference(epr);
- }
-
+ private Component delegate;
+
+ public ComponentDelegate(Component delegate) {
+ this.delegate = delegate;
+ }
+
+ public Component getDelegate() {
+ return delegate;
+ }
+
+ public void setDelegate(Component delegate) {
+ this.delegate = delegate;
+ }
+
+ public ComponentLifeCycle getLifeCycle() {
+ return delegate.getLifeCycle();
+ }
+
+ public Document getServiceDescription(ServiceEndpoint endpoint) {
+ return delegate.getServiceDescription(endpoint);
+ }
+
+ public ServiceUnitManager getServiceUnitManager() {
+ return delegate.getServiceUnitManager();
+ }
+
+ public boolean isExchangeWithConsumerOkay(ServiceEndpoint endpoint, MessageExchange exchange) {
+ return delegate.isExchangeWithConsumerOkay(endpoint, exchange);
+ }
+
+ public boolean isExchangeWithProviderOkay(ServiceEndpoint endpoint, MessageExchange exchange) {
+ return delegate.isExchangeWithProviderOkay(endpoint, exchange);
+ }
+
+ public ServiceEndpoint resolveEndpointReference(DocumentFragment epr) {
+ return delegate.resolveEndpointReference(epr);
+ }
+
}
Modified: incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/installation/DeploymentMessageTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/installation/DeploymentMessageTest.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/installation/DeploymentMessageTest.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/installation/DeploymentMessageTest.java Fri Aug 10 07:37:46 2007
@@ -148,8 +148,8 @@
getContainer().getEnvironmentContext().createComponentRootDir("component1");
getContainer().activateComponent(component2, "component2");
getContainer().getEnvironmentContext().createComponentRootDir("component2");
- File installSaUrl = createServiceAssemblyArchive("sa", new String[] { "su1", "su2" }, new String[] { "component1", "component2"});
- String result = null;;
+ File installSaUrl = createServiceAssemblyArchive("sa", new String[] {"su1", "su2" }, new String[] {"component1", "component2"});
+ String result = null;
try {
result = getDeploymentService().deploy(installSaUrl.getAbsolutePath());
fail("Deployment with an error is not supported");
@@ -232,8 +232,7 @@
}
String text = DOMUtil.getElementText(element);
return text;
- }
- else if (root != null) {
+ } else if (root != null) {
return root.getNodeValue();
} else {
return null;
Modified: incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/installation/DeploymentTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/installation/DeploymentTest.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/installation/DeploymentTest.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/installation/DeploymentTest.java Fri Aug 10 07:37:46 2007
@@ -33,20 +33,27 @@
public class DeploymentTest extends AbstractManagementTest {
// Create mocks
- protected ExtMockControl bootstrapMock;
- protected Bootstrap bootstrap;
- protected ExtMockControl componentMock;
+ protected ExtMockControl bootstrapMock;
+
+ protected Bootstrap bootstrap;
+
+ protected ExtMockControl componentMock;
+
protected Component component;
+
protected ExtMockControl lifecycleMock;
+
protected ComponentLifeCycle lifecycle;
+
protected ExtMockControl managerMock;
+
protected ServiceUnitManager manager;
-
- protected void setUp() throws Exception {
- super.setUp();
+
+ protected void setUp() throws Exception {
+ super.setUp();
// Create mocks
- bootstrapMock = ExtMockControl.createControl(Bootstrap.class);
- bootstrap = (Bootstrap) bootstrapMock.getMock();
+ bootstrapMock = ExtMockControl.createControl(Bootstrap.class);
+ bootstrap = (Bootstrap) bootstrapMock.getMock();
Bootstrap1.setDelegate(bootstrap);
componentMock = ExtMockControl.createControl(Component.class);
component = (Component) componentMock.getMock();
@@ -55,38 +62,39 @@
lifecycle = (ComponentLifeCycle) lifecycleMock.getMock();
managerMock = ExtMockControl.createControl(ServiceUnitManager.class);
manager = (ServiceUnitManager) managerMock.getMock();
- }
-
- protected void reset() {
- bootstrapMock.reset();
- componentMock.reset();
- lifecycleMock.reset();
- managerMock.reset();
- }
-
- protected void replay() {
- bootstrapMock.replay();
- componentMock.replay();
- lifecycleMock.replay();
- managerMock.replay();
- }
-
- protected void verify() {
- bootstrapMock.verify();
- componentMock.verify();
- lifecycleMock.verify();
- managerMock.verify();
- }
-
- /**
+ }
+
+ protected void reset() {
+ bootstrapMock.reset();
+ componentMock.reset();
+ lifecycleMock.reset();
+ managerMock.reset();
+ }
+
+ protected void replay() {
+ bootstrapMock.replay();
+ componentMock.replay();
+ lifecycleMock.replay();
+ managerMock.replay();
+ }
+
+ protected void verify() {
+ bootstrapMock.verify();
+ componentMock.verify();
+ lifecycleMock.verify();
+ managerMock.verify();
+ }
+
+ /**
* SA is deployed and started
+ *
* @throws Exception
*/
public void testDeployAndStart() throws Exception {
- // configure mocks
- reset();
+ // configure mocks
+ reset();
bootstrap.init(null);
- bootstrapMock.setMatcher(MockControl.ALWAYS_MATCHER);
+ bootstrapMock.setMatcher(MockControl.ALWAYS_MATCHER);
bootstrap.onInstall();
bootstrap.getExtensionMBeanName();
bootstrapMock.setReturnValue(null);
@@ -96,14 +104,16 @@
startContainer(true);
String installJarUrl = createInstallerArchive("component1").getAbsolutePath();
ObjectName installerName = getInstallationService().loadNewInstaller(installJarUrl);
- InstallerMBean installer = (InstallerMBean) MBeanServerInvocationHandler.newProxyInstance(container.getMBeanServer(), installerName, InstallerMBean.class, false);
+ InstallerMBean installer = (InstallerMBean) MBeanServerInvocationHandler.newProxyInstance(container.getMBeanServer(),
+ installerName, InstallerMBean.class, false);
assertFalse(installer.isInstalled());
ObjectName lifecycleName = installer.install();
- LifeCycleMBean lifecycleMBean = (LifeCycleMBean) MBeanServerInvocationHandler.newProxyInstance(container.getMBeanServer(), lifecycleName, LifeCycleMBean.class, false);
+ LifeCycleMBean lifecycleMBean = (LifeCycleMBean) MBeanServerInvocationHandler.newProxyInstance(container.getMBeanServer(),
+ lifecycleName, LifeCycleMBean.class, false);
assertEquals(LifeCycleMBean.SHUTDOWN, lifecycleMBean.getCurrentState());
// check mocks
verify();
-
+
// configure mocks
reset();
component.getLifeCycle();
@@ -117,7 +127,7 @@
assertEquals(LifeCycleMBean.STARTED, lifecycleMBean.getCurrentState());
// check mocks
verify();
-
+
// configure mocks
reset();
component.getServiceUnitManager();
@@ -142,7 +152,7 @@
assertEquals(DeploymentServiceMBean.SHUTDOWN, getDeploymentService().getState("sa"));
// check mocks
verify();
-
+
// configure mocks
reset();
component.getServiceUnitManager();
@@ -156,7 +166,7 @@
assertEquals(DeploymentServiceMBean.STARTED, getDeploymentService().getState("sa"));
// check mocks
verify();
-
+
// Clean shutdown
reset();
component.getLifeCycle();
@@ -165,21 +175,22 @@
componentMock.setReturnValue(manager, MockControl.ONE_OR_MORE);
lifecycle.stop();
lifecycle.shutDown();
- //manager.stop("su");
+ // manager.stop("su");
manager.shutDown("su");
replay();
shutdownContainer();
}
- /**
+ /**
* SA is deployed and started
+ *
* @throws Exception
*/
public void testDeployAndRestart() throws Exception {
- // configure mocks
- reset();
- bootstrap.init(null);
- bootstrapMock.setMatcher(MockControl.ALWAYS_MATCHER);
+ // configure mocks
+ reset();
+ bootstrap.init(null);
+ bootstrapMock.setMatcher(MockControl.ALWAYS_MATCHER);
bootstrap.onInstall();
bootstrap.getExtensionMBeanName();
bootstrapMock.setReturnValue(null);
@@ -189,14 +200,16 @@
startContainer(true);
String installJarUrl = createInstallerArchive("component1").getAbsolutePath();
ObjectName installerName = getInstallationService().loadNewInstaller(installJarUrl);
- InstallerMBean installer = (InstallerMBean) MBeanServerInvocationHandler.newProxyInstance(container.getMBeanServer(), installerName, InstallerMBean.class, false);
+ InstallerMBean installer = (InstallerMBean) MBeanServerInvocationHandler.newProxyInstance(container.getMBeanServer(),
+ installerName, InstallerMBean.class, false);
assertFalse(installer.isInstalled());
ObjectName lifecycleName = installer.install();
- LifeCycleMBean lifecycleMBean = (LifeCycleMBean) MBeanServerInvocationHandler.newProxyInstance(container.getMBeanServer(), lifecycleName, LifeCycleMBean.class, false);
+ LifeCycleMBean lifecycleMBean = (LifeCycleMBean) MBeanServerInvocationHandler.newProxyInstance(container.getMBeanServer(),
+ lifecycleName, LifeCycleMBean.class, false);
assertEquals(LifeCycleMBean.SHUTDOWN, lifecycleMBean.getCurrentState());
// check mocks
verify();
-
+
// configure mocks
reset();
component.getLifeCycle();
@@ -210,7 +223,7 @@
assertEquals(LifeCycleMBean.STARTED, lifecycleMBean.getCurrentState());
// check mocks
verify();
-
+
// configure mocks
reset();
component.getServiceUnitManager();
@@ -234,7 +247,7 @@
assertEquals(DeploymentServiceMBean.SHUTDOWN, getDeploymentService().getState("sa"));
// check mocks
verify();
-
+
// configure mocks
reset();
lifecycle.stop();
@@ -244,7 +257,7 @@
shutdownContainer();
// check mocks
verify();
-
+
// configure mocks
reset();
// XXX Should the bootstrap re-init?
@@ -256,7 +269,7 @@
componentMock.setReturnValue(lifecycle, MockControl.ONE_OR_MORE);
lifecycle.init(null);
lifecycleMock.setMatcher(MockControl.ALWAYS_MATCHER);
- lifecycle.start();
+ lifecycle.start();
component.getServiceUnitManager();
componentMock.setReturnValue(manager, MockControl.ONE_OR_MORE);
manager.init(null, null);
@@ -267,7 +280,7 @@
startContainer(false);
// check mocks
verify();
-
+
// Clean shutdown
reset();
component.getLifeCycle();
@@ -276,19 +289,20 @@
componentMock.setReturnValue(manager, MockControl.ONE_OR_MORE);
lifecycle.stop();
lifecycle.shutDown();
- //manager.stop("su");
+ // manager.stop("su");
manager.shutDown("su");
replay();
shutdownContainer();
}
- /**
+ /**
* SA is deployed and started
+ *
* @throws Exception
*/
public void testDeployStartAndRestart() throws Exception {
- // configure mocks
- reset();
+ // configure mocks
+ reset();
bootstrap.init(null);
bootstrapMock.setMatcher(MockControl.ALWAYS_MATCHER);
bootstrap.onInstall();
@@ -300,14 +314,16 @@
startContainer(true);
String installJarUrl = createInstallerArchive("component1").getAbsolutePath();
ObjectName installerName = getInstallationService().loadNewInstaller(installJarUrl);
- InstallerMBean installer = (InstallerMBean) MBeanServerInvocationHandler.newProxyInstance(container.getMBeanServer(), installerName, InstallerMBean.class, false);
+ InstallerMBean installer = (InstallerMBean) MBeanServerInvocationHandler.newProxyInstance(container.getMBeanServer(),
+ installerName, InstallerMBean.class, false);
assertFalse(installer.isInstalled());
ObjectName lifecycleName = installer.install();
- LifeCycleMBean lifecycleMBean = (LifeCycleMBean) MBeanServerInvocationHandler.newProxyInstance(container.getMBeanServer(), lifecycleName, LifeCycleMBean.class, false);
+ LifeCycleMBean lifecycleMBean = (LifeCycleMBean) MBeanServerInvocationHandler.newProxyInstance(container.getMBeanServer(),
+ lifecycleName, LifeCycleMBean.class, false);
assertEquals(LifeCycleMBean.SHUTDOWN, lifecycleMBean.getCurrentState());
// check mocks
verify();
-
+
// configure mocks
reset();
component.getLifeCycle();
@@ -321,7 +337,7 @@
assertEquals(LifeCycleMBean.STARTED, lifecycleMBean.getCurrentState());
// check mocks
verify();
-
+
// configure mocks
reset();
component.getServiceUnitManager();
@@ -345,7 +361,7 @@
assertEquals(DeploymentServiceMBean.SHUTDOWN, getDeploymentService().getState("sa"));
// check mocks
verify();
-
+
// configure mocks
reset();
manager.init(null, null);
@@ -357,7 +373,7 @@
assertEquals(DeploymentServiceMBean.STARTED, getDeploymentService().getState("sa"));
// check mocks
verify();
-
+
// configure mocks
reset();
lifecycle.stop();
@@ -369,9 +385,9 @@
shutdownContainer();
// check mocks
verify();
-
+
// configure mocks
- reset();
+ reset();
// XXX Should the bootstrap re-init?
bootstrap.init(null);
bootstrapMock.setMatcher(MockControl.ALWAYS_MATCHER);
@@ -393,7 +409,7 @@
startContainer(false);
// check mocks
verify();
-
+
// Clean shutdown
reset();
component.getLifeCycle();
@@ -402,7 +418,7 @@
componentMock.setReturnValue(manager, MockControl.ONE_OR_MORE);
lifecycle.stop();
lifecycle.shutDown();
- //manager.stop("su");
+ // manager.stop("su");
manager.shutDown("su");
replay();
shutdownContainer();
Modified: incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/installation/ExtMockControl.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/installation/ExtMockControl.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/installation/ExtMockControl.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/installation/ExtMockControl.java Fri Aug 10 07:37:46 2007
@@ -16,10 +16,6 @@
*/
package org.apache.servicemix.jbi.installation;
-import org.easymock.ArgumentsMatcher;
-import org.easymock.MockControl;
-import org.easymock.internal.Range;
-
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@@ -27,6 +23,10 @@
import junit.framework.AssertionFailedError;
+import org.easymock.ArgumentsMatcher;
+import org.easymock.MockControl;
+import org.easymock.internal.Range;
+
public class ExtMockControl implements InvocationHandler {
private MockControl control;
@@ -410,7 +410,7 @@
*/
public Object getMock() {
if (mock == null) {
- mock = Proxy.newProxyInstance(clazz.getClassLoader(), new Class[] { clazz }, this);
+ mock = Proxy.newProxyInstance(clazz.getClassLoader(), new Class[] {clazz }, this);
}
return mock;
}
Modified: incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/installation/HotDeployTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/installation/HotDeployTest.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/installation/HotDeployTest.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/installation/HotDeployTest.java Fri Aug 10 07:37:46 2007
@@ -35,17 +35,24 @@
public class HotDeployTest extends AbstractManagementTest {
// Create mocks
- protected ExtMockControl bootstrapMock;
- protected Bootstrap bootstrap;
- protected ExtMockControl componentMock;
+ protected ExtMockControl bootstrapMock;
+
+ protected Bootstrap bootstrap;
+
+ protected ExtMockControl componentMock;
+
protected Component component;
+
protected ExtMockControl lifecycleMock;
+
protected ComponentLifeCycle lifecycle;
+
protected ExtMockControl managerMock;
+
protected ServiceUnitManager manager;
-
- protected void setUp() throws Exception {
- super.setUp();
+
+ protected void setUp() throws Exception {
+ super.setUp();
// Create mocks
bootstrapMock = ExtMockControl.createControl(Bootstrap.class);
bootstrap = (Bootstrap) bootstrapMock.getMock();
@@ -57,50 +64,48 @@
lifecycle = (ComponentLifeCycle) lifecycleMock.getMock();
managerMock = ExtMockControl.createControl(ServiceUnitManager.class);
manager = (ServiceUnitManager) managerMock.getMock();
- }
-
- protected void reset() {
- bootstrapMock.reset();
- componentMock.reset();
- lifecycleMock.reset();
- managerMock.reset();
- }
-
- protected void replay() {
- bootstrapMock.replay();
- componentMock.replay();
- lifecycleMock.replay();
- managerMock.replay();
- }
-
- protected void verify() {
- bootstrapMock.verify();
- componentMock.verify();
- lifecycleMock.verify();
- managerMock.verify();
- }
-
+ }
+
+ protected void reset() {
+ bootstrapMock.reset();
+ componentMock.reset();
+ lifecycleMock.reset();
+ managerMock.reset();
+ }
+
+ protected void replay() {
+ bootstrapMock.replay();
+ componentMock.replay();
+ lifecycleMock.replay();
+ managerMock.replay();
+ }
+
+ protected void verify() {
+ bootstrapMock.verify();
+ componentMock.verify();
+ lifecycleMock.verify();
+ managerMock.verify();
+ }
+
protected void initContainer() {
container.setCreateMBeanServer(true);
container.setMonitorInstallationDirectory(true);
container.setMonitorDeploymentDirectory(true);
container.setMonitorInterval(1);
}
-
-
-
+
public void testHotDeployComponent() throws Exception {
- final Object lock = new Object();
- // configure mocks
- Bootstrap1.setDelegate(new BootstrapDelegate(bootstrap) {
- public void cleanUp() throws JBIException {
- super.cleanUp();
- synchronized (lock) {
- lock.notify();
- }
- }
- });
- reset();
+ final Object lock = new Object();
+ // configure mocks
+ Bootstrap1.setDelegate(new BootstrapDelegate(bootstrap) {
+ public void cleanUp() throws JBIException {
+ super.cleanUp();
+ synchronized (lock) {
+ lock.notify();
+ }
+ }
+ });
+ reset();
bootstrap.init(null);
bootstrapMock.setMatcher(MockControl.ALWAYS_MATCHER);
bootstrap.getExtensionMBeanName();
@@ -116,20 +121,20 @@
// test component installation
startContainer(true);
String installJarUrl = createInstallerArchive("component1").getAbsolutePath();
- File hdInstaller = new File(container.getEnvironmentContext().getInstallationDir(), new File(installJarUrl).getName());
+ File hdInstaller = new File(container.getEnvironmentContext().getInstallationDir(), new File(installJarUrl).getName());
synchronized (lock) {
- FileUtil.copyInputStream(new FileInputStream(installJarUrl),
- new FileOutputStream(hdInstaller));
- lock.wait(5000);
+ FileUtil.copyInputStream(new FileInputStream(installJarUrl), new FileOutputStream(hdInstaller));
+ lock.wait(5000);
}
Thread.sleep(50);
ObjectName lifecycleName = container.getComponent("component1").getMBeanName();
assertNotNull(lifecycleName);
- LifeCycleMBean lifecycleMBean = (LifeCycleMBean) MBeanServerInvocationHandler.newProxyInstance(container.getMBeanServer(), lifecycleName, LifeCycleMBean.class, false);
+ LifeCycleMBean lifecycleMBean = (LifeCycleMBean) MBeanServerInvocationHandler.newProxyInstance(container.getMBeanServer(),
+ lifecycleName, LifeCycleMBean.class, false);
assertEquals(LifeCycleMBean.STARTED, lifecycleMBean.getCurrentState());
// check mocks
verify();
-
+
// Clean shutdown
reset();
component.getLifeCycle();
@@ -139,19 +144,19 @@
replay();
shutdownContainer();
}
-
+
public void testHotDeployUndeployComponent() throws Exception {
- final Object lock = new Object();
- // configure mocks
- Bootstrap1.setDelegate(new BootstrapDelegate(bootstrap) {
- public void cleanUp() throws JBIException {
- super.cleanUp();
- synchronized (lock) {
- lock.notify();
- }
- }
- });
- reset();
+ final Object lock = new Object();
+ // configure mocks
+ Bootstrap1.setDelegate(new BootstrapDelegate(bootstrap) {
+ public void cleanUp() throws JBIException {
+ super.cleanUp();
+ synchronized (lock) {
+ lock.notify();
+ }
+ }
+ });
+ reset();
bootstrap.init(null);
bootstrapMock.setMatcher(MockControl.ALWAYS_MATCHER);
bootstrap.getExtensionMBeanName();
@@ -167,58 +172,58 @@
// test component installation
startContainer(true);
String installJarUrl = createInstallerArchive("component1").getAbsolutePath();
- File hdInstaller = new File(container.getEnvironmentContext().getInstallationDir(), new File(installJarUrl).getName());
+ File hdInstaller = new File(container.getEnvironmentContext().getInstallationDir(), new File(installJarUrl).getName());
synchronized (lock) {
- FileUtil.copyInputStream(new FileInputStream(installJarUrl),
- new FileOutputStream(hdInstaller));
- lock.wait(5000);
+ FileUtil.copyInputStream(new FileInputStream(installJarUrl), new FileOutputStream(hdInstaller));
+ lock.wait(5000);
}
Thread.sleep(50);
ObjectName lifecycleName = container.getComponent("component1").getMBeanName();
assertNotNull(lifecycleName);
- LifeCycleMBean lifecycleMBean = (LifeCycleMBean) MBeanServerInvocationHandler.newProxyInstance(container.getMBeanServer(), lifecycleName, LifeCycleMBean.class, false);
+ LifeCycleMBean lifecycleMBean = (LifeCycleMBean) MBeanServerInvocationHandler.newProxyInstance(container.getMBeanServer(),
+ lifecycleName, LifeCycleMBean.class, false);
assertEquals(LifeCycleMBean.STARTED, lifecycleMBean.getCurrentState());
// check mocks
verify();
-
+
// Configure mocks
reset();
bootstrap.onUninstall();
bootstrap.cleanUp();
lifecycle.stop();
lifecycle.shutDown();
- //manager.shutDown("su");
+ // manager.shutDown("su");
replay();
// test component uninstallation
synchronized (lock) {
- assertTrue(hdInstaller.delete());
- lock.wait(5000);
+ assertTrue(hdInstaller.delete());
+ lock.wait(5000);
}
Thread.sleep(50);
assertNull(container.getComponent("component1"));
// check mocks
verify();
-
+
// Clean shutdown
reset();
replay();
shutdownContainer();
}
-
+
public void testDeploySAThenComponent() throws Exception {
- final Object lock = new Object();
- // configure mocks
- Bootstrap1.setDelegate(new BootstrapDelegate(bootstrap) {
- public void cleanUp() throws JBIException {
- super.cleanUp();
- synchronized (lock) {
- lock.notify();
- }
- }
- });
- reset();
+ final Object lock = new Object();
+ // configure mocks
+ Bootstrap1.setDelegate(new BootstrapDelegate(bootstrap) {
+ public void cleanUp() throws JBIException {
+ super.cleanUp();
+ synchronized (lock) {
+ lock.notify();
+ }
+ }
+ });
+ reset();
bootstrap.init(null);
- bootstrapMock.setMatcher(MockControl.ALWAYS_MATCHER);
+ bootstrapMock.setMatcher(MockControl.ALWAYS_MATCHER);
bootstrap.getExtensionMBeanName();
bootstrapMock.setReturnValue(null);
bootstrap.onInstall();
@@ -241,25 +246,24 @@
startContainer(true);
File saJarUrl = createServiceAssemblyArchive("sa", "su", "component1");
File hdSa = new File(container.getEnvironmentContext().getDeploymentDir(), saJarUrl.getName());
- FileUtil.copyInputStream(new FileInputStream(saJarUrl),
- new FileOutputStream(hdSa));
+ FileUtil.copyInputStream(new FileInputStream(saJarUrl), new FileOutputStream(hdSa));
Thread.sleep(2000);
-
+
String installJarUrl = createInstallerArchive("component1").getAbsolutePath();
- File hdInstaller = new File(container.getEnvironmentContext().getInstallationDir(), new File(installJarUrl).getName());
+ File hdInstaller = new File(container.getEnvironmentContext().getInstallationDir(), new File(installJarUrl).getName());
synchronized (lock) {
- FileUtil.copyInputStream(new FileInputStream(installJarUrl),
- new FileOutputStream(hdInstaller));
- lock.wait(5000);
+ FileUtil.copyInputStream(new FileInputStream(installJarUrl), new FileOutputStream(hdInstaller));
+ lock.wait(5000);
}
Thread.sleep(2000);
ObjectName lifecycleName = container.getComponent("component1").getMBeanName();
assertNotNull(lifecycleName);
- LifeCycleMBean lifecycleMBean = (LifeCycleMBean) MBeanServerInvocationHandler.newProxyInstance(container.getMBeanServer(), lifecycleName, LifeCycleMBean.class, false);
+ LifeCycleMBean lifecycleMBean = (LifeCycleMBean) MBeanServerInvocationHandler.newProxyInstance(container.getMBeanServer(),
+ lifecycleName, LifeCycleMBean.class, false);
assertEquals(LifeCycleMBean.STARTED, lifecycleMBean.getCurrentState());
// check mocks
verify();
-
+
// Clean shutdown
reset();
component.getLifeCycle();
Modified: incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/installation/InstallationTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/installation/InstallationTest.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/installation/InstallationTest.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/installation/InstallationTest.java Fri Aug 10 07:37:46 2007
@@ -26,23 +26,24 @@
import org.easymock.MockControl;
-
/**
- *
+ *
* JbiTaskTest
+ *
* @version $Revision$
*/
public class InstallationTest extends AbstractManagementTest {
-
+
/**
* Installer should not be persistent across restart
+ *
* @throws Exception
*/
public void testLoadNewInstallerAndRestart() throws Exception {
ExtMockControl bootstrapMock = ExtMockControl.createControl(Bootstrap.class);
Bootstrap bootstrap = (Bootstrap) bootstrapMock.getMock();
Bootstrap1.setDelegate(bootstrap);
-
+
// configure bootstrap
bootstrap.init(null);
bootstrapMock.setMatcher(MockControl.ALWAYS_MATCHER);
@@ -55,12 +56,13 @@
ObjectName installerName = getInstallationService().loadNewInstaller(installJarUrl);
assertNotNull(Bootstrap1.getInstallContext());
assertTrue(Bootstrap1.getInstallContext().isInstall());
- InstallerMBean installer = (InstallerMBean) MBeanServerInvocationHandler.newProxyInstance(container.getMBeanServer(), installerName, InstallerMBean.class, false);
+ InstallerMBean installer = (InstallerMBean) MBeanServerInvocationHandler.newProxyInstance(container.getMBeanServer(),
+ installerName, InstallerMBean.class, false);
assertFalse(installer.isInstalled());
shutdownContainer();
// check mocks
bootstrapMock.verify();
-
+
// configure bootstrap
bootstrapMock.reset();
bootstrapMock.replay();
@@ -72,18 +74,19 @@
/**
* Installer should not be persistent across restart
+ *
* @throws Exception
*/
public void testLoadNewInstallerAndLoadNewInstaller() throws Exception {
ExtMockControl bootstrapMock = ExtMockControl.createControl(Bootstrap.class);
Bootstrap bootstrap = (Bootstrap) bootstrapMock.getMock();
Bootstrap1.setDelegate(bootstrap);
-
+
// configure bootstrap
bootstrap.init(null);
bootstrapMock.setMatcher(MockControl.ALWAYS_MATCHER);
bootstrap.getExtensionMBeanName();
- bootstrapMock.setReturnValue(null);
+ bootstrapMock.setReturnValue(null);
bootstrapMock.replay();
// test component installation
startContainer(true);
@@ -91,11 +94,12 @@
ObjectName installerName = getInstallationService().loadNewInstaller(installJarUrl);
assertNotNull(Bootstrap1.getInstallContext());
assertTrue(Bootstrap1.getInstallContext().isInstall());
- InstallerMBean installer = (InstallerMBean) MBeanServerInvocationHandler.newProxyInstance(container.getMBeanServer(), installerName, InstallerMBean.class, false);
+ InstallerMBean installer = (InstallerMBean) MBeanServerInvocationHandler.newProxyInstance(container.getMBeanServer(),
+ installerName, InstallerMBean.class, false);
assertFalse(installer.isInstalled());
// check mocks
bootstrapMock.verify();
-
+
// configure bootstrap
bootstrapMock.reset();
bootstrapMock.replay();
@@ -112,6 +116,7 @@
/**
* Installer is created, component installed and server restarted
+ *
* @throws Exception
*/
public void testInstallAndRestart() throws Exception {
@@ -122,14 +127,14 @@
ExtMockControl componentMock = ExtMockControl.createControl(Component.class);
Component component = (Component) componentMock.getMock();
Component1.setDelegate(component);
-
+
// configure bootstrap
bootstrapMock.reset();
bootstrap.init(null);
- bootstrapMock.setMatcher(MockControl.ALWAYS_MATCHER);
+ bootstrapMock.setMatcher(MockControl.ALWAYS_MATCHER);
bootstrap.onInstall();
bootstrap.getExtensionMBeanName();
- bootstrapMock.setReturnValue(null);
+ bootstrapMock.setReturnValue(null);
bootstrap.cleanUp();
bootstrapMock.replay();
// configure component
@@ -139,15 +144,17 @@
startContainer(true);
String installJarUrl = createInstallerArchive("component1").getAbsolutePath();
ObjectName installerName = getInstallationService().loadNewInstaller(installJarUrl);
- InstallerMBean installer = (InstallerMBean) MBeanServerInvocationHandler.newProxyInstance(container.getMBeanServer(), installerName, InstallerMBean.class, false);
+ InstallerMBean installer = (InstallerMBean) MBeanServerInvocationHandler.newProxyInstance(container.getMBeanServer(),
+ installerName, InstallerMBean.class, false);
assertFalse(installer.isInstalled());
ObjectName lifecycleName = installer.install();
- LifeCycleMBean lifecycleMBean = (LifeCycleMBean) MBeanServerInvocationHandler.newProxyInstance(container.getMBeanServer(), lifecycleName, LifeCycleMBean.class, false);
+ LifeCycleMBean lifecycleMBean = (LifeCycleMBean) MBeanServerInvocationHandler.newProxyInstance(container.getMBeanServer(),
+ lifecycleName, LifeCycleMBean.class, false);
assertEquals(LifeCycleMBean.SHUTDOWN, lifecycleMBean.getCurrentState());
// check mocks
bootstrapMock.verify();
componentMock.verify();
-
+
// configure bootstrap
bootstrapMock.reset();
bootstrapMock.replay();
@@ -171,20 +178,21 @@
// check mocks
bootstrapMock.verify();
componentMock.verify();
-
+
// configure bootstrap
bootstrapMock.reset();
bootstrap.init(null);
- bootstrapMock.setMatcher(MockControl.ALWAYS_MATCHER);
+ bootstrapMock.setMatcher(MockControl.ALWAYS_MATCHER);
bootstrap.getExtensionMBeanName();
- bootstrapMock.setReturnValue(null);
+ bootstrapMock.setReturnValue(null);
bootstrapMock.replay();
// configure component
componentMock.reset();
componentMock.replay();
// start container
startContainer(false);
- lifecycleMBean = (LifeCycleMBean) MBeanServerInvocationHandler.newProxyInstance(container.getMBeanServer(), lifecycleName, LifeCycleMBean.class, false);
+ lifecycleMBean = (LifeCycleMBean) MBeanServerInvocationHandler.newProxyInstance(container.getMBeanServer(), lifecycleName,
+ LifeCycleMBean.class, false);
assertEquals(LifeCycleMBean.SHUTDOWN, lifecycleMBean.getCurrentState());
// check mocks
bootstrapMock.verify();
@@ -193,6 +201,7 @@
/**
* Installer is created, component installed, started and server restarted
+ *
* @throws Exception
*/
public void testInstallStartAndRestart() throws Exception {
@@ -205,14 +214,14 @@
Component1.setDelegate(component);
ExtMockControl lifecycleMock = ExtMockControl.createControl(ComponentLifeCycle.class);
ComponentLifeCycle lifecycle = (ComponentLifeCycle) lifecycleMock.getMock();
-
+
// configure bootstrap
bootstrapMock.reset();
bootstrap.init(null);
bootstrapMock.setMatcher(MockControl.ALWAYS_MATCHER);
bootstrap.onInstall();
bootstrap.getExtensionMBeanName();
- bootstrapMock.setReturnValue(null);
+ bootstrapMock.setReturnValue(null);
bootstrap.cleanUp();
bootstrapMock.replay();
// configure component
@@ -225,16 +234,18 @@
startContainer(true);
String installJarUrl = createInstallerArchive("component1").getAbsolutePath();
ObjectName installerName = getInstallationService().loadNewInstaller(installJarUrl);
- InstallerMBean installer = (InstallerMBean) MBeanServerInvocationHandler.newProxyInstance(container.getMBeanServer(), installerName, InstallerMBean.class, false);
+ InstallerMBean installer = (InstallerMBean) MBeanServerInvocationHandler.newProxyInstance(container.getMBeanServer(),
+ installerName, InstallerMBean.class, false);
assertFalse(installer.isInstalled());
ObjectName lifecycleName = installer.install();
- LifeCycleMBean lifecycleMBean = (LifeCycleMBean) MBeanServerInvocationHandler.newProxyInstance(container.getMBeanServer(), lifecycleName, LifeCycleMBean.class, false);
+ LifeCycleMBean lifecycleMBean = (LifeCycleMBean) MBeanServerInvocationHandler.newProxyInstance(container.getMBeanServer(),
+ lifecycleName, LifeCycleMBean.class, false);
assertEquals(LifeCycleMBean.SHUTDOWN, lifecycleMBean.getCurrentState());
// check mocks
bootstrapMock.verify();
componentMock.verify();
lifecycleMock.verify();
-
+
// configure bootstrap
bootstrapMock.reset();
bootstrapMock.replay();
@@ -256,7 +267,7 @@
bootstrapMock.verify();
componentMock.verify();
lifecycleMock.verify();
-
+
// configure bootstrap
bootstrapMock.reset();
bootstrapMock.replay();
@@ -274,13 +285,13 @@
bootstrapMock.verify();
componentMock.verify();
lifecycleMock.verify();
-
+
// configure bootstrap
bootstrapMock.reset();
bootstrap.init(null);
- bootstrapMock.setMatcher(MockControl.ALWAYS_MATCHER);
+ bootstrapMock.setMatcher(MockControl.ALWAYS_MATCHER);
bootstrap.getExtensionMBeanName();
- bootstrapMock.setReturnValue(null);
+ bootstrapMock.setReturnValue(null);
bootstrapMock.replay();
// configure component
componentMock.reset();
@@ -297,7 +308,8 @@
lifecycleMock.replay();
// start container
startContainer(false);
- lifecycleMBean = (LifeCycleMBean) MBeanServerInvocationHandler.newProxyInstance(container.getMBeanServer(), lifecycleName, LifeCycleMBean.class, false);
+ lifecycleMBean = (LifeCycleMBean) MBeanServerInvocationHandler.newProxyInstance(container.getMBeanServer(), lifecycleName,
+ LifeCycleMBean.class, false);
assertEquals(LifeCycleMBean.STARTED, lifecycleMBean.getCurrentState());
// check mocks
bootstrapMock.verify();
@@ -306,8 +318,9 @@
}
/**
- * Installer is created, component installed.
- * Then we unload the installer and reload it.
+ * Installer is created, component installed. Then we unload the installer
+ * and reload it.
+ *
* @throws Exception
*/
public void testInstallAndReloadInstaller() throws Exception {
@@ -320,14 +333,14 @@
Component1.setDelegate(component);
ExtMockControl lifecycleMock = ExtMockControl.createControl(ComponentLifeCycle.class);
ComponentLifeCycle lifecycle = (ComponentLifeCycle) lifecycleMock.getMock();
-
+
// configure bootstrap
bootstrapMock.reset();
bootstrap.init(null);
bootstrapMock.setMatcher(MockControl.ALWAYS_MATCHER);
bootstrap.onInstall();
bootstrap.getExtensionMBeanName();
- bootstrapMock.setReturnValue(null);
+ bootstrapMock.setReturnValue(null);
bootstrap.cleanUp();
bootstrapMock.replay();
// configure component
@@ -342,15 +355,17 @@
startContainer(true);
String installJarUrl = createInstallerArchive("component1").getAbsolutePath();
ObjectName installerName = getInstallationService().loadNewInstaller(installJarUrl);
- InstallerMBean installer = (InstallerMBean) MBeanServerInvocationHandler.newProxyInstance(container.getMBeanServer(), installerName, InstallerMBean.class, false);
+ InstallerMBean installer = (InstallerMBean) MBeanServerInvocationHandler.newProxyInstance(container.getMBeanServer(),
+ installerName, InstallerMBean.class, false);
assertFalse(installer.isInstalled());
ObjectName lifecycleName = installer.install();
- LifeCycleMBean lifecycleMBean = (LifeCycleMBean) MBeanServerInvocationHandler.newProxyInstance(container.getMBeanServer(), lifecycleName, LifeCycleMBean.class, false);
+ LifeCycleMBean lifecycleMBean = (LifeCycleMBean) MBeanServerInvocationHandler.newProxyInstance(container.getMBeanServer(),
+ lifecycleName, LifeCycleMBean.class, false);
assertEquals(LifeCycleMBean.SHUTDOWN, lifecycleMBean.getCurrentState());
// check mocks
bootstrapMock.verify();
componentMock.verify();
-
+
// configure bootstrap
bootstrapMock.reset();
bootstrapMock.replay();
@@ -379,6 +394,7 @@
/**
* Installer is created, component installed, uninstalled and reinstalled
+ *
* @throws Exception
*/
public void testInstallAndReinstall() throws Exception {
@@ -389,14 +405,14 @@
ExtMockControl componentMock = ExtMockControl.createControl(Component.class);
Component component = (Component) componentMock.getMock();
Component1.setDelegate(component);
-
+
// configure bootstrap
bootstrapMock.reset();
bootstrap.init(null);
bootstrapMock.setMatcher(MockControl.ALWAYS_MATCHER);
bootstrap.onInstall();
bootstrap.getExtensionMBeanName();
- bootstrapMock.setReturnValue(null);
+ bootstrapMock.setReturnValue(null);
bootstrap.cleanUp();
bootstrapMock.replay();
// configure component
@@ -406,15 +422,17 @@
startContainer(true);
String installJarUrl = createInstallerArchive("component1").getAbsolutePath();
ObjectName installerName = getInstallationService().loadNewInstaller(installJarUrl);
- InstallerMBean installer = (InstallerMBean) MBeanServerInvocationHandler.newProxyInstance(container.getMBeanServer(), installerName, InstallerMBean.class, false);
+ InstallerMBean installer = (InstallerMBean) MBeanServerInvocationHandler.newProxyInstance(container.getMBeanServer(),
+ installerName, InstallerMBean.class, false);
assertFalse(installer.isInstalled());
ObjectName lifecycleName = installer.install();
- LifeCycleMBean lifecycleMBean = (LifeCycleMBean) MBeanServerInvocationHandler.newProxyInstance(container.getMBeanServer(), lifecycleName, LifeCycleMBean.class, false);
+ LifeCycleMBean lifecycleMBean = (LifeCycleMBean) MBeanServerInvocationHandler.newProxyInstance(container.getMBeanServer(),
+ lifecycleName, LifeCycleMBean.class, false);
assertEquals(LifeCycleMBean.SHUTDOWN, lifecycleMBean.getCurrentState());
// check mocks
bootstrapMock.verify();
componentMock.verify();
-
+
// configure bootstrap
bootstrapMock.reset();
bootstrap.onUninstall();
@@ -434,7 +452,7 @@
bootstrap.init(null);
bootstrapMock.setMatcher(MockControl.ALWAYS_MATCHER);
bootstrap.getExtensionMBeanName();
- bootstrapMock.setReturnValue(null);
+ bootstrapMock.setReturnValue(null);
bootstrap.onInstall();
bootstrap.cleanUp();
bootstrapMock.replay();
@@ -445,15 +463,17 @@
startContainer(true);
installJarUrl = createInstallerArchive("component1").getAbsolutePath();
installerName = getInstallationService().loadNewInstaller(installJarUrl);
- installer = (InstallerMBean) MBeanServerInvocationHandler.newProxyInstance(container.getMBeanServer(), installerName, InstallerMBean.class, false);
+ installer = (InstallerMBean) MBeanServerInvocationHandler.newProxyInstance(container.getMBeanServer(), installerName,
+ InstallerMBean.class, false);
assertFalse(installer.isInstalled());
lifecycleName = installer.install();
- lifecycleMBean = (LifeCycleMBean) MBeanServerInvocationHandler.newProxyInstance(container.getMBeanServer(), lifecycleName, LifeCycleMBean.class, false);
+ lifecycleMBean = (LifeCycleMBean) MBeanServerInvocationHandler.newProxyInstance(container.getMBeanServer(), lifecycleName,
+ LifeCycleMBean.class, false);
assertEquals(LifeCycleMBean.SHUTDOWN, lifecycleMBean.getCurrentState());
// check mocks
bootstrapMock.verify();
componentMock.verify();
-
+
// configure bootstrap
bootstrapMock.reset();
bootstrapMock.replay();
Modified: incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/jaxp/AbstractStreamReaderTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/jaxp/AbstractStreamReaderTest.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/jaxp/AbstractStreamReaderTest.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/jaxp/AbstractStreamReaderTest.java Fri Aug 10 07:37:46 2007
@@ -25,11 +25,9 @@
* @author <a href="mailto:dan@envoisolutions.com">Dan Diephouse</a>
* @since Oct 26, 2004
*/
-public abstract class AbstractStreamReaderTest
- extends TestCase
-{
- public void testSingleElement(XMLStreamReader reader) throws Exception
- {
+public abstract class AbstractStreamReaderTest extends TestCase {
+
+ public void testSingleElement(XMLStreamReader reader) throws Exception {
assertTrue(reader.hasNext());
assertEquals(XMLStreamReader.START_ELEMENT, reader.next());
assertTrue(reader.hasNext());
@@ -37,39 +35,37 @@
assertEquals(1, reader.getNamespaceCount());
assertEquals("", reader.getNamespacePrefix(0));
assertEquals("urn:test", reader.getNamespaceURI(0));
-
+
assertTrue(reader.hasNext());
assertEquals(XMLStreamReader.END_ELEMENT, reader.next());
}
-
- public void testTextChild(XMLStreamReader reader) throws Exception
- {
+
+ public void testTextChild(XMLStreamReader reader) throws Exception {
assertTrue(reader.hasNext());
assertEquals(XMLStreamReader.START_ELEMENT, reader.next());
-
+
assertEquals(1, reader.getNamespaceCount());
assertEquals("", reader.getNamespacePrefix(0));
assertEquals("urn:test", reader.getNamespaceURI(0));
-
+
assertTrue(reader.hasNext());
assertEquals(XMLStreamReader.CHARACTERS, reader.next());
-
+
assertEquals("Hello World", reader.getText());
-
+
assertTrue(reader.hasNext());
assertEquals(XMLStreamReader.END_ELEMENT, reader.next());
}
- public void testMixedContent(XMLStreamReader reader) throws Exception
- {
+ public void testMixedContent(XMLStreamReader reader) throws Exception {
assertTrue(reader.hasNext());
assertEquals(XMLStreamReader.START_ELEMENT, reader.next());
-
+
assertEquals("root", reader.getLocalName());
assertEquals(1, reader.getNamespaceCount());
assertEquals("", reader.getNamespacePrefix(0));
assertEquals("urn:test", reader.getNamespaceURI(0));
-
+
assertTrue(reader.hasNext());
assertEquals(XMLStreamReader.CHARACTERS, reader.next());
assertEquals("Hello World", reader.getText());
@@ -80,7 +76,7 @@
assertTrue(reader.hasNext());
assertEquals(XMLStreamReader.END_ELEMENT, reader.next());
-
+
assertTrue(reader.hasNext());
assertEquals(XMLStreamReader.CHARACTERS, reader.next());
assertEquals(" more text", reader.getText());
@@ -89,23 +85,21 @@
assertEquals(XMLStreamReader.END_ELEMENT, reader.next());
}
- public void testAttributes(XMLStreamReader reader) throws Exception
- {
+ public void testAttributes(XMLStreamReader reader) throws Exception {
assertTrue(reader.hasNext());
assertEquals(XMLStreamReader.START_ELEMENT, reader.next());
-
+
assertTrue(reader.hasNext());
assertEquals(XMLStreamReader.ATTRIBUTE, reader.next());
-
+
// first attribute
assertEquals(2, reader.getAttributeCount());
assertTrue(reader.getAttributePrefix(0) == null || reader.getAttributePrefix(0).equals(""));
assertEquals("att1", reader.getAttributeLocalName(0));
- assertTrue(reader.getAttributeNamespace(0) == null ||
- reader.getAttributeNamespace(0).equals(""));
+ assertTrue(reader.getAttributeNamespace(0) == null || reader.getAttributeNamespace(0).equals(""));
assertEquals("value1", reader.getAttributeValue(0));
- assertEquals("value1", reader.getAttributeValue("", "att1"));
-
+ assertEquals("value1", reader.getAttributeValue("", "att1"));
+
QName q = reader.getAttributeName(0);
assertEquals("", q.getNamespaceURI());
assertEquals("", q.getPrefix());
@@ -116,8 +110,8 @@
assertEquals("att2", reader.getAttributeLocalName(1));
assertEquals("urn:test2", reader.getAttributeNamespace(1));
assertEquals("value2", reader.getAttributeValue(1));
- assertEquals("value2", reader.getAttributeValue("urn:test2", "att2"));
-
+ assertEquals("value2", reader.getAttributeValue("urn:test2", "att2"));
+
q = reader.getAttributeName(1);
assertEquals("urn:test2", q.getNamespaceURI());
assertEquals("p", q.getPrefix());
@@ -125,36 +119,35 @@
assertTrue(reader.hasNext());
assertEquals(XMLStreamReader.ATTRIBUTE, reader.next());
-
+
assertEquals(2, reader.getNamespaceCount());
assertEquals("", reader.getNamespacePrefix(0));
assertEquals("urn:test", reader.getNamespaceURI(0));
assertEquals("p", reader.getNamespacePrefix(1));
assertEquals("urn:test2", reader.getNamespaceURI(1));
-
+
assertTrue(reader.hasNext());
assertEquals(XMLStreamReader.END_ELEMENT, reader.next());
}
-
- public void testElementChild(XMLStreamReader reader) throws Exception
- {
+
+ public void testElementChild(XMLStreamReader reader) throws Exception {
assertTrue(reader.hasNext());
assertEquals(XMLStreamReader.START_ELEMENT, reader.next());
-
+
assertEquals("root", reader.getLocalName());
assertEquals("urn:test", reader.getNamespaceURI());
assertEquals("", reader.getPrefix());
-
+
assertTrue(reader.hasNext());
assertEquals(XMLStreamReader.START_ELEMENT, reader.next());
-
+
assertEquals("child", reader.getLocalName());
assertEquals("urn:test2", reader.getNamespaceURI());
assertEquals("a", reader.getPrefix());
-
+
assertTrue(reader.hasNext());
assertEquals(XMLStreamReader.END_ELEMENT, reader.next());
-
+
assertTrue(reader.hasNext());
assertEquals(XMLStreamReader.END_ELEMENT, reader.next());
}