diff options
author | Noel Grandin <noel@peralex.com> | 2012-06-27 15:20:39 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2012-06-29 22:03:00 +0200 |
commit | 33ec740d1438c3dddf8e1974757ed05bb76425ca (patch) | |
tree | 37868edd825fe8f3777a077549e61f1379da7cd3 /qadevOOo/runner | |
parent | Java5 update - convert Vector to ArrayList (diff) | |
download | core-33ec740d1438c3dddf8e1974757ed05bb76425ca.tar.gz core-33ec740d1438c3dddf8e1974757ed05bb76425ca.zip |
Java5 update - Convert Hashtable to HashMap
Change-Id: Ibb568e841ff574d5232429ce0ba99e421ed7f05c
Diffstat (limited to 'qadevOOo/runner')
-rw-r--r-- | qadevOOo/runner/helper/CfgParser.java | 18 | ||||
-rw-r--r-- | qadevOOo/runner/lib/Parameters.java | 6 | ||||
-rw-r--r-- | qadevOOo/runner/lib/TestEnvironment.java | 4 | ||||
-rw-r--r-- | qadevOOo/runner/lib/TestParameters.java | 8 | ||||
-rw-r--r-- | qadevOOo/runner/lib/TestResult.java | 4 | ||||
-rw-r--r-- | qadevOOo/runner/org/openoffice/Runner.java | 13 | ||||
-rw-r--r-- | qadevOOo/runner/share/DescEntry.java | 2 | ||||
-rw-r--r-- | qadevOOo/runner/stats/ComplexDataBaseOutProducer.java | 4 | ||||
-rw-r--r-- | qadevOOo/runner/stats/DataBaseOutProducer.java | 18 | ||||
-rw-r--r-- | qadevOOo/runner/stats/FatDataBaseOutProducer.java | 4 | ||||
-rw-r--r-- | qadevOOo/runner/stats/OutProducerFactory.java | 10 | ||||
-rw-r--r-- | qadevOOo/runner/stats/SQLExecution.java | 26 | ||||
-rw-r--r-- | qadevOOo/runner/util/SOfficeFactory.java | 4 |
13 files changed, 64 insertions, 57 deletions
diff --git a/qadevOOo/runner/helper/CfgParser.java b/qadevOOo/runner/helper/CfgParser.java index 27a72e55313b..880bf737e2d5 100644 --- a/qadevOOo/runner/helper/CfgParser.java +++ b/qadevOOo/runner/helper/CfgParser.java @@ -17,10 +17,12 @@ */ package helper; -import lib.TestParameters; -import java.util.Properties; -import java.util.Enumeration; import java.io.FileInputStream; +import java.util.Enumeration; +import java.util.Iterator; +import java.util.Properties; + +import lib.TestParameters; import util.PropertyName; /** @@ -94,18 +96,18 @@ public class CfgParser debug = param.DebugIsActive; - //check for platform dependend parameters + //check for platform dependent parameters //this would have a $OperatingSystem as prefix String os = (String) param.get(PropertyName.OPERATING_SYSTEM); if (os != null && os.length() > 1) { - //found something that could be a prefex + //found something that could be a prefix //check all parameters for this - Enumeration keys = param.keys(); - while (keys.hasMoreElements()) + Iterator keys = param.keySet().iterator(); + while (keys.hasNext()) { - String key = (String) keys.nextElement(); + String key = (String) keys.next(); if (key.startsWith(os)) { Object oldValue = param.get(key); diff --git a/qadevOOo/runner/lib/Parameters.java b/qadevOOo/runner/lib/Parameters.java index 07d109e7a5ce..9f0a7e58108d 100644 --- a/qadevOOo/runner/lib/Parameters.java +++ b/qadevOOo/runner/lib/Parameters.java @@ -19,7 +19,7 @@ package lib; import java.util.Iterator; -import java.util.Hashtable; +import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; @@ -149,7 +149,7 @@ public class Parameters implements XPropertySet { } public Map toMap() { - return new Hashtable(parameters) { + return new HashMap(parameters) { public Object get(Object obj) { if (obj instanceof String) { return Parameters.this.get((String) obj); @@ -199,7 +199,7 @@ public class Parameters implements XPropertySet { } public static Map toMap(XPropertySet props) { - Hashtable result = new Hashtable(10); + HashMap result = new HashMap(10); XPropertySetInfo setInfo = props.getPropertySetInfo(); Property[] properties = setInfo.getProperties(); diff --git a/qadevOOo/runner/lib/TestEnvironment.java b/qadevOOo/runner/lib/TestEnvironment.java index 1bc9cd10a2f8..e88c90e3c0f3 100644 --- a/qadevOOo/runner/lib/TestEnvironment.java +++ b/qadevOOo/runner/lib/TestEnvironment.java @@ -19,7 +19,7 @@ package lib; import com.sun.star.uno.XInterface; -import java.util.Hashtable; +import java.util.HashMap; /** @@ -34,7 +34,7 @@ public final class TestEnvironment { * Contains object relations - auxiliary objects associated with the * tested object and required for testing. */ - private final Hashtable relations = new Hashtable(10); + private final HashMap relations = new HashMap(10); /** * An instance of the tested implementation object. diff --git a/qadevOOo/runner/lib/TestParameters.java b/qadevOOo/runner/lib/TestParameters.java index 79bc75308ee1..8849e2816474 100644 --- a/qadevOOo/runner/lib/TestParameters.java +++ b/qadevOOo/runner/lib/TestParameters.java @@ -18,7 +18,7 @@ package lib; -import java.util.Hashtable; +import java.util.HashMap; import util.PropertyName; import com.sun.star.beans.XPropertySet; import com.sun.star.uno.XComponentContext; @@ -31,7 +31,7 @@ import com.sun.star.uno.XComponentContext; * for example, standard paths, connection strings, etc. The TestParameters * also provides XMultiServiceFactory for the test (tests). */ -public class TestParameters extends Hashtable { +public class TestParameters extends HashMap { /** * The ConnectionString for Office Connection<br> @@ -167,7 +167,7 @@ public class TestParameters extends Hashtable { * Wraper around "get()" with some debug output * @param key A key of this table. * @return The value of this key. - * @see java.util.Hashtable + * @see java.util.HashMap */ public Object get(Object key) { Object val = super.get(key); @@ -234,7 +234,7 @@ public class TestParameters extends Hashtable { * @param key A key of this table. * @param val The value of the key. * @return The value of this key. - * @see java.util.Hashtable + * @see java.util.HashMap */ public Object put(Object key, Object val) { return super.put(key,val); diff --git a/qadevOOo/runner/lib/TestResult.java b/qadevOOo/runner/lib/TestResult.java index f95e5d3e7cf7..e49aaa6224b3 100644 --- a/qadevOOo/runner/lib/TestResult.java +++ b/qadevOOo/runner/lib/TestResult.java @@ -18,7 +18,7 @@ package lib; -import java.util.Hashtable; +import java.util.HashMap; /** * The class supports interface tests development and Status calculation. @@ -27,7 +27,7 @@ public class TestResult { /** * Contains methods having been tested and their results. */ - protected Hashtable testedMethods = new Hashtable(); + protected HashMap testedMethods = new HashMap(); /** * The method makes method tested with the result, i.e. it adds to its diff --git a/qadevOOo/runner/org/openoffice/Runner.java b/qadevOOo/runner/org/openoffice/Runner.java index 57b624cf86e9..17a5e209d2af 100644 --- a/qadevOOo/runner/org/openoffice/Runner.java +++ b/qadevOOo/runner/org/openoffice/Runner.java @@ -17,14 +17,17 @@ */ package org.openoffice; +import helper.CfgParser; +import helper.ClParser; + import java.util.Enumeration; +import java.util.Iterator; import java.util.Properties; import java.util.StringTokenizer; + import lib.TestParameters; import util.DynamicClassLoader; import base.TestBase; -import helper.ClParser; -import helper.CfgParser; /** * The main class, will call ClParser and CfgParser to <br> @@ -151,10 +154,10 @@ public class Runner bEmergencyStop |= checkPathVariable("sun.boot.class.path", sDelim); // ----- check all TestParameters ----- - aEnum = _aParams.keys(); - while (aEnum.hasMoreElements()) + Iterator aIter = _aParams.keySet().iterator(); + while (aIter.hasNext()) { - String sKey = (String) aEnum.nextElement(); + String sKey = (String) aIter.next(); if (_aParams.get(sKey) instanceof String) { String sValue = (String) _aParams.get(sKey); diff --git a/qadevOOo/runner/share/DescEntry.java b/qadevOOo/runner/share/DescEntry.java index 918eeb2941da..12ef1c35dbfd 100644 --- a/qadevOOo/runner/share/DescEntry.java +++ b/qadevOOo/runner/share/DescEntry.java @@ -83,6 +83,6 @@ public class DescEntry { * Contains an arbitrary set of parameters */ - public java.util.Hashtable UserDefinedParams = new java.util.Hashtable(); + public java.util.HashMap UserDefinedParams = new java.util.HashMap(); } diff --git a/qadevOOo/runner/stats/ComplexDataBaseOutProducer.java b/qadevOOo/runner/stats/ComplexDataBaseOutProducer.java index bb7bf2a85b28..a64e6f3cbc35 100644 --- a/qadevOOo/runner/stats/ComplexDataBaseOutProducer.java +++ b/qadevOOo/runner/stats/ComplexDataBaseOutProducer.java @@ -19,7 +19,7 @@ package stats; import share.LogWriter; import java.text.DecimalFormat; -import java.util.Hashtable; +import java.util.HashMap; import java.util.Calendar; import java.util.GregorianCalendar; @@ -30,7 +30,7 @@ import java.util.GregorianCalendar; public class ComplexDataBaseOutProducer extends DataBaseOutProducer { /** Creates a new instance of ComplexDataBaseOutProducer */ - public ComplexDataBaseOutProducer(Hashtable param) { + public ComplexDataBaseOutProducer(HashMap param) { super(param); // do we have to write debug output? Object o = param.get("DebugIsActive"); diff --git a/qadevOOo/runner/stats/DataBaseOutProducer.java b/qadevOOo/runner/stats/DataBaseOutProducer.java index 381f207904f0..e0b8e172098d 100644 --- a/qadevOOo/runner/stats/DataBaseOutProducer.java +++ b/qadevOOo/runner/stats/DataBaseOutProducer.java @@ -20,25 +20,25 @@ package stats; import share.LogWriter; import share.DescEntry; -import java.util.Hashtable; +import java.util.HashMap; /** * * @author sg128468 */ public abstract class DataBaseOutProducer implements LogWriter { - protected Hashtable mSqlInput = null; - protected Hashtable mSqlOutput = null; + protected HashMap mSqlInput = null; + protected HashMap mSqlOutput = null; protected String[] mWriteableEntryTypes = null; protected SQLExecution mSqlExec; protected boolean m_bDebug = false; /** Creates a new instance of DataBaseOutProducer - * @param param The Hashtable with test parameters + * @param param The HashMap with test parameters */ - public DataBaseOutProducer(Hashtable param) { - mSqlInput = new Hashtable(); + public DataBaseOutProducer(HashMap param) { + mSqlInput = new HashMap(); mSqlInput.putAll(param); Object o = param.get("DebugIsActive"); @@ -118,10 +118,10 @@ public abstract class DataBaseOutProducer implements LogWriter { * @param log The log writer. */ protected boolean insertEntry(DescEntry entry, LogWriter log) { - // copy the swlInput Hashtable, so it can be reset easily for the next run - Hashtable copySqlInput = new Hashtable(); + // copy the swlInput HashMap, so it can be reset easily for the next run + HashMap copySqlInput = new HashMap(); copySqlInput.putAll(mSqlInput); - // put some stuff from entry in the Hashtable + // put some stuff from entry in the HashMap mSqlInput.put("EntryLongName", entry.longName); mSqlInput.put("EntryName", entry.entryName); mSqlInput.put("EntryState", entry.State); diff --git a/qadevOOo/runner/stats/FatDataBaseOutProducer.java b/qadevOOo/runner/stats/FatDataBaseOutProducer.java index f54019226d93..88981f738247 100644 --- a/qadevOOo/runner/stats/FatDataBaseOutProducer.java +++ b/qadevOOo/runner/stats/FatDataBaseOutProducer.java @@ -19,7 +19,7 @@ package stats; import java.text.DecimalFormat; import share.LogWriter; -import java.util.Hashtable; +import java.util.HashMap; import java.util.Calendar; import java.util.GregorianCalendar; @@ -31,7 +31,7 @@ public class FatDataBaseOutProducer extends DataBaseOutProducer { /** Creates a new instance of APIDataBaseOutProducer */ - public FatDataBaseOutProducer(Hashtable param) { + public FatDataBaseOutProducer(HashMap param) { super(param); String testBase = (String)mSqlInput.get("TestBase"); int sep = testBase.indexOf('_'); diff --git a/qadevOOo/runner/stats/OutProducerFactory.java b/qadevOOo/runner/stats/OutProducerFactory.java index 1b2fe08cffa6..ffdac13b37a6 100644 --- a/qadevOOo/runner/stats/OutProducerFactory.java +++ b/qadevOOo/runner/stats/OutProducerFactory.java @@ -18,7 +18,7 @@ package stats; import share.LogWriter; -import java.util.Hashtable; +import java.util.HashMap; import util.DynamicClassLoader; /** @@ -36,7 +36,7 @@ public class OutProducerFactory { * @param Parameters of the test. * @return The created out producer. */ - public static LogWriter createOutProducer(Hashtable param) { + public static LogWriter createOutProducer(HashMap param) { LogWriter dbOut = null; boolean getDatabase = convertToBool(param.get("DataBaseOut")); if (getDatabase) { @@ -61,11 +61,11 @@ public class OutProducerFactory { } /** - * Create a databbase out producer. + * Create a database out producer. * @param The test parameters * @return The database out producer, or null if it couldn't be created. */ - public static LogWriter createDataBaseOutProducer(Hashtable param) { + public static LogWriter createDataBaseOutProducer(HashMap param) { String dataProducerName = (String)param.get("DataBaseOutProducer"); if (dataProducerName == null) { String testBaseName = (String)param.get("TestBase"); @@ -77,7 +77,7 @@ public class OutProducerFactory { LogWriter dbOut = null; try { dbOut = (LogWriter)dcl.getInstance(dataProducerName, - new Class[]{new Hashtable().getClass()}, new Object[]{param}); + new Class[]{new HashMap().getClass()}, new Object[]{param}); } catch(IllegalArgumentException e) { e.printStackTrace(); diff --git a/qadevOOo/runner/stats/SQLExecution.java b/qadevOOo/runner/stats/SQLExecution.java index b817ce25af9b..6fcab9ee84a0 100644 --- a/qadevOOo/runner/stats/SQLExecution.java +++ b/qadevOOo/runner/stats/SQLExecution.java @@ -24,7 +24,9 @@ import java.sql.ResultSetMetaData; import java.sql.Statement; import java.util.ArrayList; import java.util.Enumeration; +import java.util.HashMap; import java.util.Hashtable; +import java.util.Iterator; import java.util.StringTokenizer; /** @@ -120,10 +122,10 @@ public class SQLExecution { * Execute an sql command. * @param command The command to execute. * @param sqlInput Input values for the command. - * @param sqlOutput The results of the command are put in this Hashtable. + * @param sqlOutput The results of the command are put in this HashMap. * @return True, if no error occurred. */ - public boolean executeSQLCommand(String command, Hashtable sqlInput, Hashtable sqlOutput) + public boolean executeSQLCommand(String command, HashMap sqlInput, HashMap sqlOutput) throws IllegalArgumentException { return executeSQLCommand(command, sqlInput, sqlOutput, false); } @@ -132,15 +134,15 @@ public class SQLExecution { * Execute an sql command. * @param command The command to execute. * @param sqlInput Input values for the command. - * @param sqlOutput The results of the command are put in this Hashtable. + * @param sqlOutput The results of the command are put in this HashMap. * @param mergeOutputIntoInput The output of the result is put into the - * sqlInput Hashtable. + * sqlInput HashMap. * @return True, if no error occurred. */ - public boolean executeSQLCommand(String command, Hashtable sqlInput, Hashtable sqlOutput, boolean mergeOutputIntoInput) + public boolean executeSQLCommand(String command, HashMap sqlInput, HashMap sqlOutput, boolean mergeOutputIntoInput) throws IllegalArgumentException { if (sqlOutput == null) { - sqlOutput = new Hashtable(); + sqlOutput = new HashMap(); // this has to be true, so the user of this method gets a return mergeOutputIntoInput = true; if (sqlInput == null) { @@ -229,9 +231,9 @@ public class SQLExecution { execute((String)sqlCommand.get(i), sqlOutput, update); // merge output with input if (!update && mergeOutputIntoInput) { - Enumeration keys = sqlOutput.keys(); - while(keys.hasMoreElements()) { - String key = (String)keys.nextElement(); + Iterator keys = sqlOutput.keySet().iterator(); + while(keys.hasNext()) { + String key = (String)keys.next(); String[]val = (String[])sqlOutput.get(key); if (val != null && val.length != 0) { if (val.length == 1) @@ -252,9 +254,9 @@ public class SQLExecution { * @param command The command. * @param update If true, it is a update/alter command instead of an select * command - * @return A Hashtable with the result. + * @return A HashMap with the result. */ - private void execute(String command, Hashtable output, boolean update) { + private void execute(String command, HashMap output, boolean update) { if (m_bDebug) System.out.println("Debug - SQLExecution - execute Command: " + command); try { @@ -287,7 +289,7 @@ public class SQLExecution { if (goThroughRowsTheFirstTime) goThroughRowsTheFirstTime = false; - // put result in output Hashtable + // put result in output HashMap String[]s = new String[countRows]; s = (String[])v.toArray(s); output.put(columnNames[i-1], s); diff --git a/qadevOOo/runner/util/SOfficeFactory.java b/qadevOOo/runner/util/SOfficeFactory.java index becb92dcc190..27398b2f486e 100644 --- a/qadevOOo/runner/util/SOfficeFactory.java +++ b/qadevOOo/runner/util/SOfficeFactory.java @@ -17,7 +17,7 @@ */ package util; -import java.util.Hashtable; +import java.util.HashMap; // access the implementations via names import com.sun.star.uno.XInterface; import com.sun.star.lang.XMultiServiceFactory; @@ -44,7 +44,7 @@ import com.sun.star.awt.*; public class SOfficeFactory { - private static Hashtable lookup = new Hashtable(10); + private static HashMap lookup = new HashMap(10); protected XComponentLoader oCLoader; private SOfficeFactory(XMultiServiceFactory xMSF) { |