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 2012/11/13 20:49:24 UTC

svn commit: r1408917 - in /activemq/trunk: ./ activemq-amqp/ activemq-amqp/src/main/java/org/apache/activemq/transport/amqp/ activemq-console/src/test/java/org/apache/activemq/leveldb/ activemq-core/ activemq-core/src/test/java/org/apache/activemq/

Author: chirino
Date: Tue Nov 13 19:49:23 2012
New Revision: 1408917

URL: http://svn.apache.org/viewvc?rev=1408917&view=rev
Log:
Fixing up activemq-amqp build a bit.

Removed:
    activemq/trunk/activemq-console/src/test/java/org/apache/activemq/leveldb/IDERunner.scala
Modified:
    activemq/trunk/activemq-amqp/pom.xml
    activemq/trunk/activemq-amqp/src/main/java/org/apache/activemq/transport/amqp/AmqpProtocolConverter.java
    activemq/trunk/activemq-core/pom.xml
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/CombinationTestSupport.java
    activemq/trunk/pom.xml

Modified: activemq/trunk/activemq-amqp/pom.xml
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-amqp/pom.xml?rev=1408917&r1=1408916&r2=1408917&view=diff
==============================================================================
--- activemq/trunk/activemq-amqp/pom.xml (original)
+++ activemq/trunk/activemq-amqp/pom.xml Tue Nov 13 19:49:23 2012
@@ -35,10 +35,13 @@
 
     <dependency>
       <groupId>org.apache.activemq</groupId>
-      <artifactId>activemq-core</artifactId>
-      <scope>provided</scope>
+      <artifactId>activemq-broker</artifactId>
     </dependency>
-    
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+    </dependency>
+
     <dependency>
       <groupId>org.apache.qpid</groupId>
       <artifactId>qpid-proton</artifactId>
@@ -75,15 +78,20 @@
 
     <dependency>
       <groupId>org.apache.activemq</groupId>
-      <artifactId>activemq-core</artifactId>
+      <artifactId>activemq-broker</artifactId>
       <type>test-jar</type>
       <scope>test</scope>
     </dependency>
     <dependency>
       <groupId>org.apache.activemq</groupId>
-      <artifactId>activemq-console</artifactId>
+      <artifactId>activemq-spring</artifactId>
       <scope>test</scope>
     </dependency>
+    <!--<dependency>-->
+      <!--<groupId>org.apache.activemq</groupId>-->
+      <!--<artifactId>activemq-console</artifactId>-->
+      <!--<scope>test</scope>-->
+    <!--</dependency>-->
 
     <dependency>
       <groupId>junit</groupId>

Modified: activemq/trunk/activemq-amqp/src/main/java/org/apache/activemq/transport/amqp/AmqpProtocolConverter.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-amqp/src/main/java/org/apache/activemq/transport/amqp/AmqpProtocolConverter.java?rev=1408917&r1=1408916&r2=1408917&view=diff
==============================================================================
--- activemq/trunk/activemq-amqp/src/main/java/org/apache/activemq/transport/amqp/AmqpProtocolConverter.java (original)
+++ activemq/trunk/activemq-amqp/src/main/java/org/apache/activemq/transport/amqp/AmqpProtocolConverter.java Tue Nov 13 19:49:23 2012
@@ -436,8 +436,6 @@ class AmqpProtocolConverter {
             Receiver receiver = ((Receiver)delivery.getLink());
             if( !delivery.isReadable() ) {
                 System.out.println("it was not readable!");
-//                delivery.settle();
-//                receiver.advance();
                 return;
             }
 
@@ -457,8 +455,6 @@ class AmqpProtocolConverter {
             }
 
             receiver.advance();
-            delivery.settle();
-
             Buffer buffer = current.toBuffer();
             current = null;
             onMessage(receiver, delivery, buffer);
@@ -478,7 +474,7 @@ class AmqpProtocolConverter {
         }
 
         @Override
-        protected void onMessage(Receiver receiver, Delivery delivery, Buffer buffer) throws Exception {
+        protected void onMessage(Receiver receiver, final Delivery delivery, Buffer buffer) throws Exception {
             EncodedMessage em = new EncodedMessage(delivery.getMessageFormat(), buffer.data, buffer.offset, buffer.length);
             final ActiveMQMessage message = (ActiveMQMessage) getInboundTransformer().transform(em);
             current = null;
@@ -498,9 +494,29 @@ class AmqpProtocolConverter {
                 message.setTransactionId(new LocalTransactionId(connectionId, txid));
             }
 
+            ResponseHandler handler = null;
+            if( delivery.remotelySettled() ) {
+                delivery.settle();
+            } else {
+                handler = new ResponseHandler() {
+                    @Override
+                    public void onResponse(AmqpProtocolConverter converter, Response response) throws IOException {
+                        if( response.isException() ) {
+                            ExceptionResponse er = (ExceptionResponse)response;
+                            Rejected rejected = new Rejected();
+                            ArrayList errors = new ArrayList();
+                            errors.add(er.getException().getMessage());
+                            rejected.setError(errors);
+                            delivery.disposition(rejected);
+                        }
+                        delivery.settle();
+                        pumpProtonToSocket();
+                    }
+                };
+            }
+
             message.onSend();
-//            sendToActiveMQ(message, createResponseHandler(command));
-            sendToActiveMQ(message, null);
+            sendToActiveMQ(message, handler);
         }
 
     }
@@ -584,12 +600,10 @@ class AmqpProtocolConverter {
                         pumpProtonToSocket();
                     }
                 });
