1 package org
.argeo
.slc
.services
.impl
;
3 import org
.argeo
.slc
.core
.attachment
.Attachment
;
4 import org
.argeo
.slc
.core
.attachment
.SimpleAttachment
;
5 import org
.argeo
.slc
.core
.test
.tree
.TreeTestResult
;
6 import org
.argeo
.slc
.core
.test
.tree
.TreeTestResultListener
;
7 import org
.argeo
.slc
.msg
.test
.tree
.AddTreeTestResultAttachmentRequest
;
8 import org
.argeo
.slc
.msg
.test
.tree
.CloseTreeTestResultRequest
;
9 import org
.argeo
.slc
.msg
.test
.tree
.CreateTreeTestResultRequest
;
10 import org
.argeo
.slc
.msg
.test
.tree
.ResultPartRequest
;
11 import org
.argeo
.slc
.services
.TestManagerService
;
12 import org
.argeo
.slc
.test
.TestResultPart
;
14 /** In memory access to a test manager service */
15 public class TestManagerServiceAdapter
implements TreeTestResultListener
{
16 private Boolean onlyOnClose
= false;
18 private TestManagerService testManagerService
;
20 public void resultPartAdded(TreeTestResult testResult
,
21 TestResultPart testResultPart
) {
25 if (testResult
.getResultParts().size() == 1
26 && testResult
.getResultParts().values().iterator().next()
27 .getParts().size() == 1) {
28 CreateTreeTestResultRequest req
= new CreateTreeTestResultRequest(
30 testManagerService
.createTreeTestResult(req
);
32 ResultPartRequest req
= new ResultPartRequest(testResult
);
33 testManagerService
.addResultPart(req
);
37 public void close(TreeTestResult testResult
) {
39 CreateTreeTestResultRequest req
= new CreateTreeTestResultRequest(
41 testManagerService
.createTreeTestResult(req
);
43 CloseTreeTestResultRequest req
= new CloseTreeTestResultRequest(
45 testManagerService
.closeTreeTestResult(req
);
49 public void addAttachment(TreeTestResult testResult
, Attachment attachment
) {
52 AddTreeTestResultAttachmentRequest req
= new AddTreeTestResultAttachmentRequest();
53 req
.setResultUuid(testResult
.getUuid());
54 req
.setAttachment((SimpleAttachment
) attachment
);
55 testManagerService
.addAttachment(req
);
59 /** Publishes the test result only when it gets closed. */
60 public void setOnlyOnClose(Boolean onlyOnClose
) {
61 this.onlyOnClose
= onlyOnClose
;
64 public void setTestManagerService(TestManagerService testManagerService
) {
65 this.testManagerService
= testManagerService
;