You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ch...@apache.org on 2009/06/18 15:34:41 UTC

svn commit: r786060 - in /activemq/sandbox/activemq-flow: activemq-all/src/test/java/org/apache/activemq/legacy/transport/ activemq-all/src/test/java/org/apache/activemq/legacy/transport/tcp/ activemq-openwire/src/test/java/org/apache/activemq/legacy/o...

Author: chirino
Date: Thu Jun 18 13:34:40 2009
New Revision: 786060

URL: http://svn.apache.org/viewvc?rev=786060&view=rev
Log:
fixing compile issues.

Modified:
    activemq/sandbox/activemq-flow/activemq-all/src/test/java/org/apache/activemq/legacy/transport/TransportBrokerTestSupport.java
    activemq/sandbox/activemq-flow/activemq-all/src/test/java/org/apache/activemq/legacy/transport/tcp/SslBrokerServiceTest.java
    activemq/sandbox/activemq-flow/activemq-openwire/src/test/java/org/apache/activemq/legacy/openwireprotocol/BrokerTest.java
    activemq/sandbox/activemq-flow/activemq-openwire/src/test/java/org/apache/activemq/legacy/openwireprotocol/BrokerTestSupport.java

Modified: activemq/sandbox/activemq-flow/activemq-all/src/test/java/org/apache/activemq/legacy/transport/TransportBrokerTestSupport.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-all/src/test/java/org/apache/activemq/legacy/transport/TransportBrokerTestSupport.java?rev=786060&r1=786059&r2=786060&view=diff
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-all/src/test/java/org/apache/activemq/legacy/transport/TransportBrokerTestSupport.java (original)
+++ activemq/sandbox/activemq-flow/activemq-all/src/test/java/org/apache/activemq/legacy/transport/TransportBrokerTestSupport.java Thu Jun 18 13:34:40 2009
@@ -18,64 +18,35 @@
 
 import java.net.URI;
 import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.Iterator;
 
 import org.apache.activemq.apollo.broker.Broker;
-import org.apache.activemq.legacy.broker.BrokerService;
-import org.apache.activemq.legacy.broker.TransportConnector;
+import org.apache.activemq.apollo.broker.BrokerFactory;
 import org.apache.activemq.legacy.openwireprotocol.BrokerTest;
