You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jdo-commits@db.apache.org by mc...@apache.org on 2010/11/26 05:05:02 UTC

svn commit: r1039248 - in /db/jdo/trunk/exectck: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/jdo/ src/main/java/org/apache/jdo/exectck/ src/main/resources/

Author: mcaisse
Date: Fri Nov 26 04:05:01 2010
New Revision: 1039248

URL: http://svn.apache.org/viewvc?rev=1039248&view=rev
Log:
JDO-647 Interim checking of exectck plugin. Not quite working.

Added:
    db/jdo/trunk/exectck/
    db/jdo/trunk/exectck/pom.xml
    db/jdo/trunk/exectck/src/
    db/jdo/trunk/exectck/src/main/
    db/jdo/trunk/exectck/src/main/java/
    db/jdo/trunk/exectck/src/main/java/org/
    db/jdo/trunk/exectck/src/main/java/org/apache/
    db/jdo/trunk/exectck/src/main/java/org/apache/jdo/
    db/jdo/trunk/exectck/src/main/java/org/apache/jdo/exectck/
    db/jdo/trunk/exectck/src/main/java/org/apache/jdo/exectck/Enhance.java
    db/jdo/trunk/exectck/src/main/java/org/apache/jdo/exectck/Help.java
    db/jdo/trunk/exectck/src/main/java/org/apache/jdo/exectck/InstallSchema.java
    db/jdo/trunk/exectck/src/main/java/org/apache/jdo/exectck/PropertyUtils.java
    db/jdo/trunk/exectck/src/main/java/org/apache/jdo/exectck/RunTCK.java
    db/jdo/trunk/exectck/src/main/java/org/apache/jdo/exectck/Utilities.java
    db/jdo/trunk/exectck/src/main/resources/

Added: db/jdo/trunk/exectck/pom.xml
URL: http://svn.apache.org/viewvc/db/jdo/trunk/exectck/pom.xml?rev=1039248&view=auto
==============================================================================
--- db/jdo/trunk/exectck/pom.xml (added)
+++ db/jdo/trunk/exectck/pom.xml Fri Nov 26 04:05:01 2010
@@ -0,0 +1,122 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.apache.jdo</groupId>
+    <artifactId>jdo-exectck</artifactId>
+    <packaging>maven-plugin</packaging>
+    <version>1.0-SNAPSHOT</version>
+    <name>jdo-exectck Maven Mojo</name>
+    <url>http://maven.apache.org</url>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <version>2.0.2</version>
+                <configuration>
+                    <source>1.6</source>
+                    <target>1.6</target>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.maven</groupId>
+            <artifactId>maven-plugin-api</artifactId>
+            <version>2.0</version>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>3.8.1</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.derby</groupId>
+            <artifactId>derby</artifactId>
+            <version>10.6.1.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.derby</groupId>
+            <artifactId>derbytools</artifactId>
+            <version>10.6.1.0</version>
+        </dependency>
+        <dependency>
+            <groupId>commons-io</groupId>
+            <artifactId>commons-io</artifactId>
+            <version>1.4</version>
+        </dependency>
+        <dependency>
+            <groupId>javax.jdo</groupId>
+            <artifactId>jdo-api</artifactId>
+            <version>3.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.datanucleus</groupId>
+            <artifactId>datanucleus-core</artifactId>
+            <version>2.1.0-release</version>
+        </dependency>
+        <dependency>
+            <groupId>org.datanucleus</groupId>
+            <artifactId>datanucleus-rdbms</artifactId>
+            <version>2.1.0-release</version>
+        </dependency>
+        <dependency>
+            <groupId>org.datanucleus</groupId>
+            <artifactId>datanucleus-enhancer</artifactId>
+            <version>2.1.0-release</version>
+        </dependency>
+        <dependency>
+            <groupId>org.datanucleus</groupId>
+            <artifactId>datanucleus-jpa</artifactId>
+            <version>2.1.0-release</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-core</artifactId>
+            <version>2.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-beans</artifactId>
+            <version>2.0</version>
+        </dependency>
+        <dependency>
+            <groupId>log4j</groupId>
+            <artifactId>log4j</artifactId>
+            <version>1.2.13</version>
+        </dependency>
+        <dependency>
+            <groupId>org.datanucleus</groupId>
+            <artifactId>datanucleus-connectionpool</artifactId>
+            <version>2.0.1</version>
+        </dependency>
+        <dependency>
+            <groupId>c3p0</groupId>
+            <artifactId>c3p0</artifactId>
+            <version>0.9.0.2</version>
+        </dependency>
+        <dependency>
+            <groupId>commons-dbcp</groupId>
+            <artifactId>commons-dbcp</artifactId>
+            <version>1.2.1</version>
+        </dependency>
+        <dependency>
+            <groupId>commons-pool</groupId>
+            <artifactId>commons-pool</artifactId>
+            <version>1.3</version>
+        </dependency>
+        <dependency>
+            <groupId>commons-collections</groupId>
+            <artifactId>commons-collections</artifactId>
+            <version>3.2</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-jpa_2.0_spec</artifactId>
+            <version>1.0</version>
+        </dependency>
+    </dependencies>
+</project>
+
+

