1 package org
.argeo
.slc
.core
.test
.context
;
4 import java
.util
.TreeMap
;
6 import org
.argeo
.slc
.SlcException
;
7 import org
.argeo
.slc
.runtime
.test
.ContextUtils
;
8 import org
.argeo
.slc
.test
.context
.ContextAware
;
9 import org
.argeo
.slc
.test
.context
.ParentContextAware
;
10 import org
.springframework
.beans
.factory
.InitializingBean
;
12 public class SimpleContextAware
implements ContextAware
, InitializingBean
{
13 private ParentContextAware parentContext
;
15 private Map
<String
, Object
> values
= new TreeMap
<String
, Object
>();
16 private Map
<String
, Object
> expectedValues
= new TreeMap
<String
, Object
>();
18 private String contextSkipFlag
= DEFAULT_SKIP_FLAG
;
19 private String contextAnyFlag
= DEFAULT_ANY_FLAG
;
21 public Map
<String
, Object
> getValues() {
25 public void setValues(Map
<String
, Object
> values
) {
29 public Map
<String
, Object
> getExpectedValues() {
30 return expectedValues
;
33 public void setExpectedValues(Map
<String
, Object
> expectedValues
) {
34 this.expectedValues
= expectedValues
;
37 /** Used to add this context as a child by setting a property. */
38 public void setParentContext(ParentContextAware parentContextAware
) {
39 if (parentContext
!= null)
40 throw new SlcException("Parent context already set");
41 this.parentContext
= parentContextAware
;
42 this.parentContext
.addChildContext(this);
45 protected ParentContextAware
getParentContext() {
49 public void afterPropertiesSet() throws Exception
{
50 if (parentContext
!= null) {
51 ContextUtils
.synchronize(parentContext
);
55 public String
getContextSkipFlag() {
56 return contextSkipFlag
;
59 public void setContextSkipFlag(String contextSkipFlag
) {
60 this.contextSkipFlag
= contextSkipFlag
;
63 public String
getContextAnyFlag() {
64 return contextAnyFlag
;
67 public void setContextAnyFlag(String contextAnyFlag
) {
68 this.contextAnyFlag
= contextAnyFlag
;