3 *******************************************************************************
\r
4 * Copyright (C) 2001-2009, International Business Machines Corporation and *
\r
5 * others. All Rights Reserved. *
\r
6 *******************************************************************************
\r
8 package com.ibm.icu.dev.test;
\r
10 import java.util.Iterator;
\r
13 * Represents a collection of test data described in a file.
\r
16 public interface TestDataModule {
\r
18 * Return the name of this test data module.
\r
20 public String getName();
\r
23 * Get additional data related to the module, e.g. DESCRIPTION,
\r
24 * global settings. Might be null.
\r
26 public DataMap getInfo();
\r
29 * Returns the TestData corresponding to name, or null if name not
\r
30 * found in this module. Throw error if name is not found.
\r
31 * @throws DataModuleFormatError
\r
33 public TestData getTestData(String name) throws DataModuleFormatError;
\r
36 * @return Iterator<TestData>
\r
38 public Iterator getTestDataIterator();
\r
40 public static class Factory{
\r
42 static final TestDataModule get(String baseName, String localeName) throws DataModuleFormatError {
\r
43 return new ResourceModule(baseName, localeName);
\r
47 public static class DataModuleFormatError extends Exception{
\r
51 private static final long serialVersionUID = 4312521272388482529L;
\r
52 public DataModuleFormatError(String msg){
\r
55 //#if defined(FOUNDATION10) || defined(J2SE13)
\r
57 public DataModuleFormatError(String msg, Throwable cause){
\r
60 public DataModuleFormatError(Throwable cause) {
\r
67 * Represents a single test in the module.
\r
69 public static interface TestData {
\r
70 public String getName();
\r
72 * Get additional data related to the test data, e.g. DESCRIPTION,
\r
73 * global settings. Might be null.
\r
75 public DataMap getInfo();
\r
77 * @return Iterator<DataMap>
\r
79 public Iterator getSettingsIterator();
\r
81 * @return Iterator<DataMap>
\r
83 public Iterator getDataIterator();
\r
87 * Map-like interface for accessing key-value pairs by key.
\r
88 * If the vaule is not found by given key, return null.
\r
89 * The behavior is analogous the get() method of the Map interface.
\r
91 * @author Raymond Yang
\r
93 public interface DataMap {
\r
94 // public abstract boolean isDefined(String key);
\r
96 public abstract Object getObject(String key);
\r
97 public abstract String getString(String key);
\r
98 // public abstract char getChar(String key);
\r
99 // public abstract int getInt(String key);
\r
100 // public abstract byte getByte(String key);
\r
101 // public abstract boolean getBoolean(String key);
\r
103 // public abstract Object[] getObjectArray(String key);
\r
104 // public abstract String[] getStringArray(String key);
\r
105 // public abstract char[] getCharArray(String key);
\r
106 // public abstract int[] getIntArray(String key);
\r
107 // public abstract byte[] getByteArray(String key);
\r
108 // public abstract boolean[] getBooleanArray(String key);
\r