-/*\r
- * Copyright (C) 2007-2012 Argeo GmbH\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package org.argeo.slc.core.execution.tasks;\r
-\r
-import org.argeo.slc.SlcException;\r
-import org.argeo.slc.core.test.context.SimpleContextAware;\r
-import org.argeo.slc.test.context.ContextAware;\r
-\r
-/**\r
- * Overrides Values and Expected values of a target \r
- * <code>SimpleContextAware</code> with the corresponding\r
- * values and expected values of a source <code>ContextAware</code>\r
- *\r
- */\r
-public class OverrideContextAware implements Runnable {\r
-\r
- private ContextAware source;\r
-\r
- private SimpleContextAware target;\r
- \r
- /**\r
- * Whether an exception shall be thrown if a value\r
- * or expected value of the source is not defined\r
- * in the target\r
- */\r
- private Boolean failIfUndefinedInSource = true;\r
- \r
- public void run() {\r
- // override values\r
- if(source.getValues() != null)\r
- for(String key : source.getValues().keySet()) {\r
- if(failIfUndefinedInSource && !target.getValues().containsKey(key)) {\r
- throw new SlcException("No entry in target values for key '" + key + "'");\r
- }\r
- target.getValues().put(key, source.getValues().get(key));\r
- }\r
- \r
- // override expected values\r
- if(source.getExpectedValues() != null)\r
- for(String key : source.getExpectedValues().keySet()) {\r
- if(failIfUndefinedInSource && !target.getExpectedValues().containsKey(key)) {\r
- throw new SlcException("No entry in target expected values for key '" + key + "'");\r
- }\r
- target.getExpectedValues().put(key, source.getExpectedValues().get(key));\r
- } \r
- } \r
- \r
- public void setSource(ContextAware source) {\r
- this.source = source;\r
- }\r
-\r
- public void setTarget(SimpleContextAware target) {\r
- this.target = target;\r
- }\r
-\r
- public void setFailIfUndefinedInSource(Boolean failIfUndefinedInSource) {\r
- this.failIfUndefinedInSource = failIfUndefinedInSource;\r
- } \r
-}\r
+package org.argeo.slc.core.execution.tasks;
+
+import org.argeo.slc.SlcException;
+import org.argeo.slc.core.test.context.SimpleContextAware;
+import org.argeo.slc.test.context.ContextAware;
+
+/**
+ * Overrides Values and Expected values of a target
+ * <code>SimpleContextAware</code> with the corresponding
+ * values and expected values of a source <code>ContextAware</code>
+ *
+ */
+public class OverrideContextAware implements Runnable {
+
+ private ContextAware source;
+
+ private SimpleContextAware target;
+
+ /**
+ * Whether an exception shall be thrown if a value
+ * or expected value of the source is not defined
+ * in the target
+ */
+ private Boolean failIfUndefinedInSource = true;
+
+ public void run() {
+ // override values
+ if(source.getValues() != null)
+ for(String key : source.getValues().keySet()) {
+ if(failIfUndefinedInSource && !target.getValues().containsKey(key)) {
+ throw new SlcException("No entry in target values for key '" + key + "'");
+ }
+ target.getValues().put(key, source.getValues().get(key));
+ }
+
+ // override expected values
+ if(source.getExpectedValues() != null)
+ for(String key : source.getExpectedValues().keySet()) {
+ if(failIfUndefinedInSource && !target.getExpectedValues().containsKey(key)) {
+ throw new SlcException("No entry in target expected values for key '" + key + "'");
+ }
+ target.getExpectedValues().put(key, source.getExpectedValues().get(key));
+ }
+ }
+
+ public void setSource(ContextAware source) {
+ this.source = source;
+ }
+
+ public void setTarget(SimpleContextAware target) {
+ this.target = target;
+ }
+
+ public void setFailIfUndefinedInSource(Boolean failIfUndefinedInSource) {
+ this.failIfUndefinedInSource = failIfUndefinedInSource;
+ }
+}