camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bvah...@apache.org
Subject git commit: Override toString() by the entity classes (but only using the corresponding getters) so we can see more context information inside the logs or when an assertion should fail and what not.
Date Wed, 18 Jun 2014 08:30:18 GMT
Repository: camel
Updated Branches:
  refs/heads/master 601c14356 -> 5bf8ba893


Override toString() by the entity classes (but only using the corresponding getters) so we
can see more context information inside the logs or when an assertion should fail and what
not.

Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/5bf8ba89
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/5bf8ba89
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/5bf8ba89

Branch: refs/heads/master
Commit: 5bf8ba8935b968b249cf2004e53c1b4102cdb460
Parents: 601c143
Author: Babak Vahdat <bvahdat@apache.org>
Authored: Wed Jun 18 10:30:12 2014 +0200
Committer: Babak Vahdat <bvahdat@apache.org>
Committed: Wed Jun 18 10:30:12 2014 +0200

----------------------------------------------------------------------
 .../jpa/JpaComponentConfigurationAndDocumentationTest.java   | 2 --
 .../apache/camel/component/jpa/JpaWithNamedQueryTest.java    | 1 +
 .../src/test/java/org/apache/camel/examples/Address.java     | 7 +++++++
 .../src/test/java/org/apache/camel/examples/Customer.java    | 7 +++++++
 .../src/test/java/org/apache/camel/examples/MultiSteps.java  | 8 ++++++++
 .../src/test/java/org/apache/camel/examples/SendEmail.java   | 7 +++++++
 .../test/java/org/apache/camel/examples/VersionedItem.java   | 3 ++-
 7 files changed, 32 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/5bf8ba89/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaComponentConfigurationAndDocumentationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaComponentConfigurationAndDocumentationTest.java
b/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaComponentConfigurationAndDocumentationTest.java
index 6836ec4..eaae0b3 100644
--- a/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaComponentConfigurationAndDocumentationTest.java
+++ b/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaComponentConfigurationAndDocumentationTest.java
@@ -23,8 +23,6 @@ import org.apache.camel.impl.DefaultCamelContext;
 import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
 
-import javax.swing.*;
-
 public class JpaComponentConfigurationAndDocumentationTest extends CamelTestSupport {
 
     @Override

http://git-wip-us.apache.org/repos/asf/camel/blob/5bf8ba89/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaWithNamedQueryTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaWithNamedQueryTest.java
b/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaWithNamedQueryTest.java
index d6bae56..6a23967 100644
--- a/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaWithNamedQueryTest.java
+++ b/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaWithNamedQueryTest.java
@@ -131,6 +131,7 @@ public class JpaWithNamedQueryTest extends Assert {
                     } else {
                         // dummy row
                         assertEquals("dummy row step for: " + row, 4, row.getStep());
+                        assertEquals("Not the expected row: " + row, "cheese", row.getAddress());
                     }
                 }
                 return null;

