[teiid-commits] teiid SVN: r4323 - in trunk/engine/src: test/java/org/teiid/query/sql/lang and 1 other directory.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Tue Aug 14 14:27:10 EDT 2012


Author: shawkins
Date: 2012-08-14 14:27:10 -0400 (Tue, 14 Aug 2012)
New Revision: 4323

Modified:
   trunk/engine/src/main/java/org/teiid/query/sql/lang/MatchCriteria.java
   trunk/engine/src/test/java/org/teiid/query/sql/lang/TestMatchCriteria.java
Log:
TEIID-2138 adding an emulation option to match criteria

Modified: trunk/engine/src/main/java/org/teiid/query/sql/lang/MatchCriteria.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/lang/MatchCriteria.java	2012-08-14 17:45:39 UTC (rev 4322)
+++ trunk/engine/src/main/java/org/teiid/query/sql/lang/MatchCriteria.java	2012-08-14 18:27:10 UTC (rev 4323)
@@ -31,6 +31,7 @@
 import org.teiid.core.util.EquivalenceUtil;
 import org.teiid.core.util.HashCodeUtil;
 import org.teiid.core.util.LRUCache;
+import org.teiid.core.util.PropertiesUtils;
 import org.teiid.language.Like.MatchMode;
 import org.teiid.query.QueryPlugin;
 import org.teiid.query.sql.LanguageVisitor;
@@ -62,8 +63,10 @@
 	/** The internal null escape character */
 	public static final char NULL_ESCAPE_CHAR = 0;
 
+	static char DEFAULT_ESCAPE_CHAR = PropertiesUtils.getBooleanProperty(System.getProperties(), "org.teiid.backslashDefaultMatchEscape", false)?'\\':NULL_ESCAPE_CHAR; //$NON-NLS-1$
+	
 	/** The escape character or '' if there is none */
-	private char escapeChar = NULL_ESCAPE_CHAR;
+	private char escapeChar = DEFAULT_ESCAPE_CHAR;
 	
     /** Negation flag. Indicates whether the criteria expression contains a NOT. */
     private boolean negated;

Modified: trunk/engine/src/test/java/org/teiid/query/sql/lang/TestMatchCriteria.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/sql/lang/TestMatchCriteria.java	2012-08-14 17:45:39 UTC (rev 4322)
+++ trunk/engine/src/test/java/org/teiid/query/sql/lang/TestMatchCriteria.java	2012-08-14 18:27:10 UTC (rev 4323)
@@ -22,20 +22,15 @@
 
 package org.teiid.query.sql.lang;
 
+import static org.junit.Assert.*;
+
+import org.junit.Test;
 import org.teiid.core.util.UnitTestUtil;
-import org.teiid.query.sql.lang.MatchCriteria;
-import org.teiid.query.sql.symbol.*;
+import org.teiid.query.sql.symbol.Constant;
+import org.teiid.query.sql.symbol.ElementSymbol;
 
-import junit.framework.*;
+public class TestMatchCriteria {
 
-public class TestMatchCriteria extends TestCase {
-
-	// ################################## FRAMEWORK ################################
-	
-	public TestMatchCriteria(String name) { 
-		super(name);
-	}	
-	
 	// ################################## TEST HELPERS ################################	
 		
 	public static MatchCriteria example(String element, String str) {
@@ -62,13 +57,13 @@
 		
 	// ################################## ACTUAL TESTS ################################
 	
-	public void testEquals1() {    
+	@Test public void testEquals1() {    
 		MatchCriteria c1 = example("abc"); //$NON-NLS-1$
 		MatchCriteria c2 = example("abc"); //$NON-NLS-1$
 		assertTrue("Equivalent match criteria don't compare as equal: " + c1 + ", " + c2, c1.equals(c2));				 //$NON-NLS-1$ //$NON-NLS-2$
 	}
 
-	public void testEquals2() {    
+	@Test public void testEquals2() {    
 		MatchCriteria c1 = example("abc", '#'); //$NON-NLS-1$
         c1.setNegated(true);
 		MatchCriteria c2 = example("abc", '#'); //$NON-NLS-1$
@@ -76,46 +71,46 @@
 		assertTrue("Equivalent match criteria don't compare as equal: " + c1 + ", " + c2, c1.equals(c2));				 //$NON-NLS-1$ //$NON-NLS-2$
 	}
 
-	public void testEquals3() {    
+	@Test public void testEquals3() {    
 		MatchCriteria c1 = example("abc", '#'); //$NON-NLS-1$
         c1.setNegated(true);
 		MatchCriteria c2 = (MatchCriteria) c1.clone();
 		assertTrue("Equivalent match criteria don't compare as equal: " + c1 + ", " + c2, c1.equals(c2));				 //$NON-NLS-1$ //$NON-NLS-2$
 	}
 
-	public void testEquals4() {    
+	@Test public void testEquals4() {    
 		MatchCriteria c1 = example("abc"); //$NON-NLS-1$
 		MatchCriteria c2 = example("abc", '#'); //$NON-NLS-1$
 		assertTrue("Different match criteria compare as equal: " + c1 + ", " + c2, ! c1.equals(c2));				 //$NON-NLS-1$ //$NON-NLS-2$
 	}
 
-	public void testEquals5() {    
+	@Test public void testEquals5() {    
 		MatchCriteria c1 = example("e1", "abc"); //$NON-NLS-1$ //$NON-NLS-2$
 		MatchCriteria c2 = example("e2", "abc"); //$NON-NLS-1$ //$NON-NLS-2$
 		assertTrue("Different match criteria compare as equal: " + c1 + ", " + c2, ! c1.equals(c2));				 //$NON-NLS-1$ //$NON-NLS-2$
 	}
 
-	public void testSelfEquivalence(){
+	@Test public void testSelfEquivalence(){
 		MatchCriteria c1 = example("abc"); //$NON-NLS-1$
 		int equals = 0;
 		UnitTestUtil.helpTestEquivalence(equals, c1, c1);
 	}
 
-	public void testEquivalence(){
+	@Test public void testEquivalence(){
 		MatchCriteria c1 = example("abc"); //$NON-NLS-1$
 		MatchCriteria c2 = example("abc"); //$NON-NLS-1$
 		int equals = 0;
 		UnitTestUtil.helpTestEquivalence(equals, c1, c2);
 	}
 	
-	public void testCloneEquivalence(){
+	@Test public void testCloneEquivalence(){
 		MatchCriteria c1 = example("abc"); //$NON-NLS-1$
 		MatchCriteria c2 = (MatchCriteria)c1.clone();
 		int equals = 0;
 		UnitTestUtil.helpTestEquivalence(equals, c1, c2);
 	}	
 	
-    public void testNonEquivalence1(){
+    @Test public void testNonEquivalence1(){
         //test transitivity with two nonequal Objects
         MatchCriteria c1 = example("e1", "abc"); //$NON-NLS-1$ //$NON-NLS-2$
         MatchCriteria c2 = example("ozzy", '#'); //$NON-NLS-1$
@@ -123,7 +118,7 @@
         UnitTestUtil.helpTestEquivalence(equals, c1, c2);
     }
     
-    public void testNonEquivalence2(){
+    @Test public void testNonEquivalence2(){
         MatchCriteria c1 = example("abc", '#'); //$NON-NLS-1$
         c1.setNegated(true);
         MatchCriteria c2 = example("abc", '#'); //$NON-NLS-1$



More information about the teiid-commits mailing list