[teiid-commits] teiid SVN: r1897 - in branches/JCA: common-internal/src/main/java/com/metamatrix/internal/core/xml and 9 other directories.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Wed Mar 3 20:56:21 EST 2010


Author: shawkins
Date: 2010-03-03 20:56:20 -0500 (Wed, 03 Mar 2010)
New Revision: 1897

Removed:
   branches/JCA/connector-sdk/src/main/java/com/metamatrix/cdk/ConnectorShell.java
   branches/JCA/connector-sdk/src/main/java/com/metamatrix/cdk/ConnectorShellCommandTarget.java
   branches/JCA/connector-sdk/src/main/java/com/metamatrix/cdk/QueryCommandTarget.java
   branches/JCA/connector-sdk/src/main/java/com/metamatrix/common/classloader/
   branches/JCA/connector-sdk/src/main/java/com/metamatrix/core/commandshell/ConnectorResultUtility.java
   branches/JCA/connector-sdk/src/main/java/com/metamatrix/core/commandshell/ScriptCommandTarget.java
   branches/JCA/connector-sdk/src/main/java/com/metamatrix/core/commandshell/ScriptFileNameStack.java
   branches/JCA/connector-sdk/src/main/java/com/metamatrix/core/factory/
   branches/JCA/connector-sdk/src/test/java/com/metamatrix/core/commandshell/TestScriptFileNameStack.java
   branches/JCA/connector-sdk/src/test/java/com/metamatrix/core/factory/
   branches/JCA/test-integration/common/src/test/java/com/metamatrix/cdk/TestConnectorShell.java
   branches/JCA/test-integration/common/src/test/java/com/metamatrix/cdk/api/TestConnectorResultUtility.java
Modified:
   branches/JCA/common-core/src/main/java/com/metamatrix/core/util/ObjectConverterUtil.java
   branches/JCA/common-internal/src/main/java/com/metamatrix/internal/core/xml/JdomHelper.java
   branches/JCA/connector-sdk/src/test/java/com/metamatrix/core/commandshell/TestCommand.java
   branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/impl/FileStorageManager.java
Log:
TEIID-833 cleaning sdk and prepping for merge

Modified: branches/JCA/common-core/src/main/java/com/metamatrix/core/util/ObjectConverterUtil.java
===================================================================
--- branches/JCA/common-core/src/main/java/com/metamatrix/core/util/ObjectConverterUtil.java	2010-03-04 01:32:54 UTC (rev 1896)
+++ branches/JCA/common-core/src/main/java/com/metamatrix/core/util/ObjectConverterUtil.java	2010-03-04 01:56:20 UTC (rev 1897)
@@ -28,7 +28,6 @@
 import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.FileInputStream;