http://git-wip-us.apache.org/repos/asf/camel/blob/5bf8ba89/components/camel-jpa/src/test/java/org/apache/camel/examples/Address.java
----------------------------------------------------------------------
diff --git a/components/camel-jpa/src/test/java/org/apache/camel/examples/Address.java b/components/camel-jpa/src/test/java/org/apache/camel/examples/Address.java
index cfba9b9..1ab44a9 100644
--- a/components/camel-jpa/src/test/java/org/apache/camel/examples/Address.java
+++ b/components/camel-jpa/src/test/java/org/apache/camel/examples/Address.java
@@ -55,4 +55,11 @@ public class Address {
     public void setAddressLine2(String addressLine2) {
         this.addressLine2 = addressLine2;
     }
+
+    @Override
+    public String toString() {
+        // OpenJPA warns about fields being accessed directly in methods if NOT using the
corresponding getters.
+        return "Address[id: " + getId() + ", addressLine1: " + getAddressLine1() + ", addressLine2:
" + getAddressLine2() + "]";
+    }
+
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/5bf8ba89/components/camel-jpa/src/test/java/org/apache/camel/examples/Customer.java
----------------------------------------------------------------------
diff --git a/components/camel-jpa/src/test/java/org/apache/camel/examples/Customer.java b/components/camel-jpa/src/test/java/org/apache/camel/examples/Customer.java
index 83a120e..62ccdf2 100644
--- a/components/camel-jpa/src/test/java/org/apache/camel/examples/Customer.java
+++ b/components/camel-jpa/src/test/java/org/apache/camel/examples/Customer.java
@@ -61,4 +61,11 @@ public class Customer {
     public void setAddress(Address address) {
         this.address = address;
     }
+
+    @Override
+    public String toString() {
+        // OpenJPA warns about fields being accessed directly in methods if NOT using the
corresponding getters.
+        return "Customer[id: " + getId() + ", name: " + getName() + ", address: " + getAddress()
+ "]";
+    }
+
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/5bf8ba89/components/camel-jpa/src/test/java/org/apache/camel/examples/MultiSteps.java
----------------------------------------------------------------------
diff --git a/components/camel-jpa/src/test/java/org/apache/camel/examples/MultiSteps.java
b/components/camel-jpa/src/test/java/org/apache/camel/examples/MultiSteps.java
index 17c6e82..afca4a6 100644
--- a/components/camel-jpa/src/test/java/org/apache/camel/examples/MultiSteps.java
+++ b/components/camel-jpa/src/test/java/org/apache/camel/examples/MultiSteps.java
@@ -83,4 +83,12 @@ public class MultiSteps {
 
         LOG.info("Invoked the completion complete method. Now updated the step to: {}", getStep());
     }
+
+    @Override
+    public String toString() {
+        // OpenJPA warns about fields being accessed directly in methods if NOT using the
corresponding getters:
+        // 115  camel  WARN   [main] openjpa.Enhance - Detected the following possible violations
of the restrictions placed on property access persistent types:
+        // "org.apache.camel.examples.MultiSteps" uses property access, but its field "step"
is accessed directly in method "toString" defined in "org.apache.camel.examples.MultiSteps".
+        return "MultiSteps[id: " + getId() + ", address: " + getAddress() + ", step: " +
getStep() + "]";
+    }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/5bf8ba89/components/camel-jpa/src/test/java/org/apache/camel/examples/SendEmail.java
----------------------------------------------------------------------
diff --git a/components/camel-jpa/src/test/java/org/apache/camel/examples/SendEmail.java b/components/camel-jpa/src/test/java/org/apache/camel/examples/SendEmail.java
index 74a3a4f..b275309 100644
--- a/components/camel-jpa/src/test/java/org/apache/camel/examples/SendEmail.java
+++ b/components/camel-jpa/src/test/java/org/apache/camel/examples/SendEmail.java
@@ -67,4 +67,11 @@ public class SendEmail {
             setAddress("dummy@somewhere.org");
         }
     }
+
+    @Override
+    public String toString() {
+        // OpenJPA warns about fields being accessed directly in methods if NOT using the
corresponding getters.
+        return "SendEmail[id: " + getId() + ", address: " + getAddress() + "]";
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/5bf8ba89/components/camel-jpa/src/test/java/org/apache/camel/examples/VersionedItem.java
----------------------------------------------------------------------
diff --git a/components/camel-jpa/src/test/java/org/apache/camel/examples/VersionedItem.java
b/components/camel-jpa/src/test/java/org/apache/camel/examples/VersionedItem.java
index d76265a..c17adf1 100644
--- a/components/camel-jpa/src/test/java/org/apache/camel/examples/VersionedItem.java
+++ b/components/camel-jpa/src/test/java/org/apache/camel/examples/VersionedItem.java
@@ -69,6 +69,7 @@ public class VersionedItem {
 
     @Override
     public String toString() {
-        return "VersionedItem [id=" + id + ", name=" + name + "]";
+        // OpenJPA warns about fields being accessed directly in methods if NOT using the
corresponding getters.
+        return "VersionedItem[id: " + getId() + ", name: " + getName() + ", version: " +
getVersion() + "]";
     }
 }


Mime
View raw message