-import org.apache.activemq.legacy.openwireprotocol.StubConnection;
 import org.apache.activemq.transport.Transport;
 import org.apache.activemq.transport.TransportFactory;
 
 public abstract class TransportBrokerTestSupport extends BrokerTest {
 
-    protected TransportConnector connector;
-    private ArrayList<StubConnection> connections = new ArrayList<StubConnection>();
-
-    protected void setUp() throws Exception {
-        super.setUp();
-    }
-
     protected Broker createBroker() throws Exception {
-        BrokerService service = super.createBroker();
-        connector = service.addConnector(getBindLocation());
-        return service;
+    	Broker broker = BrokerFactory.createBroker(new URI("jaxb:classpath:non-persistent-activemq.xml"));
+    	broker.addTransportServer(TransportFactory.bind(new URI(getBindLocation())));
+        return broker;
     }
     
     protected abstract String getBindLocation();
-
-    protected void tearDown() throws Exception {
-        for (Iterator<StubConnection> iter = connections.iterator(); iter.hasNext();) {
-            StubConnection connection = iter.next();
-            connection.stop();
-            iter.remove();
-        }
-        if( connector!=null ) {
-            connector.stop();
-        }
-        super.tearDown();
-    }
-
-    protected URI getBindURI() throws URISyntaxException {
-        return new URI(getBindLocation());
+    protected String getConnectLocation() {
+    	return null;
     }
 
-    protected StubConnection createConnection() throws Exception {
-        URI bindURI = getBindURI();
-        
-        // Note: on platforms like OS X we cannot bind to the actual hostname, so we
-        // instead use the original host name (typically localhost) to bind to 
+    @Override
+    protected Transport createTransport() throws URISyntaxException, Exception {
+        String connectLocation = getConnectLocation();
+        if( connectLocation==null ) {
+        	connectLocation = getBindLocation();
+        }
+        URI connectURI = new URI(connectLocation);
         
-        URI actualURI = connector.getServer().getConnectURI();
-        URI connectURI = new URI(actualURI.getScheme(), actualURI.getUserInfo(), bindURI.getHost(), actualURI.getPort(), actualURI.getPath(), actualURI
-                .getQuery(), actualURI.getFragment());
-
-        Transport transport = TransportFactory.connect(connectURI);
-        StubConnection connection = new StubConnection(transport);
-        connections.add(connection);
-        return connection;
+        return TransportFactory.connect(connectURI);    
     }
 
 }

Modified: activemq/sandbox/activemq-flow/activemq-all/src/test/java/org/apache/activemq/legacy/transport/tcp/SslBrokerServiceTest.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-all/src/test/java/org/apache/activemq/legacy/transport/tcp/SslBrokerServiceTest.java?rev=786060&r1=786059&r2=786060&view=diff
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-all/src/test/java/org/apache/activemq/legacy/transport/tcp/SslBrokerServiceTest.java (original)
+++ activemq/sandbox/activemq-flow/activemq-all/src/test/java/org/apache/activemq/legacy/transport/tcp/SslBrokerServiceTest.java Thu Jun 18 13:34:40 2009
@@ -20,6 +20,7 @@
 import java.io.ByteArrayOutputStream;
 import java.io.FileInputStream;
 import java.io.IOException;
+import java.net.URI;
 import java.security.KeyStore;
 
 import javax.net.ssl.KeyManager;
@@ -31,10 +32,9 @@
 import junit.textui.TestRunner;
 
 import org.apache.activemq.apollo.broker.Broker;
-import org.apache.activemq.legacy.broker.BrokerService;
+import org.apache.activemq.apollo.broker.BrokerFactory;
 import org.apache.activemq.legacy.transport.TransportBrokerTestSupport;
 import org.apache.activemq.transport.TransportFactory;
-import org.apache.activemq.transport.tcp.SslTransportFactory;
 
 public class SslBrokerServiceTest extends TransportBrokerTestSupport {
 
@@ -44,19 +44,20 @@
     
     @Override
     protected Broker createBroker() throws Exception {
-        BrokerService service = new BrokerService();
-        service.setPersistent(false);
+    	Broker broker = BrokerFactory.createBroker(new URI("jaxb:classpath:non-persistent-activemq.xml"));
+    	broker.addTransportServer(TransportFactory.bind(new URI(getBindLocation())));
         
-        KeyManager[] km = getKeyManager();
-        TrustManager[] tm = getTrustManager();
-        connector = service.addSslConnector(getBindLocation(), km, tm, null);
+// TODO:    	
+//        KeyManager[] km = getKeyManager();
+//        TrustManager[] tm = getTrustManager();
+//        connector = service.addSslConnector(getBindLocation(), km, tm, null);
+//        
+//        // for client side
+//        SslTransportFactory sslFactory = new SslTransportFactory();
+//        sslFactory.setKeyAndTrustManagers(km, tm, null);
+//        TransportFactory.registerTransportFactory("ssl", sslFactory);
         
-        // for client side
-        SslTransportFactory sslFactory = new SslTransportFactory();
-        sslFactory.setKeyAndTrustManagers(km, tm, null);
-        TransportFactory.registerTransportFactory("ssl", sslFactory);
-        
-        return service;
+        return broker;
     }
     
 

Modified: activemq/sandbox/activemq-flow/activemq-openwire/src/test/java/org/apache/activemq/legacy/openwireprotocol/BrokerTest.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-openwire/src/test/java/org/apache/activemq/legacy/openwireprotocol/BrokerTest.java?rev=786060&r1=786059&r2=786060&view=diff
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-openwire/src/test/java/org/apache/activemq/legacy/openwireprotocol/BrokerTest.java (original)
+++ activemq/sandbox/activemq-flow/activemq-openwire/src/test/java/org/apache/activemq/legacy/openwireprotocol/BrokerTest.java Thu Jun 18 13:34:40 2009
@@ -44,6 +44,7 @@
     public boolean durableConsumer;
     protected static final int MAX_NULL_WAIT=500;
 
+
     public void initCombosForTestQueueOnlyOnceDeliveryWith2Consumers() {
         addCombinationValues("deliveryMode", new Object[] {Integer.valueOf(DeliveryMode.NON_PERSISTENT),
                                                            Integer.valueOf(DeliveryMode.PERSISTENT)});

Modified: activemq/sandbox/activemq-flow/activemq-openwire/src/test/java/org/apache/activemq/legacy/openwireprotocol/BrokerTestSupport.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-openwire/src/test/java/org/apache/activemq/legacy/openwireprotocol/BrokerTestSupport.java?rev=786060&r1=786059&r2=786060&view=diff
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-openwire/src/test/java/org/apache/activemq/legacy/openwireprotocol/BrokerTestSupport.java (original)
+++ activemq/sandbox/activemq-flow/activemq-openwire/src/test/java/org/apache/activemq/legacy/openwireprotocol/BrokerTestSupport.java Thu Jun 18 13:34:40 2009
@@ -21,6 +21,7 @@
 import java.io.File;
 import java.io.IOException;
 import java.net.URI;
+import java.net.URISyntaxException;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.concurrent.TimeUnit;
@@ -49,6 +50,7 @@
 import org.apache.activemq.command.TransactionId;
 import org.apache.activemq.command.TransactionInfo;
 import org.apache.activemq.command.XATransactionId;
+import org.apache.activemq.transport.Transport;
 import org.apache.activemq.transport.TransportFactory;
 
 public class BrokerTestSupport extends CombinationTestSupport {
@@ -68,6 +70,9 @@
     protected int maxWait = 4000;
     String PIPE_URI = "pipe://broker";
 	
+    private ArrayList<StubConnection> connections = new ArrayList<StubConnection>();
+
+
     protected void setUp() throws Exception {
         super.setUp();
         broker = createBroker();
@@ -81,6 +86,15 @@
     }
 
     protected void tearDown() throws Exception {
+        for (Iterator<StubConnection> iter = connections.iterator(); iter.hasNext();) {
+            StubConnection connection = iter.next();
+            try {
+				connection.stop();
+			} catch (Exception e) {
+			}
+            iter.remove();
+        }
+
         broker.stop();
         broker = null;
         super.tearDown();
@@ -283,10 +297,16 @@
     }
 
     protected StubConnection createConnection() throws Exception {
-        return new StubConnection(TransportFactory.connect(new URI(PIPE_URI)));
+    	StubConnection connection = new StubConnection(createTransport());
+        connections.add(connection);
+        return connection;
     }
 
-    /**
+    protected Transport createTransport() throws URISyntaxException, Exception {
+		return TransportFactory.connect(new URI(PIPE_URI));
+	}
+
+	/**
      * @param connection
      * @return
      * @throws InterruptedException