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