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