activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gtu...@apache.org
Subject svn commit: r918553 - in /activemq/trunk/activemq-optional/src/test/java/org/apache/activemq/transport/http: HttpJmsDurableTopicSendReceiveTest.java HttpJmsSendAndReceiveTest.java HttpTransportBrokerTest.java WaitForJettyListener.java
Date Wed, 03 Mar 2010 16:31:28 GMT
Author: gtully
Date: Wed Mar  3 16:31:27 2010
New Revision: 918553

URL: http://svn.apache.org/viewvc?rev=918553&view=rev
Log:
have more tests wait for the jetty listener - intermittent failures in hudson

Added:
    activemq/trunk/activemq-optional/src/test/java/org/apache/activemq/transport/http/WaitForJettyListener.java
  (with props)
Modified:
    activemq/trunk/activemq-optional/src/test/java/org/apache/activemq/transport/http/HttpJmsDurableTopicSendReceiveTest.java
    activemq/trunk/activemq-optional/src/test/java/org/apache/activemq/transport/http/HttpJmsSendAndReceiveTest.java
    activemq/trunk/activemq-optional/src/test/java/org/apache/activemq/transport/http/HttpTransportBrokerTest.java

Modified: activemq/trunk/activemq-optional/src/test/java/org/apache/activemq/transport/http/HttpJmsDurableTopicSendReceiveTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-optional/src/test/java/org/apache/activemq/transport/http/HttpJmsDurableTopicSendReceiveTest.java?rev=918553&r1=918552&r2=918553&view=diff
==============================================================================
--- activemq/trunk/activemq-optional/src/test/java/org/apache/activemq/transport/http/HttpJmsDurableTopicSendReceiveTest.java
(original)
+++ activemq/trunk/activemq-optional/src/test/java/org/apache/activemq/transport/http/HttpJmsDurableTopicSendReceiveTest.java
Wed Mar  3 16:31:27 2010
@@ -29,6 +29,7 @@
             broker.start();
         }
         super.setUp();
+        WaitForJettyListener.waitForJettySocketToAccept(getBrokerURL());
     }
 
     protected void tearDown() throws Exception {

Modified: activemq/trunk/activemq-optional/src/test/java/org/apache/activemq/transport/http/HttpJmsSendAndReceiveTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-optional/src/test/java/org/apache/activemq/transport/http/HttpJmsSendAndReceiveTest.java?rev=918553&r1=918552&r2=918553&view=diff
==============================================================================
--- activemq/trunk/activemq-optional/src/test/java/org/apache/activemq/transport/http/HttpJmsSendAndReceiveTest.java
(original)
+++ activemq/trunk/activemq-optional/src/test/java/org/apache/activemq/transport/http/HttpJmsSendAndReceiveTest.java
Wed Mar  3 16:31:27 2010
@@ -32,6 +32,7 @@
             broker.start();
         }
         super.setUp();
+        WaitForJettyListener.waitForJettySocketToAccept(getBrokerURL());
     }
 
     protected void tearDown() throws Exception {

Modified: activemq/trunk/activemq-optional/src/test/java/org/apache/activemq/transport/http/HttpTransportBrokerTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-optional/src/test/java/org/apache/activemq/transport/http/HttpTransportBrokerTest.java?rev=918553&r1=918552&r2=918553&view=diff
==============================================================================
--- activemq/trunk/activemq-optional/src/test/java/org/apache/activemq/transport/http/HttpTransportBrokerTest.java
(original)
+++ activemq/trunk/activemq-optional/src/test/java/org/apache/activemq/transport/http/HttpTransportBrokerTest.java
Wed Mar  3 16:31:27 2010
@@ -16,11 +16,7 @@
  */
 package org.apache.activemq.transport.http;
 
-import java.net.Socket;
 import java.net.URI;
-import java.net.URL;
-
-import javax.net.SocketFactory;
 
 import junit.framework.Test;
 import junit.textui.TestRunner;
@@ -28,13 +24,9 @@
 import org.apache.activemq.broker.BrokerFactory;
 import org.apache.activemq.broker.BrokerService;
 import org.apache.activemq.transport.TransportBrokerTestSupport;
-import org.apache.activemq.util.Wait;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 
 public class HttpTransportBrokerTest extends TransportBrokerTestSupport {
 
-    private static final Log LOG = LogFactory.getLog(HttpTransportBrokerTest.class);
     protected String getBindLocation() {
         return "http://localhost:8081";
     }
@@ -42,25 +34,7 @@
     protected void setUp() throws Exception {
         maxWait = 2000;
         super.setUp();
-        waitForJettySocketToAccept(getBindLocation());
-    }
-    
-	private void waitForJettySocketToAccept(String bindLocation) throws Exception {
-        final URL url = new URL(bindLocation);
-        assertTrue("Jetty endpoint is available", Wait.waitFor(new Wait.Condition() {
-
-            public boolean isSatisified() throws Exception {
-                boolean canConnect = false;
-                try {
-                    Socket socket = SocketFactory.getDefault().createSocket(url.getHost(),
url.getPort());
-                    socket.close();
-                    canConnect = true;
-                } catch (Exception e) {
-                    LOG.warn("verify jettty available, failed to connect to " + url + e);
-                }
-                return canConnect;
-            }}, 60 * 1000));
-        
+        WaitForJettyListener.waitForJettySocketToAccept(getBindLocation());
     }
 
     protected BrokerService createBroker() throws Exception {

Added: activemq/trunk/activemq-optional/src/test/java/org/apache/activemq/transport/http/WaitForJettyListener.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-optional/src/test/java/org/apache/activemq/transport/http/WaitForJettyListener.java?rev=918553&view=auto
==============================================================================
--- activemq/trunk/activemq-optional/src/test/java/org/apache/activemq/transport/http/WaitForJettyListener.java
(added)
+++ activemq/trunk/activemq-optional/src/test/java/org/apache/activemq/transport/http/WaitForJettyListener.java
Wed Mar  3 16:31:27 2010
@@ -0,0 +1,49 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.transport.http;
+
+import java.net.Socket;
+import java.net.URL;
+
+import javax.net.SocketFactory;
+
+import org.apache.activemq.util.Wait;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import static junit.framework.Assert.assertTrue;
+
+public class WaitForJettyListener {
+    private static final Log LOG = LogFactory.getLog(WaitForJettyListener.class);
+    
+    public static void waitForJettySocketToAccept(String bindLocation) throws Exception {
+        final URL url = new URL(bindLocation);
+        assertTrue("Jetty endpoint is available", Wait.waitFor(new Wait.Condition() {
+
+            public boolean isSatisified() throws Exception {
+                boolean canConnect = false;
+                try {
+                    Socket socket = SocketFactory.getDefault().createSocket(url.getHost(),
url.getPort());
+                    socket.close();
+                    canConnect = true;
+                } catch (Exception e) {
+                    LOG.warn("verify jettty available, failed to connect to " + url + e);
+                }
+                return canConnect;
+            }}, 60 * 1000));
+    }
+}

Propchange: activemq/trunk/activemq-optional/src/test/java/org/apache/activemq/transport/http/WaitForJettyListener.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/trunk/activemq-optional/src/test/java/org/apache/activemq/transport/http/WaitForJettyListener.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date



Mime
View raw message