X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=runtime%2Forg.argeo.slc.core%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fslc%2Fcore%2Ftest%2Ftree%2FTreeTestResult.java;h=f102ae6ab4babaf0be961118a27c85e185afa367;hb=5fe677bf811739592b1089471181e39f9cbe4f3f;hp=c27da2f76d13382c2859939b5eb4956275aa2b88;hpb=ffe7754e421f8ad5d3a336f54a498f67c6d72839;p=gpl%2Fargeo-slc.git diff --git a/runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/test/tree/TreeTestResult.java b/runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/test/tree/TreeTestResult.java index c27da2f76..f102ae6ab 100644 --- a/runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/test/tree/TreeTestResult.java +++ b/runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/test/tree/TreeTestResult.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010 Mathieu Baudier + * Copyright (C) 2007-2012 Mathieu Baudier * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package org.argeo.slc.core.test.tree; import java.io.Serializable; @@ -70,6 +69,8 @@ public class TreeTestResult implements TestResult, StructureAware, // TODO is it really necessary closeDate == null ? private Boolean isClosed = false; + private Boolean cache = true; + private transient List> listeners = new Vector>(); /** Sets the list of listeners. */ @@ -88,15 +89,18 @@ public class TreeTestResult implements TestResult, StructureAware, if (currentPath == null) throw new SlcException("No current path set."); - PartSubList subList = resultParts.get(currentPath); - if (subList == null) { - subList = new PartSubList(); - resultParts.put(currentPath, subList); + if (cache) { + PartSubList subList = resultParts.get(currentPath); + if (subList == null) { + subList = new PartSubList(); + resultParts.put(currentPath, subList); + } + subList.getParts().add(part); } + if (part instanceof TestRunAware && currentTestRun != null) { ((TestRunAware) part).notifyTestRun(currentTestRun); } - subList.getParts().add(part); // notify listeners synchronized (listeners) { @@ -115,6 +119,9 @@ public class TreeTestResult implements TestResult, StructureAware, public void notifyCurrentPath(StructureRegistry registry, TreeSPath path) { + if (!cache) + return; + if (registry != null) { for (TreeSPath p : path.getHierarchyAsList()) { if (!elements.containsKey(p)) { @@ -305,4 +312,12 @@ public class TreeTestResult implements TestResult, StructureAware, this.strictChecks = strictChecks; } + /** + * Whether information should be stored in thsi object or simply forwarded + * to teh listeners. + */ + public void setCache(Boolean cache) { + this.cache = cache; + } + }