db-jdo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcai...@apache.org
Subject svn commit: r384120 - in /db/jdo/trunk/tck20: maven.xml src/java/org/apache/jdo/tck/util/SystemCfgSummary.java
Date Wed, 08 Mar 2006 04:55:28 GMT
Author: mcaisse
Date: Tue Mar  7 20:55:26 2006
New Revision: 384120

URL: http://svn.apache.org/viewcvs?rev=384120&view=rev
Log:
JDO-300 Log system and jvm version information with test results

Added:
    db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/util/SystemCfgSummary.java
Modified:
    db/jdo/trunk/tck20/maven.xml

Modified: db/jdo/trunk/tck20/maven.xml
URL: http://svn.apache.org/viewcvs/db/jdo/trunk/tck20/maven.xml?rev=384120&r1=384119&r2=384120&view=diff
==============================================================================
--- db/jdo/trunk/tck20/maven.xml (original)
+++ db/jdo/trunk/tck20/maven.xml Tue Mar  7 20:55:26 2006
@@ -90,7 +90,6 @@
         <attainGoal name="setProps"/>
         <attainGoal name="privateInstallSchema"/>
         <attainGoal name="privateRuntck.jdori"/>
-        <attainGoal name="result"/>
     </goal>
 
     <goal name="rebuild">
@@ -254,7 +253,6 @@
     <goal name="runtck.iut" prereqs="setProps">
         <mkdir dir="${jdo.tck.log.directory.database}"/>
         <attainGoal name="privateRuntck.iut"/>
-        <attainGoal name="result"/>
     </goal>
 
     <goal name="privateRuntck.iut"
@@ -286,6 +284,7 @@
                 </j:forEach>
             </j:forEach>
         </j:forEach>
+        <attainGoal name="result"/>
     </goal>
 
     <goal name="debugtck.jdori">
@@ -296,7 +295,6 @@
     <goal name="runtck.jdori" prereqs="setProps">
         <mkdir dir="${jdo.tck.log.directory.database}"/>
         <attainGoal name="privateRuntck.jdori"/>
-        <attainGoal name="result"/>
     </goal>
 
     <goal name="privateRuntck.jdori"
@@ -326,6 +324,7 @@
                 </j:forEach>
             </j:forEach>
         </j:forEach>
+        <attainGoal name="result"/>
     </goal>
 
     <goal name="doRuntck.iut">
@@ -458,6 +457,12 @@
                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"/>

Added: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/util/SystemCfgSummary.java
URL: http://svn.apache.org/viewcvs/db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/util/SystemCfgSummary.java?rev=384120&view=auto
==============================================================================
--- db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/util/SystemCfgSummary.java (added)
+++ db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/util/SystemCfgSummary.java Tue Mar  7 20:55:26
2006
@@ -0,0 +1,94 @@
+/*
+ * Copyright 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.
+ */
+
+package org.apache.jdo.tck.util;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.PrintStream;
+
+import java.util.Enumeration;
+import java.util.Properties;
+
+import javax.jdo.JDOFatalException;
+
+/**
+ * A class to produce a text summary of system configuration information.
+ */
+public class SystemCfgSummary {
+    
+    /** The name of the system configuration summary file. */
+    private static final String SYSCFG_FILE_NAME = "system_config.txt";
+    private static String newLine;
+
+    /**
+     * Creates a new file containing system configuration information.
+     * @param args the first element contains the output directory
+     * @param args the second element contains the file name
+     */
+    public static void main(String[] args) {
+        String directory = args[0] + File.separator;
+        String fileName = null;
+        if (args[1] != null) {
+            fileName = args[1] ;
+        } else {
+            fileName = SYSCFG_FILE_NAME;
+        }
+        newLine = System.getProperty("line.separator");
+        String message = getSystemInfo();
+        if (message == null) {
+            message = "No system information found.";
+        }
+        saveSystemInfo(directory + fileName, message);
+    }
+    
+    /**
+     * Gets system information from System properties
+     * @return System property keys and values as a String, one per line
+     */
+    static String getSystemInfo() {
+        
+        Properties props = System.getProperties();
+        Enumeration propEnum = props.propertyNames();
+        StringBuffer sysinfo = new StringBuffer();
+        while (propEnum.hasMoreElements()) {
+            String key = (String)propEnum.nextElement();
+            sysinfo.append(key + ":  " + props.getProperty(key) + newLine);
+        }
+        return sysinfo.toString();
+    } 
+ 
+    /**
+     * Saves the given message to the system configuration summary file
+     *   in the given directory. 
+     * @param directory the directory
+     * @param message the message
+     */
+    static void saveSystemInfo(String path, String message) {
+        PrintStream resultStream = null;
+        try {
+            resultStream = new PrintStream(
+                    new FileOutputStream(path, true));
+            resultStream.println(message);
+        } catch (FileNotFoundException e) {
+            throw new JDOFatalException("Cannot create file " + path, e);
+        } finally {
+            if (resultStream != null)
+                resultStream.close();
+        }
+    }
+}



Mime
View raw message