Kaydet (Commit) 33ec740d authored tarafından Noel Grandin's avatar Noel Grandin Kaydeden (comit) Michael Stahl

Java5 update - Convert Hashtable to HashMap

Change-Id: Ibb568e841ff574d5232429ce0ba99e421ed7f05c
üst 10dd7e74
......@@ -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);
......
......@@ -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();
......
......@@ -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.
......
......@@ -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);
......
......@@ -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
......
......@@ -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);
......
......@@ -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();
}
......@@ -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");
......
......@@ -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);
......
......@@ -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('_');
......
......@@ -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();
......
......@@ -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);
......
......@@ -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) {
......
......@@ -18,17 +18,19 @@
package ifc.style;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
import lib.MultiPropertyTest;
import util.ValueChanger;
import util.utils;
import com.sun.star.beans.XPropertySet;
import com.sun.star.container.XNameContainer;
import com.sun.star.uno.AnyConverter;
import com.sun.star.uno.Type;
import com.sun.star.xml.AttributeData;
import java.util.Enumeration;
import java.util.Hashtable;
import lib.MultiPropertyTest;
import util.ValueChanger;
import util.utils;
/**
......@@ -481,11 +483,11 @@ public class _CharacterProperties extends MultiPropertyTest {
}
private class OwnUserDefinedAttributes implements XNameContainer{
Hashtable members = null;
HashMap members = null;
public OwnUserDefinedAttributes() {
members = new Hashtable();
members = new HashMap();
}
public Object getByName(String str) throws com.sun.star.container.NoSuchElementException, com.sun.star.lang.WrappedTargetException {
......@@ -493,18 +495,18 @@ public class _CharacterProperties extends MultiPropertyTest {
}
public String[] getElementNames() {
Enumeration oEnum = members.keys();
Iterator oEnum = members.keySet().iterator();
int count = members.size();
String[] res = new String[count];
int i=0;
while(oEnum.hasMoreElements())
res[i] = (String)oEnum.nextElement();
while(oEnum.hasNext())
res[i++] = (String)oEnum.next();
return res;
}
public com.sun.star.uno.Type getElementType() {
Enumeration oEnum = members.keys();
String key = (String)oEnum.nextElement();
Iterator oEnum = members.keySet().iterator();
String key = (String)oEnum.next();
Object o = members.get(key);
return new Type(o.getClass());
}
......
......@@ -18,7 +18,7 @@
package ifc.system;
import java.util.Hashtable;
import java.util.Map;
import lib.MultiMethodTest;
import lib.Status;
......@@ -30,7 +30,7 @@ import com.sun.star.system.XProxySettings;
* Tests <code>com.sun.star.system.XProxySettings</code> interface. The result
* of each method is compared with expected settings which is specified by the
* caller of the tests via object relation "XProxySettings.proxaSettings". That
* should be a Hashtable containing the following keys:
* should be a HashMap containing the following keys:
* <ul>
* <li>ftpProxyAddress</li>
* <li>ftpProxyPort</li>
......@@ -54,10 +54,10 @@ public class _XProxySettings extends MultiMethodTest {
public XProxySettings oObj;
/**
* Contains a Hashtable with correct results of the tested methods. See
* Contains a HashMap with correct results of the tested methods. See
* the class description.
*/
Hashtable expectedProxies;
Map expectedProxies;
/**
* Checks that the "XProxySettings.proxySettings" object relation is
......@@ -68,7 +68,7 @@ public class _XProxySettings extends MultiMethodTest {
* @see #expectedProxies
*/
public void before() {
expectedProxies = (Hashtable)tEnv.getObjRelation(
expectedProxies = (Map)tEnv.getObjRelation(
"XProxySettings.proxySettings");
if (expectedProxies == null) {
......
......@@ -18,13 +18,15 @@
package ifc.text;
import com.sun.star.beans.PropertyValue;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.HashMap;
import java.util.Iterator;
import lib.StatusException;
import lib.TestParameters;
import share.LogWriter;
import com.sun.star.beans.PropertyValue;
/**
* Testing <code>com.sun.star.text.NumberingLevel</code><p>
......@@ -63,7 +65,7 @@ import share.LogWriter;
public class _NumberingLevel {
private static TestParameters tParam = null;
private static Hashtable NumberingLevel = new Hashtable();
private static HashMap NumberingLevel = new HashMap();
private static PropertyValue[] PropertyArray = null;
private static LogWriter log = null;
......@@ -137,8 +139,8 @@ public class _NumberingLevel {
// get rest of properties and check if they are optional
if (! NumberingLevel.isEmpty()){
for (Enumeration e = NumberingLevel.keys() ; e.hasMoreElements() ;) {
String property = (String) e.nextElement();
for (Iterator e = NumberingLevel.keySet().iterator() ; e.hasNext() ;) {
String property = (String) e.next();
// if some elements are not optional -> failed
if ( ! ((Boolean)NumberingLevel.get(property)).booleanValue() ){
......
......@@ -19,7 +19,7 @@
package mod._proxyset;
import java.io.PrintWriter;
import java.util.Hashtable;
import java.util.HashMap;
import lib.StatusException;
import lib.TestCase;
......@@ -60,7 +60,7 @@ public class SOffice52ProxySettings extends TestCase {
* <ul>
* <li> <code>'XProxySettings.proxySettings'</code> for
* {@link ifc.system._XProxySettings} : </li>
* <p>It passes a Hashtable with expected proxy settings as object
* <p>It passes a HashMap with expected proxy settings as object
* relation "XProxySettings.proxySettings", to verify results. The expected
* settings are taken from parameters. The following parameters are recognized:
* <ul>
......@@ -96,7 +96,7 @@ public class SOffice52ProxySettings extends TestCase {
TestEnvironment tEnv = new TestEnvironment(oObj);
// extracting parameters to proxy settings
Hashtable proxySettings = new Hashtable(12);
HashMap proxySettings = new HashMap(12);
String prefix = "test.proxy.soffice52.";
......
......@@ -19,7 +19,7 @@
package mod._proxyset;
import java.io.PrintWriter;
import java.util.Hashtable;
import java.util.HashMap;
import lib.TestCase;
import lib.TestEnvironment;
......@@ -59,7 +59,7 @@ public class SystemProxySettings extends TestCase {
* <ul>
* <li> <code>'XProxySettings.proxySettings'</code> for
* {@link ifc.system._XProxySettings} : </li>
* <p>It passes a Hashtable with expected proxy settings as object
* <p>It passes a HashMap with expected proxy settings as object
* relation "XProxySettings.proxySettings", to verify results. The expected
* settings are taken from parameters. The following parameters are recognized:
* <ul>
......@@ -98,7 +98,7 @@ public class SystemProxySettings extends TestCase {
TestEnvironment tEnv = new TestEnvironment( oObj );
// extracting parameters to proxy settings
Hashtable proxySettings = new Hashtable(12);
HashMap proxySettings = new HashMap(12);
String prefix = "test.proxy.system.";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment