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 2007/08/08 20:58:13 UTC

svn commit: r563982 [32/32] - in /activemq/trunk/activemq-core/src: main/java/org/apache/activemq/ main/java/org/apache/activemq/advisory/ main/java/org/apache/activemq/blob/ main/java/org/apache/activemq/broker/ main/java/org/apache/activemq/broker/jm...

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/tcp/StubX509Certificate.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/tcp/StubX509Certificate.java?view=diff&rev=563982&r1=563981&r2=563982
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/tcp/StubX509Certificate.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/tcp/StubX509Certificate.java Wed Aug  8 11:56:59 2007
@@ -20,146 +20,145 @@
 import java.math.BigInteger;
 import java.security.Principal;
 import java.security.PublicKey;
+import java.security.cert.X509Certificate;
 import java.util.Date;
 import java.util.Set;
 
-import java.security.cert.X509Certificate;
-
 public class StubX509Certificate extends X509Certificate {
     public StubX509Certificate(Principal id) {
         this.id = id;
     }
-    
+
     public Principal getSubjectDN() {
         return this.id;
     }
-    
+
     private final Principal id;
-    
+
     // --- Stubbed Methods ---
     public void checkValidity() {
-    // TODO Auto-generated method stub
-    
+        // TODO Auto-generated method stub
+
     }
-    
+
     public void checkValidity(Date arg0) {
-    // TODO Auto-generated method stub
-    
+        // TODO Auto-generated method stub
+
     }
-    
+
     public int getVersion() {
-    // TODO Auto-generated method stub
-    return 0;
+        // TODO Auto-generated method stub
+        return 0;
     }
-    
+
     public BigInteger getSerialNumber() {
-    // TODO Auto-generated method stub
-    return null;
+        // TODO Auto-generated method stub
+        return null;
     }
-    
+
     public Principal getIssuerDN() {
-    // TODO Auto-generated method stub
-    return null;
+        // TODO Auto-generated method stub
+        return null;
     }
-    
+
     public Date getNotBefore() {
-    // TODO Auto-generated method stub
-    return null;
+        // TODO Auto-generated method stub
+        return null;
     }
-    
+
     public Date getNotAfter() {
-    // TODO Auto-generated method stub
-    return null;
+        // TODO Auto-generated method stub
+        return null;
     }
-    
+
     public byte[] getTBSCertificate() {
-    // TODO Auto-generated method stub
-    return null;
+        // TODO Auto-generated method stub
+        return null;
     }
-    
+
     public byte[] getSignature() {
-    // TODO Auto-generated method stub
-    return null;
+        // TODO Auto-generated method stub
+        return null;
     }
-    
+
     public String getSigAlgName() {
-    // TODO Auto-generated method stub
-    return null;
+        // TODO Auto-generated method stub
+        return null;
     }
-    
+
     public String getSigAlgOID() {
-    // TODO Auto-generated method stub
-    return null;
+        // TODO Auto-generated method stub
+        return null;
     }
-    
+
     public byte[] getSigAlgParams() {
-    // TODO Auto-generated method stub
-    return null;
+        // TODO Auto-generated method stub
+        return null;
     }
-    
+
     public boolean[] getIssuerUniqueID() {
-    // TODO Auto-generated method stub
-    return null;
+        // TODO Auto-generated method stub
+        return null;
     }
-    
+
     public boolean[] getSubjectUniqueID() {
-    // TODO Auto-generated method stub
-    return null;
+        // TODO Auto-generated method stub
+        return null;
     }
-    
+
     public boolean[] getKeyUsage() {
-    // TODO Auto-generated method stub
-    return null;
+        // TODO Auto-generated method stub
+        return null;
     }
-    
+
     public int getBasicConstraints() {
-    // TODO Auto-generated method stub
-    return 0;
+        // TODO Auto-generated method stub
+        return 0;
     }
-    
+
     public byte[] getEncoded() {
-    // TODO Auto-generated method stub
-    return null;
+        // TODO Auto-generated method stub
+        return null;
     }
-    
+
     public void verify(PublicKey arg0) {
-    // TODO Auto-generated method stub
-    
+        // TODO Auto-generated method stub
+
     }
-    
+
     public void verify(PublicKey arg0, String arg1) {
-    // TODO Auto-generated method stub
-    
+        // TODO Auto-generated method stub
+
     }
-    
+
     public String toString() {
-    // TODO Auto-generated method stub
-    return null;
+        // TODO Auto-generated method stub
+        return null;
     }
-    
+
     public PublicKey getPublicKey() {
-    // TODO Auto-generated method stub
-    return null;
+        // TODO Auto-generated method stub
+        return null;
     }
-    
+
     public boolean hasUnsupportedCriticalExtension() {
-    // TODO Auto-generated method stub
-    return false;
+        // TODO Auto-generated method stub
+        return false;
     }
-    
+
     public Set getCriticalExtensionOIDs() {
-    // TODO Auto-generated method stub
-    return null;
+        // TODO Auto-generated method stub
+        return null;
     }
-    
+
     public Set getNonCriticalExtensionOIDs() {
-    // TODO Auto-generated method stub
-    return null;
+        // TODO Auto-generated method stub
+        return null;
     }
-    
+
     public byte[] getExtensionValue(String arg0) {
-    // TODO Auto-generated method stub
-    return null;
+        // TODO Auto-generated method stub
+        return null;
     }
 
 }

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/udp/UdpTestSupport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/udp/UdpTestSupport.java?view=diff&rev=563982&r1=563981&r2=563982
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/udp/UdpTestSupport.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/udp/UdpTestSupport.java Wed Aug  8 11:56:59 2007
@@ -21,7 +21,6 @@
 import javax.jms.MessageNotWriteableException;
 
 import junit.framework.TestCase;
