camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hadr...@apache.org
Subject svn commit: r906378 - in /camel/trunk/camel-core/src/main/java/org/apache/camel: builder/ExpressionClauseSupport.java component/mock/AssertionClause.java component/mock/MockEndpoint.java
Date Thu, 04 Feb 2010 06:52:47 GMT
Author: hadrian
Date: Thu Feb  4 06:52:47 2010
New Revision: 906378

URL: http://svn.apache.org/viewvc?rev=906378&view=rev
Log:
Fix for ambiguous method call in AssertionClause

Modified:
    camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ExpressionClauseSupport.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/component/mock/AssertionClause.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/component/mock/MockEndpoint.java

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ExpressionClauseSupport.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ExpressionClauseSupport.java?rev=906378&r1=906377&r2=906378&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ExpressionClauseSupport.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ExpressionClauseSupport.java
Thu Feb  4 06:52:47 2010
@@ -92,6 +92,7 @@
     /**
      * An expression of an inbound message body converted to the expected type
      */
+    @SuppressWarnings("unchecked")
     public T body(Class expectedType) {
         return expression(ExpressionBuilder.bodyExpression(expectedType));
     }

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/component/mock/AssertionClause.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/mock/AssertionClause.java?rev=906378&r1=906377&r2=906378&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/component/mock/AssertionClause.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/component/mock/AssertionClause.java
Thu Feb  4 06:52:47 2010
@@ -27,27 +27,25 @@
 import org.apache.camel.builder.ValueBuilder;
 import org.apache.camel.util.PredicateAssertHelper;
 
-import static org.apache.camel.builder.ExpressionBuilder.bodyExpression;
-import static org.apache.camel.builder.ExpressionBuilder.headerExpression;
-import static org.apache.camel.builder.ExpressionBuilder.outBodyExpression;
-import static org.apache.camel.builder.ExpressionBuilder.propertyExpression;
-
 /**
  * A builder of assertions on message exchanges
  *
  * @version $Revision$
  */
-public abstract class AssertionClause<T> extends ExpressionClauseSupport implements
Runnable {
+public abstract class AssertionClause extends ExpressionClauseSupport<ValueBuilder>
implements Runnable {
 
     private List<Predicate> predicates = new ArrayList<Predicate>();
 
-    @SuppressWarnings("unchecked")
-    public AssertionClause(Object result) {
-        super(result);
+    public AssertionClause() {
+        super(null);
     }
 
     // Builder methods
     // -------------------------------------------------------------------------
+    public ValueBuilder expression(Expression expression) {
+        super.expression(expression);
+        return new PredicateValueBuilder(getExpressionValue());
+    }
 
     /**
      * Adds the given predicate to this assertion clause
@@ -64,57 +62,6 @@
     }
 
     /**
-     * Returns a predicate and value builder for headers on an exchange
-     */
-    public ValueBuilder header(String name) {
-        Expression expression = headerExpression(name);
-        return new PredicateValueBuilder(expression);
-    }
-
-    /**
-     * Returns a predicate and value builder for property on an exchange
-     */
-    public ValueBuilder property(String name) {
-        Expression expression = propertyExpression(name);
-        return new PredicateValueBuilder(expression);
-    }
-
-    /**
-     * Returns a predicate and value builder for the inbound body on an exchange
-     */
-    public PredicateValueBuilder body() {
-        Expression expression = bodyExpression();
-        return new PredicateValueBuilder(expression);
-    }
-
-    /**
-     * Returns a predicate and value builder for the inbound message body as a
-     * specific type
-     */
-    public <T> PredicateValueBuilder body(Class<T> type) {
-        Expression expression = bodyExpression(type);
-        return new PredicateValueBuilder(expression);
-    }
-
-    /**
-     * Returns a predicate and value builder for the outbound body on an
-     * exchange
-     */
-    public PredicateValueBuilder outBody() {
-        Expression expression = outBodyExpression();
-        return new PredicateValueBuilder(expression);
-    }
-
-    /**
-     * Returns a predicate and value builder for the outbound message body as a
-     * specific type
-     */
-    public <T> PredicateValueBuilder outBody(Class<T> type) {
-        Expression expression = outBodyExpression(type);
-        return new PredicateValueBuilder(expression);
-    }
-
-    /**
      * Performs any assertions on the given exchange
      */
     protected void applyAssertionOn(MockEndpoint endpoint, int index, Exchange exchange)
{
@@ -130,7 +77,7 @@
     /**
      * Public class needed for fluent builders
      */
-    public class PredicateValueBuilder extends ValueBuilder {
+    public final class PredicateValueBuilder extends ValueBuilder {
 
         public PredicateValueBuilder(Expression expression) {
             super(expression);

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/component/mock/MockEndpoint.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/mock/MockEndpoint.java?rev=906378&r1=906377&r2=906378&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/component/mock/MockEndpoint.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/component/mock/MockEndpoint.java
Thu Feb  4 06:52:47 2010
@@ -650,8 +650,8 @@
      * @param messageIndex the number of the message
      * @return the assertion clause
      */
-    public AssertionClause<MockEndpoint> message(final int messageIndex) {
-        final AssertionClause<MockEndpoint> clause = new AssertionClause<MockEndpoint>(this)
{
+    public AssertionClause message(final int messageIndex) {
+        final AssertionClause clause = new AssertionClause() {
             public void run() {
                 applyAssertionOn(MockEndpoint.this, messageIndex, assertExchangeReceived(messageIndex));
             }
@@ -665,8 +665,8 @@
      *
      * @return the assertion clause
      */
-    public AssertionClause<MockEndpoint> allMessages() {
-        final AssertionClause<MockEndpoint> clause = new AssertionClause<MockEndpoint>(this)
{
+    public AssertionClause allMessages() {
+        final AssertionClause clause = new AssertionClause() {
             public void run() {
                 List<Exchange> list = getReceivedExchanges();
                 int index = 0;



Mime
View raw message