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