You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by js...@apache.org on 2006/04/05 20:47:45 UTC

svn commit: r391709 - /incubator/servicemix/trunk/servicemix-jsr181/src/test/java/org/apache/servicemix/jsr181/Jsr181ComplexPojoTest.java

Author: jstrachan
Date: Wed Apr  5 11:47:44 2006
New Revision: 391709

URL: http://svn.apache.org/viewcvs?rev=391709&view=rev
Log:
added simple way to try out the visualisations by running the test case as a main()

Modified:
    incubator/servicemix/trunk/servicemix-jsr181/src/test/java/org/apache/servicemix/jsr181/Jsr181ComplexPojoTest.java

Modified: incubator/servicemix/trunk/servicemix-jsr181/src/test/java/org/apache/servicemix/jsr181/Jsr181ComplexPojoTest.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-jsr181/src/test/java/org/apache/servicemix/jsr181/Jsr181ComplexPojoTest.java?rev=391709&r1=391708&r2=391709&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-jsr181/src/test/java/org/apache/servicemix/jsr181/Jsr181ComplexPojoTest.java (original)
+++ incubator/servicemix/trunk/servicemix-jsr181/src/test/java/org/apache/servicemix/jsr181/Jsr181ComplexPojoTest.java Wed Apr  5 11:47:44 2006
@@ -27,6 +27,10 @@
 import javax.xml.transform.Source;
 import javax.xml.transform.TransformerException;
 
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.util.EventListener;
+
 import junit.framework.TestCase;
 
 import org.apache.servicemix.client.DefaultServiceMixClient;
@@ -36,6 +40,7 @@
 import org.apache.servicemix.jbi.jaxp.SourceTransformer;
 import org.apache.servicemix.jbi.jaxp.StringSource;
 import org.apache.servicemix.jbi.util.DOMUtil;
+import org.apache.servicemix.jbi.view.DotViewEndpointListener;
 import org.apache.servicemix.tck.ReceiverComponent;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
@@ -49,15 +54,44 @@
     
     protected JBIContainer container;
     protected SourceTransformer transformer = new SourceTransformer();
+    private boolean useJmx;
+    protected EventListener[] listeners;
     
+
+    public static void main(String[] args) {
+        Jsr181ComplexPojoTest test = new Jsr181ComplexPojoTest();
+        test.useJmx = true;
+        test.listeners = new EventListener[] { new DotViewEndpointListener() };
+        
+        try {
+            test.setUp();
+            test.testComplexOneWay();
+            
+            // now lets wait for the user to terminate things
+            System.out.println("Press enter to terminate the program.");
+            System.out.println("In the meantime you can use your JMX console to view the current MBeans");
+            BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
+            reader.readLine();
+
+            
+            test.tearDown();
+        }
+        catch (Exception e) {
+            System.err.println("Caught: " + e);
+            e.printStackTrace();
+        }
+    }
     protected void setUp() throws Exception {
         container = new JBIContainer();
-        container.setUseMBeanServer(false);
-        container.setCreateMBeanServer(false);
+        container.setUseMBeanServer(useJmx);
+        container.setCreateMBeanServer(useJmx);
         container.setMonitorInstallationDirectory(false);
         container.setNamingContext(new InitialContext());
         container.setEmbedded(true);
         container.setFlowName("st");
+        if (listeners != null) {
+            container.setListeners(listeners);
+        }
         container.init();
     }