X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;ds=inline;f=org.argeo.slc.runtime%2Fsrc%2Forg%2Fargeo%2Fslc%2Fruntime%2Ftest%2FSimpleTestResult.java;h=649e5d390f6ef661c786b958d9bd2d5ae78151a1;hb=09c9e5093fe1353aaac344ac8a8caf2e1dcc0778;hp=b4437d71f53953437b74cf9a10062e3c338fb68b;hpb=dfac3414a612edd63eaaf8568ddc80271707af22;p=gpl%2Fargeo-slc.git diff --git a/org.argeo.slc.runtime/src/org/argeo/slc/runtime/test/SimpleTestResult.java b/org.argeo.slc.runtime/src/org/argeo/slc/runtime/test/SimpleTestResult.java index b4437d71f..649e5d390 100644 --- a/org.argeo.slc.runtime/src/org/argeo/slc/runtime/test/SimpleTestResult.java +++ b/org.argeo.slc.runtime/src/org/argeo/slc/runtime/test/SimpleTestResult.java @@ -1,103 +1,82 @@ -/* - * Copyright (C) 2007-2012 Argeo GmbH - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc.runtime.test; - -import java.util.Date; -import java.util.List; -import java.util.Map; -import java.util.TreeMap; -import java.util.UUID; -import java.util.Vector; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.argeo.slc.SlcException; -import org.argeo.slc.test.TestResult; -import org.argeo.slc.test.TestResultPart; -import org.argeo.slc.test.TestRun; - -/** - * Basic implementation of a test result containing only a list of result parts. - */ -public class SimpleTestResult implements TestResult { - private static Log log = LogFactory.getLog(SimpleTestResult.class); - - private String uuid; - private String currentTestRunUuid; - - private Boolean throwError = true; - - private Date closeDate; - private List parts = new Vector(); - - private Map attributes = new TreeMap(); - - public void addResultPart(TestResultPart part) { - if (throwError && part.getStatus() == ERROR) { - throw new SlcException( - "There was an error in the underlying test: " - + part.getExceptionMessage()); - } - parts.add(part); - if (log.isDebugEnabled()) - log.debug(part); - } - - public void close() { - parts.clear(); - closeDate = new Date(); - } - - public List getParts() { - return parts; - } - - public Date getCloseDate() { - return closeDate; - } - - public void setThrowError(Boolean throwError) { - this.throwError = throwError; - } - - public void notifyTestRun(TestRun testRun) { - currentTestRunUuid = testRun.getUuid(); - } - - public String getUuid() { - if (uuid == null) { - uuid = UUID.randomUUID().toString(); - } - return uuid; - } - - public void setUuid(String uuid) { - this.uuid = uuid; - } - - public String getCurrentTestRunUuid() { - return currentTestRunUuid; - } - - public Map getAttributes() { - return attributes; - } - - public void setAttributes(Map attributes) { - this.attributes = attributes; - } - -} +package org.argeo.slc.runtime.test; + +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.TreeMap; +import java.util.UUID; +import java.util.Vector; + +import org.argeo.api.slc.SlcException; +import org.argeo.api.slc.test.TestResult; +import org.argeo.api.slc.test.TestResultPart; +import org.argeo.api.slc.test.TestRun; + +/** + * Basic implementation of a test result containing only a list of result parts. + */ +public class SimpleTestResult implements TestResult { + private String uuid; + private String currentTestRunUuid; + + private Boolean throwError = true; + + private Date closeDate; + private List parts = new Vector(); + + private Map attributes = new TreeMap(); + + public void addResultPart(TestResultPart part) { + if (throwError && part.getStatus() == ERROR) { + throw new SlcException("There was an error in the underlying test: " + part.getExceptionMessage()); + } + parts.add(part); +// if (log.isDebugEnabled()) +// log.debug(part); + } + + public void close() { + parts.clear(); + closeDate = new Date(); + } + + public List getParts() { + return parts; + } + + public Date getCloseDate() { + return closeDate; + } + + public void setThrowError(Boolean throwError) { + this.throwError = throwError; + } + + public void notifyTestRun(TestRun testRun) { + currentTestRunUuid = testRun.getUuid(); + } + + public String getUuid() { + if (uuid == null) { + uuid = UUID.randomUUID().toString(); + } + return uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + + public String getCurrentTestRunUuid() { + return currentTestRunUuid; + } + + public Map getAttributes() { + return attributes; + } + + public void setAttributes(Map attributes) { + this.attributes = attributes; + } + +}