-                receiver.advance();
 
             } else {
                 throw new Exception("Expected coordinator message type: "+action.getClass());
             }
-
         }
 
     };

Modified: activemq/trunk/activemq-core/pom.xml
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/pom.xml?rev=1408917&r1=1408916&r2=1408917&view=diff
==============================================================================
--- activemq/trunk/activemq-core/pom.xml (original)
+++ activemq/trunk/activemq-core/pom.xml Tue Nov 13 19:49:23 2012
@@ -1194,5 +1194,14 @@
         </plugins>
       </build>
     </profile>
+    <profile>
+      <id>unstable</id>
+      <dependencies>
+        <dependency>
+          <groupId>org.apache.activemq</groupId>
+          <artifactId>activemq-amqp</artifactId>
+        </dependency>
+      </dependencies>
+    </profile>
   </profiles>
 </project>

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/CombinationTestSupport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/CombinationTestSupport.java?rev=1408917&r1=1408916&r2=1408917&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/CombinationTestSupport.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/CombinationTestSupport.java Tue Nov 13 19:49:23 2012
@@ -16,9 +16,12 @@
  */
 package org.apache.activemq;
 
+import java.io.File;
+import java.io.IOException;
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
+import java.security.ProtectionDomain;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
@@ -65,6 +68,16 @@ public abstract class CombinationTestSup
     private HashMap<String, ComboOption> comboOptions = new HashMap<String, ComboOption>();
     private boolean combosEvaluated;
     private Map<String, Object> options;
+    protected File basedir;
+
+    static protected File basedir(Class clazz) {
+        try {
+            ProtectionDomain protectionDomain = clazz.getProtectionDomain();
+            return new File(new File(protectionDomain.getCodeSource().getLocation().getPath()), "../..").getCanonicalFile();
+        } catch (IOException e) {
+            return new File(".");
+        }
+    }
 
     static class ComboOption {
         final String attribute;
@@ -76,6 +89,9 @@ public abstract class CombinationTestSup
         }
     }
 
+    public CombinationTestSupport() {
+        basedir = basedir(getClass());
+    }
     public void addCombinationValues(String attribute, Object[] options) {
         ComboOption co = this.comboOptions.get(attribute);
         if (co == null) {

Modified: activemq/trunk/pom.xml
URL: http://svn.apache.org/viewvc/activemq/trunk/pom.xml?rev=1408917&r1=1408916&r2=1408917&view=diff
==============================================================================
--- activemq/trunk/pom.xml (original)
+++ activemq/trunk/pom.xml Tue Nov 13 19:49:23 2012
@@ -247,6 +247,11 @@
       <!-- =============================== -->
       <dependency>
         <groupId>org.apache.activemq</groupId>
+        <artifactId>activemq-amqp</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.activemq</groupId>
         <artifactId>activemq-http</artifactId>
         <version>${project.version}</version>
       </dependency>