cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject [21/39] cayenne git commit: CAY-1971 Variants of Property.like(..) : contains(..), startsWith(..), endsWith(..)
Date Thu, 27 Nov 2014 07:12:04 GMT
CAY-1971 Variants of Property.like(..) : contains(..), startsWith(..), endsWith(..)

* integration tests


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

Branch: refs/heads/CAY-1946_1
Commit: 5fe569112a0fb54b98a4da4c8559efd3d2c85776
Parents: a0d54ab
Author: aadamchik <aadamchik@apache.org>
Authored: Sat Nov 22 14:46:31 2014 +0300
Committer: aadamchik <aadamchik@apache.org>
Committed: Sat Nov 22 17:39:19 2014 +0300

----------------------------------------------------------------------
 .../apache/cayenne/exp/ExpressionFactoryIT.java  | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/5fe56911/cayenne-server/src/test/java/org/apache/cayenne/exp/ExpressionFactoryIT.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/exp/ExpressionFactoryIT.java
b/cayenne-server/src/test/java/org/apache/cayenne/exp/ExpressionFactoryIT.java
index c03b998..33e728d 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/exp/ExpressionFactoryIT.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/exp/ExpressionFactoryIT.java
@@ -103,4 +103,23 @@ public class ExpressionFactoryIT extends ServerCase {
 		artists = context.select(q2);
 		assertEquals(1, artists.size());
 	}
+	
+	@Test
+	public void testContains_Escape() {
+		Artist a1 = context.newObject(Artist.class);
+		a1.setArtistName("MA_1X");
+		Artist a2 = context.newObject(Artist.class);
+		a2.setArtistName("CA%2Y");
+		context.commitChanges();
+
+		Expression ex1 = ExpressionFactory.containsExp(Artist.ARTIST_NAME.getName(), "A_1");
+		SelectQuery<Artist> q1 = new SelectQuery<Artist>(Artist.class, ex1);
+		List<Artist> artists = context.select(q1);
+		assertEquals(1, artists.size());
+
+		Expression ex2 = ExpressionFactory.containsExp(Artist.ARTIST_NAME.getName(), "A%2");
+		SelectQuery<Artist> q2 = new SelectQuery<Artist>(Artist.class, ex2);
+		artists = context.select(q2);
+		assertEquals(1, artists.size());
+	}
 }


Mime
View raw message