- From: Thomas Gambet via cvs-syncmail <cvsmail@w3.org>
- Date: Wed, 09 Sep 2009 10:15:32 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/2006/unicorn/src/org/w3c/unicorn
In directory hutz:/tmp/cvs-serv25269/src/org/w3c/unicorn
Modified Files:
UnicornCall.java
Log Message:
added function isPassed that returns true is all the response are passed, false otherwise
+ observationList is generated only on first call of getObservationList()
Index: UnicornCall.java
===================================================================
RCS file: /sources/public/2006/unicorn/src/org/w3c/unicorn/UnicornCall.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- UnicornCall.java 8 Sep 2009 14:24:22 -0000 1.10
+++ UnicornCall.java 9 Sep 2009 10:15:30 -0000 1.11
@@ -81,6 +81,8 @@
private RequestList aRequestList = null;
private Map<String, String[]> mapOfStringParameter = null;
+
+ private LinkedHashMap<String, Response> observationMap;
/**
* Data Structure for the response
@@ -260,6 +262,16 @@
public boolean getBPassed() {
return this.bPassed;
}
+
+ public boolean isPassed() {
+ boolean passed = true;
+ for (String key : this.getObservationList().keySet()) {
+ if (!observationMap.get(key).isPassed()) {
+ passed = false;
+ }
+ }
+ return passed;
+ }
/**
* Execute the request depending on the priority
@@ -588,39 +600,42 @@
*/
public LinkedHashMap<String, Response> getObservationList() {
- LinkedHashMap<String, Response> observationMap = new LinkedHashMap<String, Response>();
-
- for (Group group : aTask.getOutput().getGroupList()) {
- if (!group.isSetType()) {
- for (String observerId : group.getObservationList()) {
- if(mapOfResponse.get(observerId) != null) {
- observationMap.put(observerId, mapOfResponse.get(observerId));
+ if (observationMap == null) {
+ observationMap = new LinkedHashMap<String, Response>();
+
+ for (Group group : aTask.getOutput().getGroupList()) {
+ if (!group.isSetType()) {
+ for (String observerId : group.getObservationList()) {
+ if(mapOfResponse.get(observerId) != null) {
+ observationMap.put(observerId, mapOfResponse.get(observerId));
+ }
}
- }
- } else {
- switch (group.getType()) {
- case FIRSTPASSED:
- String passedId = null;
- for (String observerId : group.getObservationList()) {
- if (mapOfResponse.get(observerId) == null) {
- logger.error("unknown observer id (" + observerId + ") in output group of task: " + this.getTask().getID());
- continue;
+ } else {
+ switch (group.getType()) {
+ case FIRSTPASSED:
+ String passedId = null;
+ for (String observerId : group.getObservationList()) {
+ if (mapOfResponse.get(observerId) == null) {
+ logger.error("unknown observer id (" + observerId + ") in output group of task: " + this.getTask().getID());
+ continue;
+ }
+ if (mapOfResponse.get(observerId).isPassed()) {
+ passedId = observerId;
+ break;
+ }
}
- if (mapOfResponse.get(observerId).isPassed()) {
- passedId = observerId;
- break;
+ if (passedId == null) {
+ Response resp = mapOfResponse.get(group.getObservationList().get(0));
+ if (resp != null)
+ observationMap.put(group.getObservationList().get(0), resp);
}
- }
- if (passedId == null) {
- Response resp = mapOfResponse.get(group.getObservationList().get(0));
- if (resp != null)
- observationMap.put(group.getObservationList().get(0), resp);
- }
- else
- observationMap.put(passedId, mapOfResponse.get(passedId));
+ else
+ observationMap.put(passedId, mapOfResponse.get(passedId));
+ }
}
}
}
+
return observationMap;
}
Received on Wednesday, 9 September 2009 10:15:42 UTC