Author: shawkins
Date: 2010-08-24 17:31:16 -0400 (Tue, 24 Aug 2010)
New Revision: 2487
Modified:
branches/7.1.x/common-core/src/main/java/org/teiid/core/util/Assertion.java
branches/7.1.x/common-core/src/test/java/org/teiid/core/util/TestAssertion.java
branches/7.1.x/connectors/translator-ws/src/main/java/org/teiid/translator/ws/WSExecutionFactory.java
branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/datamgr/ConnectorWorkItem.java
branches/7.1.x/engine/src/main/java/org/teiid/query/resolver/command/UpdateProcedureResolver.java
branches/7.1.x/engine/src/main/java/org/teiid/query/sql/lang/BatchedUpdateCommand.java
branches/7.1.x/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedPlanCache.java
branches/7.1.x/engine/src/test/java/org/teiid/dqp/internal/process/TestSessionAwareCache.java
Log:
misc cleanups
Modified: branches/7.1.x/common-core/src/main/java/org/teiid/core/util/Assertion.java
===================================================================
--- branches/7.1.x/common-core/src/main/java/org/teiid/core/util/Assertion.java 2010-08-24
00:25:18 UTC (rev 2486)
+++ branches/7.1.x/common-core/src/main/java/org/teiid/core/util/Assertion.java 2010-08-24
21:31:16 UTC (rev 2487)
@@ -22,9 +22,6 @@
package org.teiid.core.util;
-import java.util.Collection;
-import java.util.Map;
-
import org.teiid.core.CorePlugin;
@@ -76,210 +73,6 @@
throw new AssertionError(msg);
}
- // ########################## boolean METHODS ###################################
-
- public static final void isEqual(boolean value1, boolean value2) {
- isEqual(value1,value2,null);
- }
-
- public static final void isEqual(boolean value1, boolean value2, String message) {
- if ( value1 != value2 ) {
- final String msg = message != null ?
- message :
-
CorePlugin.Util.getString("Assertion.isEqual",new Object[]{new
Boolean(value1),new Boolean(value2)}); //$NON-NLS-1$
- failed(msg);
- }
- }
-
- public static final void isNotEqual(boolean value1, boolean value2) {
- isNotEqual(value1,value2,null);
- }
-
- public static final void isNotEqual(boolean value1, boolean value2, String message) {
- if ( value1 == value2 ) {
- final String msg = message != null ?
- message :
-
CorePlugin.Util.getString("Assertion.isNotEqual",new Object[]{new
Boolean(value1),new Boolean(value2)}); //$NON-NLS-1$
- failed(msg);
- }
- }
-
- // ########################## int METHODS ###################################
-
- public static final void isEqual(int value1, int value2) {
- isEqual(value1,value2,null);
- }
-
- public static final void isEqual(int value1, int value2, String message) {
- if ( value1 != value2 ) {
- final String msg = message != null ?
- message :
-
CorePlugin.Util.getString("Assertion.isEqual",new Object[]{new
Integer(value1),new Integer(value2)}); //$NON-NLS-1$
- failed(msg);
- }
- }
-
- public static final void isNotEqual(int value1, int value2) {
- isNotEqual(value1,value2,null);
- }
-
- public static final void isNotEqual(int value1, int value2, String message) {
- if ( value1 == value2 ) {
- final String msg = message != null ?
- message :
-
CorePlugin.Util.getString("Assertion.isNotEqual",new Object[]{new
Integer(value1),new Integer(value2)}); //$NON-NLS-1$
- failed(msg);
- }
- }
-
- public static final void isNonNegative(int value) {
- isNonNegative(value,null);
- }
-
- public static final void isNonNegative(int value, String message) {
- if ( value < 0 ) {
- final String msg = message != null ?
- message :
-
CorePlugin.Util.getString("Assertion.isNonNegative",new Object[]{new
Integer(value)}); //$NON-NLS-1$
- failed(msg);
- }
- }
-
- public static final void isNonPositive(int value) {
- isNonPositive(value,null);
- }
-
- public static final void isNonPositive(int value, String message) {
- if ( value > 0 ) {
- final String msg = message != null ?
- message :
-
CorePlugin.Util.getString("Assertion.isNonPositive",new Object[]{new
Integer(value)}); //$NON-NLS-1$
- failed(msg);
- }
- }
-
- public static final void isNegative(int value) {
- isNegative(value,null);
- }
-
- public static final void isNegative(int value, String message) {
- if ( value >= 0 ) {
- final String msg = message != null ?
- message :
-
CorePlugin.Util.getString("Assertion.isNegative",new Object[]{new
Integer(value)}); //$NON-NLS-1$
- failed(msg);
- }
- }
-
- public static final void isPositive(int value) {
- isPositive(value,null);
- }
-
- public static final void isPositive(int value, String message) {
- if ( value <= 0 ) {
- final String msg = message != null ?
- message :
-
CorePlugin.Util.getString("Assertion.isPositive",new Object[]{new
Integer(value)}); //$NON-NLS-1$
- failed(msg);
- }
- }
-
- // ########################## long METHODS ###################################
-
- public static final void isEqual(long value1, long value2) {
- isEqual(value1,value2,null);
- }
-
- public static final void isEqual(long value1, long value2, String message) {
- if ( value1 != value2 ) {
- final String msg = message != null ?
- message :
-
CorePlugin.Util.getString("Assertion.isEqual",new Object[]{new Long(value1),new
Long(value2)}); //$NON-NLS-1$
- failed(msg);
- }
- }
-
- public static final void isNotEqual(long value1, long value2) {
- isNotEqual(value1,value2,null);
- }
-
- public static final void isNotEqual(long value1, long value2, String message) {
- if ( value1 == value2 ) {
- final String msg = message != null ?
- message :
-
CorePlugin.Util.getString("Assertion.isNotEqual",new Object[]{new
Long(value1),new Long(value2)}); //$NON-NLS-1$
- failed(msg);
- }
- }
-
- public static final void isNonNegative(long value) {
- isNonNegative(value,null);
- }
-
- public static final void isNonNegative(long value, String message) {
- if ( value < 0 ) {
- final String msg = message != null ?
- message :
-
CorePlugin.Util.getString("Assertion.isNonNegative",new Object[]{new
Long(value)}); //$NON-NLS-1$
- failed(msg);
- }
- }
-
- public static final void isNonPositive(long value) {
- isNonPositive(value,null);
- }
-
- public static final void isNonPositive(long value, String message) {
- if ( value > 0 ) {
- final String msg = message != null ?
- message :
-
CorePlugin.Util.getString("Assertion.isNonPositive",new Object[]{new
Long(value)}); //$NON-NLS-1$
- failed(msg);
- }
- }
-
- public static final void isNegative(long value) {
- isNegative(value,null);
- }
-
- public static final void isNegative(long value, String message) {
- if ( value >= 0 ) {
- final String msg = message != null ?
- message :
-
CorePlugin.Util.getString("Assertion.isNegative",new Object[]{new Long(value)});
//$NON-NLS-1$
- failed(msg);
- }
- }
-
- public static final void isPositive(long value) {
- isPositive(value,null);
- }
-
- public static final void isPositive(long value, String message) {
- if ( value <= 0 ) {
- final String msg = message != null ?
- message :
-
CorePlugin.Util.getString("Assertion.isPositive",new Object[]{new Long(value)});
//$NON-NLS-1$
- failed(msg);
- }
- }
-
- // ########################## String METHODS ###################################
-
- public static final void isNotZeroLength(String value) {
- isNotZeroLength(value,null);
- }
-
- public static final void isNotZeroLength(String value, String message) {
- isNotNull(value);
- if ( value.length() == 0 ) {
- final String msg = message != null ?
- message :
-
CorePlugin.Util.getString("Assertion.isNotZeroLength"); //$NON-NLS-1$
- failed(msg);
- }
- }
-
// ########################## OBJECT METHODS ###################################
public static final void isNull(Object value) {
@@ -308,61 +101,6 @@
}
}
- /**
- * Compares with object1 == object2.
- */
- public static final void isIdentical(Object object1, Object object2) {
- isIdentical(object1,object2,null);
- }
-
- /**
- * Compares with object1 == object2.
- */
- public static final void isIdentical(Object object1, Object object2, String message) {
- if ( object1 != object2 ) {
- final String msg = message != null ?
- message :
-
CorePlugin.Util.getString("Assertion.isIdentical",new
Object[]{object1,object2}); //$NON-NLS-1$
- failed(msg);
- }
- }
-
- /**
- * Compares with object1.equals(object2).
- */
- public static final void isEqual(Object object1, Object object2) {
- isEqual(object1,object2,null);
- }
-
- /**
- * Compares with object1.equals(object2).
- */
- public static final void isEqual(Object object1, Object object2, String message) {
- if(object1 == null) {
- if ( object2 != null ) {
- final String msg = message != null ?
- message :
-
CorePlugin.Util.getString("Assertion.isEqual",new Object[]{object1,object2});
//$NON-NLS-1$
- failed(msg);
- }
- // else both are null
- } else {
- if ( object2 == null ) {
- final String msg = message != null ?
- message :
-
CorePlugin.Util.getString("Assertion.isEqual",new Object[]{object1,object2});
//$NON-NLS-1$
- failed(msg);
- }
- // else both are not null
- if ( !object1.equals(object2) ) {
- final String msg = message != null ?
- message :
-
CorePlugin.Util.getString("Assertion.isEqual",new Object[]{object1,object2});
//$NON-NLS-1$
- failed(msg);
- }
- }
- }
-
/**
* Verifies that the specified value is an instance of the specified class.
* @param value The value to verify
@@ -371,74 +109,17 @@
* @throws ClassCastException If the value is not an instance of the specified
class.
* @since 2.1
*/
- public static final Object isInstanceOf(final Object object, final Class
expectedClass, final String name) {
+ public static final <T> T isInstanceOf(final Object object, final
Class<T> expectedClass, final String name) {
if (object == null) {
return null;
}
- final Class objClass = object.getClass();
+ final Class<?> objClass = object.getClass();
if (!expectedClass.isAssignableFrom(objClass)) {
final Object[] params = new Object[]{name, expectedClass,
objClass.getName()};
final String msg =
CorePlugin.Util.getString("Assertion.invalidClassMessage",params);
//$NON-NLS-1$
throw new ClassCastException(msg);
}
- return object;
+ return expectedClass.cast(object);
}
- // ########################## COLLECTION METHODS ###################################
-
- public static final void isNotEmpty(Collection collection) {
- isNotEmpty(collection,null);
- }
-
- public static final void isNotEmpty(Collection collection, String message) {
- isNotNull(collection);
- if ( collection.isEmpty() ) {
- final String msg = message != null ?
- message :
-
CorePlugin.Util.getString("Assertion.isNotEmpty_Collection"); //$NON-NLS-1$
- failed(msg);
- }
- }
-
- public static final void isNotEmpty(Map map) {
- isNotEmpty(map,null);
- }
-
- public static final void isNotEmpty(Map map, String message) {
- isNotNull(map);
- if ( map.isEmpty() ) {
- final String msg = message != null ?
- message :
-
CorePlugin.Util.getString("Assertion.isNotEmpty_Map"); //$NON-NLS-1$
- failed(msg);
- }
- }
-
- public static final void contains(Collection collection, Object value) {
- contains(collection,value,null);
- }
-
- public static final void contains(Collection collection, Object value, String
message) {
- isNotNull(collection);
- if ( !collection.contains(value) ) {
- final String msg = message != null ?
- message :
-
CorePlugin.Util.getString("Assertion.contains_Collection"); //$NON-NLS-1$
- failed(msg);
- }
- }
-
- public static final void containsKey(Map map, Object key) {
- containsKey(map,key,null);
- }
-
- public static final void containsKey(Map map, Object key, String message) {
- isNotNull(map);
- if ( !map.containsKey(key) ) {
- final String msg = message != null ?
- message :
-
CorePlugin.Util.getString("Assertion.contains_Map"); //$NON-NLS-1$
- failed(msg);
- }
- }
}
Modified: branches/7.1.x/common-core/src/test/java/org/teiid/core/util/TestAssertion.java
===================================================================
---
branches/7.1.x/common-core/src/test/java/org/teiid/core/util/TestAssertion.java 2010-08-24
00:25:18 UTC (rev 2486)
+++
branches/7.1.x/common-core/src/test/java/org/teiid/core/util/TestAssertion.java 2010-08-24
21:31:16 UTC (rev 2487)
@@ -93,619 +93,6 @@
}
/*
- * Test for void isEqual(boolean, boolean)
- */
- public void testIsEqualbooleanboolean() {
- Assertion.isEqual(true,true);
- Assertion.isEqual(false,false);
-
- try {
- Assertion.isEqual(false,true);
- fail();
- } catch ( AssertionError e ) {
- // expected, but check the message
- final Object[] params = new Object[]{new Boolean(false),new Boolean(true)};
- final String msg =
CorePlugin.Util.getString("Assertion.isEqual",params); //$NON-NLS-1$
- assertEquals(msg, e.getMessage());
- }
- }
-
- /*
- * Test for void isEqual(boolean, boolean, String)
- */
- public void testIsEqualbooleanbooleanString() {
- Assertion.isEqual(true,true,TEST_MESSAGE);
- Assertion.isEqual(false,false,TEST_MESSAGE);
-
- try {
- Assertion.isEqual(false,true,TEST_MESSAGE);
- fail();
- } catch ( AssertionError e ) {
- // expected, but check the message
- assertEquals(TEST_MESSAGE, e.getMessage());
- }
- }
-
- /*
- * Test for void isNotEqual(boolean, boolean)
- */
- public void testIsNotEqualbooleanboolean() {
- Assertion.isNotEqual(false,true);
- Assertion.isNotEqual(true,false);
-
- try {
- Assertion.isNotEqual(false,false);
- fail();
- } catch ( AssertionError e ) {
- // expected, but check the message
- final Object[] params = new Object[]{new Boolean(false),new Boolean(false)};
- final String msg =
CorePlugin.Util.getString("Assertion.isNotEqual",params); //$NON-NLS-1$
- assertEquals(msg, e.getMessage());
- }
- }
-
- /*
- * Test for void isNotEqual(boolean, boolean, String)
- */
- public void testIsNotEqualbooleanbooleanString() {
- Assertion.isNotEqual(false,true,TEST_MESSAGE);
- Assertion.isNotEqual(true,false,TEST_MESSAGE);
-
- try {
- Assertion.isNotEqual(false,false,TEST_MESSAGE);
- fail();
- } catch ( AssertionError e ) {
- // expected, but check the message
- assertEquals(TEST_MESSAGE, e.getMessage());
- }
- }
-
- /*
- * Test for void isEqual(int, int)
- */
- public void testIsEqualintint() {
- Assertion.isEqual(-1,-1);
- Assertion.isEqual(1,1);
- Assertion.isEqual(0,0);
- Assertion.isEqual(10000,10000);
-
- try {
- Assertion.isEqual(1,-1);
- fail();
- } catch ( AssertionError e ) {
- // expected, but check the message
- final Object[] params = new Object[]{new Integer(1),new Integer(-1)};
- final String msg =
CorePlugin.Util.getString("Assertion.isEqual",params); //$NON-NLS-1$
- assertEquals(msg, e.getMessage());
- }
- }
-
- /*
- * Test for void isEqual(int, int, String)
- */
- public void testIsEqualintintString() {
- Assertion.isEqual(-1,-1,TEST_MESSAGE);
- Assertion.isEqual(1,1,TEST_MESSAGE);
- Assertion.isEqual(0,0,TEST_MESSAGE);
- Assertion.isEqual(10000,10000,TEST_MESSAGE);
-
- try {
- Assertion.isEqual(1,-1,TEST_MESSAGE);
- fail();
- } catch ( AssertionError e ) {
- // expected, but check the message
- assertEquals(TEST_MESSAGE, e.getMessage());
- }
- }
-
- /*
- * Test for void isNotEqual(int, int)
- */
- public void testIsNotEqualintint() {
- Assertion.isNotEqual(-1,-12);
- Assertion.isNotEqual(1,-1);
- Assertion.isNotEqual(0,1);
- Assertion.isNotEqual(10000,-10000);
-
- try {
- Assertion.isNotEqual(1,1);
- fail();
- } catch ( AssertionError e ) {
- // expected, but check the message
- final Object[] params = new Object[]{new Integer(1),new Integer(1)};
- final String msg =
CorePlugin.Util.getString("Assertion.isNotEqual",params); //$NON-NLS-1$
- assertEquals(msg, e.getMessage());
- }
- }
-
- /*
- * Test for void isNotEqual(int, int, String)
- */
- public void testIsNotEqualintintString() {
- Assertion.isNotEqual(-1,-12,TEST_MESSAGE);
- Assertion.isNotEqual(1,-1,TEST_MESSAGE);
- Assertion.isNotEqual(0,1,TEST_MESSAGE);
- Assertion.isNotEqual(10000,-10000,TEST_MESSAGE);
-
- try {
- Assertion.isNotEqual(1,1,TEST_MESSAGE);
- fail();
- } catch ( AssertionError e ) {
- // expected, but check the message
- assertEquals(TEST_MESSAGE, e.getMessage());
- }
- }
-
- /*
- * Test for void isNonNegative(int)
- */
- public void testIsNonNegativeint() {
- Assertion.isNonNegative(1);
- Assertion.isNonNegative(13);
- Assertion.isNonNegative(0);
-
- try {
- Assertion.isNonNegative(-1);
- fail();
- } catch ( AssertionError e ) {
- // expected, but check the message
- final Object[] params = new Object[]{new Integer(-1)};
- final String msg =
CorePlugin.Util.getString("Assertion.isNonNegative",params); //$NON-NLS-1$
- assertEquals(msg, e.getMessage());
- }
- }
-
- /*
- * Test for void isNonNegative(int, String)
- */
- public void testIsNonNegativeintString() {
- Assertion.isNonNegative(1,TEST_MESSAGE);
- Assertion.isNonNegative(13,TEST_MESSAGE);
- Assertion.isNonNegative(0,TEST_MESSAGE);
-
- try {
- Assertion.isNonNegative(-1,TEST_MESSAGE);
- fail();
- } catch ( AssertionError e ) {
- // expected, but check the message
- assertEquals(TEST_MESSAGE, e.getMessage());
- }
- }
-
- /*
- * Test for void isNonPositive(int)
- */
- public void testIsNonPositiveint() {
- Assertion.isNonPositive(-1);
- Assertion.isNonPositive(0);
- Assertion.isNonPositive(-100);
-
- try {
- Assertion.isNonPositive(1);
- fail();
- } catch ( AssertionError e ) {
- // expected, but check the message
- final Object[] params = new Object[]{new Integer(1)};
- final String msg =
CorePlugin.Util.getString("Assertion.isNonPositive",params); //$NON-NLS-1$
- assertEquals(msg, e.getMessage());
- }
- }
-
- /*
- * Test for void isNonPositive(int, String)
- */
- public void testIsNonPositiveintString() {
- Assertion.isNonPositive(-1,TEST_MESSAGE);
- Assertion.isNonPositive(0,TEST_MESSAGE);
- Assertion.isNonPositive(-100,TEST_MESSAGE);
-
- try {
- Assertion.isNonPositive(1,TEST_MESSAGE);
- fail();
- } catch ( AssertionError e ) {
- // expected, but check the message
- assertEquals(TEST_MESSAGE, e.getMessage());
- }
- }
-
- /*
- * Test for void isNegative(int)
- */
- public void testIsNegativeint() {
- Assertion.isNegative(-1);
- Assertion.isNegative(-100);
-
- try {
- Assertion.isNegative(1);
- fail();
- } catch ( AssertionError e ) {
- // expected, but check the message
- final Object[] params = new Object[]{new Integer(1)};
- final String msg =
CorePlugin.Util.getString("Assertion.isNegative",params); //$NON-NLS-1$
- assertEquals(msg, e.getMessage());
- }
- try {
- Assertion.isNegative(0);
- fail();
- } catch ( AssertionError e ) {
- // expected, but check the message
- final Object[] params = new Object[]{new Integer(0)};
- final String msg =
CorePlugin.Util.getString("Assertion.isNegative",params); //$NON-NLS-1$
- assertEquals(msg, e.getMessage());
- }
- }
-
- /*
- * Test for void isNegative(int, String)
- */
- public void testIsNegativeintString() {
- Assertion.isNegative(-1,TEST_MESSAGE);
- Assertion.isNegative(-100,TEST_MESSAGE);
-
- try {
- Assertion.isNegative(1,TEST_MESSAGE);
- fail();
- } catch ( AssertionError e ) {
- // expected, but check the message
- assertEquals(TEST_MESSAGE, e.getMessage());
- }
- try {
- Assertion.isNegative(0,TEST_MESSAGE);
- fail();
- } catch ( AssertionError e ) {
- // expected, but check the message
- assertEquals(TEST_MESSAGE, e.getMessage());
- }
- }
-
- /*
- * Test for void isPositive(int)
- */
- public void testIsPositiveint() {
- Assertion.isPositive(1);
- Assertion.isPositive(100);
-
- try {
- Assertion.isPositive(-1);
- fail();
- } catch ( AssertionError e ) {
- // expected, but check the message
- final Object[] params = new Object[]{new Integer(-1)};
- final String msg =
CorePlugin.Util.getString("Assertion.isPositive",params); //$NON-NLS-1$
- assertEquals(msg, e.getMessage());
- }
- try {
- Assertion.isPositive(0);
- fail();
- } catch ( AssertionError e ) {
- // expected, but check the message
- final Object[] params = new Object[]{new Integer(0)};
- final String msg =
CorePlugin.Util.getString("Assertion.isPositive",params); //$NON-NLS-1$
- assertEquals(msg, e.getMessage());
- }
- }
-
- /*
- * Test for void isPositive(int, String)
- */
- public void testIsPositiveintString() {
- Assertion.isPositive(1,TEST_MESSAGE);
- Assertion.isPositive(100,TEST_MESSAGE);
-
- try {
- Assertion.isPositive(-1,TEST_MESSAGE);
- fail();
- } catch ( AssertionError e ) {
- // expected, but check the message
- assertEquals(TEST_MESSAGE, e.getMessage());
- }
- try {
- Assertion.isPositive(0,TEST_MESSAGE);
- fail();
- } catch ( AssertionError e ) {
- // expected, but check the message
- assertEquals(TEST_MESSAGE, e.getMessage());
- }
- }
-
- /*
- * Test for void isEqual(long, long)
- */
- public void testIsEquallonglong() {
- Assertion.isEqual(-1l,-1l);
- Assertion.isEqual(1l,1l);
- Assertion.isEqual(0l,0l);
- Assertion.isEqual(10000l,10000l);
-
- try {
- Assertion.isEqual(1l,-1l);
- fail();
- } catch ( AssertionError e ) {
- // expected, but check the message
- final Object[] params = new Object[]{new Long(1),new Long(-1)};
- final String msg =
CorePlugin.Util.getString("Assertion.isEqual",params); //$NON-NLS-1$
- assertEquals(msg, e.getMessage());
- }
- }
-
- /*
- * Test for void isEqual(long, long, String)
- */
- public void testIsEquallonglongString() {
- Assertion.isEqual(-1l,-1l,TEST_MESSAGE);
- Assertion.isEqual(1l,1l,TEST_MESSAGE);
- Assertion.isEqual(0l,0l,TEST_MESSAGE);
- Assertion.isEqual(10000l,10000l,TEST_MESSAGE);
-
- try {
- Assertion.isEqual(1l,-1l,TEST_MESSAGE);
- fail();
- } catch ( AssertionError e ) {
- // expected, but check the message
- assertEquals(TEST_MESSAGE, e.getMessage());
- }
- }
-
- /*
- * Test for void isNotEqual(long, long)
- */
- public void testIsNotEquallonglong() {
- Assertion.isNotEqual(-1l,-12l);
- Assertion.isNotEqual(1l,12l);
- Assertion.isNotEqual(0l,-20l);
- Assertion.isNotEqual(10000l,-10000l);
-
- try {
- Assertion.isNotEqual(1l,1l);
- fail();
- } catch ( AssertionError e ) {
- // expected, but check the message
- final Object[] params = new Object[]{new Long(1l),new Long(1l)};
- final String msg =
CorePlugin.Util.getString("Assertion.isNotEqual",params); //$NON-NLS-1$
- assertEquals(msg, e.getMessage());
- }
- }
-
- /*
- * Test for void isNotEqual(long, long, String)
- */
- public void testIsNotEquallonglongString() {
- Assertion.isNotEqual(-1l,-12l,TEST_MESSAGE);
- Assertion.isNotEqual(1l,12l,TEST_MESSAGE);
- Assertion.isNotEqual(0l,-20l,TEST_MESSAGE);
- Assertion.isNotEqual(10000l,-10000l,TEST_MESSAGE);
-
- try {
- Assertion.isNotEqual(1l,1l,TEST_MESSAGE);
- fail();
- } catch ( AssertionError e ) {
- // expected, but check the message
- assertEquals(TEST_MESSAGE, e.getMessage());
- }
- }
-
- /*
- * Test for void isNonNegative(long)
- */
- public void testIsNonNegativelong() {
- Assertion.isNonNegative(1l);
- Assertion.isNonNegative(13l);
- Assertion.isNonNegative(0l);
-
- try {
- Assertion.isNonNegative(-1l);
- fail();
- } catch ( AssertionError e ) {
- // expected, but check the message
- final Object[] params = new Object[]{new Long(-1l)};
- final String msg =
CorePlugin.Util.getString("Assertion.isNonNegative",params); //$NON-NLS-1$
- assertEquals(msg, e.getMessage());
- }
- }
-
- /*
- * Test for void isNonNegative(long, String)
- */
- public void testIsNonNegativelongString() {
- Assertion.isNonNegative(1l,TEST_MESSAGE);
- Assertion.isNonNegative(13l,TEST_MESSAGE);
- Assertion.isNonNegative(0l,TEST_MESSAGE);
-
- try {
- Assertion.isNonNegative(-1l,TEST_MESSAGE);
- fail();
- } catch ( AssertionError e ) {
- // expected, but check the message
- assertEquals(TEST_MESSAGE, e.getMessage());
- }
- }
-
- /*
- * Test for void isNonPositive(long)
- */
- public void testIsNonPositivelong() {
- Assertion.isNonPositive(-1l);
- Assertion.isNonPositive(0l);
- Assertion.isNonPositive(-100l);
-
- try {
- Assertion.isNonPositive(1l);
- fail();
- } catch ( AssertionError e ) {
- // expected, but check the message
- final Object[] params = new Object[]{new Long(1)};
- final String msg =
CorePlugin.Util.getString("Assertion.isNonPositive",params); //$NON-NLS-1$
- assertEquals(msg, e.getMessage());
- }
- }
-
- /*
- * Test for void isNonPositive(long, String)
- */
- public void testIsNonPositivelongString() {
- Assertion.isNonPositive(-1l,TEST_MESSAGE);
- Assertion.isNonPositive(0l,TEST_MESSAGE);
- Assertion.isNonPositive(-100l,TEST_MESSAGE);
-
- try {
- Assertion.isNonPositive(1l,TEST_MESSAGE);
- fail();
- } catch ( AssertionError e ) {
- // expected, but check the message
- assertEquals(TEST_MESSAGE, e.getMessage());
- }
- }
-
- /*
- * Test for void isNegative(long)
- */
- public void testIsNegativelong() {
- Assertion.isNegative(-1l);
- Assertion.isNegative(-100l);
-
- try {
- Assertion.isNegative(1l);
- fail();
- } catch ( AssertionError e ) {
- // expected, but check the message
- final Object[] params = new Object[]{new Long(1)};
- final String msg =
CorePlugin.Util.getString("Assertion.isNegative",params); //$NON-NLS-1$
- assertEquals(msg, e.getMessage());
- }
- try {
- Assertion.isNegative(0l);
- fail();
- } catch ( AssertionError e ) {
- // expected, but check the message
- final Object[] params = new Object[]{new Long(0)};
- final String msg =
CorePlugin.Util.getString("Assertion.isNegative",params); //$NON-NLS-1$
- assertEquals(msg, e.getMessage());
- }
- }
-
- /*
- * Test for void isNegative(long, String)
- */
- public void testIsNegativelongString() {
- Assertion.isNegative(-1l,TEST_MESSAGE);
- Assertion.isNegative(-100l,TEST_MESSAGE);
-
- try {
- Assertion.isNegative(1l,TEST_MESSAGE);
- fail();
- } catch ( AssertionError e ) {
- // expected, but check the message
- assertEquals(TEST_MESSAGE, e.getMessage());
- }
- try {
- Assertion.isNegative(0l,TEST_MESSAGE);
- fail();
- } catch ( AssertionError e ) {
- // expected, but check the message
- assertEquals(TEST_MESSAGE, e.getMessage());
- }
- }
-
- /*
- * Test for void isPositive(long)
- */
- public void testIsPositivelong() {
- Assertion.isPositive(1l);
- Assertion.isPositive(100l);
-
- try {
- Assertion.isPositive(-1l);
- fail();
- } catch ( AssertionError e ) {
- // expected, but check the message
- final Object[] params = new Object[]{new Long(-1)};
- final String msg =
CorePlugin.Util.getString("Assertion.isPositive",params); //$NON-NLS-1$
- assertEquals(msg, e.getMessage());
- }
- try {
- Assertion.isPositive(0l);
- fail();
- } catch ( AssertionError e ) {
- // expected, but check the message
- final Object[] params = new Object[]{new Long(0)};
- final String msg =
CorePlugin.Util.getString("Assertion.isPositive",params); //$NON-NLS-1$
- assertEquals(msg, e.getMessage());
- }
- }
-
- /*
- * Test for void isPositive(long, String)
- */
- public void testIsPositivelongString() {
- Assertion.isPositive(1l,TEST_MESSAGE);
- Assertion.isPositive(100l,TEST_MESSAGE);
-
- try {
- Assertion.isPositive(-1l,TEST_MESSAGE);
- fail();
- } catch ( AssertionError e ) {
- // expected, but check the message
- assertEquals(TEST_MESSAGE, e.getMessage());
- }
- try {
- Assertion.isPositive(0l,TEST_MESSAGE);
- fail();
- } catch ( AssertionError e ) {
- // expected, but check the message
- assertEquals(TEST_MESSAGE, e.getMessage());
- }
- }
-
- /*
- * Test for void isNotZeroLength(String)
- */
- public void testIsNotZeroLengthString() {
- Assertion.isNotZeroLength("This is a string"); //$NON-NLS-1$
- Assertion.isNotZeroLength(" "); //$NON-NLS-1$
-
- try {
- Assertion.isNotZeroLength(""); //$NON-NLS-1$
- fail();
- } catch ( AssertionError e ) {
- // expected, but check the message
- final String msg =
CorePlugin.Util.getString("Assertion.isNotZeroLength"); //$NON-NLS-1$
- assertEquals(msg, e.getMessage());
- }
- try {
- Assertion.isNotZeroLength(null);
- fail();
- } catch ( AssertionError e ) {
- // expected, but check the message
- final String msg =
CorePlugin.Util.getString("Assertion.isNotNull"); //$NON-NLS-1$
- assertEquals(msg, e.getMessage());
- }
- }
-
- /*
- * Test for void isNotZeroLength(String, String)
- */
- public void testIsNotZeroLengthStringString() {
- Assertion.isNotZeroLength("This is a string",TEST_MESSAGE);
//$NON-NLS-1$
- Assertion.isNotZeroLength(" ",TEST_MESSAGE); //$NON-NLS-1$
-
- try {
- Assertion.isNotZeroLength("",TEST_MESSAGE); //$NON-NLS-1$
- fail();
- } catch ( AssertionError e ) {
- // expected, but check the message
- assertEquals(TEST_MESSAGE, e.getMessage());
- }
- try {
- Assertion.isNotZeroLength(null,TEST_MESSAGE);
- fail();
- } catch ( AssertionError e ) {
- // expected, but check the message
- final String msg =
CorePlugin.Util.getString("Assertion.isNotNull"); //$NON-NLS-1$
- assertEquals(msg, e.getMessage());
- }
- }
-
- /*
* Test for void isNull(Object)
*/
public void testIsNullObject() {
@@ -767,86 +154,6 @@
}
}
- /*
- * Test for void isIdentical(Object, Object)
- */
- public void testIsIdenticalObjectObject() {
- final String obj1 = ""; //$NON-NLS-1$
- final Integer int1 = new Integer(33);
- Assertion.isIdentical(obj1,obj1);
- Assertion.isIdentical(int1,int1);
-
- try {
- Assertion.isIdentical(int1,obj1);
- fail();
- } catch ( AssertionError e ) {
- // expected, but check the message
- final Object[] params = new Object[]{int1,obj1};
- final String msg =
CorePlugin.Util.getString("Assertion.isIdentical",params); //$NON-NLS-1$
- assertEquals(msg, e.getMessage());
- }
- }
-
- /*
- * Test for void isIdentical(Object, Object, String)
- */
- public void testIsIdenticalObjectObjectString() {
- final String obj1 = ""; //$NON-NLS-1$
- final Integer int1 = new Integer(33);
- Assertion.isIdentical(obj1,obj1,TEST_MESSAGE);
- Assertion.isIdentical(int1,int1,TEST_MESSAGE);
-
- try {
- Assertion.isIdentical(int1,obj1,TEST_MESSAGE);
- fail();
- } catch ( AssertionError e ) {
- // expected, but check the message
- assertEquals(TEST_MESSAGE, e.getMessage());
- }
- }
-
- /*
- * Test for void isEqual(Object, Object)
- */
- public void testIsEqualObjectObject() {
- final String obj1 = ""; //$NON-NLS-1$
- final String obj2 = ""; //$NON-NLS-1$
- final Integer int1 = new Integer(33);
- final Integer int2 = new Integer(33);
- Assertion.isEqual(obj1,obj2);
- Assertion.isEqual(int1,int2);
-
- try {
- Assertion.isEqual(int1,obj1);
- fail();
- } catch ( AssertionError e ) {
- // expected, but check the message
- final Object[] params = new Object[]{int1,obj1};
- final String msg =
CorePlugin.Util.getString("Assertion.isEqual",params); //$NON-NLS-1$
- assertEquals(msg, e.getMessage());
- }
- }
-
- /*
- * Test for void isEqual(Object, Object, String)
- */
- public void testIsEqualObjectObjectString() {
- final String obj1 = ""; //$NON-NLS-1$
- final String obj2 = ""; //$NON-NLS-1$
- final Integer int1 = new Integer(33);
- final Integer int2 = new Integer(33);
- Assertion.isEqual(obj1,obj2,TEST_MESSAGE);
- Assertion.isEqual(int1,int2,TEST_MESSAGE);
-
- try {
- Assertion.isEqual(int1,obj1,TEST_MESSAGE);
- fail();
- } catch ( AssertionError e ) {
- // expected, but check the message
- assertEquals(TEST_MESSAGE, e.getMessage());
- }
- }
-
public void testIsInstanceOf() {
Assertion.isInstanceOf(new Integer(1),Integer.class,"name");
//$NON-NLS-1$
Assertion.isInstanceOf("asdfasdf",String.class,"name2");
//$NON-NLS-1$ //$NON-NLS-2$
Modified:
branches/7.1.x/connectors/translator-ws/src/main/java/org/teiid/translator/ws/WSExecutionFactory.java
===================================================================
---
branches/7.1.x/connectors/translator-ws/src/main/java/org/teiid/translator/ws/WSExecutionFactory.java 2010-08-24
00:25:18 UTC (rev 2486)
+++
branches/7.1.x/connectors/translator-ws/src/main/java/org/teiid/translator/ws/WSExecutionFactory.java 2010-08-24
21:31:16 UTC (rev 2487)
@@ -132,7 +132,7 @@
//can be one of string, xml, clob
param = metadataFactory.addProcedureParameter("request",
TypeFacility.RUNTIME_NAMES.XML, Type.In, p); //$NON-NLS-1$
- param.setAnnotation("The XML document or root element that represents the request.
If the ExecutionFactory is configured in with a DefaultServiceMode or MESSAGE then SOAP
request must contain the entire SOAP message."); //$NON-NLS-1$
+ param.setAnnotation("The XML document or root element that represents the request.
If the ExecutionFactory is configured in with a DefaultServiceMode of MESSAGE, then the
SOAP request must contain the entire SOAP message."); //$NON-NLS-1$
param.setNullType(NullType.Nullable);
param = metadataFactory.addProcedureParameter("endpoint",
TypeFacility.RUNTIME_NAMES.STRING, Type.In, p); //$NON-NLS-1$
Modified:
branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/datamgr/ConnectorWorkItem.java
===================================================================
---
branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/datamgr/ConnectorWorkItem.java 2010-08-24
00:25:18 UTC (rev 2486)
+++
branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/datamgr/ConnectorWorkItem.java 2010-08-24
21:31:16 UTC (rev 2487)
@@ -219,15 +219,13 @@
// Create the execution based on mode
final Execution exec = connector.createExecution(this.translatedCommand,
this.securityContext, rmd, this.connection);
if (this.translatedCommand instanceof Call) {
- Assertion.isInstanceOf(this.execution, ProcedureExecution.class, "Call
Executions are expected to be ProcedureExecutions"); //$NON-NLS-1$
- this.execution = (ProcedureExecution)exec;
+ this.execution = Assertion.isInstanceOf(this.execution,
ProcedureExecution.class, "Call Executions are expected to be
ProcedureExecutions"); //$NON-NLS-1$
StoredProcedure proc = (StoredProcedure)command;
if (proc.returnParameters()) {
this.procedureBatchHandler = new
ProcedureBatchHandler((Call)this.translatedCommand, (ProcedureExecution)this.execution);
}
} else if (this.translatedCommand instanceof QueryExpression){
- Assertion.isInstanceOf(this.execution, ResultSetExecution.class,
"QueryExpression Executions are expected to be ResultSetExecutions");
//$NON-NLS-1$
- this.execution = (ResultSetExecution)exec;
+ this.execution = Assertion.isInstanceOf(this.execution,
ResultSetExecution.class, "QueryExpression Executions are expected to be
ResultSetExecutions"); //$NON-NLS-1$
} else {
Assertion.isInstanceOf(this.execution, UpdateExecution.class, "Update
Executions are expected to be UpdateExecutions"); //$NON-NLS-1$
this.execution = new ResultSetExecution() {
Modified:
branches/7.1.x/engine/src/main/java/org/teiid/query/resolver/command/UpdateProcedureResolver.java
===================================================================
---
branches/7.1.x/engine/src/main/java/org/teiid/query/resolver/command/UpdateProcedureResolver.java 2010-08-24
00:25:18 UTC (rev 2486)
+++
branches/7.1.x/engine/src/main/java/org/teiid/query/resolver/command/UpdateProcedureResolver.java 2010-08-24
21:31:16 UTC (rev 2487)
@@ -70,7 +70,6 @@
import org.teiid.query.sql.symbol.ElementSymbol;
import org.teiid.query.sql.symbol.Expression;
import org.teiid.query.sql.symbol.GroupSymbol;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
import org.teiid.query.sql.util.SymbolMap;
import org.teiid.query.sql.visitor.ValueIteratorProviderCollectorVisitor;
import org.teiid.query.util.ErrorMessageKeys;
@@ -115,7 +114,7 @@
// then in the query transformation, this info is used in evaluating/validating
// has criteria/translate criteria clauses
Command transformCmd = getQueryTransformCmd(virtualGroup, metadata);
- Map symbolMap = SymbolMap.createSymbolMap(virtualGroup,
(List<SingleElementSymbol>)transformCmd.getProjectedSymbols(), metadata).asMap();
+ Map symbolMap = SymbolMap.createSymbolMap(virtualGroup,
transformCmd.getProjectedSymbols(), metadata).asMap();
procCommand.setSymbolMap(symbolMap);
}
Modified:
branches/7.1.x/engine/src/main/java/org/teiid/query/sql/lang/BatchedUpdateCommand.java
===================================================================
---
branches/7.1.x/engine/src/main/java/org/teiid/query/sql/lang/BatchedUpdateCommand.java 2010-08-24
00:25:18 UTC (rev 2486)
+++
branches/7.1.x/engine/src/main/java/org/teiid/query/sql/lang/BatchedUpdateCommand.java 2010-08-24
21:31:16 UTC (rev 2487)
@@ -25,14 +25,9 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
-import java.util.Iterator;
import java.util.List;
-import org.teiid.api.exception.query.QueryMetadataException;
-import org.teiid.core.TeiidComponentException;
-import org.teiid.query.metadata.QueryMetadataInterface;
import org.teiid.query.sql.LanguageVisitor;
-import org.teiid.query.sql.symbol.GroupSymbol;
import org.teiid.query.sql.util.VariableContext;
Modified:
branches/7.1.x/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedPlanCache.java
===================================================================
---
branches/7.1.x/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedPlanCache.java 2010-08-24
00:25:18 UTC (rev 2486)
+++
branches/7.1.x/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedPlanCache.java 2010-08-24
21:31:16 UTC (rev 2487)
@@ -62,7 +62,7 @@
//No PreparedPlan at the begining
assertNull(cache.get(id));
//create one
- cache.put(id, FunctionMethod.SESSION_DETERMINISTIC, new PreparedPlan());
+ cache.put(id, FunctionMethod.SESSION_DETERMINISTIC, new PreparedPlan(), null);
//should have one now
assertNotNull("Unable to get prepared plan from cache", cache.get(id));
//$NON-NLS-1$
}
@@ -149,7 +149,7 @@
CacheID id = new CacheID(session, pi, dummy.toString());
PreparedPlan pPlan = new PreparedPlan();
- cache.put(id, FunctionMethod.SESSION_DETERMINISTIC, pPlan);
+ cache.put(id, FunctionMethod.SESSION_DETERMINISTIC, pPlan, null);
pPlan.setCommand(dummy);
pPlan.setPlan(new RelationalPlan(new ProjectNode(i)));
AnalysisRecord analysisRecord = new AnalysisRecord(true, false);
Modified:
branches/7.1.x/engine/src/test/java/org/teiid/dqp/internal/process/TestSessionAwareCache.java
===================================================================
---
branches/7.1.x/engine/src/test/java/org/teiid/dqp/internal/process/TestSessionAwareCache.java 2010-08-24
00:25:18 UTC (rev 2486)
+++
branches/7.1.x/engine/src/test/java/org/teiid/dqp/internal/process/TestSessionAwareCache.java 2010-08-24
21:31:16 UTC (rev 2487)
@@ -47,7 +47,7 @@
Cachable result = Mockito.mock(Cachable.class);
id = new CacheID(buildWorkContext(), new ParseInfo(), "SELECT * FROM FOO");
- cache.put(id, FunctionMethod.SESSION_DETERMINISTIC, result);
+ cache.put(id, FunctionMethod.SESSION_DETERMINISTIC, result, null);
// make sure that in the case of session specific; we do not call prepare
// as session is local only call for distributed
@@ -71,7 +71,7 @@
Mockito.stub(result.prepare((Cache)anyObject(),
(BufferManager)anyObject())).toReturn(true);
Mockito.stub(result.restore((Cache)anyObject(),
(BufferManager)anyObject())).toReturn(true);
- cache.put(id, FunctionMethod.USER_DETERMINISTIC, result);
+ cache.put(id, FunctionMethod.USER_DETERMINISTIC, result, null);
// make sure that in the case of session specific; we do not call prepare
// as session is local only call for distributed
@@ -97,7 +97,7 @@
Mockito.stub(result.prepare((Cache)anyObject(),
(BufferManager)anyObject())).toReturn(true);
Mockito.stub(result.restore((Cache)anyObject(),
(BufferManager)anyObject())).toReturn(true);
- cache.put(id, FunctionMethod.VDB_DETERMINISTIC, result);
+ cache.put(id, FunctionMethod.VDB_DETERMINISTIC, result, null);
// make sure that in the case of session specific; we do not call prepare
// as session is local only call for distributed