Author: shawkins
Date: 2009-05-14 22:55:01 -0400 (Thu, 14 May 2009)
New Revision: 942
Removed:
trunk/console/src/main/java/com/metamatrix/console/ui/views/users/InheritedRole.java
Modified:
trunk/engine/src/main/java/com/metamatrix/query/validator/ValidationVisitor.java
trunk/engine/src/main/resources/com/metamatrix/query/i18n.properties
trunk/engine/src/test/java/com/metamatrix/query/validator/TestValidator.java
Log:
TEIID-599 ensuring that the validation message for non-comparable types is correct
Deleted:
trunk/console/src/main/java/com/metamatrix/console/ui/views/users/InheritedRole.java
===================================================================
---
trunk/console/src/main/java/com/metamatrix/console/ui/views/users/InheritedRole.java 2009-05-14
19:00:51 UTC (rev 941)
+++
trunk/console/src/main/java/com/metamatrix/console/ui/views/users/InheritedRole.java 2009-05-15
02:55:01 UTC (rev 942)
@@ -1,42 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.console.ui.views.users;
-
-public class InheritedRole {
- private RoleDisplay role;
- private String inheritedThroughGroup;
-
- public InheritedRole(RoleDisplay role, String group) {
- super();
- this.role = role;
- this.inheritedThroughGroup = group;
- }
-
- public RoleDisplay getRoleDisplay() {
- return role;
- }
-
- public String getInheritedThroughGroup() {
- return inheritedThroughGroup;
- }
-}
Modified:
trunk/engine/src/main/java/com/metamatrix/query/validator/ValidationVisitor.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/validator/ValidationVisitor.java 2009-05-14
19:00:51 UTC (rev 941)
+++
trunk/engine/src/main/java/com/metamatrix/query/validator/ValidationVisitor.java 2009-05-15
02:55:01 UTC (rev 942)
@@ -224,7 +224,7 @@
public void visit(SubquerySetCriteria obj) {
if (isNonComparable(obj.getExpression())) {
- handleValidationError(QueryPlugin.Util.getString(ErrorMessageKeys.VALIDATOR_0027),obj);
+ handleValidationError(QueryPlugin.Util.getString(ErrorMessageKeys.VALIDATOR_0027,
obj),obj);
}
this.validateRowLimitFunctionNotInInvalidCriteria(obj);
@@ -932,7 +932,7 @@
*/
public void visit(BetweenCriteria obj) {
if (isNonComparable(obj.getExpression())) {
-
handleValidationError(QueryPlugin.Util.getString(ErrorMessageKeys.VALIDATOR_0027),obj);
+ handleValidationError(QueryPlugin.Util.getString(ErrorMessageKeys.VALIDATOR_0027,
obj),obj);
}
this.validateRowLimitFunctionNotInInvalidCriteria(obj);
}
@@ -967,7 +967,7 @@
*/
public void visit(SetCriteria obj) {
if (isNonComparable(obj.getExpression())) {
-
handleValidationError(QueryPlugin.Util.getString(ErrorMessageKeys.VALIDATOR_0027),obj);
+ handleValidationError(QueryPlugin.Util.getString(ErrorMessageKeys.VALIDATOR_0027,
obj),obj);
}
this.validateRowLimitFunctionNotInInvalidCriteria(obj);
}
@@ -978,7 +978,7 @@
*/
public void visit(SubqueryCompareCriteria obj) {
if (isNonComparable(obj.getLeftExpression())) {
-
handleValidationError(QueryPlugin.Util.getString(ErrorMessageKeys.VALIDATOR_0027),obj);
+ handleValidationError(QueryPlugin.Util.getString(ErrorMessageKeys.VALIDATOR_0027,
obj),obj);
}
this.validateRowLimitFunctionNotInInvalidCriteria(obj);
}
@@ -1027,7 +1027,7 @@
@Override
public void visit(CompareCriteria obj) {
if (isNonComparable(obj.getLeftExpression())) {
-
handleValidationError(QueryPlugin.Util.getString(ErrorMessageKeys.VALIDATOR_0027),obj);
+ handleValidationError(QueryPlugin.Util.getString(ErrorMessageKeys.VALIDATOR_0027,
obj),obj);
}
}
Modified: trunk/engine/src/main/resources/com/metamatrix/query/i18n.properties
===================================================================
--- trunk/engine/src/main/resources/com/metamatrix/query/i18n.properties 2009-05-14
19:00:51 UTC (rev 941)
+++ trunk/engine/src/main/resources/com/metamatrix/query/i18n.properties 2009-05-15
02:55:01 UTC (rev 942)
@@ -276,8 +276,8 @@
ERR.015.012.0023 = Unable to translate criteria on the update command against the virtual
group, the element {0} is mapped to an expression whose elements are not present on the
command in the procedure using the translated criteria.
ERR.015.012.0024 = The following data elements are not supported in the SELECT clause:
{0}.
ERR.015.012.0025 = Command must project at least one symbol
-ERR.015.012.0026 = Expressions of type OBJECT, CLOB, BLOB, or XML cannot be used in
SELECT DISTINCT, ORDER BY, GROUP BY, or UNION: [{0}]
-ERR.015.012.0027 = Expressions of type OBJECT, CLOB, BLOB, or XML cannot be used in
comparison criteria: {0}.
+ERR.015.012.0026 = Expressions of type OBJECT, CLOB, BLOB, or XML cannot be used in
SELECT DISTINCT, ORDER BY, GROUP BY, or non-all set queries: [{0}]
+ERR.015.012.0027 = Expressions of type OBJECT, CLOB, BLOB, or XML cannot be used in
comparison: {0}.
ValidationVisitor.invalid_lookup_key=Expressions of type OBJECT, CLOB, BLOB, or XML
cannot be used as LOOKUP key columns: {0}.
ValidationVisitor.limit_not_valid_for_xml=The limit clause cannot be used on an XML
document query.
ValidateCriteriaVistitor.element_not_comparable = The following data elements are not
supported in comparison criteria: {0}.
Modified: trunk/engine/src/test/java/com/metamatrix/query/validator/TestValidator.java
===================================================================
---
trunk/engine/src/test/java/com/metamatrix/query/validator/TestValidator.java 2009-05-14
19:00:51 UTC (rev 941)
+++
trunk/engine/src/test/java/com/metamatrix/query/validator/TestValidator.java 2009-05-15
02:55:01 UTC (rev 942)
@@ -344,16 +344,15 @@
return command;
}
- static void helpValidate(String sql, String[] expectedStringArray,
QueryMetadataInterface metadata) {
+ static ValidatorReport helpValidate(String sql, String[] expectedStringArray,
QueryMetadataInterface metadata) {
Command command = helpResolve(sql, metadata);
- helpRunValidator(command, expectedStringArray, metadata);
+ return helpRunValidator(command, expectedStringArray, metadata);
}
- public static void helpRunValidator(Command command, String[] expectedStringArray,
QueryMetadataInterface metadata) {
+ public static ValidatorReport helpRunValidator(Command command, String[]
expectedStringArray, QueryMetadataInterface metadata) {
try {
ValidatorReport report = Validator.validate(command, metadata);
- //System.out.println("\nReport = \n" + report);
ValidatorReport report3 = Validator.validate(command, metadata, new
ValueValidationVisitor(), true);
@@ -372,12 +371,13 @@
}
if(expectedStrings.size() == 0 && actualStrings.size() > 0) {
- fail("Expected no failures but got some: " +
report.getFailureMessage() + ", " + report3.getFailureMessage()); //$NON-NLS-1$
//$NON-NLS-2$ //$NON-NLS-3$
+ fail("Expected no failures but got some: " +
report.getFailureMessage() + ", " + report3.getFailureMessage()); //$NON-NLS-1$
//$NON-NLS-2$
} else if(actualStrings.size() == 0 && expectedStrings.size() > 0)
{
fail("Expected some failures but got none for sql = " +
command); //$NON-NLS-1$
} else {
assertEquals("Expected and actual sets of strings are not the same:
", expectedStrings, actualStrings); //$NON-NLS-1$
}
+ return report;
} catch(MetaMatrixException e) {
throw new MetaMatrixRuntimeException(e);
}
@@ -441,11 +441,11 @@
}
public void testValidateCompare1() {
- helpValidate("SELECT e2 FROM vTest.vMap WHERE e2 = 'a'", new
String[] {}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
+ helpValidate("SELECT e2 FROM vTest.vMap WHERE e2 = 'a'", new
String[] {}, exampleMetadata()); //$NON-NLS-1$
}
public void testValidateCompare4() {
- helpValidate("SELECT e3 FROM vTest.vMap WHERE e3 LIKE 'a'", new
String[] {}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
+ helpValidate("SELECT e3 FROM vTest.vMap WHERE e3 LIKE 'a'", new
String[] {}, exampleMetadata()); //$NON-NLS-1$
}
public void testValidateCompare6() {
@@ -453,19 +453,19 @@
}
public void testValidateCompareInHaving2() {
- helpValidate("SELECT e2 FROM vTest.vMap GROUP BY e2 HAVING e2 IS NULL",
new String[] {}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
+ helpValidate("SELECT e2 FROM vTest.vMap GROUP BY e2 HAVING e2 IS NULL",
new String[] {}, exampleMetadata()); //$NON-NLS-1$
}
public void testValidateCompareInHaving3() {
- helpValidate("SELECT e2 FROM vTest.vMap GROUP BY e2 HAVING e2 IN
('a')", new String[] {}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
+ helpValidate("SELECT e2 FROM vTest.vMap GROUP BY e2 HAVING e2 IN
('a')", new String[] {}, exampleMetadata()); //$NON-NLS-1$
}
public void testValidateCompareInHaving4() {
- helpValidate("SELECT e3 FROM vTest.vMap GROUP BY e3 HAVING e3 LIKE
'a'", new String[] {}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
+ helpValidate("SELECT e3 FROM vTest.vMap GROUP BY e3 HAVING e3 LIKE
'a'", new String[] {}, exampleMetadata()); //$NON-NLS-1$
}
public void testValidateCompareInHaving5() {
- helpValidate("SELECT e2 FROM vTest.vMap GROUP BY e2 HAVING e2 BETWEEN 1000
AND 2000", new String[] {}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
+ helpValidate("SELECT e2 FROM vTest.vMap GROUP BY e2 HAVING e2 BETWEEN 1000
AND 2000", new String[] {}, exampleMetadata()); //$NON-NLS-1$
}
public void testInvalidAggregate1() {
@@ -1019,11 +1019,11 @@
}
public void testValidateSubquery1() {
- helpValidate("SELECT e2 FROM (SELECT e2 FROM vTest.vMap WHERE e2 =
'a') AS x", new String[] {}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
+ helpValidate("SELECT e2 FROM (SELECT e2 FROM vTest.vMap WHERE e2 =
'a') AS x", new String[] {}, exampleMetadata()); //$NON-NLS-1$
}
public void testValidateSubquery2() {
- helpValidate("SELECT e2 FROM (SELECT e3 FROM vTest.vMap) AS x, vTest.vMap
WHERE e2 = 'a'", new String[] {}, exampleMetadata()); //$NON-NLS-1$
//$NON-NLS-2$
+ helpValidate("SELECT e2 FROM (SELECT e3 FROM vTest.vMap) AS x, vTest.vMap
WHERE e2 = 'a'", new String[] {}, exampleMetadata()); //$NON-NLS-1$
}
public void testValidateSubquery3() {
@@ -1035,11 +1035,11 @@
}
public void testValidateExistsSubquery() {
- helpValidate("SELECT e2 FROM test.group2 WHERE EXISTS (SELECT e2 FROM
vTest.vMap WHERE e2 = 'a')", new String[] {}, exampleMetadata());
//$NON-NLS-1$ //$NON-NLS-2$
+ helpValidate("SELECT e2 FROM test.group2 WHERE EXISTS (SELECT e2 FROM
vTest.vMap WHERE e2 = 'a')", new String[] {}, exampleMetadata());
//$NON-NLS-1$
}
public void testValidateScalarSubquery() {
- helpValidate("SELECT e2, (SELECT e1 FROM vTest.vMap WHERE e2 = '3')
FROM test.group2", new String[] {"e1"}, exampleMetadata()); //$NON-NLS-1$
//$NON-NLS-2$ //$NON-NLS-3$
+ helpValidate("SELECT e2, (SELECT e1 FROM vTest.vMap WHERE e2 = '3')
FROM test.group2", new String[] {"e1"}, exampleMetadata()); //$NON-NLS-1$
//$NON-NLS-2$
}
public void testValidateAnyCompareSubquery() {
@@ -1633,6 +1633,8 @@
public void testValidateObjectInComparison() throws Exception {
String sql = "SELECT IntKey FROM BQT1.SmallA WHERE ObjectValue = 5";
//$NON-NLS-1$
+ ValidatorReport report = helpValidate(sql, new String[] {"ObjectValue =
5"}, FakeMetadataFactory.exampleBQTCached()); //$NON-NLS-1$
+ assertEquals("Expressions of type OBJECT, CLOB, BLOB, or XML cannot be used
in comparison: ObjectValue = 5.", report.toString()); //$NON-NLS-1$
}
public void testValidateAssignmentWithFunctionOnParameter_InServer() throws
Exception{
@@ -1737,7 +1739,7 @@
QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
// Validate
- helpValidate(sql, new String[] {"BQT1.SmallA.ObjectValue =
BQT2.SmallB.ObjectValue"}, metadata); //$NON-NLS-1$ //$NON-NLS-2$
+ helpValidate(sql, new String[] {"BQT1.SmallA.ObjectValue =
BQT2.SmallB.ObjectValue"}, metadata); //$NON-NLS-1$
}
public void testDefect16772() throws Exception{
@@ -1958,7 +1960,7 @@
}
public void testClobEquals() {
- TestValidator.helpValidate("SELECT * FROM test.group where e4 =
'1'", new String[] {"e4 = '1'"},
TestValidator.exampleMetadata2()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ TestValidator.helpValidate("SELECT * FROM test.group where e4 =
'1'", new String[] {"e4 = '1'"},
TestValidator.exampleMetadata2()); //$NON-NLS-1$ //$NON-NLS-2$
}
/**
@@ -1969,11 +1971,11 @@
}
public void testBlobLessThan() {
- TestValidator.helpValidate("SELECT * FROM test.group where e3 < ?",
new String[] {"e3 < ?"}, TestValidator.exampleMetadata2()); //$NON-NLS-1$
//$NON-NLS-2$ //$NON-NLS-3$
+ TestValidator.helpValidate("SELECT * FROM test.group where e3 < ?",
new String[] {"e3 < ?"}, TestValidator.exampleMetadata2()); //$NON-NLS-1$
//$NON-NLS-2$
}
public void testValidateCompare2() {
- helpValidate("SELECT e2 FROM test.group WHERE e4 IS NULL", new String[]
{}, exampleMetadata2()); //$NON-NLS-1$ //$NON-NLS-2$
+ helpValidate("SELECT e2 FROM test.group WHERE e4 IS NULL", new String[]
{}, exampleMetadata2()); //$NON-NLS-1$
}
public void testValidateCompare3() {