camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r583819 - in /activemq/camel/trunk: camel-core/src/main/java/org/apache/camel/builder/ camel-core/src/main/java/org/apache/camel/component/mock/ camel-core/src/main/java/org/apache/camel/impl/ camel-core/src/main/java/org/apache/camel/impl/...
Date Thu, 11 Oct 2007 13:24:08 GMT
Author: jstrachan
Date: Thu Oct 11 06:24:07 2007
New Revision: 583819

URL: http://svn.apache.org/viewvc?rev=583819&view=rev
Log:
minor refactor so that ObjectHelper.equal() can be used more easily by static imports without
clashing with Object.equals()

Modified:
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/PredicateBuilder.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/mock/MockEndpoint.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/converter/DefaultTypeConverter.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/language/simple/SimpleLanguage.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ReportingTypeConverterLoader.java
    activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/DataFormatTest.java
    activemq/camel/trunk/components/camel-bam/src/main/java/org/apache/camel/bam/TimeExpression.java
    activemq/camel/trunk/components/camel-bam/src/main/java/org/apache/camel/bam/model/ActivityState.java
    activemq/camel/trunk/components/camel-jaxb/pom.xml
    activemq/camel/trunk/components/camel-jaxb/src/test/java/org/apache/camel/example/PurchaseOrder.java
    activemq/camel/trunk/tests/camel-partial-classpath-test/src/test/java/org/apache/camel/tests/partialclasspath/MyBean.java
    activemq/camel/trunk/tooling/maven/maven-camel-converters/src/main/java/org/apache/camel/maven/ConvertersMojo.java

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/PredicateBuilder.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/PredicateBuilder.java?rev=583819&r1=583818&r2=583819&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/PredicateBuilder.java
(original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/PredicateBuilder.java
Thu Oct 11 06:24:07 2007
@@ -129,7 +129,7 @@
         return new BinaryPredicateSupport<E>(left, right) {
 
             protected boolean matches(E exchange, Object leftValue, Object rightValue) {
-                return ObjectHelper.equals(leftValue, rightValue);
+                return ObjectHelper.equal(leftValue, rightValue);
             }
 
             protected String getOperationText() {
@@ -143,7 +143,7 @@
         return new BinaryPredicateSupport<E>(left, right) {
 
             protected boolean matches(E exchange, Object leftValue, Object rightValue) {
-                return !ObjectHelper.equals(leftValue, rightValue);
+                return !ObjectHelper.equal(leftValue, rightValue);
             }
 
             protected String getOperationText() {

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/mock/MockEndpoint.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/mock/MockEndpoint.java?rev=583819&r1=583818&r2=583819&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/mock/MockEndpoint.java
(original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/mock/MockEndpoint.java
Thu Oct 11 06:24:07 2007
@@ -27,7 +27,6 @@
 
 import org.apache.camel.*;
 import org.apache.camel.impl.DefaultEndpoint;
-import org.apache.camel.impl.DefaultExchange;
 import org.apache.camel.impl.DefaultProducer;
 import org.apache.camel.util.ExpressionComparator;
 import org.apache.camel.util.ObjectHelper;
@@ -510,7 +509,7 @@
     }
 
     protected void assertEquals(String message, Object expectedValue, Object actualValue)
{
-        if (!ObjectHelper.equals(expectedValue, actualValue)) {
+        if (!ObjectHelper.equal(expectedValue, actualValue)) {
             fail(message + ". Expected: <" + expectedValue + "> but was: <" + actualValue
+ ">");
         }
     }

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java?rev=583819&r1=583818&r2=583819&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java
(original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java
Thu Oct 11 06:24:07 2007
@@ -59,7 +59,7 @@
     public boolean equals(Object object) {
         if (object instanceof DefaultEndpoint) {
             DefaultEndpoint that = (DefaultEndpoint) object;
-            return ObjectHelper.equals(this.endpointUri, that.endpointUri);
+            return ObjectHelper.equal(this.endpointUri, that.endpointUri);
         }
         return false;
     }

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/converter/DefaultTypeConverter.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/converter/DefaultTypeConverter.java?rev=583819&r1=583818&r2=583819&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/converter/DefaultTypeConverter.java
(original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/converter/DefaultTypeConverter.java
Thu Oct 11 06:24:07 2007
@@ -262,8 +262,8 @@
         public boolean equals(Object object) {
             if (object instanceof TypeMapping) {
                 TypeMapping that = (TypeMapping)object;
-                return ObjectHelper.equals(this.fromType, that.fromType)
-                       && ObjectHelper.equals(this.toType, that.toType);
+                return ObjectHelper.equal(this.fromType, that.fromType)
+                       && ObjectHelper.equal(this.toType, that.toType);
             }
             return false;
         }

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/language/simple/SimpleLanguage.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/language/simple/SimpleLanguage.java?rev=583819&r1=583818&r2=583819&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/language/simple/SimpleLanguage.java
(original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/language/simple/SimpleLanguage.java
Thu Oct 11 06:24:07 2007
@@ -99,7 +99,7 @@
         if (ObjectHelper.isEqualToAny(expression, "body", "in.body")) {
             return ExpressionBuilder.bodyExpression();
         }
-        else if (ObjectHelper.equals(expression, "out.body")) {
+        else if (ObjectHelper.equal(expression, "out.body")) {
             return ExpressionBuilder.outBodyExpression();
         }
 

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java?rev=583819&r1=583818&r2=583819&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java
(original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java
Thu Oct 11 06:24:07 2007
@@ -17,7 +17,6 @@
 package org.apache.camel.util;
 
 import org.apache.camel.RuntimeCamelException;
-import org.apache.camel.Body;
 import org.apache.camel.converter.ObjectConverter;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -30,7 +29,6 @@
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.List;
-import java.io.OutputStream;
 import java.io.Closeable;
 import java.io.IOException;
 
@@ -51,7 +49,7 @@
     /**
      * A helper method for comparing objects for equality while handling nulls
      */
-    public static boolean equals(Object a, Object b) {
+    public static boolean equal(Object a, Object b) {
         if (a == b) {
             return true;
         }
@@ -67,7 +65,7 @@
      */
     public static boolean isEqualToAny(Object object, Object... values) {
         for (Object value : values) {
-            if (equals(object, value)) {
+            if (equal(object, value)) {
                 return true;
             }
         }
@@ -162,7 +160,7 @@
         } else {
             Iterator iter = ObjectConverter.iterator(value);
             while (iter.hasNext()) {
-                if (equals(value, iter.next())) {
+                if (equal(value, iter.next())) {
                     return true;
                 }
             }

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ReportingTypeConverterLoader.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ReportingTypeConverterLoader.java?rev=583819&r1=583818&r2=583819&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ReportingTypeConverterLoader.java
(original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ReportingTypeConverterLoader.java
Thu Oct 11 06:24:07 2007
@@ -23,6 +23,7 @@
 import java.util.List;
 
 import org.apache.camel.TypeConverter;
+import static org.apache.camel.util.ObjectHelper.equal;
 import org.apache.camel.impl.converter.AnnotationTypeConverterLoader;
 import org.apache.camel.impl.converter.TypeConverterRegistry;
 
@@ -32,8 +33,8 @@
 	private static final Comparator<TypeMapping> COMPARE_LAST_LOADED_FIRST =
         new Comparator<TypeMapping>() {
 			public int compare(TypeMapping t1, TypeMapping t2) {
-				if (ObjectHelper.equals(t1.fromType, t2.fromType)) {
-					return ObjectHelper.equals(t1.toType, t2.toType) ? t1.index - t2.index :
+				if (equal(t1.fromType, t2.fromType)) {
+					return equal(t1.toType, t2.toType) ? t1.index - t2.index :
 						ObjectHelper.compare(getTypeName(t1.toType), getTypeName(t2.toType));
 				}
 				return ObjectHelper.compare(getTypeName(t1.fromType), getTypeName(t2.fromType));

Modified: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/DataFormatTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/DataFormatTest.java?rev=583819&r1=583818&r2=583819&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/DataFormatTest.java
(original)
+++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/DataFormatTest.java
Thu Oct 11 06:24:07 2007
@@ -22,6 +22,7 @@
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.util.ObjectHelper;
+import static org.apache.camel.util.ObjectHelper.equal;
 
 /**
  * @version $Revision: 1.1 $
@@ -59,7 +60,7 @@
         public boolean equals(Object o) {
             if (o instanceof MyBean) {
                 MyBean that = (MyBean) o;
-                return ObjectHelper.equals(this.name, that.name) && ObjectHelper.equals(this.counter,
 that.counter);                
+                return equal(this.name, that.name) && equal(this.counter,  that.counter);
               
             }
             return false;
         }

Modified: activemq/camel/trunk/components/camel-bam/src/main/java/org/apache/camel/bam/TimeExpression.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-bam/src/main/java/org/apache/camel/bam/TimeExpression.java?rev=583819&r1=583818&r2=583819&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-bam/src/main/java/org/apache/camel/bam/TimeExpression.java
(original)
+++ activemq/camel/trunk/components/camel-bam/src/main/java/org/apache/camel/bam/TimeExpression.java
Thu Oct 11 06:24:07 2007
@@ -23,6 +23,7 @@
 import org.apache.camel.bam.rules.ActivityRules;
 import org.apache.camel.bam.rules.TemporalRule;
 import org.apache.camel.util.ObjectHelper;
+import static org.apache.camel.util.ObjectHelper.equal;
 
 /**
  * @version $Revision: $
@@ -39,7 +40,7 @@
     }
 
     public boolean isActivityLifecycle(ActivityRules activityRules, ActivityLifecycle lifecycle)
{
-        return ObjectHelper.equals(activityRules, this.activityRules) && ObjectHelper.equals(lifecycle,
this.lifecycle);
+        return equal(activityRules, this.activityRules) && equal(lifecycle, this.lifecycle);
     }
 
     /**

Modified: activemq/camel/trunk/components/camel-bam/src/main/java/org/apache/camel/bam/model/ActivityState.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-bam/src/main/java/org/apache/camel/bam/model/ActivityState.java?rev=583819&r1=583818&r2=583819&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-bam/src/main/java/org/apache/camel/bam/model/ActivityState.java
(original)
+++ activemq/camel/trunk/components/camel-bam/src/main/java/org/apache/camel/bam/model/ActivityState.java
Thu Oct 11 06:24:07 2007
@@ -82,7 +82,7 @@
      * Returns true if this state is for the given activity
      */
     public boolean isActivity(ActivityRules activityRules) {
-        return ObjectHelper.equals(getActivityDefinition(), activityRules.getActivityDefinition());
+        return ObjectHelper.equal(getActivityDefinition(), activityRules.getActivityDefinition());
     }
 
     // Properties

Modified: activemq/camel/trunk/components/camel-jaxb/pom.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-jaxb/pom.xml?rev=583819&r1=583818&r2=583819&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-jaxb/pom.xml (original)
+++ activemq/camel/trunk/components/camel-jaxb/pom.xml Thu Oct 11 06:24:07 2007
@@ -57,12 +57,6 @@
       <groupId>com.sun.xml.bind</groupId>
       <artifactId>jaxb-impl</artifactId>
     </dependency>
-<!--
-    <dependency>
-      <groupId>stax</groupId>
-      <artifactId>stax-api</artifactId>
-    </dependency>
--->
 
 
     <!-- for testing -->
@@ -75,6 +69,17 @@
       <groupId>org.apache.camel</groupId>
       <artifactId>camel-core</artifactId>
       <type>test-jar</type>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-spring</artifactId>
+      <type>test-jar</type>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-spring</artifactId>
       <scope>test</scope>
     </dependency>
     <dependency>

Modified: activemq/camel/trunk/components/camel-jaxb/src/test/java/org/apache/camel/example/PurchaseOrder.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-jaxb/src/test/java/org/apache/camel/example/PurchaseOrder.java?rev=583819&r1=583818&r2=583819&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-jaxb/src/test/java/org/apache/camel/example/PurchaseOrder.java
(original)
+++ activemq/camel/trunk/components/camel-jaxb/src/test/java/org/apache/camel/example/PurchaseOrder.java
Thu Oct 11 06:24:07 2007
@@ -45,9 +45,9 @@
     public boolean equals(Object o) {
         if (o instanceof PurchaseOrder) {
             PurchaseOrder that = (PurchaseOrder) o;
-            return ObjectHelper.equals(this.name, that.name) &&
-                    ObjectHelper.equals(this.amount, that.amount) &&
-                    ObjectHelper.equals(this.price, that.price);
+            return ObjectHelper.equal(this.name, that.name) &&
+                    ObjectHelper.equal(this.amount, that.amount) &&
+                    ObjectHelper.equal(this.price, that.price);
         }
         return false;
     }

Modified: activemq/camel/trunk/tests/camel-partial-classpath-test/src/test/java/org/apache/camel/tests/partialclasspath/MyBean.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/tests/camel-partial-classpath-test/src/test/java/org/apache/camel/tests/partialclasspath/MyBean.java?rev=583819&r1=583818&r2=583819&view=diff
==============================================================================
--- activemq/camel/trunk/tests/camel-partial-classpath-test/src/test/java/org/apache/camel/tests/partialclasspath/MyBean.java
(original)
+++ activemq/camel/trunk/tests/camel-partial-classpath-test/src/test/java/org/apache/camel/tests/partialclasspath/MyBean.java
Thu Oct 11 06:24:07 2007
@@ -38,7 +38,7 @@
     public boolean equals(Object o) {
         if (o instanceof MyBean) {
             MyBean that = (MyBean) o;
-            return ObjectHelper.equals(this.a, that.a) && ObjectHelper.equals(this.b,
that.b);
+            return ObjectHelper.equal(this.a, that.a) && ObjectHelper.equal(this.b,
that.b);
         }
         return false;
     }

Modified: activemq/camel/trunk/tooling/maven/maven-camel-converters/src/main/java/org/apache/camel/maven/ConvertersMojo.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/tooling/maven/maven-camel-converters/src/main/java/org/apache/camel/maven/ConvertersMojo.java?rev=583819&r1=583818&r2=583819&view=diff
==============================================================================
--- activemq/camel/trunk/tooling/maven/maven-camel-converters/src/main/java/org/apache/camel/maven/ConvertersMojo.java
(original)
+++ activemq/camel/trunk/tooling/maven/maven-camel-converters/src/main/java/org/apache/camel/maven/ConvertersMojo.java
Thu Oct 11 06:24:07 2007
@@ -105,8 +105,8 @@
             	boolean ignored = false;
             	Class from = mapping.getFromType();
             	Class to = mapping.getToType();
-            	if (ObjectHelper.equals(from, prevFrom) &&
-            		ObjectHelper.equals(to, prevTo)) {
+            	if (ObjectHelper.equal(from, prevFrom) &&
+            		ObjectHelper.equal(to, prevTo)) {
             		
             		ignored = true;
             		buffer.append(" ");



Mime
View raw message