Index: maven.xml
===================================================================
--- maven.xml (revision 382958)
+++ maven.xml (working copy)
@@ -90,7 +90,6 @@
-
@@ -254,7 +253,6 @@
-
+
@@ -296,7 +295,6 @@
-
+
@@ -458,6 +457,11 @@
classname="org.apache.jdo.tck.util.ResultSummary">
+
+
+
+
Index: src/java/org/apache/jdo/tck/util/SystemCfgSummary.java
===================================================================
--- src/java/org/apache/jdo/tck/util/SystemCfgSummary.java (revision 0)
+++ src/java/org/apache/jdo/tck/util/SystemCfgSummary.java (revision 0)
@@ -0,0 +1,88 @@
+/*
+ * 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
+ */
+ public static void main(String[] args) {
+ String directory = args[0] + File.separator;
+ newLine = System.getProperty("line.separator");
+ String message = getSystemInfo();
+ if (message == null) {
+ message = "No system information found.";
+ }
+ saveSystemInfo(directory, 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 directory, String message) {
+ String fileName = directory + SYSCFG_FILE_NAME;
+ PrintStream resultStream = null;
+ try {
+ resultStream = new PrintStream(
+ new FileOutputStream(fileName, true));
+ resultStream.println(message);
+ } catch (FileNotFoundException e) {
+ throw new JDOFatalException("Cannot create file " + fileName, e);
+ } finally {
+ if (resultStream != null)
+ resultStream.close();
+ }
+ }
+}