teiid SVN: r1203 - in trunk/client/src/main/java: com/metamatrix/common/xa and 3 other directories.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2009-07-28 19:09:48 -0400 (Tue, 28 Jul 2009)
New Revision: 1203
Modified:
trunk/client/src/main/java/com/metamatrix/admin/objects/MMAdminStatus.java
trunk/client/src/main/java/com/metamatrix/admin/objects/MMConnectorBinding.java
trunk/client/src/main/java/com/metamatrix/admin/objects/MMConnectorType.java
trunk/client/src/main/java/com/metamatrix/admin/objects/MMDQP.java
trunk/client/src/main/java/com/metamatrix/admin/objects/MMExtensionModule.java
trunk/client/src/main/java/com/metamatrix/admin/objects/MMGroup.java
trunk/client/src/main/java/com/metamatrix/admin/objects/MMHost.java
trunk/client/src/main/java/com/metamatrix/admin/objects/MMLogConfiguration.java
trunk/client/src/main/java/com/metamatrix/admin/objects/MMModel.java
trunk/client/src/main/java/com/metamatrix/admin/objects/MMPrincipal.java
trunk/client/src/main/java/com/metamatrix/admin/objects/MMProcess.java
trunk/client/src/main/java/com/metamatrix/admin/objects/MMPropertyDefinition.java
trunk/client/src/main/java/com/metamatrix/admin/objects/MMQueueWorkerPool.java
trunk/client/src/main/java/com/metamatrix/admin/objects/MMRequest.java
trunk/client/src/main/java/com/metamatrix/admin/objects/MMResource.java
trunk/client/src/main/java/com/metamatrix/admin/objects/MMRole.java
trunk/client/src/main/java/com/metamatrix/admin/objects/MMScriptsContainer.java
trunk/client/src/main/java/com/metamatrix/admin/objects/MMService.java
trunk/client/src/main/java/com/metamatrix/admin/objects/MMSession.java
trunk/client/src/main/java/com/metamatrix/admin/objects/MMSystem.java
trunk/client/src/main/java/com/metamatrix/admin/objects/MMUser.java
trunk/client/src/main/java/com/metamatrix/admin/objects/MMVDB.java
trunk/client/src/main/java/com/metamatrix/admin/objects/TransactionImpl.java
trunk/client/src/main/java/com/metamatrix/common/xa/XATransactionException.java
trunk/client/src/main/java/com/metamatrix/dqp/client/MetadataResult.java
trunk/client/src/main/java/com/metamatrix/platform/security/api/BasicMetaMatrixPrincipal.java
trunk/client/src/main/java/com/metamatrix/platform/security/api/LogonResult.java
trunk/client/src/main/java/com/metamatrix/platform/security/api/MetaMatrixPrincipalName.java
trunk/client/src/main/java/org/teiid/adminapi/AdminComponentException.java
trunk/client/src/main/java/org/teiid/adminapi/AdminException.java
trunk/client/src/main/java/org/teiid/adminapi/AdminOptions.java
trunk/client/src/main/java/org/teiid/adminapi/AdminProcessingException.java
Log:
TEIID-474: adding serial version id for all the client side classes that implement serializable interface
Modified: trunk/client/src/main/java/com/metamatrix/admin/objects/MMAdminStatus.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/objects/MMAdminStatus.java 2009-07-28 21:31:51 UTC (rev 1202)
+++ trunk/client/src/main/java/com/metamatrix/admin/objects/MMAdminStatus.java 2009-07-28 23:09:48 UTC (rev 1203)
@@ -34,8 +34,8 @@
* @since 4.3
*/
public class MMAdminStatus implements AdminStatus, Serializable {
-
- private int code = AdminStatus.CODE_UNKNOWN;
+ private static final long serialVersionUID = -3111591335358837218L;
+ private int code = AdminStatus.CODE_UNKNOWN;
private String message = null;
Modified: trunk/client/src/main/java/com/metamatrix/admin/objects/MMConnectorBinding.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/objects/MMConnectorBinding.java 2009-07-28 21:31:51 UTC (rev 1202)
+++ trunk/client/src/main/java/com/metamatrix/admin/objects/MMConnectorBinding.java 2009-07-28 23:09:48 UTC (rev 1203)
@@ -36,8 +36,9 @@
* May are may not be assigned to a VDB
*/
public class MMConnectorBinding extends MMAdminObject implements ConnectorBinding {
-
- private String routingUUID = ""; //$NON-NLS-1$
+
+ private static final long serialVersionUID = 6919562861762280546L;
+ private String routingUUID = ""; //$NON-NLS-1$
private String description = ""; //$NON-NLS-1$
private String connectorTypeName = ""; //$NON-NLS-1$
private int currentState;
Modified: trunk/client/src/main/java/com/metamatrix/admin/objects/MMConnectorType.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/objects/MMConnectorType.java 2009-07-28 21:31:51 UTC (rev 1202)
+++ trunk/client/src/main/java/com/metamatrix/admin/objects/MMConnectorType.java 2009-07-28 23:09:48 UTC (rev 1203)
@@ -30,11 +30,9 @@
* Dataholder for a connector type.
*/
public class MMConnectorType extends MMAdminObject implements ConnectorType {
+ private static final long serialVersionUID = -3029541826277765764L;
-
-
-
- /**
+ /**
* Constructor
* @param identifierParts of the Conenctor Type
*/
Modified: trunk/client/src/main/java/com/metamatrix/admin/objects/MMDQP.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/objects/MMDQP.java 2009-07-28 21:31:51 UTC (rev 1202)
+++ trunk/client/src/main/java/com/metamatrix/admin/objects/MMDQP.java 2009-07-28 23:09:48 UTC (rev 1203)
@@ -36,10 +36,9 @@
* May are may not be assigned to a VDB
*/
public class MMDQP extends MMAdminObject implements DQP {
-
-
- private String description = ""; //$NON-NLS-1$
+ private static final long serialVersionUID = -3212002022690786890L;
+ private String description = ""; //$NON-NLS-1$
private int currentState;
private Date stateChangedTime;
private long serviceID = -1;
Modified: trunk/client/src/main/java/com/metamatrix/admin/objects/MMExtensionModule.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/objects/MMExtensionModule.java 2009-07-28 21:31:51 UTC (rev 1202)
+++ trunk/client/src/main/java/com/metamatrix/admin/objects/MMExtensionModule.java 2009-07-28 23:09:48 UTC (rev 1203)
@@ -30,8 +30,8 @@
* A simple Extension Modules for the Admin API
*/
public final class MMExtensionModule extends MMAdminObject implements ExtensionModule {
-
- private String description;
+ private static final long serialVersionUID = -3250813293338474584L;
+ private String description;
private byte[] fileContents;
private String moduleType;
Modified: trunk/client/src/main/java/com/metamatrix/admin/objects/MMGroup.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/objects/MMGroup.java 2009-07-28 21:31:51 UTC (rev 1202)
+++ trunk/client/src/main/java/com/metamatrix/admin/objects/MMGroup.java 2009-07-28 23:09:48 UTC (rev 1203)
@@ -28,10 +28,10 @@
/**
* @since 4.3
*/
-public class MMGroup extends MMPrincipal implements
- Group {
+public class MMGroup extends MMPrincipal implements Group {
+ private static final long serialVersionUID = 1102507655851078982L;
- /**
+ /**
* @param principalName
* @since 4.3
*/
Modified: trunk/client/src/main/java/com/metamatrix/admin/objects/MMHost.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/objects/MMHost.java 2009-07-28 21:31:51 UTC (rev 1202)
+++ trunk/client/src/main/java/com/metamatrix/admin/objects/MMHost.java 2009-07-28 23:09:48 UTC (rev 1203)
@@ -32,6 +32,7 @@
*/
public final class MMHost extends MMAdminObject implements Host {
+ private static final long serialVersionUID = -779866213549875450L;
private boolean running = false;
Modified: trunk/client/src/main/java/com/metamatrix/admin/objects/MMLogConfiguration.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/objects/MMLogConfiguration.java 2009-07-28 21:31:51 UTC (rev 1202)
+++ trunk/client/src/main/java/com/metamatrix/admin/objects/MMLogConfiguration.java 2009-07-28 23:09:48 UTC (rev 1203)
@@ -22,7 +22,6 @@
package com.metamatrix.admin.objects;
-import java.util.HashMap;
import java.util.Map;
import java.util.Set;
@@ -35,6 +34,7 @@
*/
public class MMLogConfiguration extends MMAdminObject implements LogConfiguration {
+ private static final long serialVersionUID = -4585962928702271706L;
Map<String, Integer> contextMap = null;
public MMLogConfiguration(Map<String, Integer> contextMap) {
Modified: trunk/client/src/main/java/com/metamatrix/admin/objects/MMModel.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/objects/MMModel.java 2009-07-28 21:31:51 UTC (rev 1202)
+++ trunk/client/src/main/java/com/metamatrix/admin/objects/MMModel.java 2009-07-28 23:09:48 UTC (rev 1203)
@@ -32,8 +32,9 @@
/**
*/
public class MMModel extends MMAdminObject implements Model {
-
- private List connectorBindingNames = new ArrayList();
+
+ private static final long serialVersionUID = 3714234763056162230L;
+ private List connectorBindingNames = new ArrayList();
private String modelType = ""; //$NON-NLS-1$
private String modelURI = ""; //$NON-NLS-1$
private boolean isMaterialization = false;
Modified: trunk/client/src/main/java/com/metamatrix/admin/objects/MMPrincipal.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/objects/MMPrincipal.java 2009-07-28 21:31:51 UTC (rev 1202)
+++ trunk/client/src/main/java/com/metamatrix/admin/objects/MMPrincipal.java 2009-07-28 23:09:48 UTC (rev 1203)
@@ -30,8 +30,10 @@
*/
public class MMPrincipal extends MMAdminObject implements Principal {
- private static final String[] TYPE_NAMES = new String[] { TYPE_LABEL_USER, TYPE_LABEL_GROUP, TYPE_LABEL_ADMIN };
+ private static final long serialVersionUID = -1383265398519744688L;
+ private static final String[] TYPE_NAMES = new String[] { TYPE_LABEL_USER, TYPE_LABEL_GROUP, TYPE_LABEL_ADMIN };
+
private int type;
/**
Modified: trunk/client/src/main/java/com/metamatrix/admin/objects/MMProcess.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/objects/MMProcess.java 2009-07-28 21:31:51 UTC (rev 1202)
+++ trunk/client/src/main/java/com/metamatrix/admin/objects/MMProcess.java 2009-07-28 23:09:48 UTC (rev 1203)
@@ -34,6 +34,7 @@
* Data holder for information about a Process.
*/
public final class MMProcess extends MMAdminObject implements ProcessObject {
+ private static final long serialVersionUID = 8454606907083408662L;
private long freeMemory = 0;
private String hostIdentifier = ""; //$NON-NLS-1$
private InetAddress inetAddress = null;
Modified: trunk/client/src/main/java/com/metamatrix/admin/objects/MMPropertyDefinition.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/objects/MMPropertyDefinition.java 2009-07-28 21:31:51 UTC (rev 1202)
+++ trunk/client/src/main/java/com/metamatrix/admin/objects/MMPropertyDefinition.java 2009-07-28 23:09:48 UTC (rev 1203)
@@ -34,8 +34,8 @@
* @since 4.3
*/
public class MMPropertyDefinition extends MMAdminObject implements PropertyDefinition {
-
- private String value = null;
+ private static final long serialVersionUID = 6612838530524627205L;
+ private String value = null;
private Collection allowedValues = new ArrayList();
private Object defaultValue = null;
private String description = null;
Modified: trunk/client/src/main/java/com/metamatrix/admin/objects/MMQueueWorkerPool.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/objects/MMQueueWorkerPool.java 2009-07-28 21:31:51 UTC (rev 1202)
+++ trunk/client/src/main/java/com/metamatrix/admin/objects/MMQueueWorkerPool.java 2009-07-28 23:09:48 UTC (rev 1203)
@@ -30,8 +30,8 @@
* Dataholder for all the statistics gathered about a worker pool.
*/
public class MMQueueWorkerPool extends MMAdminObject implements QueueWorkerPool {
-
- // Current state
+ private static final long serialVersionUID = 454595217325824487L;
+ // Current state
private int queued = 0;
private int threads = 0;
Modified: trunk/client/src/main/java/com/metamatrix/admin/objects/MMRequest.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/objects/MMRequest.java 2009-07-28 21:31:51 UTC (rev 1202)
+++ trunk/client/src/main/java/com/metamatrix/admin/objects/MMRequest.java 2009-07-28 23:09:48 UTC (rev 1203)
@@ -34,6 +34,7 @@
*/
public class MMRequest extends MMAdminObject implements Request{
+ private static final long serialVersionUID = -6271863624581160147L;
String userName = ""; //$NON-NLS-1$;
String sessionID;
String requestID;
Modified: trunk/client/src/main/java/com/metamatrix/admin/objects/MMResource.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/objects/MMResource.java 2009-07-28 21:31:51 UTC (rev 1202)
+++ trunk/client/src/main/java/com/metamatrix/admin/objects/MMResource.java 2009-07-28 23:09:48 UTC (rev 1203)
@@ -31,7 +31,8 @@
*/
public class MMResource extends MMAdminObject implements Resource {
- private String resourceType;
+ private static final long serialVersionUID = -8732882869479091774L;
+ private String resourceType;
/**
* Constructor
Modified: trunk/client/src/main/java/com/metamatrix/admin/objects/MMRole.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/objects/MMRole.java 2009-07-28 21:31:51 UTC (rev 1202)
+++ trunk/client/src/main/java/com/metamatrix/admin/objects/MMRole.java 2009-07-28 23:09:48 UTC (rev 1203)
@@ -32,7 +32,10 @@
* @since 4.3
*/
public class MMRole extends MMAdminObject implements Role {
- /**
+
+ private static final long serialVersionUID = -768301010301417417L;
+
+ /**
* Ctor
* @param identifier the role identifier should contain the whole
* dotted notation in one field of the identifier so that the name
Modified: trunk/client/src/main/java/com/metamatrix/admin/objects/MMScriptsContainer.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/objects/MMScriptsContainer.java 2009-07-28 21:31:51 UTC (rev 1202)
+++ trunk/client/src/main/java/com/metamatrix/admin/objects/MMScriptsContainer.java 2009-07-28 23:09:48 UTC (rev 1203)
@@ -45,8 +45,9 @@
*/
public class MMScriptsContainer implements
ScriptsContainer {
-
- // <String> fileName => <byte[]> file contents
+
+ private static final long serialVersionUID = 1262888652939367623L;
+ // <String> fileName => <byte[]> file contents
private Map fileMap;
/**
Modified: trunk/client/src/main/java/com/metamatrix/admin/objects/MMService.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/objects/MMService.java 2009-07-28 21:31:51 UTC (rev 1202)
+++ trunk/client/src/main/java/com/metamatrix/admin/objects/MMService.java 2009-07-28 23:09:48 UTC (rev 1203)
@@ -24,7 +24,6 @@
import java.util.Date;
-import org.teiid.adminapi.ConnectorBinding;
import org.teiid.adminapi.Service;
import com.metamatrix.admin.AdminPlugin;
@@ -35,8 +34,9 @@
*
*/
public class MMService extends MMAdminObject implements Service {
-
- private String description = ""; //$NON-NLS-1$
+
+ private static final long serialVersionUID = -338643922496948824L;
+ private String description = ""; //$NON-NLS-1$
private String componentTypeName = ""; //$NON-NLS-1$
private int currentState;
private Date stateChangedTime;
Modified: trunk/client/src/main/java/com/metamatrix/admin/objects/MMSession.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/objects/MMSession.java 2009-07-28 21:31:51 UTC (rev 1202)
+++ trunk/client/src/main/java/com/metamatrix/admin/objects/MMSession.java 2009-07-28 23:09:48 UTC (rev 1203)
@@ -34,6 +34,8 @@
*
*/
public class MMSession extends MMAdminObject implements Session {
+
+ private static final long serialVersionUID = 4939105946380675244L;
private String userName = ""; //$NON-NLS-1$;
private String applicationName = ""; //$NON-NLS-1$
private String sessionID;
Modified: trunk/client/src/main/java/com/metamatrix/admin/objects/MMSystem.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/objects/MMSystem.java 2009-07-28 21:31:51 UTC (rev 1202)
+++ trunk/client/src/main/java/com/metamatrix/admin/objects/MMSystem.java 2009-07-28 23:09:48 UTC (rev 1203)
@@ -34,8 +34,8 @@
*/
public class MMSystem extends MMAdminObject implements SystemObject {
-
- Date startTime;
+ private static final long serialVersionUID = 7913646658641775637L;
+ Date startTime;
boolean isStarted;
Modified: trunk/client/src/main/java/com/metamatrix/admin/objects/MMUser.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/objects/MMUser.java 2009-07-28 21:31:51 UTC (rev 1202)
+++ trunk/client/src/main/java/com/metamatrix/admin/objects/MMUser.java 2009-07-28 23:09:48 UTC (rev 1203)
@@ -29,8 +29,9 @@
* @since 4.3
*/
public class MMUser extends MMPrincipal implements User {
+ private static final long serialVersionUID = -5201466263343170010L;
- /**
+ /**
* @param identifierParts
* @since 4.3
*/
Modified: trunk/client/src/main/java/com/metamatrix/admin/objects/MMVDB.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/objects/MMVDB.java 2009-07-28 21:31:51 UTC (rev 1202)
+++ trunk/client/src/main/java/com/metamatrix/admin/objects/MMVDB.java 2009-07-28 23:09:48 UTC (rev 1203)
@@ -35,8 +35,9 @@
* Dataholder object for information about a VDB (Virtual Database)
*/
public final class MMVDB extends MMAdminObject implements VDB, Comparable {
-
- /**VDB is registered but incomplete*/
+
+ private static final long serialVersionUID = -3755957080991586389L;
+ /**VDB is registered but incomplete*/
public static final int STATUS_INCOMPLETE = 1;
/**VDB is deployed but inactive*/
public static final int STATUS_INACTIVE = 2;
Modified: trunk/client/src/main/java/com/metamatrix/admin/objects/TransactionImpl.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/objects/TransactionImpl.java 2009-07-28 21:31:51 UTC (rev 1202)
+++ trunk/client/src/main/java/com/metamatrix/admin/objects/TransactionImpl.java 2009-07-28 23:09:48 UTC (rev 1203)
@@ -30,7 +30,8 @@
import com.metamatrix.common.xa.MMXid;
public class TransactionImpl extends MMAdminObject implements Transaction {
-
+
+ private static final long serialVersionUID = -8588785315218789068L;
private String associatedSession;
private String scope;
private MMXid xid;
Modified: trunk/client/src/main/java/com/metamatrix/common/xa/XATransactionException.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/common/xa/XATransactionException.java 2009-07-28 21:31:51 UTC (rev 1202)
+++ trunk/client/src/main/java/com/metamatrix/common/xa/XATransactionException.java 2009-07-28 23:09:48 UTC (rev 1203)
@@ -31,8 +31,8 @@
* XA transaction-related.
*/
public class XATransactionException extends MetaMatrixProcessingException {
-
- private int errorCode = XAException.XAER_RMERR;
+ private static final long serialVersionUID = 5685144848609237877L;
+ private int errorCode = XAException.XAER_RMERR;
/**
* No-Arg Constructor
Modified: trunk/client/src/main/java/com/metamatrix/dqp/client/MetadataResult.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/dqp/client/MetadataResult.java 2009-07-28 21:31:51 UTC (rev 1202)
+++ trunk/client/src/main/java/com/metamatrix/dqp/client/MetadataResult.java 2009-07-28 23:09:48 UTC (rev 1203)
@@ -26,7 +26,7 @@
import java.util.Map;
public class MetadataResult implements Serializable {
-
+ private static final long serialVersionUID = -1520482281079030324L;
private Map[] columnMetadata;
private int parameterCount;
Modified: trunk/client/src/main/java/com/metamatrix/platform/security/api/BasicMetaMatrixPrincipal.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/platform/security/api/BasicMetaMatrixPrincipal.java 2009-07-28 21:31:51 UTC (rev 1202)
+++ trunk/client/src/main/java/com/metamatrix/platform/security/api/BasicMetaMatrixPrincipal.java 2009-07-28 23:09:48 UTC (rev 1203)
@@ -32,8 +32,8 @@
import com.metamatrix.core.ErrorMessageKeys;
public class BasicMetaMatrixPrincipal implements MetaMatrixPrincipal, Serializable {
-
- private int type;
+ private static final long serialVersionUID = -3458004182869226507L;
+ private int type;
private String name;
private Set unmodifiableGroupNames;
Modified: trunk/client/src/main/java/com/metamatrix/platform/security/api/LogonResult.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/platform/security/api/LogonResult.java 2009-07-28 21:31:51 UTC (rev 1202)
+++ trunk/client/src/main/java/com/metamatrix/platform/security/api/LogonResult.java 2009-07-28 23:09:48 UTC (rev 1203)
@@ -36,7 +36,8 @@
*/
public class LogonResult implements Serializable {
- private TimeZone timeZone = TimeZone.getDefault();
+ private static final long serialVersionUID = 4481443514871448269L;
+ private TimeZone timeZone = TimeZone.getDefault();
private final Properties productInfo;
private String clusterName;
private SessionToken sessionToken;
Modified: trunk/client/src/main/java/com/metamatrix/platform/security/api/MetaMatrixPrincipalName.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/platform/security/api/MetaMatrixPrincipalName.java 2009-07-28 21:31:51 UTC (rev 1202)
+++ trunk/client/src/main/java/com/metamatrix/platform/security/api/MetaMatrixPrincipalName.java 2009-07-28 23:09:48 UTC (rev 1203)
@@ -25,8 +25,8 @@
import java.io.Serializable;
public class MetaMatrixPrincipalName implements Serializable {
-
- private int type;
+ private static final long serialVersionUID = 4630832657093482302L;
+ private int type;
private String name;
public MetaMatrixPrincipalName( String name, int type ) {
Modified: trunk/client/src/main/java/org/teiid/adminapi/AdminComponentException.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/AdminComponentException.java 2009-07-28 21:31:51 UTC (rev 1202)
+++ trunk/client/src/main/java/org/teiid/adminapi/AdminComponentException.java 2009-07-28 23:09:48 UTC (rev 1203)
@@ -32,11 +32,9 @@
*/
public final class AdminComponentException extends AdminException {
- /**
- * No-arg ctor.
- *
- * @since 4.3
- */
+ private static final long serialVersionUID = 7117721841515240902L;
+
+
public AdminComponentException() {
super();
}
Modified: trunk/client/src/main/java/org/teiid/adminapi/AdminException.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/AdminException.java 2009-07-28 21:31:51 UTC (rev 1202)
+++ trunk/client/src/main/java/org/teiid/adminapi/AdminException.java 2009-07-28 23:09:48 UTC (rev 1203)
@@ -40,7 +40,8 @@
*/
public abstract class AdminException extends MetaMatrixCoreException {
- // List of Admin exceptions in
+ private static final long serialVersionUID = -4446936145500241358L;
+ // List of Admin exceptions in
// case of multiple failure
private List children;
Modified: trunk/client/src/main/java/org/teiid/adminapi/AdminOptions.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/AdminOptions.java 2009-07-28 21:31:51 UTC (rev 1202)
+++ trunk/client/src/main/java/org/teiid/adminapi/AdminOptions.java 2009-07-28 23:09:48 UTC (rev 1203)
@@ -48,8 +48,9 @@
// add the corresponding string to the toString() method
// and to the ALLOWABLE_OPTIONS bitmask below.
// *************************************************************************
-
- /**
+ private static final long serialVersionUID = 2809137776857876224L;
+
+ /**
* In the case when adding resource to the system, if the resource already
* exists in the system, these modes define how to handle the situation.
*/
Modified: trunk/client/src/main/java/org/teiid/adminapi/AdminProcessingException.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/AdminProcessingException.java 2009-07-28 21:31:51 UTC (rev 1202)
+++ trunk/client/src/main/java/org/teiid/adminapi/AdminProcessingException.java 2009-07-28 23:09:48 UTC (rev 1203)
@@ -33,7 +33,9 @@
*/
public final class AdminProcessingException extends AdminException {
- /**
+ private static final long serialVersionUID = -878521636838205857L;
+
+ /**
* No-arg ctor.
*
* @since 4.3
15 years, 5 months
teiid SVN: r1202 - trunk/build/kit-adminshell.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2009-07-28 17:31:51 -0400 (Tue, 28 Jul 2009)
New Revision: 1202
Modified:
trunk/build/kit-adminshell/adminshell.sh
Log:
TEIID-224
Modified: trunk/build/kit-adminshell/adminshell.sh
===================================================================
--- trunk/build/kit-adminshell/adminshell.sh 2009-07-28 21:30:25 UTC (rev 1201)
+++ trunk/build/kit-adminshell/adminshell.sh 2009-07-28 21:31:51 UTC (rev 1202)
@@ -60,6 +60,9 @@
fi
fi
+# JPDA options. Uncomment and modify as appropriate to enable remote debugging.
+# JAVA_OPTS="$JAVA_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n"
+
TEIID_CLASSPATH="$TEIID_HOME/lib/patches/*:$TEIID_HOME/lib/*"
JAVA_OPTS="$JAVA_OPTS -Xms128m -Xmx256m -XX:MaxPermSize=256m"
JAVA_OPTS="$JAVA_OPTS -Djava.util.logging.config.file=log.properties"
15 years, 5 months
teiid SVN: r1201 - in trunk: engine/src/main/java/com/metamatrix/dqp/service and 1 other directory.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2009-07-28 17:30:25 -0400 (Tue, 28 Jul 2009)
New Revision: 1201
Modified:
trunk/build/kit-runtime/deploy.properties
trunk/engine/src/main/java/com/metamatrix/dqp/service/AuthorizationService.java
Log:
TEIID-665
Modified: trunk/build/kit-runtime/deploy.properties
===================================================================
--- trunk/build/kit-runtime/deploy.properties 2009-07-28 21:07:33 UTC (rev 1200)
+++ trunk/build/kit-runtime/deploy.properties 2009-07-28 21:30:25 UTC (rev 1201)
@@ -105,13 +105,11 @@
#
-# Authorization Service Settings
+# Authorization Service Settings (membership must be enabled to check any authorizations)
#
+auth.check_entitlements=false
+auth.adminRolesFile=./deploy/admin-roles.properties
-# Enable entitlements (data, admin)
-entitlements.enabled=false
-entitlements.adminRolesFile=./deploy/admin-roles.properties
-
#
# Socket transport
#
Modified: trunk/engine/src/main/java/com/metamatrix/dqp/service/AuthorizationService.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/dqp/service/AuthorizationService.java 2009-07-28 21:07:33 UTC (rev 1200)
+++ trunk/engine/src/main/java/com/metamatrix/dqp/service/AuthorizationService.java 2009-07-28 21:30:25 UTC (rev 1201)
@@ -57,8 +57,8 @@
public static final String DEFAULT_WSDL_USERNAME = CoreConstants.DEFAULT_ANON_USERNAME;
- public static final String ENTITELEMENTS_ENABLED = "entitlements.enabled"; //$NON-NLS-1$
- public static final String ADMIN_ROLES_FILE = "entitlements.adminRolesFile"; //$NON-NLS-1$
+ public static final String ENTITELEMENTS_ENABLED = "auth.check_entitlements"; //$NON-NLS-1$
+ public static final String ADMIN_ROLES_FILE = "auth.adminRolesFile"; //$NON-NLS-1$
/**
* Determine which of a set of resources a connection does not have permission to
15 years, 5 months
teiid SVN: r1200 - trunk/client-jdbc/src/main/java/com/metamatrix/script/io.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2009-07-28 17:07:33 -0400 (Tue, 28 Jul 2009)
New Revision: 1200
Modified:
trunk/client-jdbc/src/main/java/com/metamatrix/script/io/MetadataReader.java
trunk/client-jdbc/src/main/java/com/metamatrix/script/io/ResultSetReader.java
trunk/client-jdbc/src/main/java/com/metamatrix/script/io/StringArrayReader.java
trunk/client-jdbc/src/main/java/com/metamatrix/script/io/StringLineReader.java
Log:
TEIID-210
Modified: trunk/client-jdbc/src/main/java/com/metamatrix/script/io/MetadataReader.java
===================================================================
--- trunk/client-jdbc/src/main/java/com/metamatrix/script/io/MetadataReader.java 2009-07-28 20:59:49 UTC (rev 1199)
+++ trunk/client-jdbc/src/main/java/com/metamatrix/script/io/MetadataReader.java 2009-07-28 21:07:33 UTC (rev 1200)
@@ -61,14 +61,14 @@
String firstLine() {
StringBuffer sb = new StringBuffer();
- sb.append("ColumnName").append(delimiter);
- sb.append("ColumnType").append(delimiter);
- sb.append("ColumnTypeName").append(delimiter);
- sb.append("ColumnClassName").append(delimiter);
- sb.append("isNullable").append(delimiter);
- sb.append("TableName").append(delimiter);
- sb.append("SchemaName").append(delimiter);
- sb.append("CatalogName").append(delimiter);
+ sb.append("ColumnName").append(delimiter); //$NON-NLS-1$
+ sb.append("ColumnType").append(delimiter); //$NON-NLS-1$
+ sb.append("ColumnTypeName").append(delimiter); //$NON-NLS-1$
+ sb.append("ColumnClassName").append(delimiter); //$NON-NLS-1$
+ sb.append("isNullable").append(delimiter); //$NON-NLS-1$
+ sb.append("TableName").append(delimiter); //$NON-NLS-1$
+ sb.append("SchemaName").append(delimiter); //$NON-NLS-1$
+ sb.append("CatalogName").append(delimiter); //$NON-NLS-1$
sb.append("\n"); //$NON-NLS-1$
return sb.toString();
}
Modified: trunk/client-jdbc/src/main/java/com/metamatrix/script/io/ResultSetReader.java
===================================================================
--- trunk/client-jdbc/src/main/java/com/metamatrix/script/io/ResultSetReader.java 2009-07-28 20:59:49 UTC (rev 1199)
+++ trunk/client-jdbc/src/main/java/com/metamatrix/script/io/ResultSetReader.java 2009-07-28 21:07:33 UTC (rev 1200)
@@ -22,13 +22,22 @@
package com.metamatrix.script.io;
+import java.io.BufferedOutputStream;
+import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
+import java.sql.SQLXML;
import java.sql.Types;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
/**
* This object wraps/extends a SQL ResultSet object as Reader object. Once the
* ResultSet can read as reader then it can be persisted, printed or compared
@@ -37,7 +46,6 @@
* <p>PS: remember this is a Reader not InputStream, so all the fields read
* going to be converted to strings before they returned.
*
- * @author <a href="mailto:rreddy@metamatrix.com">Ramesh Reddy</a>
* @since 4.3
*/
public class ResultSetReader extends StringLineReader {
@@ -75,7 +83,7 @@
}
/**
- * Get the next line of restuls from the ResultSet. The first line will be the
+ * Get the next line of results from the ResultSet. The first line will be the
* metadata of the resultset and then followed by the result rows. Each row will be
* returned as one line.
* @return next result line from result set.
@@ -100,12 +108,15 @@
for (int col = 1; col <= columnCount; col++) {
Object anObj = source.getObject(col);
if (columnTypes[col-1] == Types.CLOB) {
- //sb.append(anObj != null ? "CLOB" : "null"); //$NON-NLS-1$ //$NON-NLS-2$
sb.append(anObj != null ? anObj : "null"); //$NON-NLS-1$
}
else if (columnTypes[col-1] == Types.BLOB) {
sb.append(anObj != null ? "BLOB" : "null"); //$NON-NLS-1$ //$NON-NLS-2$
}
+ else if (columnTypes[col-1] == Types.SQLXML) {
+ SQLXML xml = (SQLXML)anObj;
+ sb.append(anObj != null ? prettyPrint(xml) : "null"); //$NON-NLS-1$
+ }
else {
sb.append(anObj != null ? anObj : "null"); //$NON-NLS-1$
}
@@ -123,7 +134,7 @@
}
/**
- * Get the first line from the result set. This is the resutlset metadata line where
+ * Get the first line from the result set. This is the resultset metadata line where
* we gather the column names and their types.
* @return
* @throws SQLException
@@ -142,4 +153,27 @@
sb.append("\n"); //$NON-NLS-1$
return sb.toString();
}
+
+ String prettyPrint(SQLXML xml) throws SQLException {
+ try {
+ TransformerFactory transFactory = TransformerFactory.newInstance();
+ transFactory.setAttribute("indent-number", new Integer(2)); //$NON-NLS-1$
+
+ Transformer tf = transFactory.newTransformer();
+ tf.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); //$NON-NLS-1$
+ tf.setOutputProperty(OutputKeys.ENCODING, "UTF-8");//$NON-NLS-1$
+ tf.setOutputProperty(OutputKeys.INDENT, "yes");//$NON-NLS-1$
+ tf.setOutputProperty(OutputKeys.METHOD, "xml");//$NON-NLS-1$
+ tf.setOutputProperty(OutputKeys.STANDALONE, "yes");//$NON-NLS-1$
+ tf.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ StreamResult xmlOut = new StreamResult(new BufferedOutputStream(out));
+ tf.transform(xml.getSource(StreamSource.class), xmlOut);
+
+ return out.toString();
+ } catch (Exception e) {
+ return xml.getString();
+ }
+ }
}
Modified: trunk/client-jdbc/src/main/java/com/metamatrix/script/io/StringArrayReader.java
===================================================================
--- trunk/client-jdbc/src/main/java/com/metamatrix/script/io/StringArrayReader.java 2009-07-28 20:59:49 UTC (rev 1199)
+++ trunk/client-jdbc/src/main/java/com/metamatrix/script/io/StringArrayReader.java 2009-07-28 21:07:33 UTC (rev 1200)
@@ -27,7 +27,6 @@
/**
* Converts a String Array object into a Reader object.
- * @author <a href="mailto:rreddy@metamatrix.com">Ramesh Reddy</a>
*/
public class StringArrayReader extends StringLineReader {
String[] source = null;
Modified: trunk/client-jdbc/src/main/java/com/metamatrix/script/io/StringLineReader.java
===================================================================
--- trunk/client-jdbc/src/main/java/com/metamatrix/script/io/StringLineReader.java 2009-07-28 20:59:49 UTC (rev 1199)
+++ trunk/client-jdbc/src/main/java/com/metamatrix/script/io/StringLineReader.java 2009-07-28 21:07:33 UTC (rev 1200)
@@ -31,7 +31,6 @@
* The derived classes just need to extend this class and implement the "nextLine()"
* method to get the full "Reader" functionality.
*
- * @author <a href="mailto:rreddy@metamatrix.com">Ramesh Reddy</a>
*/
public abstract class StringLineReader extends Reader {
15 years, 5 months
teiid SVN: r1199 - in trunk: common-core/src/main/resources/com/metamatrix/core and 6 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2009-07-28 16:59:49 -0400 (Tue, 28 Jul 2009)
New Revision: 1199
Modified:
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToBigDecimalTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToBigIntegerTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToBooleanTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToByteTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToDateTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToIntegerTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToLongTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToShortTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToTimeTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToTimestampTransform.java
trunk/common-core/src/main/resources/com/metamatrix/core/i18n.properties
trunk/common-core/src/test/java/com/metamatrix/common/types/basic/TestTransforms.java
trunk/documentation/reference/src/main/docbook/en-US/content/scalar_functions.xml
trunk/engine/src/main/java/com/metamatrix/query/function/FunctionMethods.java
trunk/engine/src/main/java/com/metamatrix/query/rewriter/QueryRewriter.java
trunk/engine/src/test/java/com/metamatrix/query/function/TestFunction.java
trunk/engine/src/test/java/com/metamatrix/query/rewriter/TestQueryRewriter.java
Log:
TEIID-745 ensuring that all the parse routines obey the same rules and updating the reference.
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToBigDecimalTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToBigDecimalTransform.java 2009-07-28 18:53:00 UTC (rev 1198)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToBigDecimalTransform.java 2009-07-28 20:59:49 UTC (rev 1199)
@@ -45,7 +45,7 @@
}
try {
- return new BigDecimal((String)value);
+ return new BigDecimal(((String)value).trim());
} catch(NumberFormatException e) {
throw new TransformationException(ErrorMessageKeys.TYPES_ERR_0014, CorePlugin.Util.getString(ErrorMessageKeys.TYPES_ERR_0014, value));
}
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToBigIntegerTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToBigIntegerTransform.java 2009-07-28 18:53:00 UTC (rev 1198)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToBigIntegerTransform.java 2009-07-28 20:59:49 UTC (rev 1199)
@@ -45,7 +45,7 @@
}
try {
- return new BigInteger((String)value);
+ return new BigInteger(((String)value).trim());
} catch(NumberFormatException e) {
throw new TransformationException(ErrorMessageKeys.TYPES_ERR_0015, CorePlugin.Util.getString(ErrorMessageKeys.TYPES_ERR_0015, value));
}
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToBooleanTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToBooleanTransform.java 2009-07-28 18:53:00 UTC (rev 1198)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToBooleanTransform.java 2009-07-28 20:59:49 UTC (rev 1199)
@@ -42,7 +42,7 @@
if(value == null) {
return value;
}
- String str = (String)value;
+ String str = ((String)value).trim();
if (TRUE.equals(str)) {
return Boolean.TRUE;
}
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToByteTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToByteTransform.java 2009-07-28 18:53:00 UTC (rev 1198)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToByteTransform.java 2009-07-28 20:59:49 UTC (rev 1199)
@@ -43,7 +43,7 @@
}
try {
- return Byte.valueOf((String)value);
+ return Byte.valueOf(((String)value).trim());
} catch(NumberFormatException e) {
throw new TransformationException(ErrorMessageKeys.TYPES_ERR_0016, CorePlugin.Util.getString(ErrorMessageKeys.TYPES_ERR_0016, value));
}
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToDateTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToDateTransform.java 2009-07-28 18:53:00 UTC (rev 1198)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToDateTransform.java 2009-07-28 20:59:49 UTC (rev 1199)
@@ -43,12 +43,17 @@
if(value == null) {
return value;
}
-
+ value = ((String) value).trim();
+ Date result = null;
try {
- return Date.valueOf( (String) value );
+ result = Date.valueOf( (String) value );
} catch(Exception e) {
throw new TransformationException(e, ErrorMessageKeys.TYPES_ERR_0018, CorePlugin.Util.getString(ErrorMessageKeys.TYPES_ERR_0018, value));
}
+ if (!result.toString().equals(value)) {
+ throw new TransformationException(CorePlugin.Util.getString("transform.invalid_string_for_date", value, getTargetType().getSimpleName())); //$NON-NLS-1$
+ }
+ return result;
}
/**
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToIntegerTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToIntegerTransform.java 2009-07-28 18:53:00 UTC (rev 1198)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToIntegerTransform.java 2009-07-28 20:59:49 UTC (rev 1199)
@@ -43,7 +43,7 @@
}
try {
- return Integer.valueOf((String)value);
+ return Integer.valueOf(((String)value).trim());
} catch(NumberFormatException e) {
throw new TransformationException(ErrorMessageKeys.TYPES_ERR_0021, CorePlugin.Util.getString(ErrorMessageKeys.TYPES_ERR_0021, value));
}
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToLongTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToLongTransform.java 2009-07-28 18:53:00 UTC (rev 1198)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToLongTransform.java 2009-07-28 20:59:49 UTC (rev 1199)
@@ -43,7 +43,7 @@
}
try {
- return Long.valueOf((String)value);
+ return Long.valueOf(((String)value).trim());
} catch(NumberFormatException e) {
throw new TransformationException(ErrorMessageKeys.TYPES_ERR_0022, CorePlugin.Util.getString(ErrorMessageKeys.TYPES_ERR_0022, value));
}
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToShortTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToShortTransform.java 2009-07-28 18:53:00 UTC (rev 1198)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToShortTransform.java 2009-07-28 20:59:49 UTC (rev 1199)
@@ -43,7 +43,7 @@
}
try {
- return Short.valueOf((String)value);
+ return Short.valueOf(((String)value).trim());
} catch(NumberFormatException e) {
throw new TransformationException(ErrorMessageKeys.TYPES_ERR_0023, CorePlugin.Util.getString(ErrorMessageKeys.TYPES_ERR_0023, value));
}
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToTimeTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToTimeTransform.java 2009-07-28 18:53:00 UTC (rev 1198)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToTimeTransform.java 2009-07-28 20:59:49 UTC (rev 1199)
@@ -43,12 +43,17 @@
if(value == null) {
return value;
}
-
+ value = ((String) value).trim();
+ Time result = null;
try {
- return Time.valueOf( (String) value );
+ result = Time.valueOf((String)value);
} catch(Exception e) {
throw new TransformationException(e, ErrorMessageKeys.TYPES_ERR_0025, CorePlugin.Util.getString(ErrorMessageKeys.TYPES_ERR_0025, value));
}
+ if (!result.toString().equals(value)) {
+ throw new TransformationException(CorePlugin.Util.getString("transform.invalid_string_for_date", value, getTargetType().getSimpleName())); //$NON-NLS-1$
+ }
+ return result;
}
/**
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToTimestampTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToTimestampTransform.java 2009-07-28 18:53:00 UTC (rev 1198)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToTimestampTransform.java 2009-07-28 20:59:49 UTC (rev 1199)
@@ -43,12 +43,18 @@
if(value == null) {
return value;
}
-
+ value = ((String) value).trim();
+ Timestamp result = null;
try {
- return Timestamp.valueOf( (String) value );
+ result = Timestamp.valueOf( (String) value );
} catch(Exception e) {
throw new TransformationException(e, ErrorMessageKeys.TYPES_ERR_0024, CorePlugin.Util.getString(ErrorMessageKeys.TYPES_ERR_0024, value));
}
+ //validate everything except for fractional seconds
+ if (!((String)value).startsWith(result.toString().substring(0, 19))) {
+ throw new TransformationException(CorePlugin.Util.getString("transform.invalid_string_for_date", value, getTargetType().getSimpleName())); //$NON-NLS-1$
+ }
+ return result;
}
/**
Modified: trunk/common-core/src/main/resources/com/metamatrix/core/i18n.properties
===================================================================
--- trunk/common-core/src/main/resources/com/metamatrix/core/i18n.properties 2009-07-28 18:53:00 UTC (rev 1198)
+++ trunk/common-core/src/main/resources/com/metamatrix/core/i18n.properties 2009-07-28 20:59:49 UTC (rev 1199)
@@ -402,4 +402,6 @@
ERR.003.030.0181=Failed to connect to the Database at {0} check connection properties.
ExceptionHolder.converted_exception=Remote exception: {0} ... Original type hierarchy {1}.
-PropertiesUtils.failed_to_resolve_property=failed to completely resolve the property value for key {0}
\ No newline at end of file
+PropertiesUtils.failed_to_resolve_property=failed to completely resolve the property value for key {0}
+
+transform.invalid_string_for_date=The string representation ''{0}'' of a {1} value is out of range.
\ No newline at end of file
Modified: trunk/common-core/src/test/java/com/metamatrix/common/types/basic/TestTransforms.java
===================================================================
--- trunk/common-core/src/test/java/com/metamatrix/common/types/basic/TestTransforms.java 2009-07-28 18:53:00 UTC (rev 1198)
+++ trunk/common-core/src/test/java/com/metamatrix/common/types/basic/TestTransforms.java 2009-07-28 20:59:49 UTC (rev 1199)
@@ -22,13 +22,15 @@
package com.metamatrix.common.types.basic;
+import static org.junit.Assert.*;
+
import java.math.BigDecimal;
import java.math.BigInteger;
import java.sql.Date;
import java.sql.Time;
import java.sql.Timestamp;
-import junit.framework.TestCase;
+import org.junit.Test;
import com.metamatrix.common.types.ClobType;
import com.metamatrix.common.types.DataTypeManager;
@@ -39,12 +41,13 @@
import com.metamatrix.common.types.XMLType;
import com.metamatrix.common.types.DataTypeManager.DefaultDataClasses;
import com.metamatrix.common.types.DataTypeManager.DefaultDataTypes;
+import com.metamatrix.query.unittest.TimestampUtil;
/**
* @since 4.2
*/
-public class TestTransforms extends TestCase {
+public class TestTransforms {
private static void helpTestTransform(Object value, Object expectedValue) throws TransformationException {
Transform transform = DataTypeManager.getTransform(value.getClass(), expectedValue.getClass());
@@ -64,21 +67,27 @@
}
}
- private static void helpTransformException(Object value, Object expectedValue) {
+ private static void helpTransformException(Object value, Class<?> target) {
+ helpTransformException(value, target, null);
+ }
+
+ private static void helpTransformException(Object value, Class<?> target, String msg) {
try {
- Transform transform = DataTypeManager.getTransform(value.getClass(), expectedValue.getClass());
+ Transform transform = DataTypeManager.getTransform(value.getClass(), target);
transform.transform(value);
fail("Expected to get an exception during the transformation"); //$NON-NLS-1$
} catch (TransformationException e) {
- assertTrue(true);
+ if (msg != null) {
+ assertEquals(msg, e.getMessage());
+ }
}
}
- public void testBigDecimalToBigInteger_Defect16875() throws TransformationException {
+ @Test public void testBigDecimalToBigInteger_Defect16875() throws TransformationException {
helpTestTransform(new BigDecimal("0.5867"), new BigInteger("0")); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testString2Boolean() throws TransformationException {
+ @Test public void testString2Boolean() throws TransformationException {
helpTestTransform(new String("1"), Boolean.TRUE); //$NON-NLS-1$
helpTestTransform(new String("0"), Boolean.FALSE); //$NON-NLS-1$
helpTestTransform(new String("true"), Boolean.TRUE); //$NON-NLS-1$
@@ -86,34 +95,34 @@
helpTestTransform(new String("foo"), Boolean.FALSE); //$NON-NLS-1$
}
- public void testByte2Boolean() throws TransformationException {
+ @Test public void testByte2Boolean() throws TransformationException {
helpTestTransform(new Byte((byte)1), Boolean.TRUE);
helpTestTransform(new Byte((byte)0), Boolean.FALSE);
- helpTransformException(new Byte((byte)12), Boolean.FALSE);
+ helpTransformException(new Byte((byte)12), DataTypeManager.DefaultDataClasses.BOOLEAN);
}
- public void testShort2Boolean() throws TransformationException {
+ @Test public void testShort2Boolean() throws TransformationException {
helpTestTransform(new Short((short)1), Boolean.TRUE);
helpTestTransform(new Short((short)0), Boolean.FALSE);
- helpTransformException(new Short((short)12), Boolean.FALSE);
+ helpTransformException(new Short((short)12), DataTypeManager.DefaultDataClasses.BOOLEAN);
}
- public void testInteger2Boolean() throws TransformationException {
+ @Test public void testInteger2Boolean() throws TransformationException {
helpTestTransform(new Integer(1), Boolean.TRUE);
helpTestTransform(new Integer(0), Boolean.FALSE);
- helpTransformException(new Integer(12), Boolean.FALSE);
+ helpTransformException(new Integer(12), DataTypeManager.DefaultDataClasses.BOOLEAN);
}
- public void testLong2Boolean() throws TransformationException {
+ @Test public void testLong2Boolean() throws TransformationException {
helpTestTransform(new Long(1), Boolean.TRUE);
helpTestTransform(new Long(0), Boolean.FALSE);
- helpTransformException(new Long(12), Boolean.FALSE);
+ helpTransformException(new Long(12), DataTypeManager.DefaultDataClasses.BOOLEAN);
}
- public void testBigInteger2Boolean() throws TransformationException {
+ @Test public void testBigInteger2Boolean() throws TransformationException {
helpTestTransform(new BigInteger("1"), Boolean.TRUE); //$NON-NLS-1$
helpTestTransform(new BigInteger("0"), Boolean.FALSE); //$NON-NLS-1$
- helpTransformException(new BigInteger("12"), Boolean.FALSE); //$NON-NLS-1$
+ helpTransformException(new BigInteger("12"), DataTypeManager.DefaultDataClasses.BOOLEAN); //$NON-NLS-1$
}
static Object[][] testData = {
@@ -155,7 +164,7 @@
|| (src.equals(DataTypeManager.DefaultDataTypes.BIG_DECIMAL) && tgt.equals(DataTypeManager.DefaultDataTypes.BOOLEAN) && source == testData[10][2]);
}
- public void testAllConversions() throws TransformationException {
+ @Test public void testAllConversions() throws TransformationException {
for (int src = 0; src < dataTypes.length; src++) {
for (int tgt =0; tgt < dataTypes.length; tgt++) {
char c = conversions[src][tgt];
@@ -173,7 +182,7 @@
}
}
- public void testAllConversionsAsObject() throws TransformationException {
+ @Test public void testAllConversionsAsObject() throws TransformationException {
for (int src = 0; src < dataTypes.length; src++) {
for (int tgt =0; tgt < dataTypes.length; tgt++) {
char c = conversions[src][tgt];
@@ -191,7 +200,7 @@
}
}
- public void testObjectToAnyTransformFailure() {
+ @Test public void testObjectToAnyTransformFailure() {
Transform transform = DataTypeManager.getTransform(DefaultDataClasses.OBJECT, DefaultDataClasses.TIME);
try {
transform.transform("1"); //$NON-NLS-1$
@@ -201,7 +210,7 @@
}
}
- public void testSQLXMLToStringTransform() throws Exception {
+ @Test public void testSQLXMLToStringTransform() throws Exception {
StringBuffer xml = new StringBuffer();
int iters = DataTypeManager.MAX_STRING_LENGTH/10;
for (int i = 0; i < iters; i++) {
@@ -217,4 +226,17 @@
helpTestTransform(new StringToSQLXMLTransform().transform(xml.toString()), expected);
}
+
+ @Test public void testStringToTimestampOutOfRange() throws Exception {
+ helpTransformException("2005-13-01 11:13:01", DefaultDataClasses.TIMESTAMP, "The string representation '2005-13-01 11:13:01' of a Timestamp value is out of range."); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ @Test public void testStringToTimeTimestampWithWS() throws Exception {
+ helpTestTransform(" 2005-12-01 11:13:01 ", TimestampUtil.createTimestamp(105, 11, 1, 11, 13, 1, 0)); //$NON-NLS-1$
+ }
+
+ @Test public void testStringToLongWithWS() throws Exception {
+ helpTestTransform(" 1 ", Long.valueOf(1)); //$NON-NLS-1$
+ }
+
}
Modified: trunk/documentation/reference/src/main/docbook/en-US/content/scalar_functions.xml
===================================================================
--- trunk/documentation/reference/src/main/docbook/en-US/content/scalar_functions.xml 2009-07-28 18:53:00 UTC (rev 1198)
+++ trunk/documentation/reference/src/main/docbook/en-US/content/scalar_functions.xml 2009-07-28 20:59:49 UTC (rev 1199)
@@ -505,8 +505,8 @@
numeric string formats by visiting the Sun Java Web site at the
following
<ulink
- url="http://java.sun.com/j2se/1.4.2/docs/api/java/text/DecimalFormat.html">URL for Sun Java</ulink>
- .
+ url="http://java.sun.com/javase/6/docs/api/java/text/DecimalFormat.html">URL for Sun Java</ulink>
+ . In addition to the Java conventions, parse strings have leading and trailing whitespace removed automatically and cannot contain characters after a valid parse prefix.
</para>
<para>For example, you could use these function calls, with the
formatting string that adheres to the java.text.DecimalFormat
@@ -618,7 +618,7 @@
defines numeric string formats by visiting the Sun Java Web site
at the following
<ulink
- url="http://java.sun.com/j2se/1.4.2/docs/api/java/text/DecimalFormat.html">URL for Sun Java</ulink>
+ url="http://java.sun.com/javase/6/docs/api/java/text/DecimalFormat.html">URL for Sun Java</ulink>
.
</para>
<para>For example, you could use these function calls, with the
@@ -1038,7 +1038,16 @@
</sect1>
<sect1 id="date_time_functions">
<title>Date/Time Functions</title>
- <para>Date and time functions return dates, times, or timestamps. </para>
+ <para>Date and time functions return or operate on dates, times, or timestamps. </para>
+ <para>Parse and format Date/Time functions use the convention established within
+ the java.text.SimpleDateFormat class to define the formats you can
+ use with these functions. You can learn more about how this class
+ defines formats by visiting the Sun Java Web site
+ at the following
+ <ulink
+ url="http://java.sun.com/javase/6/docs/api/java/text/SimpleDateFormat.html">URL for Sun Java</ulink>
+ . In addition to the Java conventions, parse strings have leading and trailing whitespace removed automatically and cannot contain characters after a valid parse prefix.
+ </para>
<informaltable frame="all">
<tgroup cols="3">
<thead>
Modified: trunk/engine/src/main/java/com/metamatrix/query/function/FunctionMethods.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/function/FunctionMethods.java 2009-07-28 18:53:00 UTC (rev 1198)
+++ trunk/engine/src/main/java/com/metamatrix/query/function/FunctionMethods.java 2009-07-28 20:59:49 UTC (rev 1199)
@@ -29,6 +29,7 @@
import java.sql.Timestamp;
import java.text.DateFormat;
import java.text.DecimalFormat;
+import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
@@ -1120,42 +1121,32 @@
}
// ================== Parse String TO date/time/timestamp ==================
- public static Object parseDate(String date, String format)
- throws FunctionExecutionException {
- try {
- DateFormat df= new SimpleDateFormat(format);
- Date parsedDate = df.parse(date);
- return TimestampWithTimezone.createDate(parsedDate);
- } catch (java.text.ParseException pe) {
- throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0043, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0043 ,
- date, format));
+ private static Date parseDateHelper(String date, String format)
+ throws FunctionExecutionException {
+ date = date.trim();
+ DateFormat df = new SimpleDateFormat(format);
+ df.setLenient(false);
+ ParsePosition pp = new ParsePosition(0);
+ Date parsedDate = df.parse(date, pp);
+ if (parsedDate == null || pp.getIndex() < date.length()) {
+ throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0043, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0043, date, format));
}
+ return parsedDate;
}
-
- public static Object parseTime(String time, String format)
+
+ public static Date parseDate(String date, String format)
throws FunctionExecutionException {
-
- try {
- DateFormat df= new SimpleDateFormat(format);
- Date date = df.parse(time);
- return TimestampWithTimezone.createTime(date);
- } catch (java.text.ParseException pe) {
- throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0043, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0043 ,
- time,format));
- }
+ return TimestampWithTimezone.createDate(parseDateHelper(date, format));
}
- public static Object parseTimestamp(String timestamp, String format)
+ public static Time parseTime(String time, String format)
throws FunctionExecutionException {
+ return TimestampWithTimezone.createTime(parseDateHelper(time, format));
+ }
- try {
- DateFormat df= new SimpleDateFormat(format);
- Date date = df.parse(timestamp);
- return new Timestamp(date.getTime());
- } catch (java.text.ParseException pe) {
- throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0043, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0043 ,
- timestamp,format));
- }
+ public static Timestamp parseTimestamp(String timestamp, String format)
+ throws FunctionExecutionException {
+ return new Timestamp(parseDateHelper(timestamp, format).getTime());
}
// ================== Format number TO String ==================
@@ -1189,37 +1180,37 @@
}
// ================== Parse String TO numbers ==================
- public static Object parseInteger(Object number, Object format)
+ public static Object parseInteger(String number, String format)
throws FunctionExecutionException {
Number intNum = parseNumberHelper(number, format);
return new Integer(intNum.intValue());
}
- public static Object parseLong(Object number, Object format)
+ public static Object parseLong(String number, String format)
throws FunctionExecutionException {
Number longNum = parseNumberHelper(number, format);
return new Long(longNum.longValue());
}
- public static Object parseDouble(Object number, Object format)
+ public static Object parseDouble(String number, String format)
throws FunctionExecutionException {
Number doubleNum = parseNumberHelper(number, format);
return new Double(doubleNum.doubleValue());
}
- public static Object parseFloat(Object number, Object format)
+ public static Object parseFloat(String number, String format)
throws FunctionExecutionException {
Number longNum = parseNumberHelper(number, format);
return new Float(longNum.floatValue());
}
- public static Object parseBigInteger(Object number, Object format)
+ public static Object parseBigInteger(String number, String format)
throws FunctionExecutionException {
Number bigIntegerNum = parseNumberHelper(number, format);
return new BigInteger(bigIntegerNum.toString());
}
- public static Object parseBigDecimal(Object number, Object format)
+ public static Object parseBigDecimal(String number, String format)
throws FunctionExecutionException {
Number bigDecimalNum = parseNumberHelper(number, format);
return new BigDecimal(bigDecimalNum.toString());
@@ -1241,24 +1232,16 @@
}
}
- private static Number parseNumberHelper(Object number, Object format)
+ private static Number parseNumberHelper(String number, String format)
throws FunctionExecutionException {
-
- Number num = null;
- if (number == null || format == null) {
- return null;
- }
-
- if (number instanceof String && format instanceof String) {
- try {
- DecimalFormat df= new DecimalFormat((String) format);
- num = df.parse((String) number);
- } catch (java.text.ParseException pe) {
- throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0043, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0043 ,
+ number = number.trim();
+ DecimalFormat df= new DecimalFormat(format);
+ ParsePosition pp = new ParsePosition(0);
+ Number num = df.parse(number, pp);
+ if (num == null || pp.getIndex() < number.length()) {
+ throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0043, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0043 ,
number,format));
- }
}
-
return num;
}
Modified: trunk/engine/src/main/java/com/metamatrix/query/rewriter/QueryRewriter.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/rewriter/QueryRewriter.java 2009-07-28 18:53:00 UTC (rev 1198)
+++ trunk/engine/src/main/java/com/metamatrix/query/rewriter/QueryRewriter.java 2009-07-28 20:59:49 UTC (rev 1199)
@@ -62,6 +62,7 @@
import com.metamatrix.query.function.FunctionDescriptor;
import com.metamatrix.query.function.FunctionLibrary;
import com.metamatrix.query.function.FunctionLibraryManager;
+import com.metamatrix.query.function.FunctionMethods;
import com.metamatrix.query.metadata.QueryMetadataInterface;
import com.metamatrix.query.metadata.SupportConstants;
import com.metamatrix.query.metadata.TempMetadataAdapter;
@@ -1829,19 +1830,17 @@
// Passed all the checks, so build the optimized version
try {
- SimpleDateFormat timestampFormatter = new SimpleDateFormat(dateFormat + timeFormat);
- java.util.Date parsedTimestamp = timestampFormatter.parse(timestampValue);
-
- Constant dateConstant = new Constant(TimestampWithTimezone.createDate(parsedTimestamp));
+ Timestamp ts = FunctionMethods.parseTimestamp(timestampValue, dateFormat + timeFormat);
+ Constant dateConstant = new Constant(TimestampWithTimezone.createDate(ts));
CompareCriteria dateCompare = new CompareCriteria(formatDateFunction.getArgs()[0], CompareCriteria.EQ, dateConstant);
- Constant timeConstant = new Constant(TimestampWithTimezone.createTime(parsedTimestamp));
+ Constant timeConstant = new Constant(TimestampWithTimezone.createTime(ts));
CompareCriteria timeCompare = new CompareCriteria(formatTimeFunction.getArgs()[0], CompareCriteria.EQ, timeConstant);
CompoundCriteria compCrit = new CompoundCriteria(CompoundCriteria.AND, dateCompare, timeCompare);
return compCrit;
- } catch(ParseException e) {
+ } catch(FunctionExecutionException e) {
return criteria;
}
}
@@ -1983,7 +1982,6 @@
//space(x) => repeat(' ', x)
if (function.getName().equalsIgnoreCase(FunctionLibrary.SPACE)) {
- //change the function into timestampadd
Function result = new Function(SourceSystemFunctions.REPEAT,
new Expression[] {new Constant(" "), function.getArg(0)}); //$NON-NLS-1$
//resolve the function
@@ -1996,7 +1994,6 @@
//from_unixtime(a) => timestampadd(SQL_TSI_SECOND, a, new Timestamp(0))
if (function.getName().equalsIgnoreCase(FunctionLibrary.FROM_UNIXTIME)) {
- //change the function into timestampadd
Function result = new Function(FunctionLibrary.TIMESTAMPADD,
new Expression[] {new Constant(ReservedWords.SQL_TSI_SECOND), function.getArg(0), new Constant(new Timestamp(0)) });
//resolve the function
@@ -2007,7 +2004,7 @@
return rewriteFunction(result, procCommand, context, metadata);
}
- //rewrite nullif => case when (a = b) then null else a
+ //rewrite nullif(a, b) => case when (a = b) then null else a
if (function.getName().equalsIgnoreCase(FunctionLibrary.NULLIF)) {
List when = Arrays.asList(new Criteria[] {new CompareCriteria(function.getArg(0), CompareCriteria.EQ, function.getArg(1))});
Constant nullConstant = new Constant(null, function.getType());
Modified: trunk/engine/src/test/java/com/metamatrix/query/function/TestFunction.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/query/function/TestFunction.java 2009-07-28 18:53:00 UTC (rev 1198)
+++ trunk/engine/src/test/java/com/metamatrix/query/function/TestFunction.java 2009-07-28 20:59:49 UTC (rev 1199)
@@ -22,6 +22,8 @@
package com.metamatrix.query.function;
+import static org.junit.Assert.*;
+
import java.math.BigDecimal;
import java.math.BigInteger;
import java.sql.Date;
@@ -30,7 +32,7 @@
import java.util.Calendar;
import java.util.Properties;
-import junit.framework.TestCase;
+import org.junit.Test;
import com.metamatrix.api.exception.query.FunctionExecutionException;
import com.metamatrix.query.sql.ReservedWords;
@@ -38,17 +40,9 @@
import com.metamatrix.query.unittest.TimestampUtil;
import com.metamatrix.query.util.CommandContext;
-public class TestFunction extends TestCase {
+public class TestFunction {
- // ################################## FRAMEWORK ################################
-
- public TestFunction(String name) {
- super(name);
- }
-
- // ################################## TEST HELPERS ################################
-
- private void helpConcat(String s1, String s2, Object expected) throws FunctionExecutionException {
+ private void helpConcat(String s1, String s2, Object expected) {
Object actual = FunctionMethods.concat(s1, s2);
assertEquals("concat(" + s1 + ", " + s2 + ") failed.", expected, actual); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
@@ -79,12 +73,12 @@
assertEquals("replace(" + str + "," + sub + "," + replace + ") failed.", expected, actual); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
- public static void helpSubstring(String str, Integer start, Integer length, Object expected) throws FunctionExecutionException {
+ public static void helpSubstring(String str, Integer start, Integer length, Object expected) {
Object actual = FunctionMethods.substring(str, start, length);
assertEquals("substring(" + str + "," + start + "," + length + ") failed.", expected, actual); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
- public static void helpSubstring(String str, Integer start, Object expected) throws FunctionExecutionException {
+ public static void helpSubstring(String str, Integer start, Object expected) {
Object actual = FunctionMethods.substring(str, start);
assertEquals("substring(" + str + "," + start + ") failed.", expected, actual); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
@@ -132,7 +126,7 @@
assertEquals("Didn't get expected result from translate", expected, actual); //$NON-NLS-1$
}
- public static void helpTestLocate(String locateString, String input, int expectedLocation) throws FunctionExecutionException {
+ public static void helpTestLocate(String locateString, String input, int expectedLocation) {
Integer location = (Integer) FunctionMethods.locate(locateString, input);
int actualLocation = location.intValue();
assertEquals("Didn't get expected result from locate", expectedLocation, actualLocation); //$NON-NLS-1$
@@ -144,33 +138,33 @@
assertEquals("Didn't get expected result from locate", expectedLocation, actualLocation); //$NON-NLS-1$
}
- public static void helpTestRound(Integer number, Integer places, Object expected) throws FunctionExecutionException {
+ public static void helpTestRound(Integer number, Integer places, Object expected) {
Object actual = FunctionMethods.round(number, places);
assertEquals("round(" + number + "," + places + ") failed.", expected, actual); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- public static void helpTestRound(Float number, Integer places, Object expected) throws FunctionExecutionException {
+ public static void helpTestRound(Float number, Integer places, Object expected) {
Object actual = FunctionMethods.round(number, places);
assertEquals("round(" + number + "," + places + ") failed.", expected, actual); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- public static void helpTestRound(Double number, Integer places, Object expected) throws FunctionExecutionException {
+ public static void helpTestRound(Double number, Integer places, Object expected) {
Object actual = FunctionMethods.round(number, places);
assertEquals("round(" + number + "," + places + ") failed.", expected, actual); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- public static void helpTestRound(BigDecimal number, Integer places, Object expected) throws FunctionExecutionException {
+ public static void helpTestRound(BigDecimal number, Integer places, Object expected) {
Object actual = FunctionMethods.round(number, places);
assertEquals("round(" + number + "," + places + ") failed.", expected, actual); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- public static void helpTestHour1(String timeStr, int expected) throws FunctionExecutionException {
+ public static void helpTestHour1(String timeStr, int expected) {
Time t = Time.valueOf(timeStr);
Object actual = FunctionMethods.hour(t);
assertEquals("hour(" + t + ") failed", new Integer(expected), actual); //$NON-NLS-1$ //$NON-NLS-2$
}
- public static void helpTestHour2(String timestampStr, int expected) throws FunctionExecutionException {
+ public static void helpTestHour2(String timestampStr, int expected) {
Timestamp ts = Timestamp.valueOf(timestampStr);
Object actual = FunctionMethods.hour(ts);
assertEquals("hour(" + ts + ") failed", new Integer(expected), actual); //$NON-NLS-1$ //$NON-NLS-2$
@@ -182,7 +176,7 @@
expected, actual.toString());
}
- public static void helpTestTimestampDiff(String intervalType, Timestamp timeStamp1, Timestamp timeStamp2, Long expected) throws FunctionExecutionException {
+ public static void helpTestTimestampDiff(String intervalType, Timestamp timeStamp1, Timestamp timeStamp2, Long expected) {
Object actual = FunctionMethods.timestampDiff(intervalType, timeStamp1, timeStamp2);
assertEquals("timestampDiff(" + intervalType + ", " + timeStamp1 + ", " + timeStamp2 + ") failed", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
expected, actual);
@@ -194,7 +188,7 @@
expected2, actual2);
}
- public static void helpTestTimestampDiff(String intervalType, Time timeStamp1, Time timeStamp2, Long expected) throws FunctionExecutionException {
+ public static void helpTestTimestampDiff(String intervalType, Time timeStamp1, Time timeStamp2, Long expected) {
Object actual = FunctionMethods.timestampDiff(intervalType, timeStamp1, timeStamp2);
assertEquals("timestampDiff(" + intervalType + ", " + timeStamp1 + ", " + timeStamp2 + ") failed", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
expected, actual);
@@ -216,301 +210,301 @@
// ------------------------------ CONCAT ------------------------------
- public void testConcat1() throws FunctionExecutionException {
+ @Test public void testConcat1() throws Exception {
helpConcat("x", "y", "xy"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- public void testConcat5() throws FunctionExecutionException {
+ @Test public void testConcat5() throws Exception {
helpConcat("", "", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
// ------------------------------ TRIM ------------------------------
- public void testTrim3() throws FunctionExecutionException {
+ @Test public void testTrim3() throws Exception {
helpTrim("", true, ""); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testTrim4() throws FunctionExecutionException {
+ @Test public void testTrim4() throws Exception {
helpTrim("", false, ""); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testTrim5() throws FunctionExecutionException {
+ @Test public void testTrim5() throws Exception {
helpTrim("x", true, "x"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testTrim6() throws FunctionExecutionException {
+ @Test public void testTrim6() throws Exception {
helpTrim("x", false, "x"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testTrim7() throws FunctionExecutionException {
+ @Test public void testTrim7() throws Exception {
helpTrim(" x", true, "x"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testTrim8() throws FunctionExecutionException {
+ @Test public void testTrim8() throws Exception {
helpTrim(" x ", true, "x "); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testTrim9() throws FunctionExecutionException {
+ @Test public void testTrim9() throws Exception {
helpTrim("x ", false, "x"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testTrim10() throws FunctionExecutionException {
+ @Test public void testTrim10() throws Exception {
helpTrim(" x x ", false, " x x"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testTrim11() throws FunctionExecutionException {
+ @Test public void testTrim11() throws Exception {
helpTrim(" ", true, ""); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testTrim12() throws FunctionExecutionException {
+ @Test public void testTrim12() throws Exception {
helpTrim(" ", false, ""); //$NON-NLS-1$ //$NON-NLS-2$
}
// ------------------------------ LEFT ------------------------------
- public void testLeft1() throws FunctionExecutionException {
+ @Test public void testLeft1() throws Exception {
helpLeft("abcd", 0, ""); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testLeft2() throws FunctionExecutionException {
+ @Test public void testLeft2() throws Exception {
helpLeft("abcd", 3, "abc"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testLeft4() throws FunctionExecutionException {
+ @Test public void testLeft4() throws Exception {
helpLeft("", 0, ""); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testLeft5() throws FunctionExecutionException {
+ @Test public void testLeft5() throws Exception {
helpLeft("", 2, ""); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testLeft6() throws FunctionExecutionException {
+ @Test public void testLeft6() throws Exception {
helpLeft("abcd", 5, "abcd"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testLeft7() throws FunctionExecutionException {
+ @Test public void testLeft7() throws Exception {
helpLeft("abcd", 4, "abcd"); //$NON-NLS-1$ //$NON-NLS-2$
}
// ------------------------------ RIGHT ------------------------------
- public void testRight1() throws FunctionExecutionException {
+ @Test public void testRight1() throws Exception {
helpRight("abcd", 0, ""); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRight2() throws FunctionExecutionException {
+ @Test public void testRight2() throws Exception {
helpRight("abcd", 3, "bcd"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRight4() throws FunctionExecutionException {
+ @Test public void testRight4() throws Exception {
helpRight("", 0, ""); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRight5() throws FunctionExecutionException {
+ @Test public void testRight5() throws Exception {
helpRight("", 2, ""); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRight6() throws FunctionExecutionException {
+ @Test public void testRight6() throws Exception {
helpRight("abcd", 5, "abcd"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRight7() throws FunctionExecutionException {
+ @Test public void testRight7() throws Exception {
helpRight("abcd", 4, "abcd"); //$NON-NLS-1$ //$NON-NLS-2$
}
// ------------------------------ SUBSTRING ------------------------------
- public void testSubstring1() throws FunctionExecutionException {
+ @Test public void testSubstring1() throws Exception {
helpSubstring("abc", new Integer(1), new Integer(1), "a"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testSubstring2() throws FunctionExecutionException {
+ @Test public void testSubstring2() throws Exception {
helpSubstring("abc", new Integer(2), new Integer(2), "bc"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testSubstring3() throws FunctionExecutionException {
+ @Test public void testSubstring3() throws Exception {
helpSubstring("abc", new Integer(3), new Integer(3), "c"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testSubstring4() throws FunctionExecutionException {
+ @Test public void testSubstring4() throws Exception {
helpSubstring("abc", new Integer(3), new Integer(0), ""); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testSubstring6() throws FunctionExecutionException {
+ @Test public void testSubstring6() throws Exception {
helpSubstring("abc", new Integer(3), "c"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testSubstring7() throws FunctionExecutionException {
+ @Test public void testSubstring7() throws Exception {
helpSubstring("abc", new Integer(1), "abc"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testSubstring8() throws FunctionExecutionException {
+ @Test public void testSubstring8() throws Exception {
helpSubstring("abc", new Integer(-1), "c"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testSubstring9() throws FunctionExecutionException {
+ @Test public void testSubstring9() throws Exception {
helpSubstring("abc", new Integer(-3), "abc"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testSubstring10() throws FunctionExecutionException {
+ @Test public void testSubstring10() throws Exception {
helpSubstring("abc", new Integer(-4), null); //$NON-NLS-1$
}
- public void testSubstring11() throws FunctionExecutionException {
+ @Test public void testSubstring11() throws Exception {
helpSubstring("abc", new Integer(-1), new Integer(2), "c"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testSubstring12() throws FunctionExecutionException {
+ @Test public void testSubstring12() throws Exception {
helpSubstring("abc", new Integer(-3), new Integer(2), "ab"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testSubstring13() throws FunctionExecutionException {
+ @Test public void testSubstring13() throws Exception {
helpSubstring("abc", new Integer(0), new Integer(2), "ab"); //$NON-NLS-1$ //$NON-NLS-2$
}
// ------------------------------ REPLACE ------------------------------
- public void testReplace1() throws FunctionExecutionException {
+ @Test public void testReplace1() throws Exception {
helpReplace("", "x", "y", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
- public void testReplace2() throws FunctionExecutionException {
+ @Test public void testReplace2() throws Exception {
helpReplace("", "", "z", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
- public void testReplace3() throws FunctionExecutionException {
+ @Test public void testReplace3() throws Exception {
helpReplace("x", "x", "y", "y"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
- public void testReplace4() throws FunctionExecutionException {
+ @Test public void testReplace4() throws Exception {
helpReplace("xx", "x", "y", "yy"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
- public void testReplace5() throws FunctionExecutionException {
+ @Test public void testReplace5() throws Exception {
helpReplace("x x", "x", "y", "y y"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
- public void testReplace6() throws FunctionExecutionException {
+ @Test public void testReplace6() throws Exception {
helpReplace("x x", "x", "", " "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
- public void testReplace7() throws FunctionExecutionException {
+ @Test public void testReplace7() throws Exception {
helpReplace("x x", "x", "yz", "yz yz"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
- public void testReplace8() throws FunctionExecutionException {
+ @Test public void testReplace8() throws Exception {
helpReplace("xx xx", "xx", "y", "y y"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
// ------------------------------ CONVERT ------------------------------
- public void testConvertStringBoolean1() throws FunctionExecutionException {
+ @Test public void testConvertStringBoolean1() throws Exception {
helpConvert("true", "boolean", Boolean.TRUE); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testConvertStringBoolean2() throws FunctionExecutionException {
+ @Test public void testConvertStringBoolean2() throws Exception {
helpConvert("false", "boolean", Boolean.FALSE); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testConvertStringBoolean3() throws FunctionExecutionException {
+ @Test public void testConvertStringBoolean3() throws Exception {
helpConvert("x", "boolean", Boolean.FALSE); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testConvertStringBoolean4() throws FunctionExecutionException {
+ @Test public void testConvertStringBoolean4() throws Exception {
helpConvert("TrUe", "boolean", Boolean.TRUE); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testConvertStringBoolean5() throws FunctionExecutionException {
+ @Test public void testConvertStringBoolean5() throws Exception {
helpConvert("FAlsE", "boolean", Boolean.FALSE); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testConvertStringChar1() throws FunctionExecutionException {
+ @Test public void testConvertStringChar1() throws Exception {
helpConvert("a", "char", new Character('a')); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testConvertStringChar2() {
+ @Test public void testConvertStringChar2() throws Exception {
helpConvertFail("xx", "char"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testConvertStringByte1() throws FunctionExecutionException {
+ @Test public void testConvertStringByte1() throws Exception {
helpConvert("5", "byte", new Byte((byte) 5)); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testConvertStringShort1() throws FunctionExecutionException {
+ @Test public void testConvertStringShort1() throws Exception {
helpConvert("5", "short", new Short((short) 5)); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testConvertStringInteger1() throws FunctionExecutionException {
+ @Test public void testConvertStringInteger1() throws Exception {
helpConvert("5", "integer", new Integer(5)); //$NON-NLS-1$ //$NON-NLS-2$
}
// Integer > Integer.MAX_VALUE - should fail
- public void testConvertStringInteger2() {
+ @Test public void testConvertStringInteger2() throws Exception {
helpConvertFail("" + Integer.MAX_VALUE + "1", "integer"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- public void testConvertStringInteger3() {
+ @Test public void testConvertStringInteger3() throws Exception {
helpConvertFail("5.99", "integer"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testConvertStringLong1() throws FunctionExecutionException {
+ @Test public void testConvertStringLong1() throws Exception {
helpConvert("5", "long", new Long(5)); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testConvertStringBigInteger1() throws FunctionExecutionException {
+ @Test public void testConvertStringBigInteger1() throws Exception {
helpConvert("5", "biginteger", new BigInteger("5")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- public void testConvertStringBigInteger2() throws FunctionExecutionException {
+ @Test public void testConvertStringBigInteger2() throws Exception {
String bigInt = "" + Integer.MAX_VALUE + "111"; //$NON-NLS-1$ //$NON-NLS-2$
helpConvert(bigInt, "biginteger", new BigInteger(bigInt)); //$NON-NLS-1$
}
- public void testConvertStringFloat1() throws FunctionExecutionException {
+ @Test public void testConvertStringFloat1() throws Exception {
helpConvert("5.2", "float", new Float(5.2f)); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testConvertStringDouble1() throws FunctionExecutionException {
+ @Test public void testConvertStringDouble1() throws Exception {
helpConvert("5.2", "double", new Double(5.2d)); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testConvertStringBigDecimal1() throws FunctionExecutionException {
+ @Test public void testConvertStringBigDecimal1() throws Exception {
helpConvert("5.2", "bigdecimal", new BigDecimal("5.2")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- public void testConvertDoubleBigInteger() throws FunctionExecutionException {
+ @Test public void testConvertDoubleBigInteger() throws Exception {
helpConvert(new Double(1.0d), "biginteger", new BigInteger("1")); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testConvertFloatBigInteger() throws FunctionExecutionException {
+ @Test public void testConvertFloatBigInteger() throws Exception {
helpConvert(new Float(1.0), "biginteger", new BigInteger("1")); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testConvertBigDecimalBigInteger() throws FunctionExecutionException {
+ @Test public void testConvertBigDecimalBigInteger() throws Exception {
helpConvert(new BigDecimal("1.0"), "biginteger", new BigInteger("1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- public void testConvertDoubleLong() throws FunctionExecutionException {
+ @Test public void testConvertDoubleLong() throws Exception {
helpConvert(new Double(1.0d), "long", new Long("1")); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testConvertTimestampString() throws FunctionExecutionException {
+ @Test public void testConvertTimestampString() throws Exception {
Timestamp ts = TimestampUtil.createTimestamp(103, 7, 22, 22, 43, 53, 3333333);
helpConvert(ts, "string", "2003-08-22 22:43:53.003333333"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testAscii1() throws FunctionExecutionException {
+ @Test public void testAscii1() throws Exception {
Integer code = (Integer) FunctionMethods.ascii(new Character(' '));
assertEquals("Didn't get expected code", 32, code.intValue()); //$NON-NLS-1$
}
- public void testAscii2() throws FunctionExecutionException {
+ @Test public void testAscii2() throws Exception {
Integer code = (Integer) FunctionMethods.ascii(" "); //$NON-NLS-1$
assertEquals("Didn't get expected code", 32, code.intValue()); //$NON-NLS-1$
}
- public void testAscii4() {
+ @Test public void testAscii4() throws Exception {
try {
FunctionMethods.ascii(""); //$NON-NLS-1$
fail("Expected function exception"); //$NON-NLS-1$
@@ -518,100 +512,100 @@
}
}
- public void testAscii5() throws FunctionExecutionException {
+ @Test public void testAscii5() throws Exception {
Integer code = (Integer) FunctionMethods.ascii("abc"); //$NON-NLS-1$
assertEquals("Didn't get expected code", 97, code.intValue()); //$NON-NLS-1$
}
- public void testChr1() {
+ @Test public void testChr1() throws Exception {
Character chr = (Character) FunctionMethods.chr(new Integer(32));
assertEquals("Didn't get expected character", ' ', chr.charValue()); //$NON-NLS-1$
}
- public void testNvl1() {
+ @Test public void testNvl1() throws Exception {
String ret = (String) FunctionMethods.ifnull("x", "y"); //$NON-NLS-1$ //$NON-NLS-2$
assertEquals("Didn't get expected value", "x", ret); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testNvl2() {
+ @Test public void testNvl2() throws Exception {
String ret = (String) FunctionMethods.ifnull(null, "y"); //$NON-NLS-1$
assertEquals("Didn't get expected value", "y", ret); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testNvl3() {
+ @Test public void testNvl3() throws Exception {
String ret = (String) FunctionMethods.ifnull(null, null);
assertEquals("Didn't get expected value", null, ret); //$NON-NLS-1$
}
- public void testInitCap2() throws Exception {
+ @Test public void testInitCap2() throws Exception {
helpTestInitCap("abc", "Abc"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testInitCap3() throws FunctionExecutionException {
+ @Test public void testInitCap3() throws Exception {
helpTestInitCap(" test some\tweird\rspaces\nhere", " Test Some\tWeird\rSpaces\nHere"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testInitCap4() throws FunctionExecutionException {
+ @Test public void testInitCap4() throws Exception {
helpTestInitCap("x y ", "X Y "); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testInitCap5() throws FunctionExecutionException {
+ @Test public void testInitCap5() throws Exception {
helpTestInitCap("cows are FUN", "Cows Are Fun"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testLpad1() throws FunctionExecutionException {
+ @Test public void testLpad1() throws Exception {
helpTestLpad("x", 4, " x"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testLpad3() throws FunctionExecutionException {
+ @Test public void testLpad3() throws Exception {
helpTestLpad("x", 1, "x"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testLpad4() throws FunctionExecutionException {
+ @Test public void testLpad4() throws Exception {
helpTestLpad("xx", 1, "x"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testLpad5() throws FunctionExecutionException {
+ @Test public void testLpad5() throws Exception {
helpTestLpad("", 4, "x", "xxxx"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- public void testLpad6() throws FunctionExecutionException {
+ @Test public void testLpad6() throws Exception {
helpTestLpad("10", 6, "0", "000010"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- public void testLpad7() throws FunctionExecutionException {
+ @Test public void testLpad7() throws Exception {
helpTestLpad("x", 4, "yq", "qyqx" ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- public void testRpad1() throws FunctionExecutionException {
+ @Test public void testRpad1() throws Exception {
helpTestRpad("x", 4, "x "); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRpad3() throws FunctionExecutionException {
+ @Test public void testRpad3() throws Exception {
helpTestRpad("x", 1, "x"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRpad4() throws FunctionExecutionException {
+ @Test public void testRpad4() throws Exception {
helpTestRpad("xx", 1, "x"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRpad5() throws FunctionExecutionException {
+ @Test public void testRpad5() throws Exception {
helpTestRpad("", 4, "x", "xxxx"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- public void testRpad6() throws FunctionExecutionException {
+ @Test public void testRpad6() throws Exception {
helpTestRpad("10", 6, "0", "100000"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- public void testTranslate1() throws FunctionExecutionException {
+ @Test public void testTranslate1() throws Exception {
helpTestTranslate("This is my test", "ty", "yt", "This is mt yesy"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
- public void testTranslate2() throws FunctionExecutionException {
+ @Test public void testTranslate2() throws Exception {
helpTestTranslate("", "ty", "yt", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
- public void testTranslate3() {
+ @Test public void testTranslate3() throws Exception {
try {
FunctionMethods.translate("test", "x", "yz"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
fail("Did not get expected exception on differing src and dest lengths"); //$NON-NLS-1$
@@ -619,278 +613,278 @@
}
}
- public void testTranslate4() throws FunctionExecutionException {
+ @Test public void testTranslate4() throws Exception {
helpTestTranslate("test", "xy", "ab", "test"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
- public void testLocate1() throws FunctionExecutionException {
+ @Test public void testLocate1() throws Exception {
helpTestLocate(",", "Metamatrix, John Quincy", 11); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testLocate2() throws FunctionExecutionException {
+ @Test public void testLocate2() throws Exception {
helpTestLocate(" ", "Metamatrix, John Quincy", 12); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testLocate3() throws FunctionExecutionException {
+ @Test public void testLocate3() throws Exception {
helpTestLocate("x", "xx", 1); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testLocate4() throws FunctionExecutionException {
+ @Test public void testLocate4() throws Exception {
helpTestLocate("y", "xx", 0); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testLocate5() throws Exception {
+ @Test public void testLocate5() throws Exception {
helpTestLocate("b", "abab", 3, 4); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testLocate6() throws Exception {
+ @Test public void testLocate6() throws Exception {
helpTestLocate("z", "abab", 0, 0); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testLocate7() throws Exception {
+ @Test public void testLocate7() throws Exception {
helpTestLocate("z", "abab", null, 0); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testLocate8() throws Exception {
+ @Test public void testLocate8() throws Exception {
helpTestLocate("z", "abab", -1, 0); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testBitand() throws Exception {
+ @Test public void testBitand() throws Exception {
// Both values are integers
Integer result = (Integer) FunctionMethods.bitand(new Integer(0xFFF), new Integer(0x0F0));
assertNotNull("Result should not be null", result); //$NON-NLS-1$
assertEquals("result should be 0x0F0", 0x0F0, result.intValue()); //$NON-NLS-1$
}
- public void testBitor() throws Exception {
+ @Test public void testBitor() throws Exception {
// Both values are integers
Integer result = (Integer) FunctionMethods.bitor(new Integer(0xFFF), new Integer(0x0F0));
assertNotNull("Result should not be null", result); //$NON-NLS-1$
assertEquals("result should be 0xFFF", 0xFFF, result.intValue()); //$NON-NLS-1$
}
- public void testBitxor() throws Exception {
+ @Test public void testBitxor() throws Exception {
// Both values are integers
Integer result = (Integer) FunctionMethods.bitxor(new Integer(0xFFF), new Integer(0x0F0));
assertNotNull("Result should not be null", result); //$NON-NLS-1$
assertEquals("result should be 0xF0F", 0xF0F, result.intValue()); //$NON-NLS-1$
}
- public void testBitnot() {
+ @Test public void testBitnot() throws Exception {
// Both values are integers
Integer result = (Integer) FunctionMethods.bitnot(new Integer(0xF0F));
assertNotNull("Result should not be null", result); //$NON-NLS-1$
assertEquals("result should be 0xFFFFF0F0", 0xFFFFF0F0, result.intValue()); //$NON-NLS-1$
}
- public void testRoundInteger1() throws FunctionExecutionException {
+ @Test public void testRoundInteger1() throws Exception {
helpTestRound(new Integer(1928), new Integer(0), new Integer(1928));
}
- public void testRoundInteger2() throws FunctionExecutionException {
+ @Test public void testRoundInteger2() throws Exception {
helpTestRound(new Integer(1928), new Integer(-1), new Integer(1930));
}
- public void testRoundInteger3() throws FunctionExecutionException {
+ @Test public void testRoundInteger3() throws Exception {
helpTestRound(new Integer(1928), new Integer(-2), new Integer(1900));
}
- public void testRoundInteger4() throws FunctionExecutionException {
+ @Test public void testRoundInteger4() throws Exception {
helpTestRound(new Integer(1928), new Integer(-3), new Integer(2000));
}
- public void testRoundInteger5() throws FunctionExecutionException {
+ @Test public void testRoundInteger5() throws Exception {
helpTestRound(new Integer(1928), new Integer(-4), new Integer(0));
}
- public void testRoundInteger6() throws FunctionExecutionException {
+ @Test public void testRoundInteger6() throws Exception {
helpTestRound(new Integer(1928), new Integer(-5), new Integer(0));
}
- public void testRoundInteger7() throws FunctionExecutionException {
+ @Test public void testRoundInteger7() throws Exception {
helpTestRound(new Integer(1928), new Integer(1), new Integer(1928));
}
- public void testRoundFloat1() throws FunctionExecutionException {
+ @Test public void testRoundFloat1() throws Exception {
helpTestRound(new Float(123.456F), new Integer(4), new Float(123.456F));
}
- public void testRoundFloat2() throws FunctionExecutionException {
+ @Test public void testRoundFloat2() throws Exception {
helpTestRound(new Float(123.456F), new Integer(3), new Float(123.456F));
}
- public void testRoundFloat3() throws FunctionExecutionException {
+ @Test public void testRoundFloat3() throws Exception {
helpTestRound(new Float(123.456F), new Integer(2), new Float(123.46F));
}
- public void testRoundFloat4() throws FunctionExecutionException {
+ @Test public void testRoundFloat4() throws Exception {
helpTestRound(new Float(123.456F), new Integer(1), new Float(123.5F));
}
- public void testRoundFloat5() throws FunctionExecutionException {
+ @Test public void testRoundFloat5() throws Exception {
helpTestRound(new Float(123.456F), new Integer(0), new Float(123F));
}
- public void testRoundFloat6() throws FunctionExecutionException {
+ @Test public void testRoundFloat6() throws Exception {
helpTestRound(new Float(123.456F), new Integer(-1), new Float(120F));
}
- public void testRoundFloat7() throws FunctionExecutionException {
+ @Test public void testRoundFloat7() throws Exception {
helpTestRound(new Float(123.456F), new Integer(-2), new Float(100F));
}
- public void testRoundFloat8() throws FunctionExecutionException {
+ @Test public void testRoundFloat8() throws Exception {
helpTestRound(new Float(123.456F), new Integer(-3), new Float(0F));
}
- public void testRoundFloat9() throws FunctionExecutionException {
+ @Test public void testRoundFloat9() throws Exception {
helpTestRound(new Float(123.456F), new Integer(-4), new Float(0F));
}
- public void testRoundFloat10() throws FunctionExecutionException {
+ @Test public void testRoundFloat10() throws Exception {
helpTestRound(new Float(123.456F), new Integer(4000), new Float(123.456F));
}
- public void testRoundDouble1() throws FunctionExecutionException {
+ @Test public void testRoundDouble1() throws Exception {
helpTestRound(new Double(123.456), new Integer(4), new Double(123.456));
}
- public void testRoundDouble2() throws FunctionExecutionException {
+ @Test public void testRoundDouble2() throws Exception {
helpTestRound(new Double(123.456), new Integer(3), new Double(123.456));
}
- public void testRoundDouble3() throws FunctionExecutionException {
+ @Test public void testRoundDouble3() throws Exception {
helpTestRound(new Double(123.456), new Integer(2), new Double(123.46));
}
- public void testRoundDouble4() throws FunctionExecutionException {
+ @Test public void testRoundDouble4() throws Exception {
helpTestRound(new Double(123.456), new Integer(1), new Double(123.5));
}
- public void testRoundDouble5() throws FunctionExecutionException {
+ @Test public void testRoundDouble5() throws Exception {
helpTestRound(new Double(123.456), new Integer(0), new Double(123));
}
- public void testRoundDouble6() throws FunctionExecutionException {
+ @Test public void testRoundDouble6() throws Exception {
helpTestRound(new Double(123.456), new Integer(-1), new Double(120));
}
- public void testRoundDouble7() throws FunctionExecutionException {
+ @Test public void testRoundDouble7() throws Exception {
helpTestRound(new Double(123.456), new Integer(-2), new Double(100));
}
- public void testRoundDouble8() throws FunctionExecutionException {
+ @Test public void testRoundDouble8() throws Exception {
helpTestRound(new Double(123.456), new Integer(-3), new Double(0));
}
- public void testRoundDouble9() throws FunctionExecutionException {
+ @Test public void testRoundDouble9() throws Exception {
helpTestRound(new Double(123.456), new Integer(-4), new Double(0));
}
- public void testRoundDouble10() throws FunctionExecutionException {
+ @Test public void testRoundDouble10() throws Exception {
helpTestRound(new Double(-3.5), new Integer(0), new Double(-4));
}
- public void testRoundBigDecimal1() throws FunctionExecutionException {
+ @Test public void testRoundBigDecimal1() throws Exception {
helpTestRound(new BigDecimal("123.456"), new Integer(4), new BigDecimal("123.456")); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRoundBigDecimal2() throws FunctionExecutionException {
+ @Test public void testRoundBigDecimal2() throws Exception {
helpTestRound(new BigDecimal("123.456"), new Integer(3), new BigDecimal("123.456")); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRoundBigDecimal3() throws FunctionExecutionException {
+ @Test public void testRoundBigDecimal3() throws Exception {
helpTestRound(new BigDecimal("123.456"), new Integer(2), new BigDecimal("123.460")); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRoundBigDecimal4() throws FunctionExecutionException {
+ @Test public void testRoundBigDecimal4() throws Exception {
helpTestRound(new BigDecimal("123.456"), new Integer(1), new BigDecimal("123.500")); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRoundBigDecimal5() throws FunctionExecutionException {
+ @Test public void testRoundBigDecimal5() throws Exception {
helpTestRound(new BigDecimal("123.456"), new Integer(0), new BigDecimal("123.000")); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRoundBigDecimal6() throws FunctionExecutionException {
+ @Test public void testRoundBigDecimal6() throws Exception {
helpTestRound(new BigDecimal("123.456"), new Integer(-1), new BigDecimal("120.000")); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRoundBigDecimal7() throws FunctionExecutionException {
+ @Test public void testRoundBigDecimal7() throws Exception {
helpTestRound(new BigDecimal("123.456"), new Integer(-2), new BigDecimal("100.000")); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRoundBigDecimal8() throws FunctionExecutionException {
+ @Test public void testRoundBigDecimal8() throws Exception {
helpTestRound(new BigDecimal("123.456"), new Integer(-3), new BigDecimal("0.000")); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRoundBigDecimal9() throws FunctionExecutionException {
+ @Test public void testRoundBigDecimal9() throws Exception {
helpTestRound(new BigDecimal("123.456"), new Integer(-4), new BigDecimal("0.000")); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testHour1() throws FunctionExecutionException {
+ @Test public void testHour1() throws Exception {
helpTestHour1("00:00:00", 0); //$NON-NLS-1$
}
- public void testHour2() throws FunctionExecutionException {
+ @Test public void testHour2() throws Exception {
helpTestHour1("11:00:00", 11); //$NON-NLS-1$
}
- public void testHour3() throws FunctionExecutionException {
+ @Test public void testHour3() throws Exception {
helpTestHour1("12:00:00", 12); //$NON-NLS-1$
}
- public void testHour4() throws FunctionExecutionException {
+ @Test public void testHour4() throws Exception {
helpTestHour1("13:00:00", 13); //$NON-NLS-1$
}
- public void testHour5() throws FunctionExecutionException {
+ @Test public void testHour5() throws Exception {
helpTestHour1("23:59:59", 23); //$NON-NLS-1$
}
- public void testHour6() throws FunctionExecutionException {
+ @Test public void testHour6() throws Exception {
helpTestHour2("2002-01-01 00:00:00", 0); //$NON-NLS-1$
}
- public void testHour7() throws FunctionExecutionException {
+ @Test public void testHour7() throws Exception {
helpTestHour2("2002-01-01 11:00:00", 11); //$NON-NLS-1$
}
- public void testHour8() throws FunctionExecutionException {
+ @Test public void testHour8() throws Exception {
helpTestHour2("2002-01-01 12:00:00", 12); //$NON-NLS-1$
}
- public void testHour9() throws FunctionExecutionException {
+ @Test public void testHour9() throws Exception {
helpTestHour2("2002-01-01 13:00:00", 13); //$NON-NLS-1$
}
- public void testHour10() throws FunctionExecutionException {
+ @Test public void testHour10() throws Exception {
helpTestHour2("2002-01-01 23:59:59", 23); //$NON-NLS-1$
}
- public void testTimestampCreate1() {
+ @Test public void testTimestampCreate1() throws Exception {
helpTestTimestampCreate(TimestampUtil.createDate(103, 11, 1), TimestampUtil.createTime(23, 59, 59), "2003-12-01 23:59:59.0"); //$NON-NLS-1$
}
- public void testTimestampAdd1() throws Exception {
+ @Test public void testTimestampAdd1() throws Exception {
assertEquals(TimestampUtil.createDate(103, 11, 4), FunctionMethods.timestampAdd(ReservedWords.SQL_TSI_DAY, 3, TimestampUtil.createDate(103, 11, 1)));
}
- public void testTimestampAdd2() throws Exception {
+ @Test public void testTimestampAdd2() throws Exception {
assertEquals(TimestampUtil.createTimestamp(103, 11, 1, 18, 20, 30, 0), FunctionMethods.timestampAdd(ReservedWords.SQL_TSI_HOUR, 3, TimestampUtil.createTimestamp(103, 11, 1, 15, 20, 30, 0)));
}
- public void testTimestampAdd3() throws Exception {
+ @Test public void testTimestampAdd3() throws Exception {
assertEquals(TimestampUtil.createTime(11, 50, 30), FunctionMethods.timestampAdd(ReservedWords.SQL_TSI_MINUTE, 90, TimestampUtil.createTime(10, 20, 30)));
}
- public void testTimestampDiffTimeStamp_FracSec_1() throws FunctionExecutionException {
+ @Test public void testTimestampDiffTimeStamp_FracSec_1() throws Exception {
helpTestTimestampDiff(ReservedWords.SQL_TSI_FRAC_SECOND,
TimestampUtil.createTimestamp((2001-1900), 5, 21, 3, 9, 35, 1),
TimestampUtil.createTimestamp((2001-1900), 5, 21, 3, 9, 35, 100000000),
new Long(99999999));
}
- public void testTimestampDiffTimeStamp_FracSec_2() throws FunctionExecutionException {
+ @Test public void testTimestampDiffTimeStamp_FracSec_2() throws Exception {
helpTestTimestampDiff(ReservedWords.SQL_TSI_FRAC_SECOND,
// 1 day (8.64 x 10^10 nanos) and 1 nano
TimestampUtil.createTimestamp((2001-1900), 5, 21, 3, 9, 35, 2),
@@ -898,7 +892,7 @@
new Long(86400000000001L));
}
- public void testTimestampDiffTimeStamp_FracSec_3() throws FunctionExecutionException {
+ @Test public void testTimestampDiffTimeStamp_FracSec_3() throws Exception {
helpTestTimestampDiff(ReservedWords.SQL_TSI_FRAC_SECOND,
// 1 day (8.64 x 10^10 nanos) less 1 nano
TimestampUtil.createTimestamp((2001-1900), 5, 22, 3, 9, 35, 2),
@@ -906,28 +900,28 @@
new Long(-86399999999999L));
}
- public void testTimestampDiffTimeStamp_FracSec_4() throws FunctionExecutionException {
+ @Test public void testTimestampDiffTimeStamp_FracSec_4() throws Exception {
helpTestTimestampDiff(ReservedWords.SQL_TSI_FRAC_SECOND,
TimestampUtil.createTimestamp((2001-1900), 5, 21, 0, 0, 0, 1),
TimestampUtil.createTimestamp((2001-1900), 5, 21, 0, 0, 0, 3),
new Long(00000002));
}
- public void testTimestampDiffTimeStamp_FracSec_5() throws FunctionExecutionException {
+ @Test public void testTimestampDiffTimeStamp_FracSec_5() throws Exception {
helpTestTimestampDiff(ReservedWords.SQL_TSI_FRAC_SECOND,
TimestampUtil.createTimestamp((2004-1900), 5, 22, 0, 0, 0, 1),
TimestampUtil.createTimestamp((2004-1900), 5, 22, 0, 0, 0, 10),
new Long(9));
}
- public void testTimestampDiffTimeStamp_FracSec_6() throws FunctionExecutionException {
+ @Test public void testTimestampDiffTimeStamp_FracSec_6() throws Exception {
helpTestTimestampDiff(ReservedWords.SQL_TSI_FRAC_SECOND,
TimestampUtil.createTimestamp((2001-1900), 5, 22, 0, 0, 0, 2),
TimestampUtil.createTimestamp((2001-1900), 5, 22, 0, 0, 0, 3),
new Long(1));
}
- public void testTimestampDiffTimeStamp_FracSec_7() throws FunctionExecutionException {
+ @Test public void testTimestampDiffTimeStamp_FracSec_7() throws Exception {
helpTestTimestampDiff(ReservedWords.SQL_TSI_FRAC_SECOND,
// 1 nano diff
TimestampUtil.createTimestamp((2004-1900), 5, 22, 3, 9, 35, 2),
@@ -935,7 +929,7 @@
new Long(1));
}
- public void testTimestampDiffTimeStamp_FracSec_8() throws FunctionExecutionException {
+ @Test public void testTimestampDiffTimeStamp_FracSec_8() throws Exception {
helpTestTimestampDiff(ReservedWords.SQL_TSI_FRAC_SECOND,
// 1 nano diff
TimestampUtil.createTimestamp((2004-1900), 5, 22, 3, 9, 35, 3),
@@ -943,105 +937,105 @@
new Long(-1));
}
- public void testTimestampDiffTimeStamp_Min_1() throws FunctionExecutionException {
+ @Test public void testTimestampDiffTimeStamp_Min_1() throws Exception {
helpTestTimestampDiff(ReservedWords.SQL_TSI_MINUTE,
TimestampUtil.createTimestamp(0, 0, 0, 2, 34, 12, 0),
TimestampUtil.createTimestamp(0, 0, 0, 12, 0, 0, 0),
new Long(565));
}
- public void testTimestampDiffTimeStamp_Min_2() throws FunctionExecutionException {
+ @Test public void testTimestampDiffTimeStamp_Min_2() throws Exception {
helpTestTimestampDiff(ReservedWords.SQL_TSI_MINUTE,
TimestampUtil.createTimestamp((2001-1900), 0, 0, 2, 0, 0, 0),
TimestampUtil.createTimestamp((2001-1900), 0, 0, 0, 33, 12, 0),
new Long(-86));
}
- public void testTimestampDiffTimeStamp_Min_3() throws FunctionExecutionException {
+ @Test public void testTimestampDiffTimeStamp_Min_3() throws Exception {
helpTestTimestampDiff(ReservedWords.SQL_TSI_MINUTE,
TimestampUtil.createTimestamp((2001-1900), 8, 26, 12, 07, 58, 65497),
TimestampUtil.createTimestamp((2001-1900), 8, 29, 11, 25, 42, 483219),
new Long(4277));
}
- public void testTimestampDiffTimeStamp_Min_4() throws FunctionExecutionException {
+ @Test public void testTimestampDiffTimeStamp_Min_4() throws Exception {
helpTestTimestampDiff(ReservedWords.SQL_TSI_MINUTE,
TimestampUtil.createTimestamp((2001-1900), 8, 26, 12, 07, 58, 0),
TimestampUtil.createTimestamp((2001-1900), 8, 29, 11, 25, 42, 0),
new Long(4277));
}
- public void testTimestampDiffTimeStamp_Min_5() throws FunctionExecutionException {
+ @Test public void testTimestampDiffTimeStamp_Min_5() throws Exception {
helpTestTimestampDiff(ReservedWords.SQL_TSI_MINUTE,
TimestampUtil.createTimestamp((2001-1900), 8, 26, 12, 0, 0, 1),
TimestampUtil.createTimestamp((2001-1900), 8, 26, 12, 0, 0, 0),
new Long(0));
}
- public void testTimestampDiffTimeStamp_Hour_1() throws FunctionExecutionException {
+ @Test public void testTimestampDiffTimeStamp_Hour_1() throws Exception {
helpTestTimestampDiff(ReservedWords.SQL_TSI_HOUR,
TimestampUtil.createTimestamp((2004-1900), 8, 26, 12, 0, 0, 0),
TimestampUtil.createTimestamp((2004-1900), 8, 26, 12, 59, 59, 999999999),
new Long(0));
}
- public void testTimestampDiffTimeStamp_Week_1() throws FunctionExecutionException {
+ @Test public void testTimestampDiffTimeStamp_Week_1() throws Exception {
helpTestTimestampDiff(ReservedWords.SQL_TSI_WEEK,
TimestampUtil.createTimestamp((2001-1900), 5, 21, 3, 9, 35, 100),
TimestampUtil.createTimestamp((2001-1900), 4, 2, 5, 19, 35, 500),
new Long(-7));
}
- public void testTimestampDiffTimeStamp_Month_1() throws FunctionExecutionException {
+ @Test public void testTimestampDiffTimeStamp_Month_1() throws Exception {
helpTestTimestampDiff(ReservedWords.SQL_TSI_MONTH,
TimestampUtil.createTimestamp((2004-1900), 4, 19, 0, 0, 0, 0),
TimestampUtil.createTimestamp((2004-1900), 11, 20, 12, 0, 0, 0),
new Long(7));
}
- public void testTimestampDiffTimeStamp_Month_2() throws FunctionExecutionException {
+ @Test public void testTimestampDiffTimeStamp_Month_2() throws Exception {
helpTestTimestampDiff(ReservedWords.SQL_TSI_MONTH,
TimestampUtil.createTimestamp((2004-1900), 5, 1, 0, 0, 0, 1000000),
TimestampUtil.createTimestamp((2004-1900), 11, 1, 12, 0, 0, 1),
new Long(6));
}
- public void testTimestampDiffTimeStamp_Month_3() throws FunctionExecutionException {
+ @Test public void testTimestampDiffTimeStamp_Month_3() throws Exception {
helpTestTimestampDiff(ReservedWords.SQL_TSI_MONTH,
TimestampUtil.createTimestamp((2004-1900), 4, 19, 0, 0, 0, 1),
TimestampUtil.createTimestamp((2004-1900), 11, 18, 12, 0, 0, 1000000),
new Long(7));
}
- public void testTimestampDiffTimeStamp_Month_4() throws FunctionExecutionException {
+ @Test public void testTimestampDiffTimeStamp_Month_4() throws Exception {
helpTestTimestampDiff(ReservedWords.SQL_TSI_MONTH,
TimestampUtil.createTimestamp((2004-1900), 4, 1, 0, 0, 0, 1000000),
TimestampUtil.createTimestamp((2004-1900), 11, 1, 0, 0, 0, 0),
new Long(7));
}
- public void testTimestampDiffTimeStamp_Month_5() throws FunctionExecutionException {
+ @Test public void testTimestampDiffTimeStamp_Month_5() throws Exception {
helpTestTimestampDiff(ReservedWords.SQL_TSI_MONTH,
TimestampUtil.createTimestamp((2004-1900), 4, 1, 0, 0, 1, 0),
TimestampUtil.createTimestamp((2004-1900), 11, 1, 0, 0, 0, 0),
new Long(7));
}
- public void testTimestampDiffTimeStamp_Month_6() throws FunctionExecutionException {
+ @Test public void testTimestampDiffTimeStamp_Month_6() throws Exception {
helpTestTimestampDiff(ReservedWords.SQL_TSI_MONTH,
TimestampUtil.createTimestamp((2004-1900), 4, 1, 0, 0, 1, 0),
TimestampUtil.createTimestamp((2004-1900), 11, 1, 0, 0, 2, 0),
new Long(7));
}
- public void testTimestampDiffTimeStamp_Day_1() throws FunctionExecutionException {
+ @Test public void testTimestampDiffTimeStamp_Day_1() throws Exception {
helpTestTimestampDiff(ReservedWords.SQL_TSI_DAY,
TimestampUtil.createTimestamp((2004-1900), 2, 1, 0, 0, 0, 0),
TimestampUtil.createTimestamp((2004-1900), 3, 1, 0, 0, 0, 0),
new Long(31));
}
- public void testTimestampDiffTimeStamp_Day_2() throws FunctionExecutionException {
+ @Test public void testTimestampDiffTimeStamp_Day_2() throws Exception {
// Leap year
helpTestTimestampDiff(ReservedWords.SQL_TSI_DAY,
TimestampUtil.createTimestamp((2004-1900), 1, 1, 0, 0, 0, 0),
@@ -1049,21 +1043,21 @@
new Long(29));
}
- public void testTimestampDiffTime_Hour_1() throws FunctionExecutionException {
+ @Test public void testTimestampDiffTime_Hour_1() throws Exception {
helpTestTimestampDiff(ReservedWords.SQL_TSI_HOUR,
TimestampUtil.createTime(3, 4, 45),
TimestampUtil.createTime(5, 5, 36),
new Long(2));
}
- public void testTimestampDiffTime_Hour_2() throws FunctionExecutionException {
+ @Test public void testTimestampDiffTime_Hour_2() throws Exception {
helpTestTimestampDiff(ReservedWords.SQL_TSI_HOUR,
TimestampUtil.createTime(5, 0, 30),
TimestampUtil.createTime(3, 0, 31),
new Long(-1));
}
- public void testParseTimestamp1() throws FunctionExecutionException {
+ @Test public void testParseTimestamp1() throws Exception {
helpTestParseTimestamp("1993-04-24 3:59:59 PM", "yyyy-MM-dd hh:mm:ss aa", "{ts'1993-04-24 15:59:59.0'}"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
@@ -1090,28 +1084,28 @@
* against the system default timezone (not the startTz shown below). The fianl date value is also being read
* against the default timezone and not the endTz shown.
*/
- public void testModifyTimeZoneGMT() throws Exception {
+ @Test public void testModifyTimeZoneGMT() throws Exception {
helpTestModifyTimeZone("2004-10-03 15:19:59.123456789", "GMT+00:00", "GMT-01:00", "2004-10-03 16:19:59.123456789"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
- public void testModifyTimeZoneGMTPartialHour() throws Exception {
+ @Test public void testModifyTimeZoneGMTPartialHour() throws Exception {
helpTestModifyTimeZone("2004-10-03 15:30:59.123456789", "GMT+00:00", "GMT-01:45", "2004-10-03 17:15:59.123456789"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
- public void testModifyTimeZoneNamedTZ() throws Exception {
+ @Test public void testModifyTimeZoneNamedTZ() throws Exception {
helpTestModifyTimeZone("2004-10-03 15:19:59.123456789", "America/New_York", "America/Chicago", "2004-10-03 16:19:59.123456789"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
- public void testModifyTimeZoneNamedTZ2() throws Exception {
+ @Test public void testModifyTimeZoneNamedTZ2() throws Exception {
helpTestModifyTimeZone("2004-10-03 15:19:59.123456789", "America/Chicago", "America/New_York", "2004-10-03 14:19:59.123456789"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
- public void testModifyTimeZoneStartLocal() throws Exception {
+ @Test public void testModifyTimeZoneStartLocal() throws Exception {
helpTestModifyTimeZone("2004-10-03 15:19:59.123456789", "America/Chicago", "America/Los_Angeles", "2004-10-03 17:19:59.123456789"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
// case 2458
- public void testCurrentDate() {
+ @Test public void testCurrentDate() throws Exception {
Date curDate = (Date)FunctionMethods.currentDate();
@@ -1126,7 +1120,7 @@
}
// case 2458
- public void testCurrentTime() {
+ @Test public void testCurrentTime() throws Exception {
Time curDate = (Time)FunctionMethods.currentTime();
@@ -1141,7 +1135,7 @@
}
- public void testRand() throws FunctionExecutionException {
+ @Test public void testRand() throws Exception {
Double d = (Double)FunctionMethods.rand(new CommandContext(), new Integer(100));
assertEquals(new Double(0.7220096548596434), d);
@@ -1154,7 +1148,7 @@
FunctionMethods.rand(new CommandContext());
}
- public void testEnv() throws FunctionExecutionException {
+ @Test public void testEnv() throws Exception {
Properties p = new Properties();
String envProperty = "EnvProperty"; //$NON-NLS-1$
String systemProperty = "SystemProperty"; //$NON-NLS-1$
@@ -1173,4 +1167,16 @@
assertEquals(systemProperty+"_lowercase", FunctionMethods.env(context, systemProperty.toUpperCase())); //$NON-NLS-1$
}
+ @Test(expected=FunctionExecutionException.class) public void testParseIntStrictness() throws Exception {
+ FunctionMethods.parseInteger("1 a", "#"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ @Test(expected=FunctionExecutionException.class) public void testParseDateStrictness() throws Exception {
+ FunctionMethods.parseDate("2007-13-01", "yyyy-MM-dd"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ @Test public void testParseTimeWhitespace() throws Exception {
+ assertEquals(TimestampUtil.createTime(15, 0, 0), FunctionMethods.parseTime(" 15:00:00 ", "HH:mm:ss")); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
}
Modified: trunk/engine/src/test/java/com/metamatrix/query/rewriter/TestQueryRewriter.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/query/rewriter/TestQueryRewriter.java 2009-07-28 18:53:00 UTC (rev 1198)
+++ trunk/engine/src/test/java/com/metamatrix/query/rewriter/TestQueryRewriter.java 2009-07-28 20:59:49 UTC (rev 1199)
@@ -22,6 +22,8 @@
package com.metamatrix.query.rewriter;
+import static org.junit.Assert.*;
+
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
@@ -30,7 +32,7 @@
import java.util.Properties;
import java.util.TimeZone;
-import junit.framework.TestCase;
+import org.junit.Test;
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.MetaMatrixException;
@@ -71,17 +73,11 @@
import com.metamatrix.query.util.CommandContext;
import com.metamatrix.query.util.ContextProperties;
-public class TestQueryRewriter extends TestCase {
+public class TestQueryRewriter {
private static final String TRUE_STR = "1 = 1"; //$NON-NLS-1$
private static final String FALSE_STR = "1 = 0"; //$NON-NLS-1$
- // ################################## FRAMEWORK ################################
-
- public TestQueryRewriter(String name) {
- super(name);
- }
-
// ################################## TEST HELPERS ################################
private Criteria parseCriteria(String critStr, QueryMetadataInterface metadata) {
@@ -182,55 +178,55 @@
return rewriteCommand;
}
- public void testRewriteUnknown() {
+ @Test public void testRewriteUnknown() {
helpTestRewriteCriteria("pm1.g1.e1 = '1' and '1' = convert(null, string)", "1 = 0"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteUnknown1() {
+ @Test public void testRewriteUnknown1() {
helpTestRewriteCriteria("pm1.g1.e1 = '1' or '1' = convert(null, string)", "pm1.g1.e1 = '1'"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteUnknown2() {
+ @Test public void testRewriteUnknown2() {
helpTestRewriteCriteria("not('1' = convert(null, string))", "null <> null"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteUnknown3() {
+ @Test public void testRewriteUnknown3() {
helpTestRewriteCriteria("pm1.g1.e1 like convert(null, string))", "null <> null"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteUnknown4() {
+ @Test public void testRewriteUnknown4() {
helpTestRewriteCriteria("null in ('a', 'b', 'c')", "null <> null"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteUnknown5() {
+ @Test public void testRewriteUnknown5() {
helpTestRewriteCriteria("(null <> null) and 1 = 0", "1 = 0"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteUnknown6() {
+ @Test public void testRewriteUnknown6() {
helpTestRewriteCriteria("not(pm1.g1.e1 = '1' and '1' = convert(null, string))", "NOT ((pm1.g1.e1 = '1') and (NULL <> NULL))"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteUnknown7() {
+ @Test public void testRewriteUnknown7() {
helpTestRewriteCriteria("not(pm1.g1.e1 = '1' or '1' = convert(null, string))", "NOT ((pm1.g1.e1 = '1') or (NULL <> NULL))"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteUnknown8() {
+ @Test public void testRewriteUnknown8() {
helpTestRewriteCriteria("pm1.g1.e1 in (2, null)", "pm1.g1.e1 = '2'"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteInCriteriaWithRepeats() {
+ @Test public void testRewriteInCriteriaWithRepeats() {
helpTestRewriteCriteria("pm1.g1.e1 in ('1', '1', '2')", "pm1.g1.e1 IN ('1', '2')"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteInCriteriaWithSingleValue() {
+ @Test public void testRewriteInCriteriaWithSingleValue() {
helpTestRewriteCriteria("pm1.g1.e1 in ('1')", "pm1.g1.e1 = '1'"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteInCriteriaWithSingleValue1() {
+ @Test public void testRewriteInCriteriaWithSingleValue1() {
helpTestRewriteCriteria("pm1.g1.e1 not in ('1')", "pm1.g1.e1 != '1'"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteInCriteriaWithNoValues() throws Exception {
+ @Test public void testRewriteInCriteriaWithNoValues() throws Exception {
Criteria crit = new SetCriteria(new ElementSymbol("e1"), Collections.EMPTY_LIST); //$NON-NLS-1$
Criteria actual = QueryRewriter.rewriteCriteria(crit, null, null, null);
@@ -238,59 +234,59 @@
assertEquals(QueryRewriter.FALSE_CRITERIA, actual);
}
- public void testRewriteBetweenCriteria1() {
+ @Test public void testRewriteBetweenCriteria1() {
helpTestRewriteCriteria("pm1.g1.e1 BETWEEN 1000 AND 2000", "(pm1.g1.e1 >= '1000') AND (pm1.g1.e1 <= '2000')"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteBetweenCriteria2() {
+ @Test public void testRewriteBetweenCriteria2() {
helpTestRewriteCriteria("pm1.g1.e1 NOT BETWEEN 1000 AND 2000", "(pm1.g1.e1 < '1000') OR (pm1.g1.e1 > '2000')"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteCrit1() {
+ @Test public void testRewriteCrit1() {
helpTestRewriteCriteria("concat('a','b') = 'ab'", "1 = 1"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteCrit2() {
+ @Test public void testRewriteCrit2() {
helpTestRewriteCriteria("'x' = pm1.g1.e1", "(pm1.g1.e1 = 'x')"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteCrit3() {
+ @Test public void testRewriteCrit3() {
helpTestRewriteCriteria("pm1.g1.e1 = convert('a', string)", "pm1.g1.e1 = 'a'"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteCrit4() {
+ @Test public void testRewriteCrit4() {
helpTestRewriteCriteria("pm1.g1.e1 = CONVERT('a', string)", "pm1.g1.e1 = 'a'"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteCrit5() {
+ @Test public void testRewriteCrit5() {
helpTestRewriteCriteria("pm1.g1.e1 in ('a')", "pm1.g1.e1 = 'a'"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteCrit6() {
+ @Test public void testRewriteCrit6() {
helpTestRewriteCriteria("1 = convert(pm1.g1.e1,integer) + 10", "pm1.g1.e1 = '-9'"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteCrit7() {
+ @Test public void testRewriteCrit7() {
helpTestRewriteCriteria("((pm1.g1.e1 = 1) and (pm1.g1.e1 = 1))", "pm1.g1.e1 = '1'"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteMatchCritEscapeChar1() {
+ @Test public void testRewriteMatchCritEscapeChar1() {
helpTestRewriteCriteria("pm1.g1.e1 LIKE 'x_' ESCAPE '\\'", "pm1.g1.e1 LIKE 'x_'"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteMatchCritEscapeChar2() {
+ @Test public void testRewriteMatchCritEscapeChar2() {
helpTestRewriteCriteria("pm1.g1.e1 LIKE '#%x' ESCAPE '#'", "pm1.g1.e1 LIKE '#%x' ESCAPE '#'"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteMatchCritEscapeChar3() {
+ @Test public void testRewriteMatchCritEscapeChar3() {
helpTestRewriteCriteria("pm1.g1.e1 LIKE '#%x'", "pm1.g1.e1 LIKE '#%x'"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteMatchCritEscapeChar4() {
+ @Test public void testRewriteMatchCritEscapeChar4() {
helpTestRewriteCriteria("pm1.g1.e1 LIKE pm1.g1.e1 ESCAPE '#'", "pm1.g1.e1 LIKE pm1.g1.e1 ESCAPE '#'"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteMatchCritEscapeChar5() throws Exception {
+ @Test public void testRewriteMatchCritEscapeChar5() throws Exception {
MatchCriteria mcrit = new MatchCriteria(new ElementSymbol("pm1.g1.e1"), new Constant(null, DataTypeManager.DefaultDataClasses.STRING), '#'); //$NON-NLS-1$
Criteria expected = QueryRewriter.UNKNOWN_CRITERIA;
@@ -298,114 +294,114 @@
assertEquals("Did not get expected rewritten criteria", expected, actual); //$NON-NLS-1$
}
- public void testRewriteMatchCrit1() {
+ @Test public void testRewriteMatchCrit1() {
helpTestRewriteCriteria("pm1.g1.e1 LIKE 'x' ESCAPE '\\'", "pm1.g1.e1 = 'x'"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteMatchCrit2() {
+ @Test public void testRewriteMatchCrit2() {
helpTestRewriteCriteria("pm1.g1.e1 NOT LIKE 'x'", "pm1.g1.e1 <> 'x'"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteMatchCrit3() {
+ @Test public void testRewriteMatchCrit3() {
helpTestRewriteCriteria("pm1.g1.e1 NOT LIKE '%'", "1 = 0"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteCritTimestampCreate1() {
+ @Test public void testRewriteCritTimestampCreate1() {
helpTestRewriteCriteria("timestampCreate(pm3.g1.e2, pm3.g1.e3) = {ts'2004-11-23 09:25:00'}", "(pm3.g1.e2 = {d'2004-11-23'}) AND (pm3.g1.e3 = {t'09:25:00'})"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteCritTimestampCreate2() {
+ @Test public void testRewriteCritTimestampCreate2() {
helpTestRewriteCriteria("{ts'2004-11-23 09:25:00'} = timestampCreate(pm3.g1.e2, pm3.g1.e3)", "(pm3.g1.e2 = {d'2004-11-23'}) AND (pm3.g1.e3 = {t'09:25:00'})"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteCritSwap1() {
+ @Test public void testRewriteCritSwap1() {
helpTestRewriteCriteria("'x' = pm1.g1.e1", "pm1.g1.e1 = 'x'"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteCritSwap2() {
+ @Test public void testRewriteCritSwap2() {
helpTestRewriteCriteria("'x' <> pm1.g1.e1", "pm1.g1.e1 <> 'x'"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteCritSwap3() {
+ @Test public void testRewriteCritSwap3() {
helpTestRewriteCriteria("'x' < pm1.g1.e1", "pm1.g1.e1 > 'x'"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteCritSwap4() {
+ @Test public void testRewriteCritSwap4() {
helpTestRewriteCriteria("'x' <= pm1.g1.e1", "pm1.g1.e1 >= 'x'"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteCritSwap5() {
+ @Test public void testRewriteCritSwap5() {
helpTestRewriteCriteria("'x' > pm1.g1.e1", "pm1.g1.e1 < 'x'"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteCritSwap6() {
+ @Test public void testRewriteCritSwap6() {
helpTestRewriteCriteria("'x' >= pm1.g1.e1", "pm1.g1.e1 <= 'x'"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteCritExpr_op1() {
+ @Test public void testRewriteCritExpr_op1() {
helpTestRewriteCriteria("pm1.g1.e2 + 5 = 10", "pm1.g1.e2 = 5"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteCritExpr_op2() {
+ @Test public void testRewriteCritExpr_op2() {
helpTestRewriteCriteria("pm1.g1.e2 - 5 = 10", "pm1.g1.e2 = 15"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteCritExpr_op3() {
+ @Test public void testRewriteCritExpr_op3() {
helpTestRewriteCriteria("pm1.g1.e2 * 5 = 10", "pm1.g1.e2 = 2"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteCritExpr_op4() {
+ @Test public void testRewriteCritExpr_op4() {
helpTestRewriteCriteria("pm1.g1.e2 / 5 = 10", "pm1.g1.e2 = 50"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteCritExpr_signFlip1() {
+ @Test public void testRewriteCritExpr_signFlip1() {
helpTestRewriteCriteria("pm1.g1.e2 * -5 > 10", "pm1.g1.e2 < -2"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteCritExpr_signFlip2() {
+ @Test public void testRewriteCritExpr_signFlip2() {
helpTestRewriteCriteria("pm1.g1.e2 * -5 >= 10", "pm1.g1.e2 <= -2"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteCritExpr_signFlip3() {
+ @Test public void testRewriteCritExpr_signFlip3() {
helpTestRewriteCriteria("pm1.g1.e2 * -5 < 10", "pm1.g1.e2 > -2"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteCritExpr_signFlip4() {
+ @Test public void testRewriteCritExpr_signFlip4() {
helpTestRewriteCriteria("pm1.g1.e2 * -5 <= 10", "pm1.g1.e2 >= -2"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteCritExpr_backwards1() {
+ @Test public void testRewriteCritExpr_backwards1() {
helpTestRewriteCriteria("5 + pm1.g1.e2 <= 10", "pm1.g1.e2 <= 5"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteCritExpr_backwards2() {
+ @Test public void testRewriteCritExpr_backwards2() {
helpTestRewriteCriteria("-5 * pm1.g1.e2 <= 10", "pm1.g1.e2 >= -2"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteCritExpr_unhandled1() {
+ @Test public void testRewriteCritExpr_unhandled1() {
helpTestRewriteCriteria("5 / pm1.g1.e2 <= 10", "5 / pm1.g1.e2 <= 10"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteCritExpr_unhandled2() {
+ @Test public void testRewriteCritExpr_unhandled2() {
helpTestRewriteCriteria("5 - pm1.g1.e2 <= 10", "5 - pm1.g1.e2 <= 10"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteCrit_parseDate() {
+ @Test public void testRewriteCrit_parseDate() {
helpTestRewriteCriteria("PARSEDATE(pm3.g1.e1, 'yyyyMMdd') = {d'2003-05-01'}", //$NON-NLS-1$
"pm3.g1.e1 = '20030501'" ); //$NON-NLS-1$
- }
-
- public void testRewriteCrit_parseDate1() {
+ }
+
+ @Test public void testRewriteCrit_parseDate1() {
helpTestRewriteCriteria("PARSEDATE(pm3.g1.e1, 'yyyyMM') = {d'2003-05-01'}", //$NON-NLS-1$
"pm3.g1.e1 = '200305'" ); //$NON-NLS-1$
}
- public void testRewriteCrit_parseDate2() {
+ @Test public void testRewriteCrit_parseDate2() {
helpTestRewriteCriteria("PARSEDATE(pm3.g1.e1, 'yyyyMM') = {d'2003-05-02'}", //$NON-NLS-1$
"1 = 0" ); //$NON-NLS-1$
}
- public void testRewriteCrit_invalidParseDate() {
+ @Test public void testRewriteCrit_invalidParseDate() {
QueryMetadataInterface metadata = FakeMetadataFactory.example1Cached();
Criteria origCrit = parseCriteria("PARSEDATE(pm3.g1.e1, '''') = {d'2003-05-01'}", metadata); //$NON-NLS-1$
@@ -417,136 +413,136 @@
}
}
- public void testRewriteCrit_parseTime() {
+ @Test public void testRewriteCrit_parseTime() {
helpTestRewriteCriteria("PARSETIME(pm3.g1.e1, 'HH mm ss') = {t'13:25:04'}", //$NON-NLS-1$
"pm3.g1.e1 = '13 25 04'" ); //$NON-NLS-1$
}
- public void testRewriteCrit_parseTimestamp() {
+ @Test public void testRewriteCrit_parseTimestamp() {
helpTestRewriteCriteria("PARSETimestamp(pm3.g1.e1, 'yyyy dd mm') = {ts'2003-05-01 13:25:04.5'}", //$NON-NLS-1$
"1 = 0" ); //$NON-NLS-1$
}
- public void testRewriteCrit_parseTimestamp1() {
+ @Test public void testRewriteCrit_parseTimestamp1() {
helpTestRewriteCriteria("PARSETimestamp(pm3.g1.e1, 'yyyy dd mm') = {ts'2003-01-01 00:25:00.0'}", //$NON-NLS-1$
"pm3.g1.e1 = '2003 01 25'" ); //$NON-NLS-1$
}
- public void testRewriteCrit_parseTimestamp2() {
+ @Test public void testRewriteCrit_parseTimestamp2() {
helpTestRewriteCriteria("PARSETimestamp(CONVERT(pm3.g1.e2, string), 'yyyy-MM-dd') = {ts'2003-05-01 13:25:04.5'}", //$NON-NLS-1$
"1 = 0" ); //$NON-NLS-1$
}
- public void testRewriteCrit_parseTimestamp3() {
+ @Test public void testRewriteCrit_parseTimestamp3() {
helpTestRewriteCriteria("PARSETimestamp(pm3.g1.e1, 'yyyy dd mm') <> {ts'2003-05-01 13:25:04.5'}", //$NON-NLS-1$
"1 = 1" ); //$NON-NLS-1$
}
- public void testRewriteCrit_parseTimestamp4() {
+ @Test public void testRewriteCrit_parseTimestamp4() {
helpTestRewriteCriteria("PARSETimestamp(CONVERT(pm3.g1.e2, string), 'yyyy-MM-dd') = {ts'2003-05-01 00:00:00.0'}", //$NON-NLS-1$
"pm3.g1.e2 = {d'2003-05-01'}" ); //$NON-NLS-1$
}
- public void testRewriteCrit_parseTimestamp_notEquality() {
+ @Test public void testRewriteCrit_parseTimestamp_notEquality() {
helpTestRewriteCriteria("PARSETimestamp(pm3.g1.e1, 'yyyy dd mm') > {ts'2003-05-01 13:25:04.5'}", //$NON-NLS-1$
"PARSETimestamp(pm3.g1.e1, 'yyyy dd mm') > {ts'2003-05-01 13:25:04.5'}" ); //$NON-NLS-1$
}
- public void testRewriteCrit_parseTimestamp_decompose() {
+ @Test public void testRewriteCrit_parseTimestamp_decompose() {
helpTestRewriteCriteria("PARSETIMESTAMP(CONCAT(FORMATDATE(pm3.g1.e2, 'yyyyMMdd'), FORMATTIME(pm3.g1.e3, 'HHmmss')), 'yyyyMMddHHmmss') = PARSETIMESTAMP('19690920183045', 'yyyyMMddHHmmss')", //$NON-NLS-1$
"(pm3.g1.e2 = {d'1969-09-20'}) AND (pm3.g1.e3 = {t'18:30:45'})" ); //$NON-NLS-1$
}
- public void testRewriteCrit_timestampCreate_decompose() {
+ @Test public void testRewriteCrit_timestampCreate_decompose() {
helpTestRewriteCriteria("timestampCreate(pm3.g1.e2, pm3.g1.e3) = PARSETIMESTAMP('19690920183045', 'yyyyMMddHHmmss')", //$NON-NLS-1$
"(pm3.g1.e2 = {d'1969-09-20'}) AND (pm3.g1.e3 = {t'18:30:45'})" ); //$NON-NLS-1$
}
- public void testRewriteCrit_parseInteger() {
+ @Test public void testRewriteCrit_parseInteger() {
helpTestRewriteCriteria("parseInteger(pm1.g1.e1, '#,##0') = 1234", //$NON-NLS-1$
"pm1.g1.e1 = '1,234'" ); //$NON-NLS-1$
}
- public void testRewriteCrit_parseLong() {
+ @Test public void testRewriteCrit_parseLong() {
helpTestRewriteCriteria("parseLong(pm1.g1.e1, '#,##0') = convert(1234, long)", //$NON-NLS-1$
"pm1.g1.e1 = '1,234'" ); //$NON-NLS-1$
}
- public void testRewriteCrit_parseBigInteger() {
+ @Test public void testRewriteCrit_parseBigInteger() {
helpTestRewriteCriteria("parseBigInteger(pm1.g1.e1, '#,##0') = convert(1234, biginteger)", //$NON-NLS-1$
"pm1.g1.e1 = '1,234'" ); //$NON-NLS-1$
}
- public void testRewriteCrit_parseFloat() {
+ @Test public void testRewriteCrit_parseFloat() {
helpTestRewriteCriteria("parseFloat(pm1.g1.e1, '#,##0.###') = convert(1234.1234, float)", //$NON-NLS-1$
"pm1.g1.e1 = '1,234.123'" ); //$NON-NLS-1$
}
- public void testRewriteCrit_parseDouble() {
+ @Test public void testRewriteCrit_parseDouble() {
helpTestRewriteCriteria("parseDouble(pm1.g1.e1, '$#,##0.00') = convert(1234.5, double)", //$NON-NLS-1$
"pm1.g1.e1 = '$1,234.50'" ); //$NON-NLS-1$
}
- public void testRewriteCrit_parseBigDecimal() {
+ @Test public void testRewriteCrit_parseBigDecimal() {
helpTestRewriteCriteria("parseBigDecimal(pm1.g1.e1, '#,##0.###') = convert(1234.1234, bigdecimal)", //$NON-NLS-1$
"pm1.g1.e1 = '1,234.123'" ); //$NON-NLS-1$
}
- public void testRewriteCrit_formatDate() {
+ @Test public void testRewriteCrit_formatDate() {
helpTestRewriteCriteria("formatDate(pm3.g1.e2, 'yyyyMMdd') = '20030501'", //$NON-NLS-1$
"pm3.g1.e2 = {d'2003-05-01'}" ); //$NON-NLS-1$
}
- public void testRewriteCrit_formatTime() {
+ @Test public void testRewriteCrit_formatTime() {
helpTestRewriteCriteria("formatTime(pm3.g1.e3, 'HH mm ss') = '13 25 04'", //$NON-NLS-1$
"pm3.g1.e3 = {t'13:25:04'}" ); //$NON-NLS-1$
}
- public void testRewriteCrit_formatTimestamp() {
+ @Test public void testRewriteCrit_formatTimestamp() {
helpTestRewriteCriteria("formatTimestamp(pm3.g1.e4, 'MM dd, yyyy - HH:mm:ss') = '05 01, 1974 - 07:00:00'", //$NON-NLS-1$
"formatTimestamp(pm3.g1.e4, 'MM dd, yyyy - HH:mm:ss') = '05 01, 1974 - 07:00:00'" ); //$NON-NLS-1$
}
- public void testRewriteCrit_formatTimestamp1() {
+ @Test public void testRewriteCrit_formatTimestamp1() {
helpTestRewriteCriteria("formatTimestamp(pm3.g1.e4, 'MM dd, yyyy - HH:mm:ss.S') = '05 01, 1974 - 07:00:00.0'", //$NON-NLS-1$
"pm3.g1.e4 = {ts'1974-05-01 07:00:00.0'}" ); //$NON-NLS-1$
}
- public void testRewriteCrit_formatInteger() {
+ @Test public void testRewriteCrit_formatInteger() {
helpTestRewriteCriteria("formatInteger(pm1.g1.e2, '#,##0') = '1,234'", //$NON-NLS-1$
"pm1.g1.e2 = 1234" ); //$NON-NLS-1$
}
- public void testRewriteCrit_formatInteger1() {
+ @Test public void testRewriteCrit_formatInteger1() {
helpTestRewriteCriteria("formatInteger(pm1.g1.e2, '#5') = '105'", //$NON-NLS-1$
"formatInteger(pm1.g1.e2, '#5') = '105'" ); //$NON-NLS-1$
}
- public void testRewriteCrit_formatLong() {
+ @Test public void testRewriteCrit_formatLong() {
helpTestRewriteCriteria("formatLong(convert(pm1.g1.e2, long), '#,##0') = '1,234,567,890,123'", //$NON-NLS-1$
"1 = 0" ); //$NON-NLS-1$
}
- public void testRewriteCrit_formatLong1() {
+ @Test public void testRewriteCrit_formatLong1() {
helpTestRewriteCriteria("formatLong(convert(pm1.g1.e2, long), '#,##0') = '1,234,567,890'", //$NON-NLS-1$
"pm1.g1.e2 = 1234567890" ); //$NON-NLS-1$
}
- public void testRewriteCrit_formatTimestampInvert() {
+ @Test public void testRewriteCrit_formatTimestampInvert() {
String original = "formatTimestamp(pm3.g1.e4, 'MM dd, yyyy - HH:mm:ss.S') = ?"; //$NON-NLS-1$
String expected = "pm3.g1.e4 = parseTimestamp(?, 'MM dd, yyyy - HH:mm:ss.S')"; //$NON-NLS-1$
helpTestRewriteCriteria(original, expected);
}
- public void testRewriteCrit_plusInvert() {
+ @Test public void testRewriteCrit_plusInvert() {
String original = "pm1.g1.e2 + 1.1 = ?"; //$NON-NLS-1$
String expected = "pm1.g1.e2 = ? - 1.1"; //$NON-NLS-1$
helpTestRewriteCriteria(original, expected);
}
- public void testRewriteCrit_formatBigInteger() throws Exception {
+ @Test public void testRewriteCrit_formatBigInteger() throws Exception {
String original = "formatBigInteger(convert(pm1.g1.e2, biginteger), '#,##0') = '1,234,567,890'"; //$NON-NLS-1$
String expected = "pm1.g1.e2 = 1234567890"; //$NON-NLS-1$
@@ -559,7 +555,7 @@
assertEquals("Did not rewrite correctly: ", expectedCrit, actual); //$NON-NLS-1$
}
- public void testRewriteCrit_formatFloat() throws Exception {
+ @Test public void testRewriteCrit_formatFloat() throws Exception {
String original = "formatFloat(convert(pm1.g1.e4, float), '#,##0.###') = '1,234.123'"; //$NON-NLS-1$
String expected = "pm1.g1.e4 = 1234.123046875"; //$NON-NLS-1$
@@ -571,7 +567,7 @@
assertEquals("Did not rewrite correctly: ", expected, actual.toString()); //$NON-NLS-1$
}
- public void testRewriteCrit_formatDouble() throws Exception {
+ @Test public void testRewriteCrit_formatDouble() throws Exception {
String original = "formatDouble(convert(pm1.g1.e4, double), '$#,##0.00') = '$1,234.50'"; //$NON-NLS-1$
String expected = "pm1.g1.e4 = '1234.5'"; //$NON-NLS-1$
@@ -585,7 +581,7 @@
assertEquals("Did not rewrite correctly: ", expectedCrit, actual); //$NON-NLS-1$
}
- public void testRewriteCrit_formatBigDecimal() throws Exception {
+ @Test public void testRewriteCrit_formatBigDecimal() throws Exception {
String original = "formatBigDecimal(convert(pm1.g1.e4, bigdecimal), '#,##0.###') = convert(1234.5, bigdecimal)"; //$NON-NLS-1$
String expected = "pm1.g1.e4 = 1234.5"; //$NON-NLS-1$
@@ -598,207 +594,207 @@
assertEquals("Did not rewrite correctly: ", expectedCrit, actual); //$NON-NLS-1$
}
- public void testRewriteCritTimestampDiffDate1() {
+ @Test public void testRewriteCritTimestampDiffDate1() {
helpTestRewriteCriteria("timestampdiff(SQL_TSI_DAY, {d'2003-05-15'}, {d'2003-05-17'} ) = 2", TRUE_STR); //$NON-NLS-1$
}
- public void testRewriteCritTimestampDiffDate2() {
+ @Test public void testRewriteCritTimestampDiffDate2() {
helpTestRewriteCriteria("timestampdiff(SQL_TSI_DAY, {d'2003-06-02'}, {d'2003-05-17'} ) = -16", TRUE_STR); //$NON-NLS-1$
}
- public void testRewriteCritTimestampDiffDate3() {
+ @Test public void testRewriteCritTimestampDiffDate3() {
helpTestRewriteCriteria("timestampdiff(SQL_TSI_QUARTER, {d'2002-01-25'}, {d'2003-06-01'} ) = 5", TRUE_STR); //$NON-NLS-1$
}
- public void testRewriteCritTimestampDiffTime1() {
+ @Test public void testRewriteCritTimestampDiffTime1() {
helpTestRewriteCriteria("timestampdiff(SQL_TSI_HOUR, {t'03:04:45'}, {t'05:05:36'} ) = 2", TRUE_STR); //$NON-NLS-1$
}
- public void testRewriteCritTimestampDiffTime1_ignorecase() {
+ @Test public void testRewriteCritTimestampDiffTime1_ignorecase() {
helpTestRewriteCriteria("timestampdiff(SQL_tsi_HOUR, {t'03:04:45'}, {t'05:05:36'} ) = 2", TRUE_STR); //$NON-NLS-1$
}
- public void testRewriteOr1() {
+ @Test public void testRewriteOr1() {
helpTestRewriteCriteria("(5 = 5) OR (0 = 1)", TRUE_STR); //$NON-NLS-1$
}
- public void testRewriteOr2() {
+ @Test public void testRewriteOr2() {
helpTestRewriteCriteria("(0 = 1) OR (5 = 5)", TRUE_STR); //$NON-NLS-1$
}
- public void testRewriteOr3() {
+ @Test public void testRewriteOr3() {
helpTestRewriteCriteria("(1 = 1) OR (5 = 5)", TRUE_STR); //$NON-NLS-1$
}
- public void testRewriteOr4() {
+ @Test public void testRewriteOr4() {
helpTestRewriteCriteria("(0 = 1) OR (4 = 5)", FALSE_STR); //$NON-NLS-1$
}
- public void testRewriteOr5() {
+ @Test public void testRewriteOr5() {
helpTestRewriteCriteria("(0 = 1) OR (4 = 5) OR (pm1.g1.e1 = 'x')", "(pm1.g1.e1 = 'x')"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteOr6() {
+ @Test public void testRewriteOr6() {
helpTestRewriteCriteria("(0 = 1) OR (4 = 5) OR (pm1.g1.e1 = 'x') OR (pm1.g1.e1 = 'y')", "(pm1.g1.e1 = 'x') OR (pm1.g1.e1 = 'y')"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteOr7() {
+ @Test public void testRewriteOr7() {
helpTestRewriteCriteria("(pm1.g1.e1 = 'x') OR (pm1.g1.e1 = 'y')", "(pm1.g1.e1 = 'x') OR (pm1.g1.e1 = 'y')"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteAnd1() {
+ @Test public void testRewriteAnd1() {
helpTestRewriteCriteria("(5 = 5) AND (0 = 1)", FALSE_STR); //$NON-NLS-1$
}
- public void testRewriteAnd2() {
+ @Test public void testRewriteAnd2() {
helpTestRewriteCriteria("(0 = 1) AND (5 = 5)", FALSE_STR); //$NON-NLS-1$
}
- public void testRewriteAnd3() {
+ @Test public void testRewriteAnd3() {
helpTestRewriteCriteria("(1 = 1) AND (5 = 5)", TRUE_STR); //$NON-NLS-1$
}
- public void testRewriteAnd4() {
+ @Test public void testRewriteAnd4() {
helpTestRewriteCriteria("(0 = 1) AND (4 = 5)", FALSE_STR); //$NON-NLS-1$
}
- public void testRewriteAnd5() {
+ @Test public void testRewriteAnd5() {
helpTestRewriteCriteria("(1 = 1) AND (5 = 5) AND (pm1.g1.e1 = 'x')", "(pm1.g1.e1 = 'x')"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteAnd6() {
+ @Test public void testRewriteAnd6() {
helpTestRewriteCriteria("(1 = 1) AND (5 = 5) AND (pm1.g1.e1 = 'x') and (pm1.g1.e1 = 'y')", "(pm1.g1.e1 = 'x') AND (pm1.g1.e1 = 'y')"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteAnd7() {
+ @Test public void testRewriteAnd7() {
helpTestRewriteCriteria("(pm1.g1.e1 = 'x') AND (pm1.g1.e1 = 'y')", "(pm1.g1.e1 = 'x') AND (pm1.g1.e1 = 'y')"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteMixed1() {
+ @Test public void testRewriteMixed1() {
helpTestRewriteCriteria("((1=1) AND (1=1)) OR ((1=1) AND (1=1))", TRUE_STR); //$NON-NLS-1$
}
- public void testRewriteMixed2() {
+ @Test public void testRewriteMixed2() {
helpTestRewriteCriteria("((1=2) AND (1=1)) OR ((1=1) AND (1=1))", TRUE_STR); //$NON-NLS-1$
}
- public void testRewriteMixed3() {
+ @Test public void testRewriteMixed3() {
helpTestRewriteCriteria("((1=1) AND (1=2)) OR ((1=1) AND (1=1))", TRUE_STR); //$NON-NLS-1$
}
- public void testRewriteMixed4() {
+ @Test public void testRewriteMixed4() {
helpTestRewriteCriteria("((1=1) AND (1=1)) OR ((1=2) AND (1=1))", TRUE_STR); //$NON-NLS-1$
}
- public void testRewriteMixed5() {
+ @Test public void testRewriteMixed5() {
helpTestRewriteCriteria("((1=1) AND (1=1)) OR ((1=1) AND (1=2))", TRUE_STR); //$NON-NLS-1$
}
- public void testRewriteMixed6() {
+ @Test public void testRewriteMixed6() {
helpTestRewriteCriteria("((1=2) AND (1=1)) OR ((1=2) AND (1=1))", FALSE_STR); //$NON-NLS-1$
}
- public void testRewriteMixed7() {
+ @Test public void testRewriteMixed7() {
helpTestRewriteCriteria("((1=1) AND (1=2)) OR ((1=1) AND (1=2))", FALSE_STR); //$NON-NLS-1$
}
- public void testRewriteMixed8() {
+ @Test public void testRewriteMixed8() {
helpTestRewriteCriteria("((1=2) AND (1=2)) OR ((1=2) AND (1=2))", FALSE_STR); //$NON-NLS-1$
}
- public void testRewriteMixed9() {
+ @Test public void testRewriteMixed9() {
helpTestRewriteCriteria("((1=1) OR (1=1)) AND ((1=1) OR (1=1))", TRUE_STR); //$NON-NLS-1$
}
- public void testRewriteMixed10() {
+ @Test public void testRewriteMixed10() {
helpTestRewriteCriteria("((1=2) OR (1=1)) AND ((1=1) OR (1=1))", TRUE_STR); //$NON-NLS-1$
}
- public void testRewriteMixed11() {
+ @Test public void testRewriteMixed11() {
helpTestRewriteCriteria("((1=1) OR (1=2)) AND ((1=1) OR (1=1))", TRUE_STR); //$NON-NLS-1$
}
- public void testRewriteMixed12() {
+ @Test public void testRewriteMixed12() {
helpTestRewriteCriteria("((1=1) OR (1=1)) AND ((1=2) OR (1=1))", TRUE_STR); //$NON-NLS-1$
}
- public void testRewriteMixed13() {
+ @Test public void testRewriteMixed13() {
helpTestRewriteCriteria("((1=1) OR (1=1)) AND ((1=1) OR (1=2))", TRUE_STR); //$NON-NLS-1$
}
- public void testRewriteMixed14() {
+ @Test public void testRewriteMixed14() {
helpTestRewriteCriteria("((1=2) OR (1=1)) AND ((1=2) OR (1=1))", TRUE_STR); //$NON-NLS-1$
}
- public void testRewriteMixed15() {
+ @Test public void testRewriteMixed15() {
helpTestRewriteCriteria("((1=1) OR (1=2)) AND ((1=1) OR (1=2))", TRUE_STR); //$NON-NLS-1$
}
- public void testRewriteMixed16() {
+ @Test public void testRewriteMixed16() {
helpTestRewriteCriteria("((1=2) OR (1=2)) AND ((1=2) OR (1=2))", FALSE_STR); //$NON-NLS-1$
}
- public void testRewriteNot1() {
+ @Test public void testRewriteNot1() {
helpTestRewriteCriteria("NOT (1=1)", FALSE_STR); //$NON-NLS-1$
}
- public void testRewriteNot2() {
+ @Test public void testRewriteNot2() {
helpTestRewriteCriteria("NOT (1=2)", TRUE_STR); //$NON-NLS-1$
}
- public void testRewriteNot3() {
+ @Test public void testRewriteNot3() {
helpTestRewriteCriteria("NOT (pm1.g1.e1='x')", "NOT (pm1.g1.e1 = 'x')"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteDefect1() {
+ @Test public void testRewriteDefect1() {
helpTestRewriteCriteria("(('DE' = 'LN') AND (null > '2002-01-01')) OR (('DE' = 'DE') AND (pm1.g1.e1 > '9000000'))", "(pm1.g1.e1 > '9000000')"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteQueryCriteriaAlwaysTrue() {
+ @Test public void testRewriteQueryCriteriaAlwaysTrue() {
helpTestRewriteCommand("SELECT e1 FROM pm1.g1 WHERE 0 = 0", //$NON-NLS-1$
"SELECT e1 FROM pm1.g1"); //$NON-NLS-1$
}
- public void testSubquery1() {
+ @Test public void testSubquery1() {
helpTestRewriteCommand("SELECT e1 FROM (SELECT e1 FROM pm1.g1 WHERE (1 - 1) = (0 + 0)) AS x", //$NON-NLS-1$
"SELECT e1 FROM (SELECT e1 FROM pm1.g1) AS x"); //$NON-NLS-1$
}
- public void testExistsSubquery() {
+ @Test public void testExistsSubquery() {
helpTestRewriteCommand("SELECT e1 FROM pm1.g1 WHERE EXISTS (SELECT e1 FROM pm1.g2)", //$NON-NLS-1$
"SELECT e1 FROM pm1.g1 WHERE EXISTS (SELECT e1 FROM pm1.g2)"); //$NON-NLS-1$
}
- public void testCompareSubqueryANY() {
+ @Test public void testCompareSubqueryANY() {
helpTestRewriteCommand("SELECT e1 FROM pm1.g1 WHERE '3' = ANY (SELECT e1 FROM pm1.g2)", //$NON-NLS-1$
"SELECT e1 FROM pm1.g1 WHERE '3' = SOME (SELECT e1 FROM pm1.g2)"); //$NON-NLS-1$
}
- public void testCompareSubquery() {
+ @Test public void testCompareSubquery() {
helpTestRewriteCommand("SELECT e1 FROM pm1.g1 WHERE '3' = SOME (SELECT e1 FROM pm1.g2)", //$NON-NLS-1$
"SELECT e1 FROM pm1.g1 WHERE '3' = SOME (SELECT e1 FROM pm1.g2)"); //$NON-NLS-1$
}
- public void testCompareSubqueryUnknown() {
+ @Test public void testCompareSubqueryUnknown() {
helpTestRewriteCommand("SELECT e1 FROM pm1.g1 WHERE null = SOME (SELECT e1 FROM pm1.g2)", //$NON-NLS-1$
"SELECT e1 FROM pm1.g1 WHERE null <> null"); //$NON-NLS-1$
}
- public void testINClauseSubquery() {
+ @Test public void testINClauseSubquery() {
helpTestRewriteCommand("SELECT e1 FROM pm1.g1 WHERE '3' IN (SELECT e1 FROM pm1.g2)", //$NON-NLS-1$
"SELECT e1 FROM pm1.g1 WHERE '3' IN (SELECT e1 FROM pm1.g2)"); //$NON-NLS-1$
}
- public void testRewriteXMLCriteria1() {
+ @Test public void testRewriteXMLCriteria1() {
helpTestRewriteCriteria("context(pm1.g1.e1, pm1.g1.e1) = convert(5, string)", "context(pm1.g1.e1, pm1.g1.e1) = '5'"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteXMLCriteria2() {
+ @Test public void testRewriteXMLCriteria2() {
helpTestRewriteCriteria("context(pm1.g1.e1, convert(5, string)) = 2+3", "context(pm1.g1.e1, '5') = '5'"); //$NON-NLS-1$ //$NON-NLS-2$
}
// HAS Criteria
- public void testRewriteProcedure1() {
+ @Test public void testRewriteProcedure1() {
String procedure = "CREATE PROCEDURE\n"; //$NON-NLS-1$
procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
@@ -821,7 +817,7 @@
}
// HAS Criteria
- public void testRewriteProcedure2() {
+ @Test public void testRewriteProcedure2() {
String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
@@ -849,7 +845,7 @@
}
// HAS Criteria
- public void testRewriteProcedure3() {
+ @Test public void testRewriteProcedure3() {
String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
@@ -876,7 +872,7 @@
assertEquals("Rewritten command was not expected", rewritProc, procReturned); //$NON-NLS-1$
}
- public void testRewriteProcedure4() {
+ @Test public void testRewriteProcedure4() {
String procedure = "CREATE PROCEDURE\n"; //$NON-NLS-1$
procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
@@ -900,7 +896,7 @@
}
// CHANGING
- public void testRewriteProcedure5() {
+ @Test public void testRewriteProcedure5() {
String procedure = "CREATE PROCEDURE\n"; //$NON-NLS-1$
procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
@@ -923,7 +919,7 @@
}
// CHANGING
- public void testRewriteProcedure6() {
+ @Test public void testRewriteProcedure6() {
String procedure = "CREATE PROCEDURE\n"; //$NON-NLS-1$
procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
@@ -945,7 +941,7 @@
}
// TRANSLATE CRITERIA
- public void testRewriteProcedure7() {
+ @Test public void testRewriteProcedure7() {
String procedure = "CREATE PROCEDURE\n"; //$NON-NLS-1$
procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
@@ -969,7 +965,7 @@
}
// TRANSLATE CRITERIA
- public void testRewriteProcedure8() {
+ @Test public void testRewriteProcedure8() {
String procedure = "CREATE PROCEDURE\n"; //$NON-NLS-1$
procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
@@ -993,7 +989,7 @@
}
// rewrite input/ changing variables
- public void testRewriteProcedure9() {
+ @Test public void testRewriteProcedure9() {
String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
procedure = procedure + "Declare String var1;\n"; //$NON-NLS-1$
@@ -1021,7 +1017,7 @@
}
// virtual group elements used in procedure in if statement(TRANSLATE CRITERIA)
- public void testRewriteProcedure10() {
+ @Test public void testRewriteProcedure10() {
String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
procedure = procedure + "DECLARE integer var1;\n"; //$NON-NLS-1$
@@ -1043,7 +1039,7 @@
}
// virtual group elements used in procedure in if statement(HAS CRITERIA)
- public void testRewriteProcedure11() {
+ @Test public void testRewriteProcedure11() {
String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
procedure = procedure + "DECLARE string var1;\n"; //$NON-NLS-1$
@@ -1066,7 +1062,7 @@
// virtual group elements used in procedure in if statement(TRANSLATE CRITERIA)
// with complex query transform
- public void testRewriteProcedure12() {
+ @Test public void testRewriteProcedure12() {
String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
procedure = procedure + "DECLARE integer var1;\n"; //$NON-NLS-1$
@@ -1089,7 +1085,7 @@
// virtual group elements used in procedure in if statement(TRANSLATE CRITERIA)
// with complex query transform
- public void testRewriteProcedure13() {
+ @Test public void testRewriteProcedure13() {
String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
procedure = procedure + "DECLARE integer var1;\n"; //$NON-NLS-1$
@@ -1111,7 +1107,7 @@
}
// virtual group elements used in procedure in if statement(TRANSLATE CRITERIA)
- public void testRewriteProcedure14() {
+ @Test public void testRewriteProcedure14() {
String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
procedure = procedure + "DECLARE integer var1;\n"; //$NON-NLS-1$
@@ -1133,7 +1129,7 @@
}
// virtual group elements used in procedure in if statement(TRANSLATE CRITERIA)
- public void testRewriteProcedure15() {
+ @Test public void testRewriteProcedure15() {
String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
procedure = procedure + "DECLARE integer var1;\n"; //$NON-NLS-1$
@@ -1155,7 +1151,7 @@
}
// virtual group elements used in procedure in if statement(TRANSLATE CRITERIA)
- public void testRewriteProcedure16() {
+ @Test public void testRewriteProcedure16() {
String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
procedure = procedure + "DECLARE integer var1;\n"; //$NON-NLS-1$
@@ -1177,7 +1173,7 @@
}
// virtual group elements used in procedure in if statement(TRANSLATE CRITERIA)
- public void testRewriteProcedure17() {
+ @Test public void testRewriteProcedure17() {
String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
procedure = procedure + "DECLARE integer var1;\n"; //$NON-NLS-1$
@@ -1199,7 +1195,7 @@
}
// Bug 8212 elements in INPUT and CHANGING special groups are cese sensitive
- public void testRewriteProcedure18() {
+ @Test public void testRewriteProcedure18() {
String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
procedure = procedure + "Select Input.E1, Input.e2, CHANGING.e2, CHANGING.E1 from pm1.g1;\n"; //$NON-NLS-1$
@@ -1220,7 +1216,7 @@
// elements being set in updates are dropped if INPUT var is not available, unless a default is available
// Note that this test is a little odd in that it is an update inside of an insert
- public void testRewriteProcedure19() {
+ @Test public void testRewriteProcedure19() {
String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
procedure = procedure + "update pm1.g1 set e1=Input.E1, e2=Input.e2, e3=Input.e3;\n"; //$NON-NLS-1$
@@ -1242,7 +1238,7 @@
// elements being set in updates are dropped if INPUT var is not available, unless a default is supplied
//this test fails because the default for E1 'xyz' cannot be converted into a integer
- public void testRewriteProcedure21() {
+ @Test public void testRewriteProcedure21() {
String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
procedure = procedure + "update pm1.g1 set e1=convert(Input.E1, integer)+INPUT.E2, e2=Input.e2, e3=Input.e3;\n"; //$NON-NLS-1$
@@ -1258,7 +1254,7 @@
this.helpFailUpdateProcedure(procedure, userQuery, FakeMetadataObject.Props.INSERT_PROCEDURE);
}
- public void testRewriteProcedure21a() {
+ @Test public void testRewriteProcedure21a() {
String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
procedure = procedure + "update pm1.g1 set e1=convert(Input.E1, integer)+INPUT.E2, e2=Input.e2, e3=Input.e3;\n"; //$NON-NLS-1$
@@ -1279,7 +1275,7 @@
// none of input variables on update statement changing
- public void testRewriteProcedure22() {
+ @Test public void testRewriteProcedure22() {
String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
procedure = procedure + "update pm1.g1 set e1=convert(Input.E1, integer)+INPUT.E2, e2=Input.e2;\n"; //$NON-NLS-1$
@@ -1298,7 +1294,7 @@
}
// none of input variables on update statement changing
- public void testRewriteProcedure23() {
+ @Test public void testRewriteProcedure23() {
String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
procedure = procedure + "update pm1.g1 set e2=Input.e2, e3=Input.e3;\n"; //$NON-NLS-1$
@@ -1317,7 +1313,7 @@
}
//with an insert, defaults are used
- public void testRewriteProcedure23a() {
+ @Test public void testRewriteProcedure23a() {
String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
procedure = procedure + "update pm1.g1 set e2=Input.e2, e3=Input.e3;\n"; //$NON-NLS-1$
@@ -1337,7 +1333,7 @@
}
// elements being set in updates are dropped if INPUT var is not available
- public void testRewriteProcedure24() {
+ @Test public void testRewriteProcedure24() {
String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
procedure = procedure + "UPDATE pm1.g1 SET e2=Input.e2 WHERE TRANSLATE LIKE CRITERIA ON (e1) WITH (e1=concat(pm1.g1.e1, \"%\"));\n"; //$NON-NLS-1$
@@ -1357,7 +1353,7 @@
}
// INPUT vars in insert statements replaced by default variable when user's inser ignores values
- public void testRewriteProcedure25() {
+ @Test public void testRewriteProcedure25() {
String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
procedure = procedure + "INSERT into pm1.g1 (e1,e2,e3,e4) values (Input.e1, Input.e2, Input.e3, Input.e4);"; //$NON-NLS-1$
@@ -1377,7 +1373,7 @@
}
// virtual group elements used in procedure in if statement(TRANSLATE CRITERIA)
- public void testRewriteProcedure26() {
+ @Test public void testRewriteProcedure26() {
String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
procedure = procedure + "DECLARE integer var1;\n"; //$NON-NLS-1$
@@ -1399,7 +1395,7 @@
}
// virtual group elements used in procedure in if statement(TRANSLATE CRITERIA)
- public void testRewriteProcedure27() {
+ @Test public void testRewriteProcedure27() {
String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
procedure = procedure + "DECLARE integer var1;\n"; //$NON-NLS-1$
@@ -1430,7 +1426,7 @@
* descriptor couldn't be found for the "minus" operation for the two types
* integer and MetaMatrix's null type.
*/
- public void testRewriteProcedure_9380() {
+ @Test public void testRewriteProcedure_9380() {
String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
@@ -1457,29 +1453,29 @@
}
//base test. no change is expected
- public void testRewriteLookupFunction1() {
+ @Test public void testRewriteLookupFunction1() {
String criteria = "lookup('pm1.g1','e1', 'e2', 1) = 'ab'"; //$NON-NLS-1$
CompareCriteria expected = (CompareCriteria)parseCriteria(criteria, FakeMetadataFactory.example1Cached());
helpTestRewriteCriteria(criteria, expected, FakeMetadataFactory.example1Cached());
}
- public void testRewriteLookupFunction1b() {
+ @Test public void testRewriteLookupFunction1b() {
helpTestRewriteCriteria("lookup('pm1.g1','e1', 'e2', pm1.g1.e2) = 'ab'", "lookup('pm1.g1','e1', 'e2', pm1.g1.e2) = 'ab'"); //$NON-NLS-1$ //$NON-NLS-2$
}
/** defect 11630 1 should still get rewritten as '1'*/
- public void testRewriteLookupFunctionCompoundCriteria() {
+ @Test public void testRewriteLookupFunctionCompoundCriteria() {
String criteria = "LOOKUP('pm1.g1','e1', 'e2', 1) IS NULL AND pm1.g1.e1='1'"; //$NON-NLS-1$
CompoundCriteria expected = (CompoundCriteria)parseCriteria(criteria, FakeMetadataFactory.example1Cached());
helpTestRewriteCriteria("LOOKUP('pm1.g1','e1', 'e2', 1) IS NULL AND pm1.g1.e1=1", expected, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$
}
- public void testSelectWithNoFrom() {
+ @Test public void testSelectWithNoFrom() {
helpTestRewriteCommand("SELECT 5", "SELECT 5"); //$NON-NLS-1$ //$NON-NLS-2$
}
//defect 9822
- public void testStoredProcedure_9822() throws Exception {
+ @Test public void testStoredProcedure_9822() throws Exception {
QueryParser parser = new QueryParser();
Command command = parser.parseCommand("exec pm1.sp4(5)"); //$NON-NLS-1$
@@ -1501,7 +1497,7 @@
}
}
- public void testRewriteRecursive() {
+ @Test public void testRewriteRecursive() {
Command c = helpTestRewriteCommand("SELECT e2 FROM vm1.g33", "SELECT e2 FROM vm1.g33"); //$NON-NLS-1$ //$NON-NLS-2$
Command innerCommand = (Command) c.getSubCommands().get(0);
@@ -1509,7 +1505,7 @@
}
- public void testRewriteFunctionThrowsEvaluationError() {
+ @Test public void testRewriteFunctionThrowsEvaluationError() {
FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
Criteria origCrit = parseCriteria("5 / 0 = 5", metadata); //$NON-NLS-1$
@@ -1523,7 +1519,7 @@
}
}
- public void testRewriteConvertThrowsEvaluationError() {
+ @Test public void testRewriteConvertThrowsEvaluationError() {
FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
Criteria origCrit = parseCriteria("convert('x', integer) = 0", metadata); //$NON-NLS-1$
@@ -1536,7 +1532,7 @@
}
}
- public void testDefect13458() {
+ @Test public void testDefect13458() {
String procedure = "CREATE PROCEDURE\n"; //$NON-NLS-1$
procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
@@ -1558,15 +1554,15 @@
assertEquals("Rewritten command was not expected", rewritProc, procReturned); //$NON-NLS-1$
}
- public void testRewriteCase1954() {
+ @Test public void testRewriteCase1954() {
helpTestRewriteCriteria("convert(pm1.g1.e2, string) = '3'", "pm1.g1.e2 = 3"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteCase1954a() {
+ @Test public void testRewriteCase1954a() {
helpTestRewriteCriteria("cast(pm1.g1.e2 as string) = '3'", "pm1.g1.e2 = 3"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteCase1954b() throws Exception{
+ @Test public void testRewriteCase1954b() throws Exception{
FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
// Have to hand-build the criteria, because 3.0 gets parsed as a Float by default
@@ -1582,143 +1578,143 @@
helpTestRewriteCriteria("convert(pm1.g1.e4, string) = '3'", expected, metadata); //$NON-NLS-1$
}
- public void testRewriteCase1954c() {
+ @Test public void testRewriteCase1954c() {
helpTestRewriteCriteria("convert(pm1.g1.e1, string) = 'x'", "pm1.g1.e1 = 'x'"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteCase1954d() {
+ @Test public void testRewriteCase1954d() {
helpTestRewriteCriteria("convert(pm1.g1.e1, timestamp) = {ts '2005-01-03 00:00:00.0'}", "pm1.g1.e1 = '2005-01-03 00:00:00.0'"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteCase1954e() {
+ @Test public void testRewriteCase1954e() {
helpTestRewriteCriteria("convert(pm1.g1.e4, integer) = 2", "pm1.g1.e4 = 2.0"); //$NON-NLS-1$ //$NON-NLS-2$
}
/** Check that this fails, x is not convertable to an int */
- public void testRewriteCase1954f() {
+ @Test public void testRewriteCase1954f() {
helpTestRewriteCriteria("convert(pm1.g1.e2, string) = 'x'", "1 = 0"); //$NON-NLS-1$ //$NON-NLS-2$
}
/** Check that this returns true, x is not convertable to an int */
- public void testRewriteCase1954f1() {
+ @Test public void testRewriteCase1954f1() {
helpTestRewriteCriteria("convert(pm1.g1.e2, string) != 'x'", "1 = 1"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteCase1954Set() {
+ @Test public void testRewriteCase1954Set() {
helpTestRewriteCriteria("convert(pm1.g1.e2, string) in ('2', '3')", "pm1.g1.e2 IN (2,3)"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteCase1954SetA() {
+ @Test public void testRewriteCase1954SetA() {
helpTestRewriteCriteria("convert(pm1.g1.e2, string) in ('2', 'x')", "pm1.g1.e2 = 2"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteCase1954SetB() {
+ @Test public void testRewriteCase1954SetB() {
helpTestRewriteCriteria("cast(pm1.g1.e2 as string) in ('2', '3')", "pm1.g1.e2 IN (2,3)"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteCase1954SetC() {
+ @Test public void testRewriteCase1954SetC() {
helpTestRewriteCriteria("concat(pm1.g1.e2, 'string') in ('2', '3')", "concat(pm1.g1.e2, 'string') in ('2', '3')"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteCase1954SetD() {
+ @Test public void testRewriteCase1954SetD() {
helpTestRewriteCriteria("convert(pm1.g1.e2, string) in ('2', pm1.g1.e1)", "convert(pm1.g1.e2, string) in ('2', pm1.g1.e1)"); //$NON-NLS-1$ //$NON-NLS-2$
}
// First WHEN always true, so rewrite as THEN expression
- public void testRewriteCaseExpr1() {
+ @Test public void testRewriteCaseExpr1() {
helpTestRewriteCriteria("case when 0=0 then 1 else 2 end = 1", "1 = 1"); //$NON-NLS-1$ //$NON-NLS-2$
}
// First WHEN always false, so rewrite as ELSE expression
- public void testRewriteCaseExpr2() {
+ @Test public void testRewriteCaseExpr2() {
helpTestRewriteCriteria("case when 0=1 then 1 else 2 end = 1", "1 = 0"); //$NON-NLS-1$ //$NON-NLS-2$
}
// First WHEN can't be rewritten, so no changes
- public void testRewriteCaseExpr3() {
+ @Test public void testRewriteCaseExpr3() {
helpTestRewriteCriteria("case when 0 = pm1.g1.e2 then 1 else 2 end = 1", "CASE WHEN pm1.g1.e2 = 0 THEN 1 ELSE 2 END = 1"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteCaseExpr4() {
+ @Test public void testRewriteCaseExpr4() {
helpTestRewriteCriteria("lookup('pm1.g1', 'e2', 'e1', case when 1=1 then pm1.g1.e1 end) = 0", "lookup('pm1.g1', 'e2', 'e1', pm1.g1.e1) = 0"); //$NON-NLS-1$ //$NON-NLS-2$
}
// First WHEN always false, so remove it
- public void testRewriteCaseExpr5() {
+ @Test public void testRewriteCaseExpr5() {
helpTestRewriteCriteria("case when 0=1 then 1 when 0 = pm1.g1.e2 then 2 else 3 end = 1", "CASE WHEN pm1.g1.e2 = 0 THEN 2 ELSE 3 END = 1"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteCaseExprForCase5413aFrom502() {
+ @Test public void testRewriteCaseExprForCase5413aFrom502() {
helpTestRewriteCriteria("pm1.g2.e1 = case when 0 = pm1.g1.e2 then 2 else 2 end", "pm1.g2.e1 = '2'"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteCaseExprForCase5413bFrom502() {
+ @Test public void testRewriteCaseExprForCase5413bFrom502() {
helpTestRewriteCriteria("case when 0 = pm1.g1.e2 then null else null end IS NULL", TRUE_STR); //$NON-NLS-1$
}
- public void testRewriteCaseExprForCase5413a() {
+ @Test public void testRewriteCaseExprForCase5413a() {
helpTestRewriteCriteria("pm1.g2.e1 = case when 0 = pm1.g1.e2 then 2 else 2 end", "pm1.g2.e1 = '2'"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteCaseExprForCase5413b() {
+ @Test public void testRewriteCaseExprForCase5413b() {
helpTestRewriteCriteria("case when 0 = pm1.g1.e2 then null else null end IS NULL", TRUE_STR); //$NON-NLS-1$
}
// First WHEN always true, so rewrite as THEN expression
- public void testRewriteSearchedCaseExpr1() {
+ @Test public void testRewriteSearchedCaseExpr1() {
helpTestRewriteCriteria("case 0 when 0 then 1 else 2 end = 1", "1 = 1"); //$NON-NLS-1$ //$NON-NLS-2$
}
// First WHEN always false, so rewrite as ELSE expression
- public void testRewriteSearchedCaseExpr2() {
+ @Test public void testRewriteSearchedCaseExpr2() {
helpTestRewriteCriteria("case 0 when 1 then 1 else 2 end = 1", "1 = 0"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteSearchedCaseExpr3() {
+ @Test public void testRewriteSearchedCaseExpr3() {
helpTestRewriteCriteria("case 0 when pm1.g1.e2 then 1 else 2 end = 1", "CASE WHEN pm1.g1.e2 = 0 THEN 1 ELSE 2 END = 1"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteSearchedCaseExpr4() {
+ @Test public void testRewriteSearchedCaseExpr4() {
String criteria = "lookup('pm1.g1', 'e2', 'e1', '2') = 0"; //$NON-NLS-1$
CompareCriteria expected = (CompareCriteria)parseCriteria(criteria, FakeMetadataFactory.example1Cached());
helpTestRewriteCriteria("lookup('pm1.g1', 'e2', 'e1', case 0 when 1 then pm1.g1.e1 else 2 end) = 0", expected, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$
}
// First WHEN always false, so remove it
- public void testRewriteSearchedCaseExpr5() {
+ @Test public void testRewriteSearchedCaseExpr5() {
helpTestRewriteCriteria("case 0 when 1 then 1 when pm1.g1.e2 then 2 else 3 end = 1", "CASE WHEN pm1.g1.e2 = 0 THEN 2 ELSE 3 END = 1"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testDefect16879_1(){
+ @Test public void testDefect16879_1(){
helpTestRewriteCommand("SELECT decodestring(e1, 'a, b') FROM pm1.g1", "SELECT CASE WHEN e1 = 'a' THEN 'b' ELSE e1 END FROM pm1.g1"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testDefect16879_2(){
+ @Test public void testDefect16879_2(){
helpTestRewriteCommand("SELECT decodestring(e1, 'a, b, c, d') FROM pm1.g1", "SELECT CASE WHEN e1 = 'a' THEN 'b' WHEN e1 = 'c' THEN 'd' ELSE e1 END FROM pm1.g1"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testDefect16879_3(){
+ @Test public void testDefect16879_3(){
helpTestRewriteCommand("SELECT decodeinteger(e1, 'a, b') FROM pm1.g1", "SELECT CASE WHEN e1 = 'a' THEN 'b' ELSE e1 END FROM pm1.g1"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testDefect16879_4(){
+ @Test public void testDefect16879_4(){
helpTestRewriteCommand("SELECT decodeinteger(e1, 'a, b, c, d') FROM pm1.g1", "SELECT CASE WHEN e1 = 'a' THEN 'b' WHEN e1 = 'c' THEN 'd' ELSE e1 END FROM pm1.g1"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testDefect16879_5(){
+ @Test public void testDefect16879_5(){
helpTestRewriteCommand("SELECT decodeinteger(e1, 'null, b, c, d') FROM pm1.g1", "SELECT CASE WHEN e1 IS NULL THEN 'b' WHEN e1 = 'c' THEN 'd' ELSE e1 END FROM pm1.g1"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testDefect16879_6(){
+ @Test public void testDefect16879_6(){
helpTestRewriteCommand("SELECT decodeinteger(e1, 'a, b, null, d') FROM pm1.g1", "SELECT CASE WHEN e1 = 'a' THEN 'b' WHEN e1 IS NULL THEN 'd' ELSE e1 END FROM pm1.g1"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testDefect16879_7(){
+ @Test public void testDefect16879_7(){
helpTestRewriteCommand("SELECT decodeinteger(e1, 'a, b, null, d, e') FROM pm1.g1", "SELECT CASE WHEN e1 = 'a' THEN 'b' WHEN e1 IS NULL THEN 'd' ELSE 'e' END FROM pm1.g1"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testCaseExpressionThatResolvesToNull() {
+ @Test public void testCaseExpressionThatResolvesToNull() {
String sqlBefore = "SELECT CASE 'x' WHEN 'Old Inventory System' THEN NULL WHEN 'New Inventory System' THEN NULL END"; //$NON-NLS-1$
String sqlAfter = "SELECT null"; //$NON-NLS-1$
@@ -1730,7 +1726,7 @@
//note that the env is now treated as deterministic, however it is really only deterministic within a session
- public void testRewriteExecEnv() throws Exception {
+ @Test public void testRewriteExecEnv() throws Exception {
Command command = QueryParser.getQueryParser().parseCommand("exec pm1.sq2(env('sessionid'))"); //$NON-NLS-1$
QueryResolver.resolveCommand(command, FakeMetadataFactory.example1Cached());
@@ -1744,7 +1740,7 @@
assertEquals("SELECT e1, e2 FROM pm1.g1 WHERE e1 = '1'", rewriteCommand.toString()); //$NON-NLS-1$
}
- public void testRewriteExecCase6455() throws Exception {
+ @Test public void testRewriteExecCase6455() throws Exception {
Command command = QueryParser.getQueryParser().parseCommand("exec pm1.sq2(env('sessionid')) OPTION PLANONLY DEBUG"); //$NON-NLS-1$
QueryResolver.resolveCommand(command, FakeMetadataFactory.example1Cached());
@@ -1759,23 +1755,23 @@
}
- public void testRewriteNestedFunctions() {
+ @Test public void testRewriteNestedFunctions() {
helpTestRewriteCommand("SELECT e1 FROM pm1.g1 where convert(parsedate(e1, 'yyyy-MM-dd'), string) = '2006-07-01'", "SELECT e1 FROM pm1.g1 WHERE e1 = '2006-07-01'"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteWithReference() {
+ @Test public void testRewriteWithReference() {
helpTestRewriteCommand("SELECT e1 FROM pm1.g1 where parsetimestamp(e1, 'yyyy-MM-dd') != ?", "SELECT e1 FROM pm1.g1 WHERE e1 <> formattimestamp(?, 'yyyy-MM-dd')"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewiteJoinCriteria() {
+ @Test public void testRewiteJoinCriteria() {
helpTestRewriteCommand("SELECT pm1.g1.e1 FROM pm1.g1 inner join pm1.g2 on (pm1.g1.e1 = null)", "SELECT pm1.g1.e1 FROM pm1.g1 INNER JOIN pm1.g2 ON 1 = 0"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewiteCompoundCriteria() {
+ @Test public void testRewiteCompoundCriteria() {
helpTestRewriteCriteria("(pm1.g1.e1 = 1 and pm1.g1.e2 = 2) and (pm1.g1.e3 = 1 and pm1.g1.e4 = 2)", "(pm1.g1.e1 = '1') AND (pm1.g1.e2 = 2) AND (pm1.g1.e3 = TRUE) AND (pm1.g1.e4 = 2.0)"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteWhile() throws Exception {
+ @Test public void testRewriteWhile() throws Exception {
String procedure = "CREATE PROCEDURE\n"; //$NON-NLS-1$
procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
@@ -1802,7 +1798,7 @@
}
- public void testRewriteWhile1() {
+ @Test public void testRewriteWhile1() {
String procedure = "CREATE PROCEDURE\n"; //$NON-NLS-1$
procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
@@ -1827,7 +1823,7 @@
/**
* Tests that VariableSubstitutionVisitor does not cause an NPE on count(*)
*/
- public void testRewriteProcedureWithCount() {
+ @Test public void testRewriteProcedureWithCount() {
String procedure = "CREATE PROCEDURE\n"; //$NON-NLS-1$
procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
@@ -1850,7 +1846,7 @@
/**
* Test to ensure the update changing list retains e1 = ?
*/
- public void testVariableSubstitutionVisitor() throws Exception {
+ @Test public void testVariableSubstitutionVisitor() throws Exception {
String procedure1 = "CREATE PROCEDURE "; //$NON-NLS-1$
procedure1 += "BEGIN\n"; //$NON-NLS-1$
procedure1 += "DECLARE string var1 = INPUT.e1;\n"; //$NON-NLS-1$
@@ -1877,7 +1873,7 @@
assertEquals(expected, command.getSubCommand().toString());
}
- public void testRemoveEmptyLoop() {
+ @Test public void testRemoveEmptyLoop() {
String procedure1 = "CREATE virtual PROCEDURE "; //$NON-NLS-1$
procedure1 += "BEGIN\n"; //$NON-NLS-1$
procedure1 += "loop on (select e1 from pm1.g1) as myCursor\n"; //$NON-NLS-1$
@@ -1891,7 +1887,7 @@
helpTestRewriteCommand(procedure1, expected);
}
- public void testRewriteDeclare() {
+ @Test public void testRewriteDeclare() {
String procedure1 = "CREATE virtual PROCEDURE "; //$NON-NLS-1$
procedure1 += "BEGIN\n"; //$NON-NLS-1$
procedure1 += "declare integer x = 1 + 1;\n"; //$NON-NLS-1$
@@ -1902,26 +1898,26 @@
helpTestRewriteCommand(procedure1, expected);
}
- public void testRewriteUnionJoin() {
+ @Test public void testRewriteUnionJoin() {
String sql = "select pm1.g1.e1 from pm1.g1 union join pm1.g2 where g1.e1 = 1"; //$NON-NLS-1$
String expected = "SELECT pm1.g1.e1 FROM pm1.g1 FULL OUTER JOIN pm1.g2 ON 1 = 0 WHERE g1.e1 = '1'"; //$NON-NLS-1$
helpTestRewriteCommand(sql, expected);
}
- public void testRewriteNonNullDependentFunction() {
+ @Test public void testRewriteNonNullDependentFunction() {
helpTestRewriteCriteria("pm1.g1.e1 = concat(null, pm1.g1.e2)", "null <> null"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteInWithNull() {
+ @Test public void testRewriteInWithNull() {
helpTestRewriteCriteria("convert(null, string) in (pm1.g1.e1, pm1.g1.e2)", "null <> null"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteXMLCriteriaCases5630And5640() {
+ @Test public void testRewriteXMLCriteriaCases5630And5640() {
helpTestRewriteCommand("select * from xmltest.doc1 where node1 = null", "SELECT * FROM xmltest.doc1 WHERE node1 = null"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteCorrelatedSubqueryInHaving() {
+ @Test public void testRewriteCorrelatedSubqueryInHaving() {
String sql = "select pm1.g1.e1 from pm1.g1 group by pm1.g1.e1 having pm1.g1.e1 in (select pm1.g1.e1 from pm1.g2)"; //$NON-NLS-1$
String expected = "SELECT pm1.g1.e1 FROM pm1.g1 GROUP BY pm1.g1.e1 HAVING pm1.g1.e1 IN (SELECT pm1.g1.e1 FROM pm1.g2)"; //$NON-NLS-1$
@@ -1934,7 +1930,7 @@
assertEquals(1, refs.size());
}
- public void testRewriteSelectInto() {
+ @Test public void testRewriteSelectInto() {
String sql = "select distinct pm1.g1.e1 into #temp from pm1.g1"; //$NON-NLS-1$
String expected = "SELECT DISTINCT pm1.g1.e1 INTO #temp FROM pm1.g1"; //$NON-NLS-1$
@@ -1944,34 +1940,34 @@
/**
* Accounts for type change with duplicate names
*/
- public void testRewriteSelectInto1() {
+ @Test public void testRewriteSelectInto1() {
String sql = "select distinct e2, e2, e3, e4 into pm1.g1 from pm1.g2"; //$NON-NLS-1$
String expected = "SELECT PM1_G1_1.E2 AS E2, PM1_G1_1.E2_0, PM1_G1_1.E3, PM1_G1_1.E4 INTO pm1.g1 FROM (SELECT DISTINCT e2, e2 AS E2_0, e3, e4 FROM pm1.g2) AS pm1_g1_1"; //$NON-NLS-1$
helpTestRewriteCommand(sql, expected);
}
- public void testUnionQueryNullInOneBranch() throws Exception {
+ @Test public void testUnionQueryNullInOneBranch() throws Exception {
verifyProjectedTypesOnUnionBranches("SELECT e1, e2 FROM pm1.g1 UNION ALL SELECT e1, null FROM pm1.g2", //$NON-NLS-1$
new Class[] { DataTypeManager.DefaultDataClasses.STRING, DataTypeManager.DefaultDataClasses.INTEGER });
}
- public void testUnionQueryNullInOneBranch2() throws Exception {
+ @Test public void testUnionQueryNullInOneBranch2() throws Exception {
verifyProjectedTypesOnUnionBranches("SELECT e1, e2 FROM pm1.g1 UNION ALL SELECT e1, e2 FROM pm1.g2 UNION ALL SELECT e1, null FROM pm1.g2", //$NON-NLS-1$
new Class[] { DataTypeManager.DefaultDataClasses.STRING, DataTypeManager.DefaultDataClasses.INTEGER });
}
- public void testUnionQueryNullInOneBranch3() throws Exception {
+ @Test public void testUnionQueryNullInOneBranch3() throws Exception {
verifyProjectedTypesOnUnionBranches("SELECT e1, null FROM pm1.g1 UNION ALL SELECT e1, null FROM pm1.g2 UNION ALL SELECT e1, e2 FROM pm1.g2", //$NON-NLS-1$
new Class[] { DataTypeManager.DefaultDataClasses.STRING, DataTypeManager.DefaultDataClasses.INTEGER });
}
- public void testUnionQueryNullInAllBranches() throws Exception {
+ @Test public void testUnionQueryNullInAllBranches() throws Exception {
verifyProjectedTypesOnUnionBranches("SELECT e1, null FROM pm1.g1 UNION ALL SELECT e1, null FROM pm1.g2 UNION ALL SELECT e1, null FROM pm1.g2", //$NON-NLS-1$
new Class[] { DataTypeManager.DefaultDataClasses.STRING, DataTypeManager.DefaultDataClasses.STRING });
}
- public void testUnionQueryWithTypeConversion() throws Exception {
+ @Test public void testUnionQueryWithTypeConversion() throws Exception {
verifyProjectedTypesOnUnionBranches("SELECT e1 FROM pm1.g1 UNION ALL SELECT e2 FROM pm1.g2", //$NON-NLS-1$
new Class[] { DataTypeManager.DefaultDataClasses.STRING});
}
@@ -1990,11 +1986,11 @@
}
}
- public void testRewiteOrderBy() {
+ @Test public void testRewiteOrderBy() {
helpTestRewriteCommand("SELECT 1+1 as a FROM pm1.g1 order by a", "SELECT 2 AS a FROM pm1.g1"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewiteOrderBy1() {
+ @Test public void testRewiteOrderBy1() {
helpTestRewriteCommand("SELECT 1+1 as a FROM pm1.g1 union select pm1.g2.e1 from pm1.g2 order by a", "SELECT '2' AS a FROM pm1.g1 UNION SELECT pm1.g2.e1 FROM pm1.g2 ORDER BY a"); //$NON-NLS-1$ //$NON-NLS-2$
}
@@ -2003,7 +1999,7 @@
*
* It also ensures that all project symbols are uniquely named in the inline view
*/
- public void testSelectIntoWithOrderByAndTypeConversion() throws Exception {
+ @Test public void testSelectIntoWithOrderByAndTypeConversion() throws Exception {
String procedure = "CREATE VIRTUAL PROCEDURE\n"; //$NON-NLS-1$
procedure += "BEGIN\n"; //$NON-NLS-1$
procedure += "CREATE local temporary table temp (x string, y integer, z integer);\n"; //$NON-NLS-1$
@@ -2015,23 +2011,23 @@
}
- public void testInsertWithQuery() throws Exception {
+ @Test public void testInsertWithQuery() throws Exception {
String sql = "insert into pm1.g1 select e1, e2, e3, e4 from pm1.g2 union select e1, e2, e3, e4 from pm1.g2"; //$NON-NLS-1$
helpTestRewriteCommand(sql, "SELECT PM1_G1_1.E1, PM1_G1_1.E2, PM1_G1_1.E3, PM1_G1_1.E4 INTO pm1.g1 FROM (SELECT e1, e2, e3, e4 FROM pm1.g2 UNION SELECT e1, e2, e3, e4 FROM pm1.g2) AS pm1_g1_1"); //$NON-NLS-1$
}
- public void testRewriteNot() {
+ @Test public void testRewriteNot() {
helpTestRewriteCriteria("not(not(pm1.g1.e1 = 1 + 1))", "pm1.g1.e1 = '2'"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteQueryWithNoFrom() {
+ @Test public void testRewriteQueryWithNoFrom() {
String sql = "select 1 as a order by a"; //$NON-NLS-1$
helpTestRewriteCommand(sql, "SELECT 1 AS a"); //$NON-NLS-1$
}
- public void testOrderByDuplicateRemoval() {
+ @Test public void testOrderByDuplicateRemoval() {
String sql = "SELECT pm1.g1.e1, pm1.g1.e1 as c1234567890123456789012345678901234567890 FROM pm1.g1 ORDER BY c1234567890123456789012345678901234567890, e1 "; //$NON-NLS-1$
helpTestRewriteCommand(sql, "SELECT pm1.g1.e1, pm1.g1.e1 AS c1234567890123456789012345678901234567890 FROM pm1.g1 ORDER BY c1234567890123456789012345678901234567890"); //$NON-NLS-1$
}
@@ -2039,7 +2035,7 @@
/**
* Case 4814
*/
- public void testVirtualRightOuterJoinSwap() throws Exception {
+ @Test public void testVirtualRightOuterJoinSwap() throws Exception {
String sql = "SELECT sa.IntKey AS sa_IntKey, mb.IntKey AS mb_IntKey FROM (select * from BQT1.smalla) sa RIGHT OUTER JOIN (select BQT1.mediumb.intkey from BQT1.mediumb) mb ON sa.IntKey = mb.IntKey"; //$NON-NLS-1$
helpTestRewriteCommand(sql, "SELECT sa.IntKey AS sa_IntKey, mb.IntKey AS mb_IntKey FROM (SELECT BQT1.mediumb.intkey FROM BQT1.mediumb) AS mb LEFT OUTER JOIN (SELECT * FROM BQT1.smalla) AS sa ON sa.IntKey = mb.IntKey", FakeMetadataFactory.exampleBQTCached()); //$NON-NLS-1$
}
@@ -2047,36 +2043,36 @@
/**
* Case 4814
*/
- public void testVirtualRightOuterJoinSwap1() throws Exception {
+ @Test public void testVirtualRightOuterJoinSwap1() throws Exception {
String sql = "SELECT sa.IntKey AS sa_IntKey, mb.IntKey AS mb_IntKey FROM ((select * from BQT1.smalla) sa inner join BQT1.smallb on sa.intkey = smallb.intkey) RIGHT OUTER JOIN (select BQT1.mediumb.intkey from BQT1.mediumb) mb ON sa.IntKey = mb.IntKey"; //$NON-NLS-1$
helpTestRewriteCommand(sql, "SELECT sa.IntKey AS sa_IntKey, mb.IntKey AS mb_IntKey FROM (SELECT BQT1.mediumb.intkey FROM BQT1.mediumb) AS mb LEFT OUTER JOIN ((SELECT * FROM BQT1.smalla) AS sa INNER JOIN BQT1.smallb ON sa.intkey = smallb.intkey) ON sa.IntKey = mb.IntKey", FakeMetadataFactory.exampleBQTCached()); //$NON-NLS-1$
}
- public void testRewriteConcat2() {
+ @Test public void testRewriteConcat2() {
helpTestRewriteCriteria("concat2('a','b') = 'ab'", "1 = 1"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteConcat2_1() {
+ @Test public void testRewriteConcat2_1() {
helpTestRewriteCriteria("concat2(null, null) is null", "1 = 1"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteConcat2_2() throws Exception {
+ @Test public void testRewriteConcat2_2() throws Exception {
helpTestRewriteCriteria("concat2(pm1.g1.e1, null) = 'xyz'", "CASE WHEN pm1.g1.e1 IS NULL THEN null ELSE concat(ifnull(pm1.g1.e1, ''), '') END = 'xyz'", true); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteConcat2_3() throws Exception {
+ @Test public void testRewriteConcat2_3() throws Exception {
helpTestRewriteCriteria("concat2(pm1.g1.e1, convert(pm1.g1.e2, string)) = 'xyz'", "CASE WHEN (pm1.g1.e1 IS NULL) AND (convert(pm1.g1.e2, string) IS NULL) THEN null ELSE concat(ifnull(pm1.g1.e1, ''), ifnull(convert(pm1.g1.e2, string), '')) END = 'xyz'", true); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteConcat2_4() throws Exception {
+ @Test public void testRewriteConcat2_4() throws Exception {
helpTestRewriteCriteria("concat2('a', pm1.g1.e1) = 'xyz'", "concat('a', ifnull(pm1.g1.e1, '')) = 'xyz'"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewiteEvaluatableAggregate() {
+ @Test public void testRewiteEvaluatableAggregate() {
helpTestRewriteCommand("select pm1.g1.e1, max(1) from pm1.g1", "SELECT pm1.g1.e1, 1 FROM pm1.g1"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteFromUnixTime() throws Exception {
+ @Test public void testRewriteFromUnixTime() throws Exception {
TimestampWithTimezone.resetCalendar(TimeZone.getTimeZone("GMT-06:00")); //$NON-NLS-1$
try {
helpTestRewriteCriteria("from_unixtime(pm1.g1.e2) = '1992-12-01 07:00:00'", "timestampadd(SQL_TSI_SECOND, pm1.g1.e2, {ts'1969-12-31 18:00:00.0'}) = {ts'1992-12-01 07:00:00.0'}"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -2085,15 +2081,15 @@
}
}
- public void testRewriteNullIf() throws Exception {
+ @Test public void testRewriteNullIf() throws Exception {
helpTestRewriteCriteria("nullif(pm1.g1.e2, pm1.g1.e4) = 1", "CASE WHEN pm1.g1.e2 = pm1.g1.e4 THEN convert(null, double) ELSE pm1.g1.e2 END = 1.0", true); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testRewriteCoalesce() throws Exception {
+ @Test public void testRewriteCoalesce() throws Exception {
helpTestRewriteCriteria("coalesce(convert(pm1.g1.e2, double), pm1.g1.e4) = 1", "ifnull(convert(pm1.g1.e2, double), pm1.g1.e4) = 1", true); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testProcWithNull() throws Exception {
+ @Test public void testProcWithNull() throws Exception {
String sql = "exec pm1.vsp26(1, null)"; //$NON-NLS-1$
try {
@@ -2133,7 +2129,7 @@
* @see com.metamatrix.query.sql.symbol.AggregateSymbol
* @see com.metamatrix.query.sql.symbol.SearchedCaseExpression
*/
- public void testAggregateWithBetweenInCaseInSelect() {
+ @Test public void testAggregateWithBetweenInCaseInSelect() {
// Define a list of aggregates to test against
List<String> aggregateCommands = Arrays.asList( new String[] { "SUM", "MAX", "MIN", "AVG", "COUNT" } ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
@@ -2178,7 +2174,7 @@
* @see com.metamatrix.query.sql.lang.CompoundCriteria
* @see com.metamatrix.query.sql.symbol.SearchedCaseExpression
*/
- public void testBetweenInCaseInSelect() {
+ @Test public void testBetweenInCaseInSelect() {
String sqlBefore = "SELECT CASE WHEN e2 BETWEEN 3 AND 5 THEN e2 ELSE -1 END FROM pm1.g1"; //$NON-NLS-1$
String sqlAfter = "SELECT CASE WHEN (e2 >= 3) AND (e2 <= 5) THEN e2 ELSE -1 END FROM pm1.g1"; //$NON-NLS-1$
@@ -2210,7 +2206,7 @@
* @see com.metamatrix.query.sql.lang.CompoundCriteria
* @see com.metamatrix.query.sql.symbol.SearchedCaseExpression
*/
- public void testBetweenInCase() {
+ @Test public void testBetweenInCase() {
String sqlBefore = "SELECT * FROM pm1.g1 WHERE e3 = CASE WHEN e2 BETWEEN 3 AND 5 THEN e2 ELSE -1 END"; //$NON-NLS-1$
String sqlAfter = "SELECT * FROM pm1.g1 WHERE e3 = CASE WHEN (e2 >= 3) AND (e2 <= 5) THEN e2 ELSE -1 END"; //$NON-NLS-1$
@@ -2219,5 +2215,5 @@
assertEquals( "e2 >= 3", ccrit.getCriteria(0).toString() ); //$NON-NLS-1$
assertEquals( "e2 <= 5", ccrit.getCriteria(1).toString() ); //$NON-NLS-1$
}
-
+
}
15 years, 5 months
teiid SVN: r1198 - in trunk: build/kit-adminshell and 1 other directory.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2009-07-28 14:53:00 -0400 (Tue, 28 Jul 2009)
New Revision: 1198
Added:
trunk/build/kit-adminshell/log.properties
Modified:
trunk/adminshell/src/main/resources/scripts/server.bsh
trunk/adminshell/src/main/resources/scripts/util.bsh
trunk/build/kit-adminshell/adminshell.bat
trunk/build/kit-adminshell/adminshell.sh
Log:
TEIID-224: making error reporting less verbose during the connect and shutdown.
Modified: trunk/adminshell/src/main/resources/scripts/server.bsh
===================================================================
--- trunk/adminshell/src/main/resources/scripts/server.bsh 2009-07-28 18:30:48 UTC (rev 1197)
+++ trunk/adminshell/src/main/resources/scripts/server.bsh 2009-07-28 18:53:00 UTC (rev 1198)
@@ -46,11 +46,13 @@
currentContext().internalAdmin = createExceptionHandlingProxy(mmConn.getAdminAPI());
return mmConn;
} catch(e) {
- print("Failed to connect: "+e.getMessage());
+ print("Failed to connect: {"+e.getMessage()+"}");
+ return null;
}
}
else {
print("Wrong syntax for the URL.. connection failed");
+ return null;
}
}
Modified: trunk/adminshell/src/main/resources/scripts/util.bsh
===================================================================
--- trunk/adminshell/src/main/resources/scripts/util.bsh 2009-07-28 18:30:48 UTC (rev 1197)
+++ trunk/adminshell/src/main/resources/scripts/util.bsh 2009-07-28 18:53:00 UTC (rev 1198)
@@ -183,12 +183,11 @@
if (ex instanceof AdminException) {
print("Error:"+ex.getMessage());
}
- } catch(AdminComponentException e) {
- print(e.getClass().getName() +" Error:"+e.getMessage());
- } catch (AdminProcessingException e) {
- print(e.getClass().getName() +" Error:"+e.getMessage());
} catch(Throwable t) {
- print(t.getClass().getName() +" Error:"+e.getMessage());
+ msg = t.getMessage();
+ if (msg != null) {
+ print(msg);
+ }
}
return null;
}
Modified: trunk/build/kit-adminshell/adminshell.bat
===================================================================
--- trunk/build/kit-adminshell/adminshell.bat 2009-07-28 18:30:48 UTC (rev 1197)
+++ trunk/build/kit-adminshell/adminshell.bat 2009-07-28 18:53:00 UTC (rev 1198)
@@ -57,6 +57,7 @@
rem JVM memory allocation pool parameters. Modify as appropriate.
set JAVA_OPTS=%JAVA_OPTS% -Xms128m -Xmx256m -XX:MaxPermSize=256m
+set JAVA_OPTS=%JAVA_OPTS% -Djava.util.logging.config.file=log.properties
echo ===============================================================================
echo.
Modified: trunk/build/kit-adminshell/adminshell.sh
===================================================================
--- trunk/build/kit-adminshell/adminshell.sh 2009-07-28 18:30:48 UTC (rev 1197)
+++ trunk/build/kit-adminshell/adminshell.sh 2009-07-28 18:53:00 UTC (rev 1198)
@@ -61,8 +61,9 @@
fi
TEIID_CLASSPATH="$TEIID_HOME/lib/patches/*:$TEIID_HOME/lib/*"
+JAVA_OPTS="$JAVA_OPTS -Xms128m -Xmx256m -XX:MaxPermSize=256m"
+JAVA_OPTS="$JAVA_OPTS -Djava.util.logging.config.file=log.properties"
-
# Print the env settings
echo "========================================================================="
echo ""
@@ -75,4 +76,4 @@
echo "========================================================================="
echo ""
-$JAVA -cp $TEIID_CLASSPATH -Xmx256m org.teiid.AdminShell $*
\ No newline at end of file
+$JAVA $JAVA_OPTS -cp $TEIID_CLASSPATH -Xmx256m org.teiid.AdminShell $*
\ No newline at end of file
Added: trunk/build/kit-adminshell/log.properties
===================================================================
--- trunk/build/kit-adminshell/log.properties (rev 0)
+++ trunk/build/kit-adminshell/log.properties 2009-07-28 18:53:00 UTC (rev 1198)
@@ -0,0 +1,17 @@
+# Specify the handlers to create in the root logger
+# (all loggers are children of the root logger)
+# The following creates two handlers
+handlers = java.util.logging.ConsoleHandler
+
+# Set the default logging level for the root logger
+.level = OFF
+
+# Set the default logging level for new ConsoleHandler instances
+java.util.logging.ConsoleHandler.level = INFO
+
+# Set the default formatter for new ConsoleHandler instances
+java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
+
+# Set the default logging level for the logger named com.mycompany
+org.teiid = OFF
+
Property changes on: trunk/build/kit-adminshell/log.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
15 years, 5 months
teiid SVN: r1197 - in trunk/engine/src: main/java/com/metamatrix/query/processor/relational and 1 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2009-07-28 14:30:48 -0400 (Tue, 28 Jul 2009)
New Revision: 1197
Modified:
trunk/engine/src/main/java/com/metamatrix/query/function/aggregate/NullFilter.java
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/DuplicateFilter.java
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/GroupingNode.java
trunk/engine/src/test/java/com/metamatrix/query/processor/relational/TestGroupingNode.java
Log:
TEIID-726 updating the fix and adding a test to ensure the input type is set correctly
Modified: trunk/engine/src/main/java/com/metamatrix/query/function/aggregate/NullFilter.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/function/aggregate/NullFilter.java 2009-07-28 17:58:26 UTC (rev 1196)
+++ trunk/engine/src/main/java/com/metamatrix/query/function/aggregate/NullFilter.java 2009-07-28 18:30:48 UTC (rev 1197)
@@ -42,6 +42,10 @@
this.proxy = proxy;
}
+
+ public AggregateFunction getProxy() {
+ return proxy;
+ }
/**
* @see com.metamatrix.query.function.aggregate.AggregateFunction#initialize(String, Class)
Modified: trunk/engine/src/main/java/com/metamatrix/query/processor/relational/DuplicateFilter.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/processor/relational/DuplicateFilter.java 2009-07-28 17:58:26 UTC (rev 1196)
+++ trunk/engine/src/main/java/com/metamatrix/query/processor/relational/DuplicateFilter.java 2009-07-28 18:30:48 UTC (rev 1197)
@@ -69,6 +69,10 @@
this.mgr = mgr;
this.groupName = groupName;
}
+
+ public List getElements() {
+ return elements;
+ }
/**
* @see com.metamatrix.query.function.aggregate.AggregateFunction#initialize(String, Class)
Modified: trunk/engine/src/main/java/com/metamatrix/query/processor/relational/GroupingNode.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/processor/relational/GroupingNode.java 2009-07-28 17:58:26 UTC (rev 1196)
+++ trunk/engine/src/main/java/com/metamatrix/query/processor/relational/GroupingNode.java 2009-07-28 18:30:48 UTC (rev 1197)
@@ -218,14 +218,18 @@
}
functions[i] = new NullFilter(functions[i]);
- outputType = aggSymbol.getType();
+ inputType = aggSymbol.getExpression().getType();
}
} else {
functions[i] = new ConstantFunction();
}
functions[i].initialize(outputType, inputType);
}
- }
+ }
+
+ AggregateFunction[] getFunctions() {
+ return functions;
+ }
public TupleBatch nextBatchDirect()
throws BlockedException, MetaMatrixComponentException, MetaMatrixProcessingException {
Modified: trunk/engine/src/test/java/com/metamatrix/query/processor/relational/TestGroupingNode.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/query/processor/relational/TestGroupingNode.java 2009-07-28 17:58:26 UTC (rev 1196)
+++ trunk/engine/src/test/java/com/metamatrix/query/processor/relational/TestGroupingNode.java 2009-07-28 18:30:48 UTC (rev 1197)
@@ -42,6 +42,8 @@
import com.metamatrix.common.types.DataTypeManager;
import com.metamatrix.query.function.FunctionDescriptor;
import com.metamatrix.query.function.FunctionLibraryManager;
+import com.metamatrix.query.function.aggregate.AggregateFunction;
+import com.metamatrix.query.function.aggregate.NullFilter;
import com.metamatrix.query.processor.FakeDataManager;
import com.metamatrix.query.processor.FakeTupleSource;
import com.metamatrix.query.sql.symbol.AggregateSymbol;
@@ -173,6 +175,12 @@
};
helpProcess(mgr, node, context, expected);
+
+ //ensure that the distinct input type is correct
+ AggregateFunction[] functions = node.getFunctions();
+ AggregateFunction countDist = functions[5];
+ DuplicateFilter dup = (DuplicateFilter)((NullFilter)countDist).getProxy();
+ assertEquals(DataTypeManager.DefaultDataClasses.INTEGER, ((ElementSymbol)dup.getElements().get(0)).getType());
}
public void test2() throws Exception {
15 years, 5 months
teiid SVN: r1196 - trunk/build/kit-runtime/bin.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2009-07-28 13:58:26 -0400 (Tue, 28 Jul 2009)
New Revision: 1196
Modified:
trunk/build/kit-runtime/bin/keystore.bat
trunk/build/kit-runtime/bin/keystore.sh
trunk/build/kit-runtime/bin/run.bat
trunk/build/kit-runtime/bin/run.sh
trunk/build/kit-runtime/bin/shutdown.bat
trunk/build/kit-runtime/bin/shutdown.sh
Log:
TEIID-702: Added script comments and better script usage messages
Modified: trunk/build/kit-runtime/bin/keystore.bat
===================================================================
--- trunk/build/kit-runtime/bin/keystore.bat 2009-07-27 21:20:17 UTC (rev 1195)
+++ trunk/build/kit-runtime/bin/keystore.bat 2009-07-28 17:58:26 UTC (rev 1196)
@@ -1,7 +1,15 @@
@echo off
-rem
-rem This script file encrypts the passed in clear text and spits out encypted form
-rem
+rem ================================================================================== ###
+rem This script helps in creating a security key for encrypting ###
+rem passwords and also helps in converting a clear text password into a ###
+rem encrypted one. For more information on how to use encrypted passwords please ###
+rem check out https://www.jboss.org/community/wiki/EncryptingpasswordsinTeiid ###
+rem ###
+rem usage: keystore.bat [options] ###
+rem options: ###
+rem -c, --create Creates security key "teiid.keystore" file in the deploy directory ###
+rem -e, --encrypt <password> Encrypts the clear text password into encrypted form ###
+rem ================================================================================== ###
@if not "%ECHO%" == "" echo %ECHO%
@if "%OS%" == "Windows_NT" setlocal
@@ -34,38 +42,49 @@
set TEIID_CLASSPATH=%TEIID_HOME%\lib\patches\*;%TEIID_HOME%\deploy;%TEIID_HOME%\client\*;%TEIID_HOME%\lib\*;
set KEYSTORE_FILE=%TEIID_HOME%\deploy\teiid.keystore
-if "x%1%" == "x" (
- goto prompt
-) else (
- if "%1%" == "-create" (
- if not exist %KEYSTORE_FILE% (
- "%JAVA%" -classpath "%TEIID_CLASSPATH%" com.metamatrix.common.util.crypto.CryptoUtil -genkey %KEYSTORE_FILE%
- echo A new key with keystore generated at %KEYSTORE_FILE%
+if "%1%" == "--create" (
+ goto create
+)
+if "%1%" == "-c" (
+ goto create
+)
+if "%1%" == "--encrypt" (
+ goto encrypt
+)
+if "%1%" == "-e" (
+ goto encrypt
+)
+goto prompt
+
+:create
+ if not exist %KEYSTORE_FILE% (
+ "%JAVA%" -classpath "%TEIID_CLASSPATH%" com.metamatrix.common.util.crypto.CryptoUtil -genkey %KEYSTORE_FILE%
+ echo A new key with keystore generated at %KEYSTORE_FILE%
+ ) else (
+ echo %KEYSTORE_FILE% already exists. Delete the current one if you would like to create a new keystore.
+ )
+goto end
+
+:encrypt
+ if NOT "x%2%" == "x" (
+ if exist %KEYSTORE_FILE% (
+ "%JAVA%" -classpath "%TEIID_CLASSPATH%" com.metamatrix.common.util.crypto.CryptoUtil -key %KEYSTORE_FILE% -encrypt %2%
) else (
- echo %KEYSTORE_FILE% already exists. Delete the current one if you would like to create a new keystore.
- )
+ echo %KEYSTORE_FILE% not found. Create a security key by using
+ echo usage:%0% --create
+ )
) else (
- if "%1%" == "-encrypt" (
- if NOT "x%2%" == "x" (
- if exist %KEYSTORE_FILE% (
- "%JAVA%" -classpath "%TEIID_CLASSPATH%" com.metamatrix.common.util.crypto.CryptoUtil -key %KEYSTORE_FILE% -encrypt %2%
- ) else (
- echo %KEYSTORE_FILE% not found. Create a keystore first by using
- echo usage:%0% -create
- )
- ) else (
- goto prompt
- )
- ) else (
- goto prompt
- )
+ goto prompt
)
-)
goto end
:prompt
- echo usage:%0% -create
- echo usage:%0% -encrypt plain-text-password
+ echo This scripts helps to create a security key, and helps to encrypt a clear text password
+ echo
+ echo usage: %0% [options]
+ echo options:
+ echo -c, --create Creates security key "teiid.keystore" file in the "deploy" directory
+ echo -e, --encrypt [password] Encrypts the clear text password into encrypted form
goto end
:end
\ No newline at end of file
Modified: trunk/build/kit-runtime/bin/keystore.sh
===================================================================
--- trunk/build/kit-runtime/bin/keystore.sh 2009-07-27 21:20:17 UTC (rev 1195)
+++ trunk/build/kit-runtime/bin/keystore.sh 2009-07-28 17:58:26 UTC (rev 1196)
@@ -1,4 +1,15 @@
#!/bin/sh
+### ================================================================================== ###
+### This script helps in creating a security key for encrypting ###
+### passwords and also helps in converting a clear text password into a ###
+### encrypted one. For more information on how to use encrypted passwords please ###
+### check out https://www.jboss.org/community/wiki/EncryptingpasswordsinTeiid ###
+### ###
+### usage: ./keystore.sh [options] ###
+### options: ###
+### -c, --create Creates security key "teiid.keystore" file in the deploy directory ###
+### -e, --encrypt <password> Encrypts the clear text password into encrypted form ###
+### ================================================================================== ###
DIRNAME=`dirname $0`
@@ -49,8 +60,11 @@
fi
prompt() {
- echo "usage:$0 -create"
- echo "usage:$0 -encrypt <plain-text-password> "
+ echo "echo This scripts helps to create a security key, and helps to encrypt a clear text password"
+ echo "usage: $0 [options]"
+ echo "options:"
+ echo "-c, --create Creates security key \"teiid.keystore\" file in the \"deploy\" directory"
+ echo "-e, --encrypt <password> Encrypts the clear text password into encrypted form"
}
KEYSTORE_FILE=$TEIID_HOME/deploy/teiid.keystore
@@ -59,7 +73,7 @@
then
prompt;
else
- if [ "${1}" = "-create" ]
+ if [ "${1}" = "-c" -o "${1}" = "--create" ]
then
# generate teiid.keystore if does not exist.
if [ ! -f $KEYSTORE_FILE ]; then
@@ -69,12 +83,12 @@
echo "$KEYSTORE_FILE already exists. Delete the current one if you would like to create a new keystore"
fi
else
- if [ "${1}" = "-encrypt" -a "${2}" != "" ]; then
+ if [ "${1}" = "-e" -o "${1}" = "--encrypt" -a "${2}" != "" ]; then
if [ -f $KEYSTORE_FILE ]; then
"$JAVA" -classpath $TEIID_CLASSPATH com.metamatrix.common.util.crypto.CryptoUtil -key $KEYSTORE_FILE -encrypt $2
else
- echo "$KEYSTORE_FILE not found. Create a keystore first by using "
- echo "$0 -create"
+ echo "$KEYSTORE_FILE not found. Create a security key by using "
+ echo "$0 --create"
fi
else
prompt
Modified: trunk/build/kit-runtime/bin/run.bat
===================================================================
--- trunk/build/kit-runtime/bin/run.bat 2009-07-27 21:20:17 UTC (rev 1195)
+++ trunk/build/kit-runtime/bin/run.bat 2009-07-28 17:58:26 UTC (rev 1196)
@@ -1,6 +1,8 @@
@echo off
rem -------------------------------------------------------------------------
-rem Teiid Bootstrap Script for Windows (borrowed & modified from JBoss AS)
+rem This script starts the Teiid in stand alone Server mode. Once started
+rem successfully JDBC clients can connect to the server over socket transport.
+rem Check the documentation to use Teiid in embedded mode.
rem -------------------------------------------------------------------------
Modified: trunk/build/kit-runtime/bin/run.sh
===================================================================
--- trunk/build/kit-runtime/bin/run.sh 2009-07-27 21:20:17 UTC (rev 1195)
+++ trunk/build/kit-runtime/bin/run.sh 2009-07-28 17:58:26 UTC (rev 1196)
@@ -1,9 +1,9 @@
#!/bin/sh
-### ====================================================================== ###
-## ##
-## Teiid Bootstrap Script ##
-## (script borrowed from JBossAS) ##
-### ====================================================================== ###
+### ========================================================================== ###
+### This script starts the Teiid in stand alone Server mode. Once started ###
+### successfully JDBC clients can connect to the server over socket transport. ###
+### Check the documentation to use Teiid in embedded mode. ###
+### ========================================================================== ###
DIRNAME=`dirname $0`
Modified: trunk/build/kit-runtime/bin/shutdown.bat
===================================================================
--- trunk/build/kit-runtime/bin/shutdown.bat 2009-07-27 21:20:17 UTC (rev 1195)
+++ trunk/build/kit-runtime/bin/shutdown.bat 2009-07-28 17:58:26 UTC (rev 1196)
@@ -1,6 +1,7 @@
@echo off
rem -------------------------------------------------------------------------
-rem Teiid Bootstrap Script for Windows (borrowed & modified from JBoss AS)
+rem This scripts sends a shuts down signal to the running Teiid Server on
+rem the local machine.
rem -------------------------------------------------------------------------
Modified: trunk/build/kit-runtime/bin/shutdown.sh
===================================================================
--- trunk/build/kit-runtime/bin/shutdown.sh 2009-07-27 21:20:17 UTC (rev 1195)
+++ trunk/build/kit-runtime/bin/shutdown.sh 2009-07-28 17:58:26 UTC (rev 1196)
@@ -1,8 +1,7 @@
#!/bin/sh
### ====================================================================== ###
-## ##
-## Teiid Bootstrap Script ##
-## (script borrowed from JBossAS) ##
+### This scripts sends a shuts down signal to the running Teiid Server on ###
+### the local machine. ###
### ====================================================================== ###
DIRNAME=`dirname $0`
15 years, 5 months
teiid SVN: r1195 - in trunk: common-core/src/main/java/com/metamatrix/common/util and 8 other directories.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2009-07-27 17:20:17 -0400 (Mon, 27 Jul 2009)
New Revision: 1195
Modified:
trunk/client-jdbc/src/main/java/org/teiid/jdbc/EmbeddedProfile.java
trunk/common-core/src/main/java/com/metamatrix/common/util/PropertiesUtils.java
trunk/common-core/src/main/resources/com/metamatrix/core/i18n.properties
trunk/common-core/src/test/java/com/metamatrix/common/util/TestPropertiesUtils.java
trunk/common-internal/src/main/java/com/metamatrix/common/config/api/ComponentType.java
trunk/common-internal/src/main/java/com/metamatrix/common/config/api/ConfigurationModelContainer.java
trunk/common-internal/src/main/java/com/metamatrix/common/config/model/BasicComponentType.java
trunk/common-internal/src/main/java/com/metamatrix/common/config/model/ConfigurationModelContainerImpl.java
trunk/engine/src/main/java/com/metamatrix/query/util/CommandContext.java
trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorManager.java
trunk/runtime/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedConfigurationService.java
trunk/runtime/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedDataService.java
trunk/runtime/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactoryImpl.java
Log:
TEIID-742, TEIID-743
Modified: trunk/client-jdbc/src/main/java/org/teiid/jdbc/EmbeddedProfile.java
===================================================================
--- trunk/client-jdbc/src/main/java/org/teiid/jdbc/EmbeddedProfile.java 2009-07-27 20:27:21 UTC (rev 1194)
+++ trunk/client-jdbc/src/main/java/org/teiid/jdbc/EmbeddedProfile.java 2009-07-27 21:20:17 UTC (rev 1195)
@@ -387,7 +387,7 @@
InputStream in = null;
try{
in = dqpURL.openStream();
- Properties props = new Properties();
+ Properties props = new Properties(System.getProperties());
props.load(in);
String logMsg = getResourceMessage("EmbeddedDriver.use_properties"); //$NON-NLS-1$
Modified: trunk/common-core/src/main/java/com/metamatrix/common/util/PropertiesUtils.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/util/PropertiesUtils.java 2009-07-27 20:27:21 UTC (rev 1194)
+++ trunk/common-core/src/main/java/com/metamatrix/common/util/PropertiesUtils.java 2009-07-27 21:20:17 UTC (rev 1195)
@@ -777,7 +777,7 @@
}
/**
- * The speciality of nested properties is, in a given property file
+ * The specialty of nested properties is, in a given property file
* there can be values with pattern like "${...}"
* <code>
* key1=value1
@@ -785,24 +785,20 @@
* </code>
* where the value of the <code>key2</code> should resolve to <code>value1/value2</code>
* also if the property in the pattern <code>${..}</code> is not found in the loaded
- * properties, then it will look up for the property value in the <code>System</code>
- * properties. Multiple nesting is OK, however recursive nested is not good, and
- * behaviour is undocumented in this case.
+ * properties, an exception is thrown. Multiple nesting is OK, however recursive nested is not supported.
* @param original - Original properties to be resolved
* @return resolved properties object.
* @since 4.4
*/
public static Properties resolveNestedProperties(Properties original) {
- Properties modified = new Properties();
- for(Enumeration e = original.keys(); e.hasMoreElements();) {
+ for(Enumeration e = original.propertyNames(); e.hasMoreElements();) {
String key = (String)e.nextElement();
String value = original.getProperty(key);
// this will take care of the if there are any non-string properties,
// no nesting allowed on these.
if (value == null) {
- modified.put(key, original.get(key));
continue;
}
@@ -819,31 +815,17 @@
if (matched) {
String nestedkey = value.substring(start+2, end);
String nestedvalue = original.getProperty(nestedkey);
- if (nestedvalue == null) {
- nestedvalue = System.getProperty(nestedkey);
- }
// this will handle case where we did not resolve, mark it blank
if (nestedvalue == null) {
- value = null;
- break;
+ throw new MetaMatrixRuntimeException(CorePlugin.Util.getString("PropertiesUtils.failed_to_resolve_property", nestedkey)); //$NON-NLS-1$
}
value = value.substring(0,start)+nestedvalue+value.substring(end+1);
}
- else {
- break;
- }
}
- if (value != null) {
- // now add to the modified property list
- modified.setProperty(key, value);
- }
- else {
- // since we do not have this property, remove it..
- modified.remove(key);
- }
+ original.setProperty(key, value);
}
- return modified;
+ return original;
}
// ======================================================
@@ -879,7 +861,7 @@
boolean bPass = false;
- String sMatchFrag = "";
+ String sMatchFrag = ""; //$NON-NLS-1$
// List propNames = new ArrayList();
@@ -890,7 +872,7 @@
// which means anything passes.
pattern.trim();
if ( pattern.length() == 0 )
- pattern = "*";
+ pattern = "*"; //$NON-NLS-1$
int iFirstStar = pattern.indexOf( chStar );
int iLastStar = pattern.lastIndexOf( chStar );
Modified: trunk/common-core/src/main/resources/com/metamatrix/core/i18n.properties
===================================================================
--- trunk/common-core/src/main/resources/com/metamatrix/core/i18n.properties 2009-07-27 20:27:21 UTC (rev 1194)
+++ trunk/common-core/src/main/resources/com/metamatrix/core/i18n.properties 2009-07-27 21:20:17 UTC (rev 1195)
@@ -402,3 +402,4 @@
ERR.003.030.0181=Failed to connect to the Database at {0} check connection properties.
ExceptionHolder.converted_exception=Remote exception: {0} ... Original type hierarchy {1}.
+PropertiesUtils.failed_to_resolve_property=failed to completely resolve the property value for key {0}
\ No newline at end of file
Modified: trunk/common-core/src/test/java/com/metamatrix/common/util/TestPropertiesUtils.java
===================================================================
--- trunk/common-core/src/test/java/com/metamatrix/common/util/TestPropertiesUtils.java 2009-07-27 20:27:21 UTC (rev 1194)
+++ trunk/common-core/src/test/java/com/metamatrix/common/util/TestPropertiesUtils.java 2009-07-27 21:20:17 UTC (rev 1195)
@@ -625,13 +625,12 @@
public void testNestedProperties() throws Exception {
System.setProperty("testdirectory", "c:/metamatrix/testdirectory"); //$NON-NLS-1$ //$NON-NLS-2$
- Properties p = new Properties();
+ Properties p = new Properties(System.getProperties());
p.setProperty("key1", "value1"); //$NON-NLS-1$ //$NON-NLS-2$
p.setProperty("key2", "${key1}/value2"); //$NON-NLS-1$ //$NON-NLS-2$
p.put("key3", new Integer(-234)); //$NON-NLS-1$
p.setProperty("key4", "${key2}/value4"); //$NON-NLS-1$ //$NON-NLS-2$
p.setProperty("key5", "${testdirectory}/testdata"); //$NON-NLS-1$ //$NON-NLS-2$
- p.setProperty("key6", "${foo}"); //$NON-NLS-1$ //$NON-NLS-2$
p.setProperty("key7", "anotherdir/${testdirectory}/${key1}"); //$NON-NLS-1$ //$NON-NLS-2$
Properties m = PropertiesUtils.resolveNestedProperties(p);
@@ -639,8 +638,19 @@
assertEquals(new Integer(-234), m.get("key3")); //$NON-NLS-1$
assertEquals("value1/value2/value4", m.getProperty("key4")); //$NON-NLS-1$ //$NON-NLS-2$
assertEquals("c:/metamatrix/testdirectory/testdata", m.getProperty("key5")); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(null, m.getProperty("key6")); //$NON-NLS-1$
assertEquals("anotherdir/c:/metamatrix/testdirectory/value1", m.getProperty("key7")); //$NON-NLS-1$ //$NON-NLS-2$
+ assertTrue(p == m); // no cloning.
+
+
+ p.setProperty("key6", "${foo}"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ try {
+ m = PropertiesUtils.resolveNestedProperties(p);
+ fail("must have failed to resovle as {foo} does not exist"); //$NON-NLS-1$
+ } catch(RuntimeException e) {
+ // pass
+ }
+
}
public void testOverrideProperties() {
Modified: trunk/common-internal/src/main/java/com/metamatrix/common/config/api/ComponentType.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/common/config/api/ComponentType.java 2009-07-27 20:27:21 UTC (rev 1194)
+++ trunk/common-internal/src/main/java/com/metamatrix/common/config/api/ComponentType.java 2009-07-27 21:20:17 UTC (rev 1195)
@@ -74,6 +74,8 @@
*/
Properties getDefaultPropertyValues();
+ Properties getDefaultPropertyValues(Properties props);
+
/**
* Returns the List <String> of properties that are defined as
* masked for this component type.
Modified: trunk/common-internal/src/main/java/com/metamatrix/common/config/api/ConfigurationModelContainer.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/common/config/api/ConfigurationModelContainer.java 2009-07-27 20:27:21 UTC (rev 1194)
+++ trunk/common-internal/src/main/java/com/metamatrix/common/config/api/ConfigurationModelContainer.java 2009-07-27 21:20:17 UTC (rev 1195)
@@ -118,7 +118,9 @@
*/
Properties getDefaultPropertyValues(ComponentTypeID componentTypeID) ;
+ Properties getDefaultPropertyValues(Properties defaultProperties, ComponentTypeID componentTypeID) ;
+
/**
* Return a collection of objects of type <code>ResourceDescriptor</code>.
* These are all the hosts defined in this configuration.
Modified: trunk/common-internal/src/main/java/com/metamatrix/common/config/model/BasicComponentType.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/common/config/model/BasicComponentType.java 2009-07-27 20:27:21 UTC (rev 1194)
+++ trunk/common-internal/src/main/java/com/metamatrix/common/config/model/BasicComponentType.java 2009-07-27 21:20:17 UTC (rev 1195)
@@ -134,7 +134,12 @@
public Properties getDefaultPropertyValues() {
Properties result = new Properties();
-
+ result = getDefaultPropertyValues(result);
+ return result;
+
+ }
+
+ public Properties getDefaultPropertyValues(Properties props) {
Collection defns = getComponentTypeDefinitions();
for (Iterator it=defns.iterator(); it.hasNext();) {
@@ -145,18 +150,16 @@
if (value instanceof String) {
String v = (String) value;
if (v.trim().length() > 0) {
- result.put(ctd.getPropertyDefinition().getName(), v );
+ props.put(ctd.getPropertyDefinition().getName(), v );
}
} else {
- result.put(ctd.getPropertyDefinition().getName(), value.toString() );
+ props.put(ctd.getPropertyDefinition().getName(), value.toString() );
}
}
}
-
- return result;
-
- }
+ return props;
+ }
/**
Modified: trunk/common-internal/src/main/java/com/metamatrix/common/config/model/ConfigurationModelContainerImpl.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/common/config/model/ConfigurationModelContainerImpl.java 2009-07-27 20:27:21 UTC (rev 1194)
+++ trunk/common-internal/src/main/java/com/metamatrix/common/config/model/ConfigurationModelContainerImpl.java 2009-07-27 21:20:17 UTC (rev 1195)
@@ -302,8 +302,15 @@
public Properties getDefaultPropertyValues(ComponentTypeID componentTypeID) {
Properties result = new Properties();
+ result = getDefaultPropertyValues(result, componentTypeID);
+ return result;
+
+ }
+
+ public Properties getDefaultPropertyValues(Properties defaultProperties, ComponentTypeID componentTypeID) {
+ Properties result = new Properties(defaultProperties);
- Collection defns = getAllComponentTypeDefinitions(componentTypeID);
+ Collection defns = getAllComponentTypeDefinitions(componentTypeID);
for (Iterator it=defns.iterator(); it.hasNext();) {
ComponentTypeDefn ctd = (ComponentTypeDefn) it.next();
@@ -321,10 +328,8 @@
}
}
}
-
- return result;
-
- }
+ return result;
+ }
Modified: trunk/engine/src/main/java/com/metamatrix/query/util/CommandContext.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/util/CommandContext.java 2009-07-27 20:27:21 UTC (rev 1194)
+++ trunk/engine/src/main/java/com/metamatrix/query/util/CommandContext.java 2009-07-27 21:20:17 UTC (rev 1195)
@@ -140,7 +140,7 @@
setCommandPayload(context.commandPayload);
setVdbName(context.vdbName);
setVdbVersion(context.vdbVersion);
- setEnvironmentProperties(PropertiesUtils.clone(context.environmentProperties));
+ setEnvironmentProperties(context.environmentProperties);
setProcessDebug(context.processDebug);
setProcessorBatchSize(context.processorBatchSize);
setConnectorBatchSize(context.connectorBatchSize);
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorManager.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorManager.java 2009-07-27 20:27:21 UTC (rev 1194)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorManager.java 2009-07-27 21:20:17 UTC (rev 1195)
@@ -338,7 +338,7 @@
connectorWorkerPool = WorkerPoolFactory.newWorkerPool(connectorName, maxThreads);
// Create the Connector env
- Properties clonedProps = PropertiesUtils.resolveNestedProperties(props);
+ Properties clonedProps = new Properties(this.props);
ConnectorEnvironment connectorEnv = new ConnectorEnvironmentImpl(clonedProps, new DefaultConnectorLogger(connectorID), env, connectorWorkerPool);
Modified: trunk/runtime/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedConfigurationService.java
===================================================================
--- trunk/runtime/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedConfigurationService.java 2009-07-27 20:27:21 UTC (rev 1194)
+++ trunk/runtime/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedConfigurationService.java 2009-07-27 21:20:17 UTC (rev 1195)
@@ -113,6 +113,7 @@
private ArrayList<VDBLifeCycleListener> vdbLifeCycleListeners = new ArrayList<VDBLifeCycleListener>();
private ArrayList<ConnectorBindingLifeCycleListener> connectorBindingLifeCycleListeners = new ArrayList<ConnectorBindingLifeCycleListener>();
private UDFSource udfSource;
+ private Map<ConnectorBindingType, Properties> defaultConnectorTypePropertiesCache = new HashMap<ConnectorBindingType, Properties>();
private AbstractClassLoaderManager classLoaderManager = new AbstractClassLoaderManager(Thread.currentThread().getContextClassLoader(), true, true) {
@@ -612,8 +613,23 @@
* @param binding
* @return properties for the connector binding given
*/
- public Properties getDefaultProperties(ConnectorBindingType type) {
- return configurationModel.getDefaultPropertyValues((ComponentTypeID)type.getID());
+ public Properties getDefaultProperties(ConnectorBindingType type) {
+ if (type != null) {
+ Properties props = null;
+ synchronized (this.defaultConnectorTypePropertiesCache) {
+ props = this.defaultConnectorTypePropertiesCache.get(type);
+ if (props == null) {
+ props = new Properties(getUserPreferences());
+ props = configurationModel.getDefaultPropertyValues(props, (ComponentTypeID)type.getID());
+ if (props.isEmpty()) {
+ props = type.getDefaultPropertyValues(props);
+ }
+ this.defaultConnectorTypePropertiesCache.put(type, props);
+ }
+ }
+ return props;
+ }
+ return new Properties(getUserPreferences());
}
/**
@@ -952,7 +968,7 @@
throws ApplicationInitializationException {
try {
- this.setUserPreferences(PropertiesUtils.clone(properties));
+ this.setUserPreferences(properties);
DQPEmbeddedPlugin.logInfo("EmbeddedConfigurationService.dqp_loading", new Object[] {getProcessName()}); //$NON-NLS-1$
Modified: trunk/runtime/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedDataService.java
===================================================================
--- trunk/runtime/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedDataService.java 2009-07-27 20:27:21 UTC (rev 1194)
+++ trunk/runtime/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedDataService.java 2009-07-27 21:20:17 UTC (rev 1195)
@@ -48,6 +48,7 @@
import com.metamatrix.common.config.api.ComponentTypeID;
import com.metamatrix.common.config.api.ConnectorBinding;
import com.metamatrix.common.config.api.ConnectorBindingType;
+import com.metamatrix.common.util.PropertiesUtils;
import com.metamatrix.common.util.crypto.CryptoException;
import com.metamatrix.common.util.crypto.CryptoUtil;
import com.metamatrix.common.vdb.api.VDBArchive;
@@ -499,10 +500,9 @@
Properties getDecryptedProperties(ConnectorBinding binding)
throws MetaMatrixComponentException{
+
+ Properties decryptedProperties = null;
- Properties bindingProperties = binding.getProperties();
- Properties decryptedProperties = new Properties();
-
// Get all the default properties for the connector type, so that
// if the connector binding does not have all the properties then these
// will take over, otherwise the connector binding ones overwrite
@@ -510,16 +510,9 @@
ConnectorBindingType type = getConfigurationService().getConnectorType(id.getName());
// Index connector has no formal definition in the configuration file.
- if (type != null) {
- Properties props = getConfigurationService().getDefaultProperties(type);
- if (props == null || props.isEmpty()) {
- props = type.getDefaultPropertyValues();
- }
-
- if (props != null && !props.isEmpty()) {
- decryptedProperties.putAll(props);
- }
- }
+ decryptedProperties = new Properties(getConfigurationService().getDefaultProperties(type));
+
+ Properties bindingProperties = binding.getProperties();
// now overlay the custom properties from the default properties.
decryptedProperties.putAll(bindingProperties);
@@ -536,7 +529,7 @@
}
}
}
- return decryptedProperties;
+ return PropertiesUtils.resolveNestedProperties(decryptedProperties);
}
/**
Modified: trunk/runtime/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactoryImpl.java
===================================================================
--- trunk/runtime/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactoryImpl.java 2009-07-27 20:27:21 UTC (rev 1194)
+++ trunk/runtime/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactoryImpl.java 2009-07-27 21:20:17 UTC (rev 1195)
@@ -121,12 +121,12 @@
}
URL bootstrapURL = null;
- Properties props = info;
+ Properties props = new Properties(System.getProperties());
String processName = "embedded"; //$NON-NLS-1$
try {
bootstrapURL = URLHelper.buildURL(info.getProperty(DQPEmbeddedProperties.BOOTURL));
- props = PropertiesUtils.loadFromURL(bootstrapURL);
+ props.putAll(PropertiesUtils.loadFromURL(bootstrapURL));
props.putAll(info);
props = PropertiesUtils.resolveNestedProperties(props);
15 years, 5 months
teiid SVN: r1194 - trunk/build/kit-runtime/examples/portfolio/PortfolioModel.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2009-07-27 16:27:21 -0400 (Mon, 27 Jul 2009)
New Revision: 1194
Modified:
trunk/build/kit-runtime/examples/portfolio/PortfolioModel/Portfolio.vdb
Log:
TEIID-684: adding the classpath for the deby connector
Modified: trunk/build/kit-runtime/examples/portfolio/PortfolioModel/Portfolio.vdb
===================================================================
--- trunk/build/kit-runtime/examples/portfolio/PortfolioModel/Portfolio.vdb 2009-07-27 18:50:49 UTC (rev 1193)
+++ trunk/build/kit-runtime/examples/portfolio/PortfolioModel/Portfolio.vdb 2009-07-27 20:27:21 UTC (rev 1194)
@@ -108,34 +108,40 @@
i�p�h|%�m�~%+0��yz�jU�,��[υm��xJW/-~^��h���w���gi�
-
-sl$
-G^����5�����v2.�]H-M�%��f��{�"�LH�:o�z��a��ܹz�v1y��Y�����������3j2����kx?w�b�?���s�w�~��/؟�-nP�G�Q��Ç���!����&�����Β�|A_<�B2O�I7�������D�9�p��P�'�~�$�x#g�&� w΄z ��fo���5�Z�p���w�H�|�/�A4Ķ=��{��ۛ�͝n�d�;�^��՚n�z-cט�l̦l�UN�0��W
-=8��߲b�۷�r���`p4P /FO��j���,I��a���d5�\�)��z�1��p�*G�x��c�:tj13=��̐��uf(Wr/�����A|�Iԑ��S2�~'A�G�ꄊ�T��X1���+ؠO�ݭ�^_����-5r�j��9[�I��ȵ����J��DGxQ�Ըfd��>�ԝ+n�� 5���vm}
-����(��Z3PDȝ��9|��m��Ss�]�upx���З�����T��k�\���]3~� -�Ɗ
-��S@�G�v����n���Iww�����mono@�^�x$��&�
-�\6y��ܢY�@$�_�|0i>WZ
-�@'pgĈ�a0�\r��5�pv����7�p�R$D�߁C�(���<gz\�V��# j@f$�����;^�I�S���R+C͞|x�`�!!<y)�Ȕ?��{�P�!/�CBH�\b�'
-��%�K���z@ʙ���1�N��3�R�[�-$~���x�ҔD���xVJ�
-����9������/ �`��
-#IW8n��L)�Ya������tDΟ����h�[3�x�=\�%���1��������Y;�ؤ��m4<�1f�^�!���4�Ӄ�S�(�������sD��Or�)��c
-$V؉���{�����YGI�a�:^�$�'�:�jʌ�k�Y��-�� 8�
-x�Y'BѬ�H�+��N�=��b��LNԁXRZ���2�p9�r}������p�ܐ�Nj��F�{X��Sf�i>_�KV�ҵ��-<�����G��$V�GǞ���j�z� @ �Q�4��k��c��'*t<8���q�|�$R�|�zا0���W����*�@��E�[�-�%�z�ullw��۱�\=٣����(�ӳ$�ZRu:G��x��c\v�
-�c���븞$Dy��N�`�-����b��q�ڏ�6ڤ/q���E��6Ǹ�ua�>�+���S�Kc~g�,q̨�Ki.�kQ
-�!8*�"�o"T��c#5zH��ҩ�1�
-2I���$It���h=F��g��=ru��P/�eRAA�ý�>��[J�W���tW�o���`�r�!̦r
-`0�Cz�nq���0���&
-d�Ik�e��1/=L2�ȴX�ɾT������`��� �*�GkX.&*E�Cp��ݐ�F�ί����{z˝��ka�ҵ���tm��U��'F��Oe74T��:���*̌��.��^Fg8�T�� ��0�w�.~O��*�;R��|"�=V�
-�ۀ?�+ `H
-Kde�I,��R�BQ寸o略5
+��
+LKpb٪ś�Z:6����/�ܦ?�#7��ä�X꺬��
+w���8�����p9�����$�pb��݆��|!�=��Vt�D�0���QP$FB�,���l�C��G�olW�bs��
+
+��(���!���22R�%�R���@
+:�1`7�[L�aT6谕]��{9�a��`�@U�_�����ݏ���c���$�
+�$P�~2b30˥/Q��&����nt]���I]�qD�2)�A>�I+Mc�|�Ff���.ƗI��ӯ��n�<����m�[�>����;�5��o���<�*o�`���rf��A�;'E�e����G�ZR�"1�@��B����*�/�4���
+���+�
+�I�71�R��i7<��[D0�p��!�<R|�����s�9o�n��þjM��y�p���R�G�[h2�8h�Rg �Tl�R8ƶQs�1��by�$Oɠ��.\�D.l���:�^���NI�}0��]��t�<�0=t�g5�<��}*Z��VZ��=3�/�#��Nd�t���:�N�:�*J����@���,�<v�%���P؆���=����#! �!�c�;���S�+��W��Q�d<�8����7��'gg��x�_-R����
+�����������r~q^:�9�d|1�[��0���Ҁ�NS8��"ռ)��(�A�e�5���>��l�~0�[4�[�n�n��q�-��A�Tz�B�Z�g�
+-^��k��tV�PJ4�(R�J-��c���.2��
+n@.�K�ck��w�Nm�����G���^F>H��} �Ғ��92P��ß,����3'}�U�c[�+HQ�~T �˨.¬� h\���F��&� �<r3��%��1.�|]����s1�T��X��Y%K1���ԗ˵(�^��%�
+�y�7��f�H�R����u�8@��lB�q�*��+�L�8>CAb]9>�0������i�y�X_�!#�s�a�TGP�p�&Op����/��[/�!ض\x��,����Z�v��fʩ|N3Q^��O��
+�s�/��_ُ���%Y�~w�A��l������b�@��wH�o�MB��9��>C��t���-�t�A����s���q2W�f�f)2$z*fp4��i��ma���
+�������W�z}]g}��u���X�7V��K�j�*.u^Wq����U\�*.u���K]ť����Vq���uH��uH��m����u�����~����+�|+�G���iiLQ��^U
+�5�X$
+
+��[qO�0�+
+k
���t;������y�J&"��I �
�,�f�^�Z���x�glS��y
@@ -193,7 +199,6 @@
��E����͛�,���O��6�C�vdz]t�2�0r`&�wשS����'iDi�G��$���1�_�I,"�&��:L�ղ(V�TOV���q
-
-
\ No newline at end of file
+
+
\ No newline at end of file
15 years, 5 months