Added: db/jdo/trunk/exectck/src/main/java/org/apache/jdo/exectck/Enhance.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/exectck/src/main/java/org/apache/jdo/exectck/Enhance.java?rev=1039248&view=auto
==============================================================================
--- db/jdo/trunk/exectck/src/main/java/org/apache/jdo/exectck/Enhance.java (added)
+++ db/jdo/trunk/exectck/src/main/java/org/apache/jdo/exectck/Enhance.java Fri Nov 26 04:05:01 2010
@@ -0,0 +1,209 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package org.apache.jdo.exectck;
+
+import java.net.MalformedURLException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.apache.commons.io.FileUtils;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import javax.jdo.JDOEnhancer;
+import javax.jdo.JDOHelper;
+
+/**
+ * Goal that enhances test classes for testing a JDO implementation.
+ *
+ * @goal enhance
+ *
+ * @phase integration-test
+ *
+ */
+public class Enhance extends AbstractMojo {
+
+    /**
+     * Location of TCK generated output.
+     * @parameter expression="${jdo.tck.doEnhance}"
+     *      default-value=true
+     * @required
+     */
+    private boolean doEnhance;
+
+    /**
+     * Root of the TCK source installation.
+     * @parameter expression="${project.src.directory}"
+     *      default-value="${basedir}/src"
+     * @required
+     */
+    private String srcDirectory;
+    /**
+     * Location of the logs directory.
+     * @parameter expression="${project.log.directory}"
+     *      default-value="${project.build.directory}/logs"
+     * @required
+     */
+    private File logsDirectory;
+    /**
+     * Location of TCK generated output.
+     * @parameter expression="${project.build.directory}"
+     *      default-value="${basedir}/target"
+     * @required
+     */
+    private String buildDirectory;
+    /**
+     * Implementation to be tested (jdori or iut).
+     * Any value other than "jdori" will test an appropriately configured IUT
+     * @parameter expression="${jdo.tck.impl}"
+     *      default-value="jdori"
+     * @required
+     */
+    private String impl;
+    /**
+     * List of identity types to be tested.
+     * @parameter expression="${jdo.tck.identitytypes}"
+     *      default-value="applicationidentity datastoreidentity"
+     * @required
+     */
+    private String identitytypes;
+    private HashSet<String> idtypes;
+
+    @Override
+    public void execute() throws MojoExecutionException, MojoFailureException {
+
+        if (!doEnhance) {
+            System.out.println("Skipping Enhance!");
+            return;
+        }
+
+        idtypes = new HashSet();
+        PropertyUtils.string2Set(identitytypes, idtypes);
+
+        // Create directory for enhancer logs
+        String enhanceLogsDirName = logsDirectory + File.separator + "enhancer";
+        File enhancerLogsDir = new File(enhanceLogsDirName);
+        if (!(enhancerLogsDir.exists()) && !(enhancerLogsDir.mkdirs())) {
+            throw new MojoExecutionException("Failed to create directory "
+                    + enhancerLogsDir);
+        }
+
+        // Create directory for enhanced classes
+        String enhancedDirName = buildDirectory + File.separator + "enhanced"
+                + File.separator + impl + File.separator;
+        File enhancedDir = new File(enhancedDirName);
+        if (!(enhancedDir.exists()) && !(enhancedDir.mkdirs())) {
+            throw new MojoExecutionException("Failed to create directory "
+                    + enhancedDir);
+        }
+
+
+
+        String[] pcPkgNames = {"org/apache/jdo/tck/api/",
+            "org/apache/jdo/tck/pc/",
+            "org/apache/jdo/tck/models/inheritance/"};
+        String[] metadataExtensions = {"jdo", "jdoquery", "orm", "xml", "properties"};  // we really want "jdo.properties", but this is easier
+        String genericPkgName = "org";
+        File toFile = null;
+        File fromFile = null;
+        String fromFileName = null;
+        String fromDirName = null;
+        String pkgName = null;
+        int startIdx = -1;
+        Iterator<File> fi = null;
+        String[] classArray = new String[10];
+
+        // Copy metadata from src to enhanced
+        for (String idtype : idtypes) {
+            fromDirName = srcDirectory + File.separator + "jdo";
+            // iterator over list of abs name of metadata files in src
+            fi = FileUtils.iterateFiles(
+                    new File(fromDirName), metadataExtensions, true);
+
+            while (fi.hasNext()) {
+                try {
+                    fromFile = fi.next();
+                    fromFileName = fromFile.toString();
+//                    System.out.println("Copying " + fromFileName);
+                    if ((startIdx = fromFileName.indexOf(idtype + File.separator /*+ genericPkgName*/)) > -1) {
+                        // fully specified name of file (idtype + package + filename)
+                        pkgName = fromFileName.substring(startIdx);
+                        toFile = new File(enhancedDirName + File.separator
+                                + pkgName);
+//                        System.out.println("Copy from source dir to " + toFile.toString());
+                        FileUtils.copyFile(fromFile, toFile);
+                    } else {
+                        continue;  // idtype not in pathname, do not copy
+                    }
+                } catch (IOException ex) {
+                    throw new MojoExecutionException("Failed to copy files from "
+                            + fromFileName + " to " + toFile.toString()
+                            + ": " + ex.getLocalizedMessage());
+                }
+            }
+
+            // Copy pc and pa classes from target/classes to enhanced
+            String[] extensions = {"class"};
+            fromDirName = buildDirectory + File.separator
+                    + "classes" + File.separator;
+            String enhancedIdDirName = enhancedDirName + idtype + File.separator;
+            ArrayList<String> classes = new ArrayList<String>();
+            for (String pcPkgName : pcPkgNames) {
+                // iterator over list of abs name of class files in target/classes
+                fi = FileUtils.iterateFiles(
+                        new File(fromDirName + pcPkgName), extensions, true);
+                while (fi.hasNext()) {
+                    try {
+                        fromFile = fi.next();
+                        fromFileName = fromFile.toString();
+                        // fully specified name of file (package + filename)
+                        toFile = new File(enhancedIdDirName + fromFileName.substring(
+                                fromFileName.indexOf(pcPkgName)));
+                        FileUtils.copyFile(fromFile, toFile);
+                        classes.add(toFile.toString());
+                    } catch (IOException ex) {
+                        throw new MojoExecutionException("Failed to copy files from "
+                                + fromFileName + " to " + toFile.toString()
+                                + ": " + ex.getLocalizedMessage());
+                    }
+                }
+            }
+
+            // Enhance classes
+
+            URL[] classPathURLs = new URL[2];
+            ClassLoader loader = null;
+            try {
+                classPathURLs[0] = (new File(enhancedIdDirName)).toURI().toURL();
+                classPathURLs[1] = (new File(fromDirName)).toURI().toURL();
+                loader = new URLClassLoader(classPathURLs, getClass().getClassLoader());
+                Utilities.printClasspath(loader);
+                // debugging
+//                Class cls = null;
+//                try {
+//                    cls = loader.loadClass("org.apache.jdo.tck.pc.companyListWithoutJoin.CompanyModelReader");
+//                } catch (ClassNotFoundException ex) {
+//                    Logger.getLogger(Enhance.class.getName()).log(Level.SEVERE, null, ex);
+//                }
+            } catch (MalformedURLException ex) {
+                Logger.getLogger(Enhance.class.getName()).log(Level.SEVERE, null, ex);
+            }
+            JDOEnhancer enhancer = JDOHelper.getEnhancer();
+            enhancer.setVerbose(true);
+            String[] classArr = classes.toArray(classArray);
+            enhancer.addClasses(classArr);
+            enhancer.setClassLoader(loader);
+            System.out.println("Enhancing classes");
+            enhancer.enhance();
+        }
+    }
+}

