2 *******************************************************************************
\r
3 * Copyright (C) 2001-2009, International Business Machines Corporation and *
\r
4 * others. All Rights Reserved. *
\r
5 *******************************************************************************
\r
7 package com.ibm.icu.dev.test;
\r
9 import java.util.Iterator;
\r
12 * Represents a collection of test data described in a file.
\r
15 public interface TestDataModule {
\r
17 * Return the name of this test data module.
\r
19 public String getName();
\r
22 * Get additional data related to the module, e.g. DESCRIPTION,
\r
23 * global settings. Might be null.
\r
25 public DataMap getInfo();
\r
28 * Returns the TestData corresponding to name, or null if name not
\r
29 * found in this module. Throw error if name is not found.
\r
30 * @throws DataModuleFormatError
\r
32 public TestData getTestData(String name) throws DataModuleFormatError;
\r
35 * @return Iterator<TestData>
\r
37 public Iterator getTestDataIterator();
\r
39 public static class Factory{
\r
41 static final TestDataModule get(String baseName, String localeName) throws DataModuleFormatError {
\r
42 return new ResourceModule(baseName, localeName);
\r
46 public static class DataModuleFormatError extends Exception{
\r
50 private static final long serialVersionUID = 4312521272388482529L;
\r
51 public DataModuleFormatError(String msg){
\r
54 public DataModuleFormatError(String msg, Throwable cause){
\r
57 public DataModuleFormatError(Throwable cause) {
\r
63 * Represents a single test in the module.
\r
65 public static interface TestData {
\r
66 public String getName();
\r
68 * Get additional data related to the test data, e.g. DESCRIPTION,
\r
69 * global settings. Might be null.
\r
71 public DataMap getInfo();
\r
73 * @return Iterator<DataMap>
\r
75 public Iterator getSettingsIterator();
\r
77 * @return Iterator<DataMap>
\r
79 public Iterator getDataIterator();
\r
83 * Map-like interface for accessing key-value pairs by key.
\r
84 * If the vaule is not found by given key, return null.
\r
85 * The behavior is analogous the get() method of the Map interface.
\r
87 * @author Raymond Yang
\r
89 public interface DataMap {
\r
90 // public abstract boolean isDefined(String key);
\r
92 public abstract Object getObject(String key);
\r
93 public abstract String getString(String key);
\r
94 // public abstract char getChar(String key);
\r
95 // public abstract int getInt(String key);
\r
96 // public abstract byte getByte(String key);
\r
97 // public abstract boolean getBoolean(String key);
\r
99 // public abstract Object[] getObjectArray(String key);
\r
100 // public abstract String[] getStringArray(String key);
\r
101 // public abstract char[] getCharArray(String key);
\r
102 // public abstract int[] getIntArray(String key);
\r
103 // public abstract byte[] getByteArray(String key);
\r
104 // public abstract boolean[] getBooleanArray(String key);
\r