-
 import org.apache.activemq.command.ActiveMQDestination;
 import org.apache.activemq.command.ActiveMQQueue;
 import org.apache.activemq.command.ActiveMQTextMessage;
@@ -38,7 +37,6 @@
 import org.apache.commons.logging.LogFactory;
 
 /**
- * 
  * @version $Revision$
  */
 public abstract class UdpTestSupport extends TestCase implements TransportListener {
@@ -69,12 +67,11 @@
 
             Command received = assertCommandReceived();
             assertTrue("Should have received a ConsumerInfo but was: " + received, received instanceof ConsumerInfo);
-            ConsumerInfo actual = (ConsumerInfo) received;
+            ConsumerInfo actual = (ConsumerInfo)received;
             assertEquals("Selector", expected.getSelector(), actual.getSelector());
             assertEquals("isExclusive", expected.isExclusive(), actual.isExclusive());
             assertEquals("getPrefetchSize", expected.getPrefetchSize(), actual.getPrefetchSize());
-        }
-        catch (Exception e) {
+        } catch (Exception e) {
             log.info("Caught: " + e);
             e.printStackTrace();
             fail("Failed to send to transport: " + e);
@@ -93,8 +90,7 @@
         assertSendTextMessage(destination, text);
     }
 
-    protected void assertSendTextMessage(ActiveMQDestination destination, String text)
-            throws MessageNotWriteableException {
+    protected void assertSendTextMessage(ActiveMQDestination destination, String text) throws MessageNotWriteableException {
         large = true;
 
         ActiveMQTextMessage expected = new ActiveMQTextMessage();
@@ -114,16 +110,14 @@
             producer.oneway(new ProducerInfo());
 
             Command received = assertCommandReceived();
-            assertTrue("Should have received a ActiveMQTextMessage but was: " + received,
-                    received instanceof ActiveMQTextMessage);
-            ActiveMQTextMessage actual = (ActiveMQTextMessage) received;
+            assertTrue("Should have received a ActiveMQTextMessage but was: " + received, received instanceof ActiveMQTextMessage);
+            ActiveMQTextMessage actual = (ActiveMQTextMessage)received;
 
             assertEquals("getDestination", expected.getDestination(), actual.getDestination());
             assertEquals("getText", expected.getText(), actual.getText());
 
             log.info("Received text message with: " + actual.getText().length() + " character(s)");
-        }
-        catch (Exception e) {
+        } catch (Exception e) {
             log.info("Caught: " + e);
             e.printStackTrace();
             fail("Failed to send to transport: " + e);
@@ -148,8 +142,7 @@
                     consumer.setTransportListener(UdpTestSupport.this);
                     try {
                         consumer.start();
-                    }
-                    catch (Exception e) {
+                    } catch (Exception e) {
                         throw new RuntimeException(e);
                     }
                 }
@@ -200,29 +193,25 @@
     }
 
     public void onCommand(Object o) {
-    	final Command command = (Command) o;
+        final Command command = (Command)o;
         if (command instanceof WireFormatInfo) {
             log.info("Got WireFormatInfo: " + command);
-        }
-        else {
+        } else {
             if (command.isResponseRequired()) {
                 // lets send a response back...
                 sendResponse(command);
 
             }
             if (large) {
-                log.info("### Received command: " + command.getClass() + " with id: "
-                        + command.getCommandId());
-            }
-            else {
+                log.info("### Received command: " + command.getClass() + " with id: " + command.getCommandId());
+            } else {
                 log.info("### Received command: " + command);
             }
 
             synchronized (lock) {
                 if (receivedCommand == null) {
                     receivedCommand = command;
-                }
-                else {
+                } else {
                     log.info("Ignoring superfluous command: " + command);
                 }
                 lock.notifyAll();
@@ -235,8 +224,7 @@
         response.setCorrelationId(command.getCommandId());
         try {
             consumer.oneway(response);
-        }
-        catch (IOException e) {
+        } catch (IOException e) {
             log.info("Caught: " + e);
             e.printStackTrace();
             throw new RuntimeException(e);

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/AMQFailoverIssue.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/AMQFailoverIssue.java?view=diff&rev=563982&r1=563981&r2=563982
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/AMQFailoverIssue.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/AMQFailoverIssue.java Wed Aug  8 11:56:59 2007
@@ -66,7 +66,7 @@
 
     // This should fail with incubator-activemq-fuse-4.1.0.5
     public void testFailoverIssue() throws Exception {
-        BrokerService brokerService1=null;
+        BrokerService brokerService1 = null;
         ActiveMQConnectionFactory acf;
         PooledConnectionFactory pcf;
         DefaultMessageListenerContainer container1 = null;

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/AMQStackOverFlowTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/AMQStackOverFlowTest.java?view=diff&rev=563982&r1=563981&r2=563982
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/AMQStackOverFlowTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/AMQStackOverFlowTest.java Wed Aug  8 11:56:59 2007
@@ -19,10 +19,12 @@
 
 import java.net.URI;
 import java.util.ArrayList;
+
 import javax.jms.JMSException;
 import javax.jms.Message;
 import javax.jms.Session;
 import javax.jms.TextMessage;
+
 import junit.framework.Assert;
 import junit.framework.TestCase;
 import org.apache.activemq.ActiveMQConnectionFactory;
@@ -38,117 +40,112 @@
 
 public class AMQStackOverFlowTest extends TestCase {
 
-	private static final String URL1 = "tcp://localhost:61616";
+    private static final String URL1 = "tcp://localhost:61616";
+
+    private static final String URL2 = "tcp://localhost:61617";
 
-	private static final String URL2 = "tcp://localhost:61617";
+    public void testStackOverflow() throws Exception {
+        BrokerService brokerService1 = null;
+        BrokerService brokerService2 = null;
 
-	public void testStackOverflow() throws Exception {
-		BrokerService brokerService1 = null;
-		BrokerService brokerService2 = null;
+        try {
+            brokerService1 = createBrokerService("broker1", URL1, URL2);
+            brokerService1.start();
+            brokerService2 = createBrokerService("broker2", URL2, URL1);
+            brokerService2.start();
 
-		try {
-			brokerService1 = createBrokerService("broker1", URL1, URL2);
-			brokerService1.start();
-			brokerService2 = createBrokerService("broker2", URL2, URL1);
-			brokerService2.start();
+            final ActiveMQConnectionFactory cf1 = new ActiveMQConnectionFactory(URL1);
+            cf1.setUseAsyncSend(false);
 
-			final ActiveMQConnectionFactory cf1 = new ActiveMQConnectionFactory(
-					URL1);
-			cf1.setUseAsyncSend(false);
+            final ActiveMQConnectionFactory cf2 = new ActiveMQConnectionFactory(URL2);
+            cf2.setUseAsyncSend(false);
 
-			final ActiveMQConnectionFactory cf2 = new ActiveMQConnectionFactory(
-					URL2);
-			cf2.setUseAsyncSend(false);
+            final JmsTemplate template1 = new JmsTemplate(cf1);
+            template1.setReceiveTimeout(10000);
 
-			final JmsTemplate template1 = new JmsTemplate(cf1);
-			template1.setReceiveTimeout(10000);
+            template1.send("test.q", new MessageCreator() {
 
-			template1.send("test.q", new MessageCreator() {
+                public Message createMessage(Session session) throws JMSException {
+                    return session.createTextMessage("test");
+                }
 
-				public Message createMessage(Session session)
-						throws JMSException {
-					return session.createTextMessage("test");
-				}
+            });
 
-			});
+            final JmsTemplate template2 = new JmsTemplate(cf2);
+            template2.setReceiveTimeout(10000);
 
-			final JmsTemplate template2 = new JmsTemplate(cf2);
-			template2.setReceiveTimeout(10000);
+            final Message m = template2.receive("test.q");
+            assertTrue(m instanceof TextMessage);
 
-			final Message m = template2.receive("test.q");
-			assertTrue(m instanceof TextMessage);
-		
-			final TextMessage tm = (TextMessage) m;
+            final TextMessage tm = (TextMessage)m;
 
-			Assert.assertEquals("test", tm.getText());
+            Assert.assertEquals("test", tm.getText());
 
-			template2.send("test2.q", new MessageCreator() {
+            template2.send("test2.q", new MessageCreator() {
 
-				public Message createMessage(Session session)
-						throws JMSException {
-					return session.createTextMessage("test2");
-				}
+                public Message createMessage(Session session) throws JMSException {
+                    return session.createTextMessage("test2");
+                }
 
-			});
+            });
 
-			final Message m2 = template1.receive("test2.q");
+            final Message m2 = template1.receive("test2.q");
 
             assertTrue(m2 instanceof TextMessage);
 
-			final TextMessage tm2 = (TextMessage) m2;
+            final TextMessage tm2 = (TextMessage)m2;
 
-			Assert.assertEquals("test2", tm2.getText());
+            Assert.assertEquals("test2", tm2.getText());
 
-		} finally {
+        } finally {
 
-			brokerService1.stop();
-			brokerService1 = null;
-			brokerService2.stop();
-			brokerService2 = null;
+            brokerService1.stop();
+            brokerService1 = null;
+            brokerService2.stop();
+            brokerService2 = null;
 
-		}
+        }
 
-	}
+    }
 
-	private BrokerService createBrokerService(final String brokerName,
-			final String uri1, final String uri2) throws Exception {
-		final BrokerService brokerService = new BrokerService();
+    private BrokerService createBrokerService(final String brokerName, final String uri1, final String uri2)
+        throws Exception {
+        final BrokerService brokerService = new BrokerService();
 
-		brokerService.setBrokerName(brokerName);
-		brokerService.setPersistent(false);
-		brokerService.setUseJmx(true);
+        brokerService.setBrokerName(brokerName);
+        brokerService.setPersistent(false);
+        brokerService.setUseJmx(true);
 
-		final UsageManager memoryManager = new UsageManager();
-		memoryManager.setLimit(10);
-		brokerService.setMemoryManager(memoryManager);
+        final UsageManager memoryManager = new UsageManager();
+        memoryManager.setLimit(10);
+        brokerService.setMemoryManager(memoryManager);
 
-		final ArrayList<PolicyEntry> policyEntries = new ArrayList<PolicyEntry>();
+        final ArrayList<PolicyEntry> policyEntries = new ArrayList<PolicyEntry>();
 
-		final PolicyEntry entry = new PolicyEntry();
-		entry.setQueue(">");
-		entry.setMemoryLimit(1);
-		policyEntries.add(entry);
+        final PolicyEntry entry = new PolicyEntry();
+        entry.setQueue(">");
+        entry.setMemoryLimit(1);
+        policyEntries.add(entry);
 
-		final PolicyMap policyMap = new PolicyMap();
-		policyMap.setPolicyEntries(policyEntries);
-		brokerService.setDestinationPolicy(policyMap);
+        final PolicyMap policyMap = new PolicyMap();
+        policyMap.setPolicyEntries(policyEntries);
+        brokerService.setDestinationPolicy(policyMap);
 
-		final TransportConnector tConnector = new TransportConnector();
-		tConnector.setUri(new URI(uri1));
-		tConnector.setBrokerName(brokerName);
-		tConnector.setName(brokerName + ".transportConnector");
-		brokerService.addConnector(tConnector);
+        final TransportConnector tConnector = new TransportConnector();
+        tConnector.setUri(new URI(uri1));
+        tConnector.setBrokerName(brokerName);
+        tConnector.setName(brokerName + ".transportConnector");
+        brokerService.addConnector(tConnector);
 
-		if (uri2 != null) {
-			final NetworkConnector nc = new DiscoveryNetworkConnector(new URI(
-					"static:" + uri2));
-			nc.setBridgeTempDestinations(true);
-			nc.setBrokerName(brokerName);
-			nc.setPrefetchSize(1);
-			brokerService.addNetworkConnector(nc);
-		}
+        if (uri2 != null) {
+            final NetworkConnector nc = new DiscoveryNetworkConnector(new URI("static:" + uri2));
+            nc.setBridgeTempDestinations(true);
+            nc.setBrokerName(brokerName);
+            nc.setPrefetchSize(1);
+            brokerService.addNetworkConnector(nc);
+        }
 
-		return brokerService;
+        return brokerService;
 
-	}
+    }
 }

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/TwoBrokerTopicSendReceiveTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/TwoBrokerTopicSendReceiveTest.java?view=diff&rev=563982&r1=563981&r2=563982
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/TwoBrokerTopicSendReceiveTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/TwoBrokerTopicSendReceiveTest.java Wed Aug  8 11:56:59 2007
@@ -47,12 +47,13 @@
         log.info("Waiting for brokers Initialize.");
         Thread.sleep(5000);
         log.info("Brokers should be initialized by now.. starting test.");
-        
+
         super.setUp();
     }
 
     protected ActiveMQConnectionFactory createReceiverConnectionFactory() throws JMSException {
-        return createConnectionFactory("org/apache/activemq/usecases/receiver.xml", "receiver", "vm://receiver");
+        return createConnectionFactory("org/apache/activemq/usecases/receiver.xml", "receiver",
+                                       "vm://receiver");
     }
 
     protected ActiveMQConnectionFactory createSenderConnectionFactory() throws JMSException {
@@ -61,11 +62,11 @@
 
     protected void tearDown() throws Exception {
         super.tearDown();
-    	for (Iterator iter = brokers.values().iterator(); iter.hasNext();) {
-			BrokerService broker = (BrokerService) iter.next();
-			ServiceSupport.dispose(broker);
-			iter.remove();
-		}
+        for (Iterator iter = brokers.values().iterator(); iter.hasNext();) {
+            BrokerService broker = (BrokerService)iter.next();
+            ServiceSupport.dispose(broker);
+            iter.remove();
+        }
     }
 
     protected Connection createReceiveConnection() throws JMSException {
@@ -76,13 +77,14 @@
         return sendFactory.createConnection();
     }
 
-    protected ActiveMQConnectionFactory createConnectionFactory(String config, String brokerName, String connectUrl) throws JMSException {
+    protected ActiveMQConnectionFactory createConnectionFactory(String config, String brokerName,
+                                                                String connectUrl) throws JMSException {
         try {
             BrokerFactoryBean brokerFactory = new BrokerFactoryBean(new ClassPathResource(config));
             brokerFactory.afterPropertiesSet();
             BrokerService broker = brokerFactory.getBroker();
             brokers.put(brokerName, broker);
-            
+
             return new ActiveMQConnectionFactory(connectUrl);
 
         } catch (Exception e) {