]> git.argeo.org Git - gpl/argeo-slc.git/blob - org.argeo.slc.core/src/main/java/org/argeo/slc/core/test/context/SimpleContextAware.java
Replace test result id by UUID
[gpl/argeo-slc.git] / org.argeo.slc.core / src / main / java / org / argeo / slc / core / test / context / SimpleContextAware.java
1 package org.argeo.slc.core.test.context;
2
3 import java.util.Map;
4 import java.util.TreeMap;
5
6 import org.springframework.beans.factory.InitializingBean;
7
8 import org.argeo.slc.core.SlcException;
9
10 public class SimpleContextAware implements ContextAware, InitializingBean {
11 private ParentContextAware parentContext;
12
13 private Map<String, Object> values = new TreeMap<String, Object>();
14 private Map<String, Object> expectedValues = new TreeMap<String, Object>();
15
16 private String contextSkipFlag = DEFAULT_SKIP_FLAG;
17 private String contextAnyFlag = DEFAULT_ANY_FLAG;
18
19 public Map<String, Object> getValues() {
20 return values;
21 }
22
23 public void setValues(Map<String, Object> values) {
24 this.values = values;
25 }
26
27 public Map<String, Object> getExpectedValues() {
28 return expectedValues;
29 }
30
31 public void setExpectedValues(Map<String, Object> expectedValues) {
32 this.expectedValues = expectedValues;
33 }
34
35 /** Used to add this context as a child by setting a property. */
36 public void setParentContext(ParentContextAware parentContextAware) {
37 if (parentContext != null)
38 throw new SlcException("Parent context already set");
39 this.parentContext = parentContextAware;
40 this.parentContext.addChildContext(this);
41 }
42
43 protected ParentContextAware getParentContext() {
44 return parentContext;
45 }
46
47 public void afterPropertiesSet() throws Exception {
48 if (parentContext != null) {
49 ContextUtils.synchronize(parentContext);
50 }
51 }
52
53 public String getContextSkipFlag() {
54 return contextSkipFlag;
55 }
56
57 public void setContextSkipFlag(String contextSkipFlag) {
58 this.contextSkipFlag = contextSkipFlag;
59 }
60
61 public String getContextAnyFlag() {
62 return contextAnyFlag;
63 }
64
65 public void setContextAnyFlag(String contextAnyFlag) {
66 this.contextAnyFlag = contextAnyFlag;
67 }
68
69 }