Added: db/jdo/trunk/exectck/src/main/java/org/apache/jdo/exectck/Help.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/exectck/src/main/java/org/apache/jdo/exectck/Help.java?rev=1039248&view=auto
==============================================================================
--- db/jdo/trunk/exectck/src/main/java/org/apache/jdo/exectck/Help.java (added)
+++ db/jdo/trunk/exectck/src/main/java/org/apache/jdo/exectck/Help.java Fri Nov 26 04:05:01 2010
@@ -0,0 +1,58 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.apache.jdo.exectck;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+
+/**
+ * Goal that displays help text for the exectck Maven plugin.
+ *
+ * @goal help
+ *
+ * @phase integration-test
+ *
+ */
+public class Help extends AbstractMojo{
+
+    @Override
+    public void execute() throws MojoExecutionException, MojoFailureException {
+        
+        StringBuffer msg = new StringBuffer();
+
+        msg.append("\n\n*** jdo-exectck Maven plugin ***\n\n");
+        msg.append("This plugin executes the JDO Technology Compatibility Kit (TCK)\n");
+        msg.append("against the Reference Implementation (RI) or an implementation under test (IUT).\n\n");
+        msg.append("- To display this help text, type \"mvn jdo-exectck:help\"\n");
+        msg.append("- To run the entire TCK type \"mvn integration-test\" or \"mvn install\"\n");
+        msg.append("- To run individual goals as \"mvn jdo-exectck:<goal>\"\n");
+        msg.append("  or specify command line parameters to configure the test.\n");
+        msg.append("\nGOALS\n");
+        msg.append("* installSchema\n");
+        msg.append("  Installs all of the database schemas required to execute tests\n");
+        msg.append("  in the current test configurations.\n");
+        msg.append("* enhance\n");
+        msg.append("  Not yet implemented\n");
+        msg.append("* runTCK\n");
+        msg.append("  Not yet implemented\n");
+        msg.append("\nPARAMETERS\n");
+        msg.append("To set parameters from the command line, \n  use the -D option and the parameter name.\n");
+        msg.append("  For example, \"mvn -Djdo.tck.identitytype=applicationidentity\"\n");
+        msg.append("* jdo.tck.cfglist\n");
+        msg.append("  List of configuration files, each describing a test configuration.\n");
+        msg.append("   Default is all configurations.\n");
+        msg.append("* jdo.tck.dblist\n");
+        msg.append("   List of databases to run tests under.\n");
+        msg.append("   Currently only derby is supported\n");
+        msg.append("* jdo.tck.identitytype\n");
+        msg.append("   List of identity types to be tested\n");
+        msg.append("   Default value is \"applicationidentity datastoreidentity\"\n");
+
+        System.out.println(msg.toString());
+    }
+
+}

Added: db/jdo/trunk/exectck/src/main/java/org/apache/jdo/exectck/InstallSchema.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/exectck/src/main/java/org/apache/jdo/exectck/InstallSchema.java?rev=1039248&view=auto
==============================================================================
--- db/jdo/trunk/exectck/src/main/java/org/apache/jdo/exectck/InstallSchema.java (added)
+++ db/jdo/trunk/exectck/src/main/java/org/apache/jdo/exectck/InstallSchema.java Fri Nov 26 04:05:01 2010
@@ -0,0 +1,237 @@
+package org.apache.jdo.exectck;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import org.apache.commons.io.FileUtils;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.HashSet;
+
+/**
+ * Goal that installs a database schema for testing a JDO implementation.
+ *
+ * @goal installSchema
+ * 
+ * @phase integration-test
+ *
+ */
+public class InstallSchema
+        extends AbstractMojo {
+
+    /**
+     * Location of TCK generated output.
+     * @parameter expression="${jdo.tck.doInstallSchema}"
+     *      default-value=true
+     * @required
+     */
+    private boolean doInstallSchema;
+
+    /**
+     * Root of the TCK installation.
+     * @parameter expression="${project.base.directory}"
+     *      default-value="${basedir}"
+     * @required
+     */
+//    private String baseDirectory;
+    
+    /**
+     * Location of TCK generated output.
+     * @parameter expression="${project.build.directory}"
+     *      default-value="${basedir}/target"
+     * @required
+     */
+    private String buildDirectory;
+    
+    /**
+     * Location of the logs directory.
+     * @parameter expression="${project.log.directory}"
+     *      default-value="${project.build.directory}/logs"
+     * @required
+     */
+    private File logsDirectory;
+    
+    /**
+     * Location of the configuration directory.
+     * @parameter expression="${project.conf.directory}"
+     *      default-value="${basedir}/src/conf"
+     * @required
+     */
+    private String confDirectory;
+    
+    /**
+     * Location of the configuration directory.
+     * @parameter expression="${project.sql.directory}"
+     *      default-value="${basedir}/src/sql"
+     * @required
+     */
+    private String sqlDirectory;
+
+    /**
+     * List of configuration files, each describing a test configuration.
+     * Note: Collection can only be configured in pom.xml. Using multi-valued
+     *       type because long String cannot be broken across lines in pom.xml.
+     * @parameter
+     * @required
+     */
+    private HashSet<String> cfgs;
+
+    /**
+     * List of configuration files, each describing a test configuration.
+     * Allows command line override of configured cfgs value.
+     * @parameter expression="${jdo.tck.cfglist}
+     * @optional
+     */
+    private String cfgList;
+    
+    /**
+     * List of databases to run tests under.
+     * Currently only derby is supported.
+     * @parameter expression="${jdo.tck.dblist}" default-value="derby"
+     * @required
+     */
+    private String dblist;
+    private HashSet<String> dbs;
+    
+    /**
+     * List of identity types to be tested.
+     * @parameter expression="${jdo.tck.identitytypes}"
+     *      default-value="applicationidentity datastoreidentity"
+     * @required
+     */
+    private String identitytypes;
+    private HashSet<String> idtypes;
+    
+    /**
+     * List of mappings required by the current configurationd
+     */
+    private HashSet<String> mappings;
+
+    @Override
+    public void execute()
+            throws MojoExecutionException {
+
+        if (!doInstallSchema) {
+            System.out.println("Skipping InstallSchema!");
+            return;
+        }
+        
+        dbs = new HashSet();
+        idtypes = new HashSet();
+        mappings = new HashSet();
+
+        if (cfgList != null) {
+            cfgs = new HashSet();
+            PropertyUtils.string2Set(cfgList, cfgs);
+        }
+
+        PropertyUtils.string2Set(dblist, dbs);
+        PropertyUtils.string2Set(identitytypes, idtypes);
+        PropertyUtils.mappingsSet(cfgs, confDirectory, mappings);
+        System.out.println("*>Schemas to be installed for \n  configurations: "
+                + cfgs.toString() + "\n  databases: " + dbs.toString()
+                + "\n  identity types: " + identitytypes.toString());
+
+//        System.setProperty("jdo.tck.basedir", baseDirectory);
+        System.setProperty("java.security.manager", "default");
+        System.setProperty("java.security.policy", confDirectory
+                + File.separator + "security.policy");
+
+        // Currently we support only derby. To support additional db's,
+        //   configuration data must be parameterized.
+        for (String db : dbs) {
+
+            // Create directory for db logs
+            String dbLogsDirName = logsDirectory + File.separator + "database";
+            File dbLogsDir = new File(dbLogsDirName);
+            if (!(dbLogsDir.exists()) && !(dbLogsDir.mkdirs())) {
+                throw new MojoExecutionException("Failed to create directory "
+                        + dbLogsDir);
+            }
+
+            // Create database directory
+            String dbDirName = buildDirectory + File.separator + "database"
+                    + File.separator + db;
+            File dbDir = new File(dbDirName);
+            if (!(dbDir.exists()) && !(dbDir.mkdirs())) {
+                throw new MojoExecutionException("Failed to create directory "
+                        + dbDir);
+            }
+
+            // Copy derby.properties to db dir
+            File dbConf = new File(confDirectory + File.separator + db
+                    + ".properties");
+            File targetDir = new File(dbDirName);
+            try {
+                FileUtils.copyFileToDirectory(dbConf, targetDir, false);
+            } catch (IOException ex) {
+                throw new MojoExecutionException("Failed to copy file " + dbConf
+                        + " to " + dbDir + ": " + ex.getLocalizedMessage());
+            }
+
+            // Create database
+            for (String idtype : idtypes) {
+
+                for (String mapping : mappings) {
+
+                    System.setProperty("ij.outfile", logsDirectory + File.separator
+                            + "database" + File.separator + db + "_" + idtype
+                            + "_" + mapping + ".txt");
+
+                    if (mapping.equals("0")) {
+                        mapping = "";
+                    }
+                    System.out.println("*> Installing schema" + mapping
+                                + ".sql for " + db + " " + idtype);
+
+                    String[] args = {sqlDirectory + File.separator + db
+                        + File.separator + idtype + File.separator
+                        + "schema" + mapping + ".sql"};
+                    System.setProperty("derby.system.home", dbDirName);
+
+                    try {
+                        org.apache.derby.tools.ij.main(args);
+                    } catch (IOException ioex) {
+                        throw new MojoExecutionException(
+                                "*> Failed to execute ij: " +
+                                ioex.getLocalizedMessage());
+                    } catch (Exception ex) {
+                        ex.printStackTrace();
+                        System.out.println("*> Classpath is ");
+                        new Utilities().printClasspath();
+                        System.out.println("*> derby.system.home is \n    "
+                                + System.getProperty("derby.system.home"));
+                        System.out.println("*> jdo.tck.basedir is \n    "
+                                + System.getProperty("jdo.tck.basedir"));
+                        System.out.println("*> ij.outfile is \n    "
+                                + System.getProperty("ij.outfile"));
+                        System.out.println("*> java.security.manager is \n    "
+                                + System.getProperty("java.security.manager"));
+                        System.out.println("*> java.security.policy is \n    "
+                                + System.getProperty("java.security.policy"));
+                    } finally {
+                        System.out.println("*> Installation of schema" + mapping
+                                + ".sql for " + db + " " + idtype
+                                + " is complete. See diagnostic output in "
+                                + dbLogsDir + ".");
+                    }
+                }
+            }
+        }
+    }
+}

