1 package org.ocltf.test;
2
3 import java.net.URL;
4 import java.util.HashMap;
5 import java.util.Map;
6
7
8 /***
9 * Represents a TranslatorTest object loaded and
10 * executed by the ExpressionTranslatorTest object.
11 *
12 * @author Chad Brandon
13 */
14 public class TranslationTest {
15
16 private String translation;
17 private Map expressionConfigs = new HashMap();
18 private URL uri;
19
20 /***
21 * Sets the name of the translator for which this TranslationTest
22 * will be used to test.
23 *
24 * @param translation the name .ocltf.the translation to test.
25 */
26 public void setTranslation(String translation) {
27 this.translation = translation;
28 }
29
30 /***
31 * Returns the name of the translator, for which
32 * this TranslationTest will be used to test.
33 *
34 * @return String
35 */
36 public String getTranslation() {
37 String methodName = "getTranslation";
38 if(this.translation == null) {
39 throw new TranslationTestProcessorException(methodName
40 + " - translation can not be null");
41 }
42 return this.translation;
43 }
44
45 /***
46 * Adds an ExpressionTest to this TranslationTest.
47 *
48 * @param config a ExpressionTest instance.
49 */
50 public void addExpression(ExpressionTest config) {
51 this.expressionConfigs.put(config.getFrom(), config);
52 }
53
54 /***
55 * Returns all the ExpressionTest objects
56 * in a Map keyed by the from element body.
57 *
58 * @return Map
59 */
60 public Map getExpressionConfigs() {
61 return this.expressionConfigs;
62 }
63
64 /***
65 * Gets the URI for the test which this TranslationTest was loaded from.
66 *
67 * @return Returns the uri.
68 */
69 public URL getUri() {
70 return uri;
71 }
72
73 /***
74 * Sets the URI for the test which this TranslationTest was loaded from.
75 *
76 * @param uri The uri to set.
77 */
78 protected void setUri(URL uri) {
79 this.uri = uri;
80 }
81
82 }