]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/test/context/ContextUtils.java
Move ReailizedFlow to execution package
[gpl/argeo-slc.git] / runtime / org.argeo.slc.core / src / main / java / org / argeo / slc / core / test / context / ContextUtils.java
index 742aa62f71d3291da988a8bf761ccc5ca5f7489b..04281c21b344a808f2c47f7e87d4efb529b87606 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
- * Copyright (C) 2010 Mathieu Baudier <mbaudier@argeo.org>\r
+ * Copyright (C) 2007-2012 Mathieu Baudier\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
@@ -13,7 +13,6 @@
  * See the License for the specific language governing permissions and\r
  * limitations under the License.\r
  */\r
-\r
 package org.argeo.slc.core.test.context;\r
 \r
 import java.util.Map;\r
@@ -21,23 +20,18 @@ import java.util.TreeMap;
 \r
 import org.apache.commons.logging.Log;\r
 import org.apache.commons.logging.LogFactory;\r
-\r
-import org.argeo.slc.core.structure.tree.TreeSPath;\r
-import org.argeo.slc.core.structure.tree.TreeSRelated;\r
 import org.argeo.slc.core.test.SimpleResultPart;\r
-import org.argeo.slc.structure.StructureAware;\r
-import org.argeo.slc.structure.StructureElement;\r
-import org.argeo.slc.structure.StructureRegistry;\r
 import org.argeo.slc.test.TestResult;\r
 import org.argeo.slc.test.TestStatus;\r
 import org.argeo.slc.test.context.ContextAware;\r
 import org.argeo.slc.test.context.ParentContextAware;\r
 \r
+/** Utilities for comparing and synchronising contexts. */\r
 public class ContextUtils {\r
        private final static Log log = LogFactory.getLog(ContextUtils.class);\r
 \r
        public static void compareReachedExpected(ContextAware contextAware,\r
-                       TestResult testResult, TreeSRelated treeSRelated) {\r
+                       TestResult testResult) {\r
                for (String key : contextAware.getExpectedValues().keySet()) {\r
 \r
                        // Compare expected values with reached ones\r
@@ -50,9 +44,6 @@ public class ContextUtils {
                                continue;\r
                        }\r
 \r
-                       // Register in structure\r
-                       registerInStructure(testResult, treeSRelated, key);\r
-\r
                        if (contextAware.getValues().containsKey(key)) {\r
                                Object reachedValue = contextAware.getValues().get(key);\r
 \r
@@ -75,42 +66,6 @@ public class ContextUtils {
                                                TestStatus.FAILED, "No value reached for key '" + key\r
                                                                + "'"));\r
                        }\r
-                       resetStructure(testResult, treeSRelated);\r
-               }\r
-       }\r
-\r
-       @SuppressWarnings("unchecked")\r
-       private static void registerInStructure(TestResult testResult,\r
-                       TreeSRelated treeSRelated, String key) {\r
-               if (treeSRelated != null) {\r
-                       if (treeSRelated.getBasePath() != null) {\r
-                               TreeSPath path = treeSRelated.getBasePath().createChild(key);\r
-                               StructureRegistry<TreeSPath> registry = treeSRelated\r
-                                               .getRegistry();\r
-                               final StructureElement element = treeSRelated\r
-                                               .getStructureElement(key);\r
-                               registry.register(path, element);\r
-                               if (testResult instanceof StructureAware)\r
-                                       ((StructureAware<TreeSPath>) testResult).notifyCurrentPath(\r
-                                                       registry, path);\r
-\r
-                               if (log.isDebugEnabled())\r
-                                       log.debug("Checking key " + key + " for path " + path);\r
-                       }\r
-               }\r
-       }\r
-\r
-       @SuppressWarnings("unchecked")\r
-       private static void resetStructure(TestResult testResult,\r
-                       TreeSRelated treeSRelated) {\r
-               if (treeSRelated != null) {\r
-                       if (treeSRelated.getBasePath() != null) {\r
-                               if (testResult instanceof StructureAware) {\r
-                                       ((StructureAware<TreeSPath>) testResult).notifyCurrentPath(\r
-                                                       treeSRelated.getRegistry(), treeSRelated\r
-                                                                       .getBasePath());\r
-                               }\r
-                       }\r
                }\r
        }\r
 \r
@@ -143,8 +98,8 @@ public class ContextUtils {
                        // same keys\r
                        Map<String, Object> expectedValuesCommonChild = new TreeMap<String, Object>(\r
                                        expectedValuesCommon);\r
-                       putNotContained(expectedValuesCommonChild, child\r
-                                       .getExpectedValues());\r
+                       putNotContained(expectedValuesCommonChild,\r
+                                       child.getExpectedValues());\r
 \r
                        if (child instanceof ParentContextAware) {\r
                                // Recursive sync\r