Added: db/jdo/trunk/exectck/src/main/java/org/apache/jdo/exectck/PropertyUtils.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/exectck/src/main/java/org/apache/jdo/exectck/PropertyUtils.java?rev=1039248&view=auto
==============================================================================
--- db/jdo/trunk/exectck/src/main/java/org/apache/jdo/exectck/PropertyUtils.java (added)
+++ db/jdo/trunk/exectck/src/main/java/org/apache/jdo/exectck/PropertyUtils.java Fri Nov 26 04:05:01 2010
@@ -0,0 +1,112 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package org.apache.jdo.exectck;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.Properties;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ *
+ * Helper class that sets properties required for running the JDO TCK.
+ *
+ */
+public class PropertyUtils {
+
+    /**
+     * Separates white space separated items from a String into HashSet entries
+     * Used to collect command line argument lists into a Collection
+     *
+     * @param names String of white space separated items
+     * @param list  HashSet to contain String items
+     */
+    public static void string2Set(String names, HashSet<String> list) {
+//        System.out.println("names are " + names);
+        String[] items = names.split("[ \t\n]");
+        for (String s : items) {
+            list.add(s);
+        }
+//        System.out.println("List names are " + list.toString());
+    }
+
+    /**
+     * Parses a set of config files for the mapping entry and
+     * provides the mapping values in a HashSet<String>.
+     * @param cfglist config file names
+     * @param confDir directory where config files are found
+     * @param mappings object to containg mapping values
+     */
+    public static void mappingsSet(HashSet<String> cfglist, String confDir,
+            HashSet<String> mappings) {
+
+        for (String cfg : cfglist) {
+            String mapping = "";
+            String confName = confDir + "/" + cfg;
+
+            Properties props = new Properties();
+            FileInputStream fis = null;
+//            System.out.println("confName is " + confName);
+            try {
+                fis = new FileInputStream(confName);
+                props.load(fis);
+                mapping = props.getProperty("jdo.tck.mapping");
+            } catch (IOException e) {
+                e.printStackTrace();
+                try {
+                    if (fis != null) {
+                        fis.close();
+                    }
+                } catch (IOException ex) {
+                    Logger.getLogger(PropertyUtils.class.getName()).log(Level.SEVERE, null, ex);
+                }
+                return;
+            }
+
+            mappings.add(mapping);
+        }
+    }
+
+    /*
+     * Open a properties file and return a Properties object
+     */
+    public static Properties getProperties(String fname){
+//        System.out.println("Goal RunTCK, getProperties: parsing properties from "
+//                + fname);
+        Properties props = new Properties();
+        FileInputStream fis = null;
+            try {
+                fis = new FileInputStream(new File(fname));
+                props.load(fis);
+            } catch (IOException e) {
+                e.printStackTrace();
+                try {
+                    if (fis != null) {
+                        fis.close();
+                    }
+                } catch (IOException ex) {
+                    Logger.getLogger(PropertyUtils.class.getName()).log(Level.SEVERE, null, ex);
+                }
+            }
+        return props;
+    }
+
+    /*
+     * Set the value of key if found in properties.
+     */
+    public static void setSysProperty(Properties properties, String key, String newkey) {
+        String value = properties.getProperty("key");
+        if (value != null) {
+            System.setProperty(newkey, value);
+        }
+    }
+
+    public static void setSysProperty(Properties properties, String key) {
+        setSysProperty(properties, key, key);
+    }
+}

