]> 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
Remove legacy code
[gpl/argeo-slc.git] / runtime / org.argeo.slc.core / src / main / java / org / argeo / slc / core / test / context / ContextUtils.java
index 8d795405c99946aa6fd9c82596ed722e8e97b7d9..f62fb5ca35d66a07e22a765f9d4c1c1bc5b291a7 100644 (file)
@@ -1,3 +1,18 @@
+/*\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.test.context;\r
 \r
 import java.util.Map;\r
@@ -5,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
@@ -34,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
@@ -59,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
@@ -107,7 +78,7 @@ public class ContextUtils {
                                parent.getExpectedValues());\r
                synchronize(parent, expectedValuesCommon);\r
                if (log.isDebugEnabled())\r
-                       log.debug("Synchonized context " + parent);\r
+                       log.debug("Synchronized context " + parent);\r
 \r
        }\r
 \r
@@ -127,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