-import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
@@ -133,17 +132,17 @@
     public static void write(final InputStream is, final File f) throws IOException {
         FileOutputStream fio = new FileOutputStream(f);
         BufferedOutputStream bos = new BufferedOutputStream(fio);
-
-        byte[] buff = new byte[2048];
-        int bytesRead;
-
-        // Simple read/write loop.
-        while (-1 != (bytesRead = is.read(buff, 0, buff.length))) {
-            bos.write(buff, 0, bytesRead);
+        try {
+		    byte[] buff = new byte[2048];
+		    int bytesRead;
+		
+		    // Simple read/write loop.
+		    while (-1 != (bytesRead = is.read(buff, 0, buff.length))) {
+		        bos.write(buff, 0, bytesRead);
+		    }
+        } finally {
+        	bos.close();
         }
-
-        bos.flush();
-        bos.close(); 
     }
     
     public static void write(byte[] data, final String fileName) throws Exception {
@@ -158,16 +157,6 @@
         is.close();
     }
 
-    public static InputStream convertToInputStream(final File file) {
-        try {
-            FileInputStream fis = new FileInputStream(file);
-            InputStream isContent = new BufferedInputStream(fis);
-            return isContent;
-        } catch (FileNotFoundException fie) {
-            final Object[] params = new Object[]{file.getName()};
-            throw new IllegalArgumentException(CorePlugin.Util.getString("ObjectConverterUtil.File_is_not_found_4",params)); //$NON-NLS-1$
-        }
-    }
     /**
      * Returns the given bytes as a char array using a given encoding (null means platform default).
      */

Modified: branches/JCA/common-internal/src/main/java/com/metamatrix/internal/core/xml/JdomHelper.java
===================================================================
--- branches/JCA/common-internal/src/main/java/com/metamatrix/internal/core/xml/JdomHelper.java	2010-03-04 01:32:54 UTC (rev 1896)
+++ branches/JCA/common-internal/src/main/java/com/metamatrix/internal/core/xml/JdomHelper.java	2010-03-04 01:56:20 UTC (rev 1897)
@@ -738,22 +738,20 @@
      * @throws IOException if there are problems writing to the file.
      */
     public static void write( Document doc , String filename, String indent, boolean newlines ) throws IOException {
-        if(doc == null){
-            ArgCheck.isNotNull(doc,CorePlugin.Util.getString("JdomHelper.The_Document_reference_may_not_be_null_42")); //$NON-NLS-1$
-        }
+        ArgCheck.isNotNull(doc,CorePlugin.Util.getString("JdomHelper.The_Document_reference_may_not_be_null_42")); //$NON-NLS-1$
+        ArgCheck.isNotNull(filename,CorePlugin.Util.getString("JdomHelper.The_filename_may_not_be_null_43")); //$NON-NLS-1$
         
-        if(filename == null){
-            ArgCheck.isNotNull(filename,CorePlugin.Util.getString("JdomHelper.The_filename_may_not_be_null_43")); //$NON-NLS-1$
-        }
-        
         if(filename.length() == 0){
             ArgCheck.isNotZeroLength(filename,CorePlugin.Util.getString("JdomHelper.The_filename_may_not_be_zero-length_44")); //$NON-NLS-1$
         }
         
         FileOutputStream out = new FileOutputStream( filename );
-        write(doc,out,indent,newlines);
-        out.flush();
-        out.close();
+        try {
+	        write(doc,out,indent,newlines);
+	        out.flush();
+        } finally {
+        	out.close();
+        }
     }
 
     /**

Deleted: branches/JCA/connector-sdk/src/main/java/com/metamatrix/cdk/ConnectorShell.java
===================================================================
--- branches/JCA/connector-sdk/src/main/java/com/metamatrix/cdk/ConnectorShell.java	2010-03-04 01:32:54 UTC (rev 1896)
+++ branches/JCA/connector-sdk/src/main/java/com/metamatrix/cdk/ConnectorShell.java	2010-03-04 01:56:20 UTC (rev 1897)
@@ -1,118 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.cdk;
-
-import com.metamatrix.cdk.api.ConnectorHost;
-import com.metamatrix.core.commandshell.CommandShell;
-
-
-/**
- * Command line utility to execute queries on a connector.
- */
-public class ConnectorShell extends CommandShell {
-	
-	
-
-    public ConnectorShell(ConnectorHost host) {
-        super(new ConnectorShellCommandTarget(host));
-    }
-    
-    public ConnectorShell(ConnectorShellCommandTarget target) {
-        super(target);
-    }
-
-    public static void main(String[] args) {
-        System.out.println("Starting"); //$NON-NLS-1$
-        
-        new ConnectorShell(new ConnectorShellCommandTarget()).run(args, DEFAULT_LOG_FILE);
-    }
-    
-    protected boolean showHelpFor(String methodName) {
-        return getParameterNamesDirect(methodName) != null;
-    }
-    
-    protected String[] getParameterNames(String methodName) {
-        String[] result = getParameterNamesDirect(methodName);
-        if (result == null) {
-            result = new String[] {};
-        }
-        return result;
-    }
-
-    private String[] getParameterNamesDirect(String methodName) {
-        if (methodName.equals("select")) { //$NON-NLS-1$
-            return new String[] { "query" }; //$NON-NLS-1$
-        } else if (methodName.equals("run")) { //$NON-NLS-1$
-            return new String[] { "scriptName" }; //$NON-NLS-1$
-        } else if (methodName.equals("setProperty")) { //$NON-NLS-1$
-            return new String[] { "propertyName", "propertyValue" }; //$NON-NLS-1$ //$NON-NLS-2$
-        } else if (methodName.equals("load")) { //$NON-NLS-1$
-            return new String[] { "fullyQualifiedConnectorClassName", "pathToVdbFile" }; //$NON-NLS-1$ //$NON-NLS-2$
-        } else if (methodName.equals("getProperties")) { //$NON-NLS-1$
-            return new String[] {};
-        } else if (methodName.equals("delete")) { //$NON-NLS-1$
-            return new String[] { "multilineSqlTerminatedWith;" }; //$NON-NLS-1$
-        } else if (methodName.equals("insert")) { //$NON-NLS-1$
-            return new String[] { "multilineSqlTerminatedWith;" }; //$NON-NLS-1$
-        } else if (methodName.equals("help")) { //$NON-NLS-1$
-            return new String[] { "" }; //$NON-NLS-1$
-        } else if (methodName.equals("update")) { //$NON-NLS-1$
-            return new String[] { "multilineSqlTerminatedWith;" }; //$NON-NLS-1$
-        } else if (methodName.equals("select")) { //$NON-NLS-1$
-            return new String[] { "multilineSqlTerminatedWith;" }; //$NON-NLS-1$
-        } else if (methodName.equals("quit")) { //$NON-NLS-1$
-            return new String[] { "" }; //$NON-NLS-1$
-        } else if (methodName.equals("runScript")) { //$NON-NLS-1$
-            return new String[] { "pathToScriptFile", "scriptNameWithinFile" }; //$NON-NLS-1$ //$NON-NLS-2$
-        } else if (methodName.equals("loadFromScript")) { //$NON-NLS-1$
-            return new String[] { "pathToConfiguratonScript" };         //$NON-NLS-1$
-        } else if (methodName.equals("setFailOnError")) { //$NON-NLS-1$
-            return new String[] { "boolean" }; //$NON-NLS-1$
-        } else if (methodName.equals("setPrintStackOnError")) { //$NON-NLS-1$
-            return new String[] { "boolean" }; //$NON-NLS-1$
-        } else if (methodName.equals("setSecurityContext")) { //$NON-NLS-1$
-            return new String[] { "vdbName", "vdbVersion", "userName" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-        } else if (methodName.equals("setScriptFile")) { //$NON-NLS-1$
-            return new String[] { "pathToScriptFile" }; //$NON-NLS-1$
-        } else if (methodName.equals("runAll")) { //$NON-NLS-1$
-            return new String[] {};
-        } else if (methodName.equals("setBatchSize")) { //$NON-NLS-1$
-            return new String[] { "batchSize" }; //$NON-NLS-1$
-        } else if (methodName.equalsIgnoreCase("start")) { //$NON-NLS-1$
-            return new String[] {};
-        } else if (methodName.equalsIgnoreCase("stop")) { //$NON-NLS-1$
-            return new String[] {};
-        } else if (methodName.equalsIgnoreCase("loadProperties")) { //$NON-NLS-1$
-            return new String[] {"pathToPropertyFile"}; //$NON-NLS-1$
-        } else if (methodName.equalsIgnoreCase("createTemplate")) { //$NON-NLS-1$
-            return new String[] {"pathToTemplateFile"}; //$NON-NLS-1$
-        } else if (methodName.equalsIgnoreCase("createArchive")) { //$NON-NLS-1$
-            return new String[] {"pathToArchiveFileName", "pathToCDKFileName", "pathToDirectoryForExtenstionModules"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-        } else if (methodName.equalsIgnoreCase("loadArchive")) { //$NON-NLS-1$
-            return new String[] {"pathToArchiveFileName", "newConnectorTypeName"}; //$NON-NLS-1$//$NON-NLS-2$
-        } else if (methodName.equalsIgnoreCase("exec")) { //$NON-NLS-1$
-            return new String[] {"fullyQualifiedProcedureName"}; //$NON-NLS-1$
-        }
-        return null;
-    }
-}

Deleted: branches/JCA/connector-sdk/src/main/java/com/metamatrix/cdk/ConnectorShellCommandTarget.java
===================================================================
--- branches/JCA/connector-sdk/src/main/java/com/metamatrix/cdk/ConnectorShellCommandTarget.java	2010-03-04 01:32:54 UTC (rev 1896)
+++ branches/JCA/connector-sdk/src/main/java/com/metamatrix/cdk/ConnectorShellCommandTarget.java	2010-03-04 01:56:20 UTC (rev 1897)
@@ -1,236 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.cdk;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URLClassLoader;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Properties;
-import java.util.Set;
-
-import org.teiid.connector.api.Connector;
-import org.teiid.connector.api.ConnectorException;
-import org.teiid.connector.api.ExecutionContext;
-import org.teiid.connector.language.Call;
-import org.teiid.connector.language.Command;
-import org.teiid.connector.language.Select;
-
-import com.metamatrix.cdk.api.ConnectorHost;
-import com.metamatrix.core.MetaMatrixRuntimeException;
-import com.metamatrix.core.commandshell.ConnectorResultUtility;
-import com.metamatrix.core.factory.ComponentLoader;
-
-
-/**
- * Implements the commands supported by the ConnectorShell.  Delegates to a ConnectorHost to execute queries.
- */
-public class ConnectorShellCommandTarget extends QueryCommandTarget {
-    private static final String MM_JAR_PROTOCOL = "extensionjar"; //$NON-NLS-1$   
-    private static final String CONNECTOR_CLASSPATH = "ConnectorClassPath"; //$NON-NLS-1$
-    private static final String CONNECTOR_CLASS_NAME = "ConnectorClass"; //$NON-NLS-1$
-    
-    private ConnectorHost connectorHost;
-    private Properties connectorProperties = null;
-    private Connector connector;
-    private String vdbFileName;
-    private String connectorClassName = null;
-    private URLClassLoader connectorClassLoader = null;
-    public ConnectorShellCommandTarget() {
-    }
-    
-    public ConnectorShellCommandTarget(ConnectorHost connectorHost) {
-        this.connectorHost = connectorHost;
-    }
-    
-    protected String execute(String query) {
-        try {
-            Command command = getConnectorHost().getCommand(query);
-            String[] columnNames = null;
-            if(command instanceof Select) {
-                Select iquery = (Select) command;
-                columnNames = iquery.getColumnNames();
-            } else if (!(command instanceof Call)){
-                columnNames = new String[] {"count"}; //$NON-NLS-1$
-            }
-            List results = getConnectorHost().executeCommand(command);
-            return ConnectorResultUtility.resultsToString(results, columnNames);
-        } catch (ConnectorException e) {
-            throw new MetaMatrixRuntimeException(e);
-        }
-    }
-
-    protected Set getMethodsToIgnore() {
-        Set result = new HashSet();
-        result.addAll(Arrays.asList( new String[] { "runRep", "setUsePreparedStatement"} )); //$NON-NLS-1$ //$NON-NLS-2$
-        return result;
-    }
-
-    /**
-     * Executes the provided script and expects the script to produce a ConnectorHost for executing queries.
-     * @param configurationScriptFileName Resource name of the script file to be loaded from the class path.
-     */
-    public void loadFromScript(String configurationScriptFileName) {
-        ComponentLoader loader = new ComponentLoader(this.getClass().getClassLoader(), configurationScriptFileName);       
-        connectorHost = (ConnectorHost) loader.load("ConnectorHost"); //$NON-NLS-1$
-    }
-    
-    public void load(String connectorClassName, String vdbFileName) throws IllegalAccessException,
-        InstantiationException, ClassNotFoundException {
-        if (connectorClassLoader == null) {
-            Class.forName(connectorClassName);	// Just make sure we load the class
-            this.connectorProperties = new Properties();
-        }
-        else {
-            connectorClassLoader.loadClass(connectorClassName).newInstance();
-        }        
-        this.vdbFileName = vdbFileName;
-        this.connectorClassName = connectorClassName; 
-        connectorHost = null;
-    }
-    
-
-    public void start() throws IllegalAccessException,
-    	InstantiationException, ClassNotFoundException, ConnectorException {
-        if (connectorHost == null) {
-            if (vdbFileName == null) {
-                throw new RuntimeException(CdkPlugin.Util.getString("ConnectorShellCommandTarget.Connector_must_be_loaded_before_it_can_be_used._1")); //$NON-NLS-1$
-            }
-            if (connectorClassLoader == null) {
-                connector = (Connector) Class.forName(connectorClassName).newInstance();
-            }
-            else {
-                connector = (Connector) connectorClassLoader.loadClass(connectorClassName).newInstance();
-            }
-            connectorHost = new ConnectorHost(connector, null, shell.expandFileName(vdbFileName));     
-        }
-    }
-    
-    public void stop() {
-        if (connector != null) {
-            connector = null;
-        } 
-        connectorHost = null;
-    }
-    
-    private Properties loadFromPropertiesFile(File propertyFile) {
-        Properties props = new Properties();
-        InputStream in = null;
-        try {
-            in = new FileInputStream(propertyFile);
-            props.load(in);
-            return props;
-        } catch (IOException e) {
-            throw new RuntimeException(CdkPlugin.Util.getString("ConnectorShellCommandTarget.Cannot_read_from_file__{0}_1", propertyFile)); //$NON-NLS-1$
-        } finally {
-            try {
-                in.close();
-            } catch (Exception e) {
-            }
-        }
-    }
-    
-    public void setFailOnError(boolean failOnError) {
-        if (failOnError) {
-            shell.turnOffExceptionHandling();
-        } else {
-            shell.turnOnExceptionHandling();
-        }        
-    }
-    
-    public void setPrintStackOnError(boolean printStackOnError) {
-        shell.setPrintStackTraceOnException(printStackOnError);
-    }
-    
-    public void setSecurityContext(ExecutionContext context) {
-        getConnectorHost().setExecutionContext(context);
-    }
-    
-    public void setBatchSize(int batchSize) {
-    }
-
-    public void setProperty(String propertyName, String propertyValue) {
-        if (connectorHost == null) {
-            if (connectorProperties == null) {
-                connectorProperties = new Properties();
-            }
-            connectorProperties.put(propertyName, propertyValue);
-        } else {
-            throw new RuntimeException(CdkPlugin.Util.getString("ConnectorShellCommandTarget.Cannot_set_connector_properties_after_the_connector_is_started._1")); //$NON-NLS-1$
-        }
-    }
-    
-    private ConnectorHost getConnectorHost() {
-        return connectorHost;
-    }
-    
-    public void createTemplate(String filename) {
-        File file = new File(filename);
-        if (file.exists()) {
-            if (!file.canWrite()) {
-                throw new RuntimeException(CdkPlugin.Util.getString("ConnectorShellCommandTarget.Cannot_write_to_file__{0}_3", file)); //$NON-NLS-1$
-            }
-        } else if (file.getParentFile() == null || file.getParentFile().exists()) {
-            try {
-                if (!file.createNewFile()) {
-                    throw new RuntimeException(CdkPlugin.Util.getString("ConnectorShellCommandTarget.Cannot_create_file__{0}_4", file)); //$NON-NLS-1$
-                }
-            } catch (IOException e) {
-                throw new RuntimeException(CdkPlugin.Util.getString("ConnectorShellCommandTarget.Cannot_create_file__{0}_4", file)); //$NON-NLS-1$
-            }
-        } else {
-            throw new RuntimeException(CdkPlugin.Util.getString("ConnectorShellCommandTarget.Cannot_create_file_{0}_because_directory_{1}_does_not_exist._6", file, file.getParentFile())); //$NON-NLS-1$
-        }
-        FileOutputStream out = null;
-        try {
-            out = new FileOutputStream(file);
-        } catch (FileNotFoundException e) {
-            throw new RuntimeException(CdkPlugin.Util.getString("ConnectorShellCommandTarget.Cannot_write_to_file__{0}_3", file)); //$NON-NLS-1$
-        }
-        
-        InputStream template = getClass().getResourceAsStream("Template.cdk"); //$NON-NLS-1$
-        int readByte = -1;
-        try {
-            while((readByte = template.read()) != -1) {
-                out.write(readByte);
-            }
-        } catch (IOException e) {
-            throw new RuntimeException(CdkPlugin.Util.getString("ConnectorShellCommandTarget.Cannot_write_to_file__{0}_3", file)); //$NON-NLS-1$
-        } finally {
-            try {
-                template.close();
-            } catch (Exception e) {
-            }
-            try {
-                out.close();
-            } catch (Exception e) {
-            }
-        }
-    }
-}

Deleted: branches/JCA/connector-sdk/src/main/java/com/metamatrix/cdk/QueryCommandTarget.java
===================================================================
--- branches/JCA/connector-sdk/src/main/java/com/metamatrix/cdk/QueryCommandTarget.java	2010-03-04 01:32:54 UTC (rev 1896)
+++ branches/JCA/connector-sdk/src/main/java/com/metamatrix/cdk/QueryCommandTarget.java	2010-03-04 01:56:20 UTC (rev 1897)
@@ -1,111 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.cdk;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-
-import com.metamatrix.core.MetaMatrixRuntimeException;
-import com.metamatrix.core.commandshell.ScriptCommandTarget;
-
-/**
- * Base CommandTarget class for processing SQL queries via the command line.
- */
-abstract public class QueryCommandTarget extends ScriptCommandTarget {
-
-	abstract protected String execute(String query);
-    protected boolean usePreparedStatement = false;
-    protected boolean prepareStmt = false;
-    protected Map preparedStmts = new HashMap();
-    protected String currentPreparedStmtName = null;
-    
-    protected String readSql(String commandName, String[] args) {
-        StringBuffer query = new StringBuffer();
-        StringBuffer firstLine = new StringBuffer();
-        firstLine.append(commandName);
-        firstLine.append(" "); //$NON-NLS-1$
-
-        for (int i = 0; i < args.length; i++) {
-            firstLine.append(args[i]);
-            firstLine.append(" "); //$NON-NLS-1$
-        }
-
-        String line = firstLine.toString();
-
-        boolean cont = true;
-        while (cont) {
-            try {
-                if (line != null && line.trim().endsWith(";")) { //$NON-NLS-1$
-                    cont = false;
-                    line = line.trim();
-                    line = line.substring(0, line.length() - 1);
-                }
-                query.append(" "); //$NON-NLS-1$
-                query.append(line);
-                if (cont) {
-                    line = shell.getNextCommandLine();
-                }
-            } catch (IOException e) {
-                throw new MetaMatrixRuntimeException(e);
-            }
-        }
-        return query.toString();            
-    }
-    
-    public void setUsePreparedStatement(boolean usePreparedStatement) {
-        this.usePreparedStatement = usePreparedStatement;
-    }
-    
-    protected String executeSql(String commandName, String[] args) {
-        if (!this.usePreparedStatement) {
-            prepareStmt = false;
-        }
-        
-        if (prepareStmt) {
-            preparedStmts.put(currentPreparedStmtName, readSql(commandName, args));
-            return ""; //$NON-NLS-1$
-        }
-        return execute(readSql(commandName, args));
-    }
-    
-	public String select(String[] args) { 
-		return executeSql("select", args); //$NON-NLS-1$
-	}
-
-	public String insert(String[] args) {
-		return executeSql("insert", args); //$NON-NLS-1$
-	}
-
-	public String update(String[] args) {
-		return executeSql("update", args); //$NON-NLS-1$
-	}
-
-	public String delete(String[] args) {
-		return executeSql("delete", args); //$NON-NLS-1$
-	}
-    
-    public String exec(String[] args) {
-        return executeSql("exec", args); //$NON-NLS-1$
-    }    
-}

Deleted: branches/JCA/connector-sdk/src/main/java/com/metamatrix/core/commandshell/ConnectorResultUtility.java
===================================================================
--- branches/JCA/connector-sdk/src/main/java/com/metamatrix/core/commandshell/ConnectorResultUtility.java	2010-03-04 01:32:54 UTC (rev 1896)
+++ branches/JCA/connector-sdk/src/main/java/com/metamatrix/core/commandshell/ConnectorResultUtility.java	2010-03-04 01:56:20 UTC (rev 1897)
@@ -1,206 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.core.commandshell;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.StringReader;
-import java.util.Iterator;
-import java.util.List;
-
-import com.metamatrix.core.MetaMatrixRuntimeException;
-import com.metamatrix.core.util.StringUtil;
-
-/**
- * Provides utility methods for manipulating the results of executing commands against a connector.
- */
-public class ConnectorResultUtility {
-    private static final String ERROR_MESSAGE_PREFIX = "CompareResults Error: "; //$NON-NLS-1$
-    private static final String NULL_STRING = "<null>"; //$NON-NLS-1$
-    private static final String COLUMN_SEPARATOR = "\t"; //$NON-NLS-1$
-    private static final String NOROWS_STRING = "No rows returned."; //$NON-NLS-1$
-
-    /**
-     * Converts a List of Lists, where each sub-list is a row of data, into a tab delimited String where each line is
-     * a row of data.  Each object is converted to a String.
-     * @param results a List of Lists of data typcially obtained by executing a command on a connector through the ConnectorHost
-     * @return the results converted to a tab delimited String
-     */
-    public static String resultsToString(List results, String[] columnNames) {
-        if (results == null || results.isEmpty()) {
-            return NOROWS_STRING;
-        }
-        StringBuffer result = new StringBuffer();
-        int columnIndex = 0;
-        for (Iterator iterator = results.iterator(); iterator.hasNext();) {
-
-            List row = (List) iterator.next();
-            boolean firstColumn = true;
-            columnIndex = 0;
-            for (Iterator j = row.iterator(); j.hasNext(); columnIndex++) {
-                Object next = j.next();
-                String value = null;
-                if (next == null) {
-                    value = NULL_STRING;
-                } else {
-                    value = next.toString();
-                    value = StringUtil.replaceAll(value, "\t", "\\t"); //$NON-NLS-1$ //$NON-NLS-2$
-                    value = StringUtil.replaceAll(value, "\n", "\\n"); //$NON-NLS-1$ //$NON-NLS-2$
-                }
-                if (firstColumn) {
-                    firstColumn = false;
-                } else {
-                    result.append(COLUMN_SEPARATOR);
-                }
-                result.append(value);
-            }
-            result.append(StringUtil.LINE_SEPARATOR);
-        }
-
-        if (columnNames == null || columnNames.length == 0) {
-            columnNames = new String[columnIndex];
-            for (int i = 0; i < columnIndex; i++) {
-                columnNames[i] = "col" + (i+1); //$NON-NLS-1$
-            }
-        }
-        StringBuffer header = new StringBuffer();
-        boolean firstValue = true;
-        for (int i=0; i < columnNames.length; i++) {
-            String label = null;
-            if (columnNames[i] == null) {
-                label = NULL_STRING;
-            } else {
-                label = columnNames[i];
-                
-                int delimiterIndex = columnNames[i].lastIndexOf('.');
-                if (delimiterIndex != -1) {
-                    label = columnNames[i].substring(delimiterIndex + 1);
-                }
-            }
-            if (firstValue) {
-                firstValue = false;
-            } else {
-                header.append(COLUMN_SEPARATOR);
-            }
-            header.append(label);
-        }
-        header.append(StringUtil.LINE_SEPARATOR);
-        return header.toString() + result.toString();
-    }
-    
-    public static String resultsToString(List results) {
-        return resultsToString(results, null);
-    }
-
-    private static int getRowCount(String text) throws IOException {
-        BufferedReader reader = new BufferedReader(new StringReader(text));
-        int rowCount = 0;
-        String line = reader.readLine();
-        while (line != null) {
-            rowCount++;
-            line = reader.readLine();
-        }
-        return rowCount;
-    }
-
-    /**
-     * Compares two sets of results to determine if they are identical.
-     * The results are in the string form provided by the resultsToString method.
-     * @param expected String form of the expected results
-     * @param actual String form of the actual results
-     * @return null if the String are identical or a description of the first difference if they are different
-     */
-    public static String compareResultsStrings(String expected, String actual) {
-        if (expected.equals(actual)) {
-            return null;
-        }
-        try {
-            BufferedReader expectedReader = new BufferedReader(new StringReader(expected));
-            BufferedReader actualReader = new BufferedReader(new StringReader(actual));
-
-            int expectedRowCount = getRowCount(expected);
-            int actualRowCount = getRowCount(actual);
-
-            if (expectedRowCount > actualRowCount) {
-                return (ERROR_MESSAGE_PREFIX + "Expected " + expectedRowCount + //$NON-NLS-1$
-                " records but received only " + actualRowCount); //$NON-NLS-1$
-            } else if (actualRowCount > expectedRowCount) {
-                // Check also for less records than expected
-                return (ERROR_MESSAGE_PREFIX + "Expected " + expectedRowCount + //$NON-NLS-1$
-                " records but received " + actualRowCount); //$NON-NLS-1$
-            }
-
-            String expectedLine = expectedReader.readLine();
-            int rowIndex = 0;
-            while (expectedLine != null) {
-                String actualLine = actualReader.readLine();
-
-                List actualRow = StringUtil.split(actualLine, COLUMN_SEPARATOR);
-                List expectedRow = StringUtil.split(expectedLine, COLUMN_SEPARATOR);
-                int actualColumnCount = actualRow.size();
-                int expectedColumnCount = expectedRow.size();
-
-                //TODO: i18n the messages
-                
-                // Get actual value
-                if (actualColumnCount != expectedColumnCount) {
-                    return("Incorrect number of columns at row = " + rowIndex + ", expected = " + expectedColumnCount + ", actual = " //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-                                                    + actualColumnCount);
-                }
-
-                // Compare sorted actual record with sorted expected record column by column
-                for (int columnIndex = 0; columnIndex < expectedColumnCount; columnIndex++) {
-                    // Get expected value
-                    Object expectedValue = expectedRow.get(columnIndex);
-                    Object actualValue = actualRow.get(columnIndex);
-
-                    // Compare these values
-                    if (expectedValue == null) {
-                        if (actualValue != null) {
-                            return getMismatchMessage(rowIndex, columnIndex, expectedValue, actualValue);
-                        }
-                    } else {
-                        if (!expectedValue.equals(actualValue)) {
-                            return getMismatchMessage(rowIndex, columnIndex, expectedValue, actualValue);
-                        }
-                    }
-                } // end loop through columns
-                expectedLine = expectedReader.readLine();
-
-                rowIndex++;
-            } // end loop through rows    }
-        } catch (IOException e) {
-            //this should not happen because the code is simply reading from Strings in memory
-            throw new MetaMatrixRuntimeException(e);
-        }
-        return null;
-    }
-
-    private static String getMismatchMessage(int rowIndex, int columnIndex, Object expectedValue, Object actualValue) {
-        return (ERROR_MESSAGE_PREFIX + "Value mismatch at row " + rowIndex //$NON-NLS-1$
-        + " and column " + columnIndex //$NON-NLS-1$
-        + ": expected = " //$NON-NLS-1$
-        + expectedValue + ", actual = " //$NON-NLS-1$
-        + actualValue);
-    }
-}

Deleted: branches/JCA/connector-sdk/src/main/java/com/metamatrix/core/commandshell/ScriptCommandTarget.java
===================================================================
--- branches/JCA/connector-sdk/src/main/java/com/metamatrix/core/commandshell/ScriptCommandTarget.java	2010-03-04 01:32:54 UTC (rev 1896)
+++ branches/JCA/connector-sdk/src/main/java/com/metamatrix/core/commandshell/ScriptCommandTarget.java	2010-03-04 01:56:20 UTC (rev 1897)
@@ -1,162 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.core.commandshell;
-
-import java.util.Arrays;
-import java.util.List;
-
-import com.metamatrix.core.CorePlugin;
-import com.metamatrix.core.util.StringUtil;
-
-/**
- * Base command target class with scripting support.
- */
-public class ScriptCommandTarget extends CommandTarget implements StringUtil.Constants {
-    protected static final String TEST_PREFIX = "test"; //$NON-NLS-1$
-
-    protected int testFailureCount = 0;
-
-    protected int testCount = 0;
-
-    private ScriptFileNameStack scriptFileNames = new ScriptFileNameStack();
-    
-    private boolean runningSetUp = false;
-    
-    public void setScriptFile(String scriptFileName) {
-        scriptFileNames.setDefaultScriptFileName(scriptFileName);
-    }
-
-    protected static final String SETUP_SCRIPT = "setUp"; //$NON-NLS-1$
-
-    protected boolean hasSetupScript(String fileName) {
-        String[] scriptNames = shell.getScriptNames(fileName);
-        List scriptNameList = Arrays.asList(scriptNames);
-        return scriptNameList.contains(SETUP_SCRIPT);
-    }
-
-    protected StringBuffer testFailureMessage;
-
-    protected void runningScript(String fileName) {
-        scriptFileNames.usingScriptFile(fileName);
-    }
-        
-    public String run(String scriptName) {
-        if (scriptFileNames.hasDefaultScriptFileBeenSet()) {
-            return runScriptDirect(scriptFileNames.getUnexpandedCurrentScriptFileName(), scriptName);
-        }
-        throw new NoScriptFileException();
-    }
-
-    public String runScript(String fileName, String scriptName) {
-        return runScriptDirect( fileName, scriptName );
-    }
-
-    private String runScriptDirect(String originalFileName, String scriptName) {
-        String fileName = scriptFileNames.expandScriptFileName(originalFileName);
-        testFailureMessage = new StringBuffer();
-        if (!runningSetUp) {
-            if (hasSetupScript(fileName)) {
-                try {
-                    runningSetUp = true;
-                    runScript(fileName, SETUP_SCRIPT, null, null); 
-                } finally {
-                    runningSetUp = false;
-                }
-            }
-        }
-        runScript(fileName, scriptName, null, getScriptResultListener());
-        return testFailureMessage.toString();
-    }
-
-    void runScript(String fileName, String scriptName, StringBuffer transcript, ScriptResultListener listener) {
-        scriptFileNames.startingScriptFromFile(fileName);
-        try {
-            shell.runScript(fileName, scriptName, transcript, listener);
-        } finally {
-            scriptFileNames.finishedScript();
-        }
-    }
-
-    private ScriptResultListener getScriptResultListener() {
-        return new ScriptResultListener() {
-            public void scriptResults(String scriptFileName, String scriptName, String expected, String actual) {
-                ScriptCommandTarget.this.scriptResults(scriptFileName, scriptName, expected, actual);
-            }
-        };
-    }
-
-    private void scriptResults(String scriptFileName, String scriptName, String expected, String actual) {
-        if(expected.equals(actual)) {
-        } else {
-            testFailureCount++;
-            String diffString = ConnectorResultUtility.compareResultsStrings(expected, actual);
-            testFailureMessage.append(CorePlugin.Util.getString("ScriptCommandTarget.Test_{0}.{1}_failed.{2}_2", new Object[] {scriptFileName, scriptName, diffString}) ); //$NON-NLS-1$
-            testFailureMessage.append(NEW_LINE);
-        }
-    }
-
-    protected void resetTestStatistics() {
-        testCount = 0;
-        testFailureCount = 0;
-        testFailureMessage = new StringBuffer();
-    }
-
-    public String runAll() {
-        resetTestStatistics();
-        String fileName = scriptFileNames.expandScriptFileName(scriptFileNames.getUnexpandedCurrentScriptFileName());
-        String[] scriptNames = shell.getScriptNames( fileName );
-        boolean runSetup = hasSetupScript( fileName );
-        for (int i=0; i<scriptNames.length; i++) {
-            if (scriptNames[i].startsWith(TEST_PREFIX)){
-                testCount++;
-                if (runSetup) {
-                    runScript(fileName, SETUP_SCRIPT, null, null); 
-                    runSetup = false;
-                }
-                runScript(fileName, scriptNames[i], null, getScriptResultListener());
-            }
-        }   
-        return getTestSummary();
-    }
-
-    protected String getTestSummary() {
-        return testFailureMessage.toString() + CorePlugin.Util.getString("ScriptCommandTarget.Tests_run__{0}_test_failures__{1}_1", new Object[] {new Integer(testCount), new Integer(testFailureCount)}); //$NON-NLS-1$
-    }
-
-    public void runRep(int repCount, String scriptName) {
-        for (int i=0; i<repCount; i++) {
-            run(scriptName);
-        }
-    }
-
-    public void setSilent(boolean silent) {
-        shell.setSilent(silent);
-    }
-    
-    protected Object clone() throws CloneNotSupportedException {
-        ScriptCommandTarget result = (ScriptCommandTarget) super.clone();
-        result.scriptFileNames = (ScriptFileNameStack) scriptFileNames.clone();
-        return result;
-    } 
-        
-}

Deleted: branches/JCA/connector-sdk/src/main/java/com/metamatrix/core/commandshell/ScriptFileNameStack.java
===================================================================
--- branches/JCA/connector-sdk/src/main/java/com/metamatrix/core/commandshell/ScriptFileNameStack.java	2010-03-04 01:32:54 UTC (rev 1896)
+++ branches/JCA/connector-sdk/src/main/java/com/metamatrix/core/commandshell/ScriptFileNameStack.java	2010-03-04 01:56:20 UTC (rev 1897)
@@ -1,143 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.core.commandshell;
-
-import java.io.File;
-import java.util.Stack;
-
-/**
- * Keeps track of script file names and script directories as scripts are run.
- * Knows how to interpret relative file names in the context of other file names.
- */
-class ScriptFileNameStack implements Cloneable {
-    private String defaultScriptFileName;
-
-    private Stack executingScriptFileName = new Stack();
-
-    /**
-     * @param scriptFileName The default script file name to use when none is specified and when no scripts are executing.
-     */
-    public void setDefaultScriptFileName(String scriptFileName) {
-        log("setDefaultScriptFileName", scriptFileName); //$NON-NLS-1$
-        defaultScriptFileName = scriptFileName;
-    }
-    
-
-    /**
-     * Record that a script file name is being used.  This will become the default if no default has been set.
-     * @param scriptFileName
-     */
-    public void usingScriptFile(String scriptFileName) {
-        log("usingScriptFile", scriptFileName); //$NON-NLS-1$
-        if (!hasDefaultScriptFileBeenSet()) {
-            setDefaultScriptFileName(scriptFileName);
-        }
-    }
-    
-    private void log(String method, String value) {
-        //System.out.println("ScriptFileNames." + method + ": " + value);
-    }
-
-    /**
-     * Expands relative file names to include path information from currently running file names.
-     * @param scriptFileName
-     * @return
-     */
-    public String expandScriptFileName(String scriptFileName) {
-        log("expandScriptFileName", scriptFileName); //$NON-NLS-1$
-        String result = scriptFileName;
-        String parent = getParent();
-        if (isAbsolute(scriptFileName) || parent == null) {
-        } else {
-            result = parent + File.separator + scriptFileName;
-        }
-        log("expandScriptFileName", "result=" + result); //$NON-NLS-1$ //$NON-NLS-2$
-        return result;
-    }
-   
-    private String getParent() {
-        String parent = null;
-        if (!executingScriptFileName.isEmpty()) {
-            parent = new File(peek()).getParent();
-        }
-        return parent;
-    }
-   
-
-    public boolean hasDefaultScriptFileBeenSet() {
-        return defaultScriptFileName != null;
-    }
-
-    private String peek() {
-        return (String) executingScriptFileName.peek();
-    }
-    
-    private boolean isAbsolute(String fileName) {
-        File file = new File(fileName);
-        return file.isAbsolute() || fileName.startsWith("\\") || fileName.startsWith("/"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    /**
-     * Retrieves the default script file name.
-     * If a script is currently executing this will return the name of the current executing script file rather than the default.
-     * @return
-     */
-    public String getUnexpandedCurrentScriptFileName() {
-        String result = getCurrentScriptFileNameDirect();
-        log("getCurrentScriptFileName", result); //$NON-NLS-1$
-        return result;
-    }
-
-    private String getCurrentScriptFileNameDirect() {
-        if (executingScriptFileName.isEmpty()) {
-            return defaultScriptFileName;
-        }
-        return new File(peek()).getName();
-    }
-
-    /**
-     * Indicate that a script is about to be executed from the given file.
-     * This must be called in order to maintain the stack tracking the current script file.
-     * @param fileName
-     */
-    public void startingScriptFromFile(String fileName) {
-        log("startingScriptFromFile", fileName); //$NON-NLS-1$
-        executingScriptFileName.push(fileName);
-    }
-    
-    /**
-     * Indicate that a script has completed execution.
-     * This must be called in order to maintain the stack tracking the current script file.
-     */
-    public void finishedScript() {
-        log("finishedScript", ""); //$NON-NLS-1$ //$NON-NLS-2$
-        executingScriptFileName.pop();
-    }
-    
-    protected Object clone() throws CloneNotSupportedException {
-        ScriptFileNameStack result = (ScriptFileNameStack) super.clone();
-        executingScriptFileName = (Stack) executingScriptFileName.clone();        
-        return result;
-    } 
-
-}

Modified: branches/JCA/connector-sdk/src/test/java/com/metamatrix/core/commandshell/TestCommand.java
===================================================================
--- branches/JCA/connector-sdk/src/test/java/com/metamatrix/core/commandshell/TestCommand.java	2010-03-04 01:32:54 UTC (rev 1896)
+++ branches/JCA/connector-sdk/src/test/java/com/metamatrix/core/commandshell/TestCommand.java	2010-03-04 01:56:20 UTC (rev 1897)
@@ -22,26 +22,14 @@
 
 package com.metamatrix.core.commandshell;
 
-import java.util.TimeZone;
 import junit.framework.TestCase;
 
-import com.metamatrix.common.util.TimestampWithTimezone;
-import com.metamatrix.core.util.UnitTestUtil;
-
 public class TestCommand extends TestCase {
 
     public TestCommand(String name) {
         super(name);
     }
 
-	public void setUp() {
-		TimestampWithTimezone.resetCalendar(TimeZone.getTimeZone("GMT-06:00")); //$NON-NLS-1$
-	}
-
-	public void tearDown() {
-		TimestampWithTimezone.resetCalendar(null);
-	}
-
     public void test() throws Exception {
         FakeCommandTarget target = new FakeCommandTarget();
         String commandName = "getLatest"; //$NON-NLS-1$
@@ -60,15 +48,6 @@
         assertEquals("getLatest samplePath", target.getTrace()); //$NON-NLS-1$
     }
 
-    public void testArgConversion() throws Exception {
-        FakeCommandTarget target = new FakeCommandTarget();
-        String commandName = "checkin"; //$NON-NLS-1$
-        String[] args = new String[] { "samplePath", UnitTestUtil.getTestDataPath() + "/fakeFile", "2003-10-01:00:00:00" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-        Command command = new Command(target, commandName, args);
-        command.execute();
-        assertEquals("checkin samplePath <data> Wed Oct 01 00:00:00 GMT-06:00 2003", target.getTrace()); //$NON-NLS-1$
-    }
-
     public void testArgConversionStringArray() throws Exception {
         FakeCommandTarget target = new FakeCommandTarget();
         String commandName = "method0"; //$NON-NLS-1$
@@ -95,14 +74,6 @@
         assertEquals("getLatest samplePath", target.getTrace()); //$NON-NLS-1$
     }
 
-    public void testCommandParsingDates() throws Exception {
-        FakeCommandTarget target = new FakeCommandTarget();
-        String commandLine = "checkin samplePath " + UnitTestUtil.getTestDataPath() + "/fakeFile \"2003-10-01:00:00:00\""; //$NON-NLS-1$ //$NON-NLS-2$
-        Command command = new Command(target, commandLine);
-        command.execute();
-        assertEquals("checkin samplePath <data> Wed Oct 01 00:00:00 GMT-06:00 2003", target.getTrace()); //$NON-NLS-1$
-    }
-
     public void testComment() throws Exception {
         FakeCommandTarget target = new FakeCommandTarget();
         String commandLine = "//command"; //$NON-NLS-1$

Deleted: branches/JCA/connector-sdk/src/test/java/com/metamatrix/core/commandshell/TestScriptFileNameStack.java
===================================================================
--- branches/JCA/connector-sdk/src/test/java/com/metamatrix/core/commandshell/TestScriptFileNameStack.java	2010-03-04 01:32:54 UTC (rev 1896)
+++ branches/JCA/connector-sdk/src/test/java/com/metamatrix/core/commandshell/TestScriptFileNameStack.java	2010-03-04 01:56:20 UTC (rev 1897)
@@ -1,184 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.core.commandshell;
-
-import java.io.File;
-import junit.framework.TestCase;
-
-public class TestScriptFileNameStack extends TestCase {
-    ScriptFileNameStack names = new ScriptFileNameStack();
-
-    public void testCurrentDefaultSetRelativeDirectory() {
-        names.setDefaultScriptFileName("a"+File.separator+"b"+File.separator+"c"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-        assertEquals("a" + File.separator + "b" + File.separator + "c", names.getUnexpandedCurrentScriptFileName()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testCurrentDefaultSetAbsoluteDirectory() {
-        names.setDefaultScriptFileName(File.separator+"a"+File.separator+"b"+File.separator+"c"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-        assertEquals(File.separator + "a" + File.separator + "b" + File.separator + "c", names.getUnexpandedCurrentScriptFileName()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    ////
-
-    public void testCurrentDefaultWithExecutingScript() {
-        names.setDefaultScriptFileName("a"+File.separator+"b"+File.separator+"c"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-        names.startingScriptFromFile("d"); //$NON-NLS-1$
-        assertEquals("d", names.getUnexpandedCurrentScriptFileName()); //$NON-NLS-1$
-    }
-
-    public void testCurrentDefaultSetWithExecutingScript() {
-        names.setDefaultScriptFileName(File.separator+"a"+File.separator+"b"+File.separator+"c"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-        names.startingScriptFromFile("d"); //$NON-NLS-1$
-        assertEquals("d", names.getUnexpandedCurrentScriptFileName()); //$NON-NLS-1$
-    }
-
-    public void testCurrentDefaultWithExecutingRelativeScript() {
-        names.setDefaultScriptFileName("a"+File.separator+"b"+File.separator+"c"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-        names.startingScriptFromFile("d"+File.separator+"e"); //$NON-NLS-1$ //$NON-NLS-2$
-        assertEquals("e", names.getUnexpandedCurrentScriptFileName()); //$NON-NLS-1$
-    }
-
-    public void testCurrentDefaultSetWithExecutingAbsoluteScript() {
-        names.setDefaultScriptFileName(File.separator+"a"+File.separator+"b"+File.separator+"c"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-        names.startingScriptFromFile(File.separator+"d"+File.separator+"e"); //$NON-NLS-1$ //$NON-NLS-2$
-        assertEquals("e", names.getUnexpandedCurrentScriptFileName()); //$NON-NLS-1$
-    }
-
-    ////
-
-    public void testExpandWithExecutingScript() {
-        names.setDefaultScriptFileName("a"+File.separator+"b"+File.separator+"c"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-        names.startingScriptFromFile("d"); //$NON-NLS-1$
-        assertEquals("e", names.expandScriptFileName("e")); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testExpandWithExecutingScript2() {
-        names.setDefaultScriptFileName(File.separator+"a"+File.separator+"b"+File.separator+"c"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-        names.startingScriptFromFile("d"); //$NON-NLS-1$
-        assertEquals("e", names.expandScriptFileName("e")); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testExpandWithExecutingRelativeScript() {
-        names.setDefaultScriptFileName("a"+File.separator+"b"+File.separator+"c"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-        names.startingScriptFromFile("d"+File.separator+"e"); //$NON-NLS-1$ //$NON-NLS-2$
-        assertEquals("d" + File.separator + "f", names.expandScriptFileName("f")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testExpandWithExecutingAbsoluteScript() {
-        names.setDefaultScriptFileName(File.separator+"a"+File.separator+"b"+File.separator+"c"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-        names.startingScriptFromFile(File.separator+"d"+File.separator+"e"); //$NON-NLS-1$ //$NON-NLS-2$
-        assertEquals(File.separator + "d" + File.separator + "f", names.expandScriptFileName("f")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testExpandWithExecutingBaseScript() {
-        names.setDefaultScriptFileName("a"+File.separator+"b"+File.separator+"c"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-        names.startingScriptFromFile("d"+File.separator+"e"); //$NON-NLS-1$ //$NON-NLS-2$
-        assertEquals("d" + File.separator + "f", names.expandScriptFileName("f")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testExpandWithExecutingScriptStack() {
-        names.setDefaultScriptFileName("a"+File.separator+"b"+File.separator+"c"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-        names.startingScriptFromFile("d"+File.separator+"e"); //$NON-NLS-1$ //$NON-NLS-2$
-        names.startingScriptFromFile("f"+File.separator+"g"); //$NON-NLS-1$ //$NON-NLS-2$
-        assertEquals("f" + File.separator + "h", names.expandScriptFileName("h")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testExpandWithExecutingScriptStackExpand() {
-        names.setDefaultScriptFileName("a"+File.separator+"b"+File.separator+"c"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-        names.startingScriptFromFile(names.expandScriptFileName("d"+File.separator+"e")); //$NON-NLS-1$ //$NON-NLS-2$
-        names.startingScriptFromFile(names.expandScriptFileName("f"+File.separator+"g")); //$NON-NLS-1$ //$NON-NLS-2$
-        assertEquals("d" + File.separator + "f" + File.separator + "h", names.expandScriptFileName("h")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-    }
-
-    public void testExpandWithExecutingScriptStackExpand2() {
-        names.setDefaultScriptFileName("a"+File.separator+"b"+File.separator+"c"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-        names.startingScriptFromFile(names.expandScriptFileName("a"+File.separator+"b"+File.separator+"c")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-        names.startingScriptFromFile(names.expandScriptFileName("d"+File.separator+"e")); //$NON-NLS-1$ //$NON-NLS-2$
-        names.startingScriptFromFile(names.expandScriptFileName("f"+File.separator+"g")); //$NON-NLS-1$ //$NON-NLS-2$
-        assertEquals("a" + File.separator + "b" + File.separator + "d" + File.separator + "f" + File.separator + "h", names.expandScriptFileName("h")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
-    }
-
-    public void testExpandWithExecutingScriptStackRelative() {
-        names.setDefaultScriptFileName("a"+File.separator+"b"+File.separator+"c"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-        names.startingScriptFromFile("d"+File.separator+"e"); //$NON-NLS-1$ //$NON-NLS-2$
-        names.startingScriptFromFile("d"+File.separator+"f"+File.separator+"g"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-        assertEquals("d" + File.separator + "f" + File.separator + "h", names.expandScriptFileName("h")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-    }
-
-    ////
-
-    public void testExpandFromRelativeDirectory() {
-        names.setDefaultScriptFileName("a"+File.separator+"b"+File.separator+"c"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-        assertEquals("d", names.expandScriptFileName("d")); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testExpandFromAbsoluteDirectory() {
-        names.setDefaultScriptFileName(File.separator+"a"+File.separator+"b"+File.separator+"c"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-        assertEquals("d", names.expandScriptFileName("d")); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testExpandWithoutReferencesingBaseDirectoryAbsolute() {
-        names.setDefaultScriptFileName(File.separator+"a"+File.separator+"b"+File.separator+"c"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-        assertEquals(File.separator + "d" + File.separator + "e", names.expandScriptFileName(File.separator + "d" + File.separator + "e")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-    }
-
-    public void testExpandWithoutReferencesingBaseDirectoryRelative() {
-        names.setDefaultScriptFileName(File.separator+"a"+File.separator+"b"+File.separator+"c"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-        assertEquals("d" + File.separator + "e", names.expandScriptFileName("d" + File.separator + "e")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-    }
-
-    public void testHasBaseDefaultBeenSet() {
-        assertFalse(names.hasDefaultScriptFileBeenSet());
-        names.setDefaultScriptFileName("a"); //$NON-NLS-1$
-        assertTrue(names.hasDefaultScriptFileBeenSet());
-    }
-
-    public void testSettingDefaultByUsing() {
-        names.usingScriptFile("a"); //$NON-NLS-1$
-        assertTrue(names.hasDefaultScriptFileBeenSet());
-    }
-
-    public void testUsingIgnoredAfterSetDefaultCalled() {
-        names.setDefaultScriptFileName("a"); //$NON-NLS-1$
-        names.usingScriptFile("b"); //$NON-NLS-1$
-        assertEquals("a", names.getUnexpandedCurrentScriptFileName()); //$NON-NLS-1$
-    }
-
-    public void testExecutingScriptAsStack() {
-        names.setDefaultScriptFileName(File.separator+"a"+File.separator+"b"+File.separator+"c"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-        names.startingScriptFromFile(File.separator+"d"+File.separator+"e"); //$NON-NLS-1$ //$NON-NLS-2$
-        names.startingScriptFromFile(File.separator+"f"+File.separator+"g"); //$NON-NLS-1$ //$NON-NLS-2$
-        names.startingScriptFromFile(File.separator+"h"+File.separator+"i"); //$NON-NLS-1$ //$NON-NLS-2$
-        names.finishedScript();
-        assertEquals("g", names.getUnexpandedCurrentScriptFileName()); //$NON-NLS-1$
-    }
-
-    public void testClone() throws CloneNotSupportedException {
-        names.startingScriptFromFile("a"); //$NON-NLS-1$
-        names.startingScriptFromFile("b"); //$NON-NLS-1$
-        ScriptFileNameStack names2 = (ScriptFileNameStack) names.clone();
-        names.finishedScript();
-        assertEquals("b", names2.getUnexpandedCurrentScriptFileName()); //$NON-NLS-1$
-    }
-
-}

Modified: branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/impl/FileStorageManager.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/impl/FileStorageManager.java	2010-03-04 01:32:54 UTC (rev 1896)
+++ branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/impl/FileStorageManager.java	2010-03-04 01:56:20 UTC (rev 1897)
@@ -44,7 +44,8 @@
  * Implements file storage that automatically splits large files and limits the number of open files.
  */
 public class FileStorageManager implements StorageManager {
-	    
+	
+    private static final int DEFAULT_MAX_OPEN_FILES = 128;
 	private static final String FILE_PREFIX = "b_"; //$NON-NLS-1$
 	
 	private class FileInfo {
@@ -151,7 +152,7 @@
 	}
 
     // Initialization
-    private int maxOpenFiles = 32;
+    private int maxOpenFiles = DEFAULT_MAX_OPEN_FILES;
     private long maxFileSize = 2L * 1024L * 1024L * 1024L; // 2GB
     private String directory;
     private File dirFile;
@@ -173,11 +174,7 @@
     });
     
     /**
-     * Initialize with properties
-     * @param props Initialization properties
-     * @see com.metamatrix.common.buffer.BufferManager#BUFFER_STORAGE_DIRECTORY
-     * @see com.metamatrix.common.buffer.BufferManager#MAX_OPEN_FILES
-     * @see com.metamatrix.common.buffer.BufferManager#MAX_FILE_SIZE
+     * Initialize
      */
     public void initialize() throws MetaMatrixComponentException {
         if(this.directory == null) {

Deleted: branches/JCA/test-integration/common/src/test/java/com/metamatrix/cdk/TestConnectorShell.java
===================================================================
--- branches/JCA/test-integration/common/src/test/java/com/metamatrix/cdk/TestConnectorShell.java	2010-03-04 01:32:54 UTC (rev 1896)
+++ branches/JCA/test-integration/common/src/test/java/com/metamatrix/cdk/TestConnectorShell.java	2010-03-04 01:56:20 UTC (rev 1897)
@@ -1,265 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.cdk;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-
-import com.metamatrix.core.commandshell.CommandShell;
-import com.metamatrix.core.commandshell.CommandShellTest;
-import com.metamatrix.core.util.StringUtil;
-import com.metamatrix.core.util.UnitTestUtil;
-
-public class TestConnectorShell extends CommandShellTest {
-    private ConnectorShell connectorShell;
-    private ConnectorShellCommandTarget commandTarget;
-    
-    public TestConnectorShell(String name) {
-        super(name);
-    }
-
-    /* 
-     * @see junit.framework.TestCase#setUp()
-     */
-    protected void setUp() throws Exception {
-        super.setUp();
-        commandTarget = new ConnectorShellCommandTarget();
-        connectorShell = new ConnectorShell(commandTarget);
-        connectorShell.setSilent(true);
-        connectorShell.setPrintStackTraceOnException(false);
-        connectorShell.setDefaultFilePath(UnitTestUtil.getTestDataPath() + File.separator); 
-    }
-
-    public void testLoad() {
-        String result = loadLoopBackConnector();
-        assertNull(result);
-    }
-    
-    private String loadLoopBackConnector() {
-        return connectorShell.execute("load com.metamatrix.connector.loopback.LoopbackConnector partssupplier/PartsSupplier.vdb"); //$NON-NLS-1$  
-    }
-    
-    private void start() {
-        connectorShell.execute("start"); //$NON-NLS-1$
-    }
-    
-    public void testSelect() {
-        loadLoopBackConnector();
-        start();
-        String result = connectorShell.execute("select * from partssupplier.partssupplier.parts;"); //$NON-NLS-1$
-        assertEquals("PART_ID\tPART_NAME\tPART_COLOR\tPART_WEIGHT" + StringUtil.LINE_SEPARATOR + "ABCDEFGHIJ\tABCDEFGHIJ\tABCDEFGHIJ\tABCDEFGHIJ" + StringUtil.LINE_SEPARATOR, result); //$NON-NLS-1$  //$NON-NLS-2$
-    }
-    
-    
-    public void testRun() {
-        loadLoopBackConnector();
-        start();
-        setScriptFile();
-        connectorShell.turnOffExceptionHandling();
-        String result = connectorShell.execute("run test1"); //$NON-NLS-1$
-        assertEquals("Test " + UnitTestUtil.getTestDataPath() + File.separator + "script.txt.test1 failed.  CompareResults Error: Expected 1 records but received 2\n", result); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    private void setScriptFile() {
-        setScriptFile( "script.txt" ); //$NON-NLS-1$
-    }
-    
-    private void setScriptFile(String fileName) {
-        connectorShell.execute("setScriptFile " + UnitTestUtil.getTestDataPath() + File.separator + fileName); //$NON-NLS-1$ 
-    }
-    
-    public void testCallingScriptFromAnotherScriptFile() {
-        commandTarget.setFailOnError(true);
-        connectorShell.execute( "setscriptfile " + UnitTestUtil.getTestDataPath() + File.separator + "/cdk/s1.txt" ); //$NON-NLS-1$ //$NON-NLS-2$
-        
-        assertEquals( "", connectorShell.execute( "s3" ) ); //$NON-NLS-1$ //$NON-NLS-2$
-        assertEquals( "", connectorShell.execute( "s1" ) ); //$NON-NLS-1$ //$NON-NLS-2$
-        connectorShell.execute( "s4" ); //$NON-NLS-1$
-        connectorShell.execute( "s2" ); //$NON-NLS-1$
-    }
-    
-    public void testCallingScriptFromAnotherScriptFileThatCallsAScript() {
-        commandTarget.setFailOnError(true);
-        connectorShell.setDefaultFilePath(""); //$NON-NLS-1$
-        connectorShell.execute( "setscriptfile " + UnitTestUtil.getTestDataPath() + File.separator + "/cdk/s3.txt" ); //$NON-NLS-1$ //$NON-NLS-2$
-        
-        assertEquals( "", connectorShell.execute( "s3_3" ) ); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-    
-    public void testRunAllTests() {
-        loadLoopBackConnector();
-        start();
-        setScriptFile();
-        String result = connectorShell.execute("runAll"); //$NON-NLS-1$
-        assertEquals("Test " + UnitTestUtil.getTestDataPath() + File.separator + "script.txt.test1 failed.  CompareResults Error: Expected 1 records but received 2\nTest " + UnitTestUtil.getTestDataPath() + File.separator +"script.txt.testBadData failed.  CompareResults Error: Value mismatch at row 1 and column 2: expected = XX, actual = ABCDEFGHIJ\nTests run: 14 test failures: 2", result); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-    
-    public void testSetProperty() {
-        connectorShell.setDefaultFilePath(UnitTestUtil.getTestDataPath() + File.separator); 
-        setScriptFile();
-        String result = connectorShell.execute("run testSetProperty"); //$NON-NLS-1$
-        assertEquals("", result); //$NON-NLS-1$ 
-    }
-    
-    public void testSetPropertyAfterConnectorHostStart() {
-        connectorShell.setDefaultFilePath(UnitTestUtil.getTestDataPath() + File.separator); 
-        setScriptFile();
-        start();
-        String result = connectorShell.execute("run testSetPropertyAfterConnectorHostStart"); //$NON-NLS-1$
-        assertEquals("", result); //$NON-NLS-1$ 
-    }
-    
-    public void testLoadingClearsProperties() {
-        connectorShell.setDefaultFilePath(UnitTestUtil.getTestDataPath() + File.separator); 
-        setScriptFile();
-        String result = connectorShell.execute("run testLoadingClearsProperties"); //$NON-NLS-1$
-        assertEquals("", result); //$NON-NLS-1$ 
-    }
-    
-    public void testRunAllTestsWithoutSetup() {
-        loadLoopBackConnector();
-        start();
-        setScriptFile("scriptWithoutSetup.txt"); //$NON-NLS-1$
-        String result = connectorShell.execute("runAll"); //$NON-NLS-1$
-        assertEquals("Test " + UnitTestUtil.getTestDataPath() + File.separator + "scriptWithoutSetup.txt.test1 failed.  CompareResults Error: Expected 1 records but received 2\nTests run: 3 test failures: 1", result); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-    
-    public void testCaseInsensitiveCommands() {
-        loadLoopBackConnector();
-        setScriptFile();
-        String result = connectorShell.execute("run testCaseInsensitiveCommands"); //$NON-NLS-1$
-        assertEquals("", result); //$NON-NLS-1$
-    }
-    
-    public void testInvokingAsCommandLine() {
-        new ConnectorShell(new ConnectorShellCommandTarget()).run(new String[] {"quit"}, UnitTestUtil.getTestScratchPath() + "/connector_shell.log"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-    
-    
-    /* 
-     * @see com.metamatrix.core.commandshell.CommandShellTest#getCommandShell()
-     */
-    protected CommandShell getCommandShell() {
-        return connectorShell;
-    }
-    
-    public void testLoadArchive() {
-        runTest("testLoadArchive"); //$NON-NLS-1$
-    }
-
-    public void testCreateArchive() {        
-        File f = UnitTestUtil.getTestScratchFile("foo.caf");
-        f.delete();
-        connectorShell.execute("createArchive "+UnitTestUtil.getTestScratchPath()+"/foo.caf "+UnitTestUtil.getTestDataPath()+"/sample/sample2.cdk "+UnitTestUtil.getTestDataPath()+"/sample");
-        assertTrue("failed to create archive file", f.exists());
-    }
-    
-    public void testHelp() {
-        runTest("testHelp"); //$NON-NLS-1$
-    }
-
-    public void testNotLoadingConnector() {
-        runTest("testNotLoadingConnector"); //$NON-NLS-1$
-    }     
-
-    public void testStart() {
-        loadLoopBackConnector();
-        connectorShell.execute("start"); //$NON-NLS-1$
-    }
-    
-    public void testStop() {
-        loadLoopBackConnector();
-        start();
-        connectorShell.execute("stop"); //$NON-NLS-1$
-    }
-    
-    public void testLoadXMLProperties() {
-        loadLoopBackConnector();
-        connectorShell.execute("loadProperties " + UnitTestUtil.getTestDataPath() + File.separator+ "properties.cdk"); //$NON-NLS-1$ //$NON-NLS-2$
-        start();
-        String loadedProperties = connectorShell.execute("getProperties"); //$NON-NLS-1$
-        String expected = new StringBuffer("property1=PropVal1") //$NON-NLS-1$
-                            .append(StringUtil.LINE_SEPARATOR)
-                            .append("property2=PropVal2") //$NON-NLS-1$
-                            .append(StringUtil.LINE_SEPARATOR)
-                            .append("property3=com.metamatrix.cdk.propertyVal") //$NON-NLS-1$
-                            .append(StringUtil.LINE_SEPARATOR)
-                            .toString();
-        assertEquals(expected, loadedProperties);
-    }
-    
-    public void testLoadPropertiesFromPropertiesFile() {
-        loadLoopBackConnector();
-        connectorShell.execute("loadProperties " + UnitTestUtil.getTestDataPath() + File.separator+ "/cdk/connector.properties"); //$NON-NLS-1$ //$NON-NLS-2$
-        start();
-        String loadedProperties = connectorShell.execute("getProperties"); //$NON-NLS-1$
-        assertNotNull(loadedProperties);
-        String expected = new StringBuffer("property1=PropVal1") //$NON-NLS-1$
-                            .append(StringUtil.LINE_SEPARATOR)
-                            .append("property2=PropVal2") //$NON-NLS-1$
-                            .append(StringUtil.LINE_SEPARATOR)
-                            .append("property3=com.metamatrix.cdk.propertyVal") //$NON-NLS-1$
-                            .append(StringUtil.LINE_SEPARATOR)
-                            .toString();
-        assertEquals(expected, loadedProperties);
-    }
-    
-    
-    public void testCreateTemplateFileDoesNotExistNoPath() throws FileNotFoundException, IOException {
-        //Create a template file.  The file does not exist yet.  The filename does not include a path.
-        runTemplateTestAndDeleteFile("testTemplate1");  //$NON-NLS-1$
-    }
-    
-    public void testCreateTemplateFileDoesNotExist() throws FileNotFoundException, IOException {
-        //Create a template file.  The file does not exist yet.  The filename does not include a path.
-        runTemplateTestAndDeleteFile("testTemplate2");  //$NON-NLS-1$
-    }
-    
-    private void runTemplateTestAndDeleteFile(String fileName) throws FileNotFoundException, IOException {
-    	fileName = UnitTestUtil.getTestScratchPath() + File.separator + fileName;
-        new File(fileName).delete();
-        runTemplateTest(fileName);
-    }
-    
-    private void runTemplateTest(String tempFileName) throws FileNotFoundException, IOException {
-        connectorShell.execute("setFailOnError true");  //$NON-NLS-1$
-        connectorShell.execute("createTemplate " + tempFileName); //$NON-NLS-1$
-
-        FileInputStream template = new FileInputStream(new File(tempFileName));
-        InputStream original = getClass().getResourceAsStream("Template.cdk"); //$NON-NLS-1$
-        int originalByte= 0, tempByte = 0;
-        int bytesCompared = 0;
-        while((originalByte = original.read()) != -1 && (tempByte = template.read()) != -1) {            
-            assertEquals(originalByte, tempByte);
-            bytesCompared++;
-        }
-        assertTrue(bytesCompared>0);
-        // Ensure that the end of the master template has been reached        
-        assertEquals(-1, originalByte);
-        template.close();
-        original.close();
-    }
-}

Deleted: branches/JCA/test-integration/common/src/test/java/com/metamatrix/cdk/api/TestConnectorResultUtility.java
===================================================================
--- branches/JCA/test-integration/common/src/test/java/com/metamatrix/cdk/api/TestConnectorResultUtility.java	2010-03-04 01:32:54 UTC (rev 1896)
+++ branches/JCA/test-integration/common/src/test/java/com/metamatrix/cdk/api/TestConnectorResultUtility.java	2010-03-04 01:56:20 UTC (rev 1897)
@@ -1,191 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.cdk.api;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import junit.framework.TestCase;
-
-import com.metamatrix.core.commandshell.ConnectorResultUtility;
-import com.metamatrix.core.util.StringUtil;
-
-public class TestConnectorResultUtility extends TestCase {
-    List bob1;
-    List bob2;
-    List jim1;
-    List bobShort;
-    List bobMultiLineWithTabs;
-    
-    List nullList;
-    
-    List results1;
-    List results2;
-    
-    public TestConnectorResultUtility(String name) {
-        super(name);
-    }
-    
-    public void testSame() {  
-        results1.add(bob1);
-        results1.add(jim1);
-        
-        results2.add(bob1);
-        results2.add(jim1);
-
-        String expected = ConnectorResultUtility.resultsToString(results1);
-        String actual = ConnectorResultUtility.resultsToString(results2);        
-        String result = ConnectorResultUtility.compareResultsStrings(expected, actual);
-        assertNull(result);
-    }
-    
-    public void testDifferent() {
-        results1.add(bob1);
-        results1.add(jim1);
-
-        results2.add(bob2);
-        results2.add(jim1);
-
-        String expected = ConnectorResultUtility.resultsToString(results1);
-        String actual = ConnectorResultUtility.resultsToString(results2);
-        String result = ConnectorResultUtility.compareResultsStrings(expected, actual);
-        assertEquals("CompareResults Error: Value mismatch at row 1 and column 1: expected = 45, actual = 25", result); //$NON-NLS-1$
-    }
-    
-    public void testTooFewRows() {  
-        results1.add(bob1);
-        results1.add(jim1);
-
-        results2.add(bob1);
-
-        String expected = ConnectorResultUtility.resultsToString(results1);
-        String actual = ConnectorResultUtility.resultsToString(results2);        
-        String result = ConnectorResultUtility.compareResultsStrings(expected, actual);
-        assertEquals("CompareResults Error: Expected 3 records but received only 2", result); //$NON-NLS-1$
-    }
-
-    public void testTooManyRows() {  
-        results1.add(bob1);
-
-        results2.add(bob1);
-        results2.add(jim1);
-
-        String expected = ConnectorResultUtility.resultsToString(results1);
-        String actual = ConnectorResultUtility.resultsToString(results2);        
-        String result = ConnectorResultUtility.compareResultsStrings(expected, actual);
-        assertEquals("CompareResults Error: Expected 2 records but received 3", result); //$NON-NLS-1$
-    }
-
-    public void testNullColumns() {  
-        results1.add(bob1);
-
-        results2.add(nullList);
-
-        String expected = ConnectorResultUtility.resultsToString(results1);
-        String actual = ConnectorResultUtility.resultsToString(results2);        
-        String result = ConnectorResultUtility.compareResultsStrings(expected, actual);
-        assertEquals("CompareResults Error: Value mismatch at row 1 and column 0: expected = bob, actual = <null>", result); //$NON-NLS-1$
-    }
-
-    public void testNullColumnInFirstRowWithDataLater() {
-        results1.add(nullList);
-        results1.add(bob1);
-        String result = ConnectorResultUtility.resultsToString(results1);
-        assertEquals(
-            "col1\tcol2" + StringUtil.LINE_SEPARATOR +   //$NON-NLS-1$
-            "<null>\t<null>" + StringUtil.LINE_SEPARATOR +    //$NON-NLS-1$
-            "bob\t45" + StringUtil.LINE_SEPARATOR,            //$NON-NLS-1$
-            result); 
-    }
-
-    public void testNullColumnInFirstRowWithNoDataLater() {
-        results1.add(nullList);
-        results1.add(nullList);
-        String result = ConnectorResultUtility.resultsToString(results1);
-        assertEquals(
-            "col1\tcol2" + StringUtil.LINE_SEPARATOR +   //$NON-NLS-1$
-            "<null>\t<null>" + StringUtil.LINE_SEPARATOR +   //$NON-NLS-1$
-            "<null>\t<null>" + StringUtil.LINE_SEPARATOR,    //$NON-NLS-1$
-            result); 
-    }
-
-    public void testTooFewColumns() {  
-        results1.add(bob1);
-
-        results2.add(bobShort);
-
-        String expected = ConnectorResultUtility.resultsToString(results1);
-        String actual = ConnectorResultUtility.resultsToString(results2);        
-        String result = ConnectorResultUtility.compareResultsStrings(expected, actual);
-        assertEquals("Incorrect number of columns at row = 0, expected = 2, actual = 1", result); //$NON-NLS-1$
-    }
-
-    public void testTooManyColumns() {  
-        results1.add(bobShort);
-
-        results2.add(bob1);
-
-        String expected = ConnectorResultUtility.resultsToString(results1);
-        String actual = ConnectorResultUtility.resultsToString(results2);        
-        String result = ConnectorResultUtility.compareResultsStrings(expected, actual);
-        assertEquals("Incorrect number of columns at row = 0, expected = 1, actual = 2", result); //$NON-NLS-1$
-    }
-    
-    public void testTabsAndNewLines() {
-        results1.add(bobMultiLineWithTabs);
-        String result = ConnectorResultUtility.resultsToString(results1);
-        //tabs and newlines in Strings in the result object end up as literal "\t" and "\n" values in the string version
-        assertEquals("col1\tcol2" + StringUtil.LINE_SEPARATOR + "bob\\tsmith\\nEsquire\t45" + StringUtil.LINE_SEPARATOR, result); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    /* 
-     * @see junit.framework.TestCase#setUp()
-     */
-    protected void setUp() throws Exception {
-        super.setUp();
-        bob1 = new ArrayList();
-        bob1.add("bob"); //$NON-NLS-1$
-        bob1.add(new Integer(45));
-        jim1 = new ArrayList();
-        jim1.add("jim"); //$NON-NLS-1$
-        jim1.add(new Integer(19));
-
-        bob2 = new ArrayList();
-        bob2.add("bob"); //$NON-NLS-1$
-        bob2.add(new Integer(25));
-        
-        bobShort = new ArrayList();
-        bobShort.add("bob"); //$NON-NLS-1$
-        
-        bobMultiLineWithTabs = new ArrayList();
-        bobMultiLineWithTabs.add("bob\tsmith\nEsquire"); //$NON-NLS-1$
-        bobMultiLineWithTabs.add(new Integer(45));
-        
-        nullList = new ArrayList();
-        nullList.add(null);
-        nullList.add(null);
-               
-        results1 = new ArrayList();
-        results2 = new ArrayList();
-    }
-}



More information about the teiid-commits mailing list