Added: db/jdo/trunk/exectck/src/main/java/org/apache/jdo/exectck/RunTCK.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/exectck/src/main/java/org/apache/jdo/exectck/RunTCK.java?rev=1039248&view=auto
==============================================================================
--- db/jdo/trunk/exectck/src/main/java/org/apache/jdo/exectck/RunTCK.java (added)
+++ db/jdo/trunk/exectck/src/main/java/org/apache/jdo/exectck/RunTCK.java Fri Nov 26 04:05:01 2010
@@ -0,0 +1,573 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package org.apache.jdo.exectck;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Properties;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.apache.commons.io.FileUtils;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+
+/*
+ *     <goal name="privateRuntck.jdori"
+
+<echo>Run all configurations on jdori</echo>
+<j:set var="runOnceTestRanOnce" value="false"/>
+<j:forEach var="jdo.tck.database" items="${jdo.tck.dblist}">
+<j:forEach var="jdo.tck.identitytype" items="${jdo.tck.identitytypes}">
+<j:forEach var="jdo.tck.cfg" items="${jdo.tck.cfglist}">
+<j:set var="runOnce" value="false"/>
+<u:properties file="${basedir}/src/conf/${jdo.tck.cfg}"/>
+<j:if test="${runOnce == false || (runOnce == true &amp;&amp; runOnceTestRanOnce == false)}">
+<attainGoal name="exclude"/>
+<j:new var="schemaname" className="java.lang.String"/>
+<j:set var="id" value="${jdo.tck.identitytype}"/>
+<j:set var="mapping" value="${jdo.tck.mapping}"/>
+<j:if test="${mapping == zeroval}">
+<j:set var="jdo.tck.mapping" value=""/>
+</j:if>
+<j:set var="schemaname">
+<j:expr value="${schemaname.concat(id)}"/>
+<j:expr value="${schemaname.concat(mapping)}"/>
+</j:set>
+<attainGoal name="doRuntck.jdori"/>
+<j:if test="${runOnce == true}">
+<j:set var="runOnceTestRanOnce" value="true"/>
+</j:if>
+</j:if>
+</j:forEach>
+</j:forEach>
+</j:forEach>
+<attainGoal name="result"/>
+</goal>
+ *
+ *     <goal name="doRuntck.jdori">
+<j:if test="${jdo.tck.security}">
+<j:set var="jdo.tck.security.jvmargs"
+value="-Djava.security.manager -Djava.security.policy=${basedir}/src/conf/security.policy"/>
+<echo message="Running with Java security manager settings: ${jdo.tck.security.jvmargs}"/>
+</j:if>
+
+<path id="this.jdori.classpath">
+<pathelement location="${jdo.tck.enhanced.dir}/${jdo.tck.identitytype}.jar"/>
+<path refid="jdori.classpath"/>
+</path>
+<u:loadText file="${basedir}/src/conf/${jdori.pmf.properties}"
+var="PMFProps"/>
+<j:file name="${jdo.tck.testclasses.dir}/${jdori.pmf.properties}"
+omitXmlDeclaration="true">
+${PMFProps}
+### Properties below added by maven goal doRuntck.jdori
+<!-- javax.jdo.option.Mapping=${jdo.tck.database}${jdo.tck.mapping} -->
+javax.jdo.option.Mapping=standard${jdo.tck.mapping}
+javax.jdo.mapping.Schema=${schemaname}
+</j:file>
+
+<j:set var="debugJvmargs" value="${jdo.tck.debug.jvmargs}"/>
+<j:if test="${not empty debugJvmargs}">
+<echo>JVM will wait until debugger attaches on port ${jdo.tck.debug.port}...</echo>
+</j:if>
+
+<echo>Starting configuration="${jdo.tck.cfg}" with database="${jdo.tck.database}" identitytype="${jdo.tck.identitytype}" mapping="${jdo.tck.mapping}" on the Reference Implementation.</echo>
+<java fork="yes" dir="${jdo.tck.testdir}"
+classname="${jdo.tck.testrunnerclass}">
+<classpath refid="this.jdori.classpath"/>
+<sysproperty key="ResultPrinterClass"
+value="${jdo.tck.resultprinterclass}"/>
+<sysproperty key="verbose" value="${verbose}"/>
+<sysproperty key="PMFProperties"
+value="${jdo.tck.testclasses.dir}/${jdori.pmf.properties}"/>
+<sysproperty key="PMF2Properties"
+value="${jdo.tck.testclasses.dir}/${jdori.pmf.properties}"/>
+<sysproperty key="jdo.tck.testdata" value="${jdo.tck.testdata}"/>
+<sysproperty key="jdo.tck.standarddata"
+value="${jdo.tck.standarddata}"/>
+<sysproperty key="jdo.tck.description"
+value="${jdo.tck.description}"/>
+<sysproperty key="jdo.tck.identitytype"
+value="${jdo.tck.identitytype}"/>
+<sysproperty key="jdo.tck.database"
+value="${jdo.tck.database}"/>
+<sysproperty key="jdo.tck.cfg"
+value="${jdo.tck.cfg}"/>
+<sysproperty key="jdo.tck.exclude"
+value="${jdo.tck.exclude}"/>
+<sysproperty key="jdo.tck.log.directory"
+value="${jdo.tck.log.directory}/${timestamp}"/>
+<sysproperty key="jdo.tck.cleanupaftertest"
+value="${jdo.tck.cleanupaftertest}"/>
+<sysproperty key="jdo.tck.requiredOptions"
+value="${jdo.tck.requiredOptions}"/>
+<sysproperty key="jdo.tck.schemaname"
+value="${schemaname}"/>
+<sysproperty key="jdo.tck.mapping.companyfactory"
+value="${jdo.tck.mapping.companyfactory}"/>
+<sysproperty key="jdo.tck.closePMFAfterEachTest"
+value="${jdo.tck.closePMFAfterEachTest}"/>
+<sysproperty key="jdo.tck.signaturefile"
+value="${jdo.tck.signaturefile}"/>
+<sysproperty key="jdo.tck.junit.jarfile"
+value="${junit.jarfile}"/>
+<sysproperty key="jdo.tck.testclasses.dir"
+value="${jdo.tck.testclasses.dir}"/>
+<sysproperty key="jdo.tck.enhanced.jarfile"
+value="${jdo.tck.enhanced.dir}/${jdo.tck.identitytype}.jar"/>
+<sysproperty key="jdo.api.jarfile"
+value="${jdo.api.jarfile}"/>
+<sysproperty key="jdo.tck.basedir"
+value="${jdo.tck.basedir}"/>
+<sysproperty key="jdo.tck.jdori.jarfile"
+value="${datanucleus.jdori.jarfile}"/>
+<sysproperty key="jdo.tck.jdori.rdbms.jarfile"
+value="${datanucleus.rdbms.jarfile}"/>
+<sysproperty key="jdo.tck.jdori.enhancer.jarfile"
+value="${datanucleus.enhancer.jarfile}"/>
+<sysproperty key="jdo.tck.springcore.jarfile"
+value="${springcore.jarfile}"/>
+<sysproperty key="jdo.tck.springbeans.jarfile"
+value="${springbeans.jarfile}"/>
+
+<jvmarg line="${database.runtck.sysproperties}"/>
+<jvmarg line="${jdori.runtck.sysproperties}"/>
+<jvmarg line="${jdo.tck.debug.jvmargs}"/>
+<jvmarg line="${jdo.tck.security.jvmargs}"/>
+
+<arg line="${jdo.tck.classes}"/>
+</java>
+<echo>Finished configuration="${jdo.tck.cfg}" with database="${jdo.tck.database}" identitytype="${jdo.tck.identitytype}" mapping="${jdo.tck.mapping}" on the Reference Implementation.</echo>
+</goal>
+ */
+/*     <goal name="result">
+<java fork="yes" dir="${jdo.tck.testdir}"
+classname="org.apache.jdo.tck.util.ResultSummary">
+<classpath refid="jdori.classpath"/>
+<arg line="${jdo.tck.log.directory}/${timestamp}"/>
+</java>
+<java fork="yes" dir="${jdo.tck.testdir}"
+classname="org.apache.jdo.tck.util.SystemCfgSummary">
+<classpath refid="jdori.classpath"/>
+<arg line="${jdo.tck.log.directory}/${timestamp}/configuration"/>
+<arg line="system_config.txt"/>
+</java>
+ */
+//        <copy todir="${jdo.tck.log.directory}/${timestamp}/configuration">
+//            <fileset dir="${basedir}" includes="*.properties, *.xml"/>
+//            <fileset dir="${basedir}/src/conf" includes="**/*"/>
+//            <fileset dir="${basedir}/src/jdo" includes="**/*.jdo"/>
+//            <fileset dir="${basedir}/src/orm" includes="**/*.orm"/>
+//        </copy>
+//    </goal>
+/**
+ * Goal that runs the JDO TCK against the Reference Implementation (RI)
+ * or an implementation under test (IUT).
+ *
+ * @goal runtck
+ *
+ * @phase integration-test
+ *
+ */
+public class RunTCK extends AbstractMojo {
+
+    /**
+     * To skip running of TCK, set to false.
+     * @parameter expression="${jdo.tck.doRunTCK}"
+     *      default-value=true
+     * @required
+     */
+    private boolean doRunTCK;
+    /**
+     * To run the RunTCK plugin goal in verbose mode.
+     * @parameter expression="${jdo.tck.doRunTCK}"
+     *      default-value=false
+     * @required
+     */
+    private boolean runtckVerbose;
+    /**
+     * Run the TCK in a debugger.
+     * @parameter expression="${jdo.tck.debugTCK}"
+     *      default-value=false
+     * @required
+     */
+    private boolean debugTCK;
+    /**
+     * Location of TCK generated output.
+     * @parameter expression="${project.build.directory}"
+     *      default-value="${basedir}/target"
+     * @required
+     */
+    private String buildDirectory;
+    /**
+     * Location of the logs directory.
+     * @parameter expression="${project.log.directory}"
+     *      default-value="${project.build.directory}/logs"
+     * @required
+     */
+    private File logsDirectory;
+    /**
+     * Location of the configuration directory.
+     * @parameter expression="${project.conf.directory}"
+     *      default-value="${basedir}/src/conf"
+     * @required
+     */
+    private String confDirectory;
+    /**
+     * Location of the configuration directory.
+     * @parameter expression="${project.sql.directory}"
+     *      default-value="${basedir}/src/sql"
+     * @required
+     */
+    private String sqlDirectory;
+    /**
+     * Implementation to be tested (jdori or iut).
+     * Any value other than "jdori" will test an appropriately configured IUT
+     * @parameter expression="${jdo.tck.impl}"
+     *      default-value="jdori"
+     * @required
+     */
+    private String impl;
+    /**
+     * List of configuration files, each describing a test configuration.
+     * Note: Collection can only be configured in pom.xml. Using multi-valued
+     *       type because long String cannot be broken across lines in pom.xml.
+     * @parameter
+     * @required
+     */
+    private HashSet<String> cfgs;
+    /**
+     * List of configuration files, each describing a test configuration.
+     * Allows command line override of configured cfgs value.
+     * @parameter expression="${jdo.tck.cfglist}"
+     *      default-value="detach.conf"
+     * @optional
+     */
+    private String cfgList;
+    /**
+     * Name of file in src/conf containing pmf properties.
+     * @parameter expression="${jdo.tck.pmfproperties}"
+     * @optional
+     */
+    private String pmfProperties;
+    /**
+     * Name of file in src/conf containing property jdo.tck.exclude,
+     *   whose value is a list of files to be excluded from testing.
+     * @parameter expression="${jdo.tck.excludefile}"
+     *      default-value="exclude.list"
+     * @optional
+     */
+    private String exclude;
+    /**
+     * List of databases to run tests under.
+     * Currently only derby is supported.
+     * @parameter expression="${jdo.tck.dblist}" default-value="derby"
+     * @required
+     */
+    private String dblist;
+    private HashSet<String> dbs;
+    /**
+     * List of identity types to be tested.
+     * @parameter expression="${jdo.tck.identitytypes}"
+     *      default-value="applicationidentity datastoreidentity"
+     * @required
+     */
+    private String identitytypes;
+    private HashSet<String> idtypes;
+    /**
+     * List of mappings required by the current configurationd
+     */
+    private HashSet<String> mappings;
+    /**
+     * Run the TCK tests in verbose mode.
+     * @parameter expression="${jdo.tck.verbose} default-value="false"
+     * @optional
+     */
+    private String verbose;
+    /**
+     * To retain test output for debugging, set to false.
+     * @parameter expression="${jdo.tck.cleanupaftertest} default-value="true"
+     * @optional
+     */
+    private String cleanupaftertest;
+
+    /**
+     * Properties to use in accessing database.
+     * @parameter expression="${database.runtck.sysproperties}"
+     * @optional
+     */
+    private String dbproperties;    // NOTE: only allows for one db
+
+    /**
+     * Properties to use in accessing database.
+     * @parameter expression="${jdo.tck.signaturefile}"
+     * @optional
+     */
+    private String signaturefile;
+
+    /**
+     * JVM properties.
+     * @parameter expression="${jdo.tck.jvmproperties}"
+     *      default-value="-Xmx512m"
+     * @optional
+     */
+    private String jvmproperties;
+
+    /**
+     * The port number the JVM should listen for a debugger on.
+     * @parameter expression="${jdo.tck.debug.port}"
+     *      default-value="8787"
+     * @optional
+     */
+    private String debugPort;
+    /**
+     * User-supplied arguments for debug directives.
+     * @parameter expression="${jdo.tck.debug.jvmargs}"
+     *      default-value="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=${jdo.tck.debug.port}"
+     * @optional
+     */
+    private String debugDirectives;
+    /**
+     * Class used to run a batch of tests.
+     * @parameter expression="${jdo.tck.testrunnerclass}"
+     *      default-value="org.apache.jdo.tck.util.BatchTestRunner"
+     * @required
+     */
+    private String testRunnerClass;
+    /**
+     * Class used to output test result and configuration information.
+     * @parameter expression="${jdo.tck.resultprinterclass}"
+     *      default-value="org.apache.jdo.tck.util.BatchResultPrinter"
+     * @required
+     */
+    private String resultPrinterClass;
+
+    @Override
+    public void execute() throws MojoExecutionException, MojoFailureException {
+
+        if (!doRunTCK) {
+            System.out.println("Skipping RunTCK!");
+            return;
+        }
+
+        dbs = new HashSet();
+        idtypes = new HashSet();
+        mappings = new HashSet();
+        Properties props = null;
+        boolean alreadyran = false;
+        String runonce = "false";
+        StringBuffer propsString = new StringBuffer(" ");
+
+        if (cfgs != null) {
+            System.out.println("Configurations specified in cfgs are " + cfgs.toString());
+        } else if (cfgList != null) {
+            cfgs = new HashSet();
+            PropertyUtils.string2Set(cfgList, cfgs);
+            System.out.println("Configurations are " + cfgs.toString());
+        } else {
+            throw new MojoExecutionException(
+                    "Could not find configurations to run TCK. "
+                    + "Set cfgList parameter on command line "
+                    + "or cfgs in pom.xml.");
+        }
+
+        PropertyUtils.string2Set(dblist, dbs);
+        PropertyUtils.string2Set(identitytypes, idtypes);
+        System.out.println("*>TCK to be run for " + impl
+                + " on \n configurations: "
+                + cfgs.toString() + "\n  databases: " + dbs.toString()
+                + "\n  identity types: " + identitytypes.toString());
+
+        // Properties required for test execution
+        propsString.append(" -DResultPrinterClass=" + resultPrinterClass);
+        propsString.append(" -Dverbose=" + verbose);
+        propsString.append(" -Djdo.tck.cleanupaftertest=" + cleanupaftertest);
+        propsString.append(" -DPMFProperties=" + pmfProperties);
+        propsString.append(" -DPMFProperties=" + confDirectory + File.separator
+                + pmfProperties + " ");
+        propsString.append(" -DPMF2Properties=" + buildDirectory + File.separator
+                + "classes" + File.separator + pmfProperties);
+        String excludeFile = confDirectory + File.separator + exclude;
+        propsString.append(" -Djdo.tck.exclude=" +
+                PropertyUtils.getProperties(excludeFile).getProperty("jdo.tck.exclude"));
+
+        // Create configuration log directory
+        String timestamp = Utilities.now();
+        String thisLogDir = logsDirectory + File.separator + timestamp
+                + File.separator;
+        String cfgDirName = thisLogDir + "configuration";
+        File cfgDir = new File(cfgDirName);
+        if (!(cfgDir.exists()) && !(cfgDir.mkdirs())) {
+            throw new MojoExecutionException("Failed to create directory "
+                    + cfgDirName);
+        }
+        propsString.append(" -Djdo.tck.log.directory=" + thisLogDir);
+
+        // Get ClassLoader URLs to build classpath below
+        URL[] cpURLs = ((URLClassLoader) Thread.currentThread().getContextClassLoader()).getURLs();
+        ArrayList<URL> urlList = new ArrayList<URL>(Arrays.asList(cpURLs));
+
+        for (String db : dbs) {
+            System.setProperty("jdo.tck.database", db);
+            alreadyran = false;
+
+            for (String idtype : idtypes) {
+                propsString.append(" -Djdo.tck.identitytype=" + idtype);
+                String enhancedDirName = buildDirectory + File.separator + "enhanced"
+                        + File.separator + impl + File.separator + idtype + File.separator;
+                File enhancedDir = new File(enhancedDirName);
+                if (!(enhancedDir.exists())) {
+                    throw new MojoExecutionException("Could not find enhanced directory "
+                            + enhancedDirName + ". Execute Enhance goal before RunTCK.");
+                }
+
+                // Set classpath string: add new entries to URLS from loader
+                ArrayList<URL> cpList = urlList;
+                try {
+                    URL url1 = enhancedDir.toURI().toURL();
+                    URL url2 = new File(buildDirectory + File.separator
+                            + "classes" + File.separator).toURI().toURL();
+                    cpList.add(url1);
+                    cpList.add(url2);
+                } catch (MalformedURLException ex) {
+                    ex.printStackTrace();
+                    Logger.getLogger(RunTCK.class.getName()).log(Level.SEVERE, null, ex);
+                }
+                String cpString = Utilities.urls2ClasspathString(cpList);
+                if (runtckVerbose) {
+                    System.out.println("Classpath is " + cpString);
+                }
+
+                for (String cfg : cfgs) {
+
+                    // Parse conf file and set properties String
+                    props = PropertyUtils.getProperties(confDirectory
+                            + File.separator + cfg);
+                    propsString.append(" -Djdo.tck.testdata=" +
+                            props.getProperty("jdo.tck.testdata"));
+                    propsString.append(" -Djdo.tck.standarddata=" +
+                            props.getProperty("jdo.tck.standarddata"));
+//                    propsString.append(" -Djdo.tck.description=\"" +
+//                            props.getProperty("jdo.tck.description") + "\"");
+                    propsString.append(" -Djdo.tck.requiredOptions=" +
+                            props.getProperty("jdo.tck.requiredOptions"));
+                    propsString.append(" -Djdo.tck.signaturefile=" +
+                            signaturefile);
+                    String mapping = props.getProperty("jdo.tck.mapping");
+                    if (mapping == null) {
+                        throw new MojoExecutionException(
+                                "Could not find mapping value in conf file: " + cfg);
+                    }
+                    String classes = props.getProperty("jdo.tck.classes");
+                    if (classes == null) {
+                        throw new MojoExecutionException(
+                                "Could not find classes value in conf file: " + cfg);
+                    }
+
+                    propsString.append(" -Djdo.tck.schemaname=" + idtype + mapping);
+                    propsString.append(" -Djdo.tck.cfg=" + cfg);
+
+                    runonce = props.getProperty("runonce");
+                    runonce = (runonce == null) ? "false" : runonce;
+
+                    // Add Mapping and schemaname to properties file
+                    StringBuffer propsFileData = new StringBuffer();
+                    propsFileData.append("\n### Properties below added by maven goal doRuntck.jdori");
+                    propsFileData.append("\njavax.jdo.mapping.Schema=" + idtype + mapping);
+                    mapping = (mapping.equals("0")) ? "" : mapping;
+                    propsFileData.append("\njavax.jdo.option.Mapping=standard" + mapping);
+                    propsFileData.append("\n");
+                    String pmfPropsFileName = buildDirectory + File.separator
+                            + "classes" + File.separator + pmfProperties;
+                    try {
+                        BufferedWriter out = new BufferedWriter(new FileWriter(pmfPropsFileName, true));
+                        out.write(propsFileData.toString());
+                        out.close();
+                    } catch (IOException ex) {
+                        Logger.getLogger(RunTCK.class.getName()).log(Level.SEVERE, null, ex);
+                    }
+
+                    // build command line string
+                    StringBuffer cmdBuf = new StringBuffer();
+                    cmdBuf.append("java " + " ");
+                    cmdBuf.append("-cp " + cpString + " ");
+                    cmdBuf.append(propsString + " ");
+                    cmdBuf.append(dbproperties + " ");
+                    cmdBuf.append(jvmproperties + " ");
+                    if (debugTCK) {
+                        cmdBuf.append(debugDirectives + " ");
+                    }
+                    cmdBuf.append(testRunnerClass + " ");
+                    cmdBuf.append(classes);
+
+                    // invoke class runner
+                    System.out.println("Starting configuration=" + cfg +
+                            " with database=" + db + " identitytype=" + idtype
+                            + " mapping=" + mapping + " on the " + impl + ".");
+                    if (debugTCK) {
+                        System.out.println("Using debug arguments: \n"
+                                + debugDirectives);
+                    }
+                    if (runonce.equals("true") && alreadyran) {
+                        continue;
+                    }
+                    System.out.println("Command line is: \n" + cmdBuf.toString());
+                    try {
+                        Process proc = Runtime.getRuntime().exec(cmdBuf.toString());
+//                        System.out.println("Err: "
+//                                + Utilities.convertStreamToString(proc.getErrorStream()));
+//                        System.out.println("Out: "
+//                                + Utilities.convertStreamToString(proc.getInputStream()));
+                        try {
+                            proc.waitFor();
+                        } catch (InterruptedException ex) {
+                            Logger.getLogger(RunTCK.class.getName()).log(Level.SEVERE, null, ex);
+                        }
+                    } catch (IOException ex) {
+                        Logger.getLogger(RunTCK.class.getName()).log(Level.SEVERE, null, ex);
+                    }
+                    if (runonce.equals("true")) {
+                        alreadyran = true;
+                    }
+
+
+                    // Output results
+ /*     <goal name="result">
+                    <java fork="yes" dir="${jdo.tck.testdir}"
+                    classname="org.apache.jdo.tck.util.ResultSummary">
+                    <classpath refid="jdori.classpath"/>
+                    <arg line="${jdo.tck.log.directory}/${timestamp}"/>
+                    </java>
+                    <java fork="yes" dir="${jdo.tck.testdir}"
+                    classname="org.apache.jdo.tck.util.SystemCfgSummary">
+                    <classpath refid="jdori.classpath"/>
+                    <arg line="${jdo.tck.log.directory}/${timestamp}/configuration"/>
+                    <arg line="system_config.txt"/>
+                    </java>
+                     */
+
+                    // Copy files to configuration logs directory
+//        <copy todir="${jdo.tck.log.directory}/${timestamp}/configuration">
+//            <fileset dir="${basedir}" includes="*.properties, *.xml"/>
+//            <fileset dir="${basedir}/src/conf" includes="**/*"/>
+//            <fileset dir="${basedir}/src/jdo" includes="**/*.jdo"/>
+//            <fileset dir="${basedir}/src/orm" includes="**/*.orm"/>
+//        </copy>
+
+                }
+            }
+        }
+
+    }
+}

Added: db/jdo/trunk/exectck/src/main/java/org/apache/jdo/exectck/Utilities.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/exectck/src/main/java/org/apache/jdo/exectck/Utilities.java?rev=1039248&view=auto
==============================================================================
--- db/jdo/trunk/exectck/src/main/java/org/apache/jdo/exectck/Utilities.java (added)
+++ db/jdo/trunk/exectck/src/main/java/org/apache/jdo/exectck/Utilities.java Fri Nov 26 04:05:01 2010
@@ -0,0 +1,122 @@
+package org.apache.jdo.exectck;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Calendar;
+
+public class Utilities {
+
+    Utilities() {
+    }
+    
+    public static final String DATE_FORMAT_NOW = "yyyyMMdd-HHmmss";
+
+    /*
+     * Return the current date/time as a String.
+     */
+    public static String now() {
+        Calendar cal = Calendar.getInstance();
+        SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT_NOW);
+        return sdf.format(cal.getTime());
+    }
+
+    /*
+     * From an array of URLs, create a classpath String suitable for use
+     *   as a command line argument
+     */
+    public static String urls2ClasspathString(ArrayList<URL> urls) {
+        StringBuffer cp = new StringBuffer();
+
+        for (URL url: urls) {
+            cp.append(url.getPath());
+            cp.append(File.pathSeparator);
+        }
+        return cp.toString();
+    }
+
+    public static void printClasspath(ClassLoader loader) {
+
+        //Get the URLs
+        URL[] urls = ((URLClassLoader) loader).getURLs();
+
+        System.out.println(urls.length + " URL(s) for loader: ");
+        for (int i = 0; i < urls.length; i++) {
+            System.out.println("    " + urls[i].getFile());
+        }
+
+//        //Get the Context Classloader
+//        loader = Thread.currentThread().getContextClassLoader();
+//
+//        //Get the URLs
+//        urls = ((URLClassLoader)loader).getURLs();
+//
+//        System.out.println(urls.length + "URLs for loader: ");
+//        for(int i=0; i< urls.length; i++)
+//        {
+//            System.out.println("    " + urls[i].getFile());
+//        }
+
+    }
+
+    public void printClasspath() {
+
+        //Get the System Classloader
+        ClassLoader loader = ClassLoader.getSystemClassLoader();
+
+        //Get the URLs
+        URL[] urls = ((URLClassLoader) loader).getURLs();
+
+        for (int i = 0; i < urls.length; i++) {
+            System.out.println("    " + urls[i].getFile());
+        }
+
+        //Get the System Classloader
+        loader = Thread.currentThread().getContextClassLoader();
+
+        //Get the URLs
+        urls = ((URLClassLoader) loader).getURLs();
+
+        for (int i = 0; i < urls.length; i++) {
+            System.out.println("    " + urls[i].getFile());
+        }
+
+    }
+
+    public static String convertStreamToString(InputStream is)
+            throws IOException {
+        /*
+         * To convert the InputStream to String we use the
+         * Reader.read(char[] buffer) method. We iterate until the
+         * Reader return -1 which means there's no more data to
+         * read. We use the StringWriter class to produce the string.
+         */
+        if (is != null) {
+            Writer writer = new StringWriter();
+
+            char[] buffer = new char[1024];
+            try {
+                Reader reader = new BufferedReader(
+                        new InputStreamReader(is, "UTF-8"));
+                int n;
+                while ((n = reader.read(buffer)) != -1) {
+                    writer.write(buffer, 0, n);
+                }
+            } finally {
+                is.close();
+            }
+            return writer.toString();
+        } else {
+            return "";
+        }
+    }
+}