2 * Copyright (C) 2010 Mathieu Baudier <mbaudier@argeo.org>
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package org
.argeo
.slc
.ws
;
19 import java
.util
.List
;
20 import java
.util
.Vector
;
22 import org
.springframework
.ws
.client
.core
.WebServiceTemplate
;
23 import org
.springframework
.ws
.soap
.client
.SoapFaultClientException
;
25 import org
.apache
.commons
.logging
.Log
;
26 import org
.apache
.commons
.logging
.LogFactory
;
28 import org
.argeo
.slc
.msg
.process
.SlcExecutionRequest
;
29 import org
.argeo
.slc
.msg
.process
.SlcExecutionStatusRequest
;
30 import org
.argeo
.slc
.msg
.process
.SlcExecutionStepsRequest
;
31 import org
.argeo
.slc
.process
.SlcExecution
;
32 import org
.argeo
.slc
.process
.SlcExecutionStep
;
33 import org
.argeo
.slc
.unit
.AbstractSpringTestCase
;
34 import org
.argeo
.slc
.unit
.process
.SlcExecutionTestUtils
;
35 import org
.argeo
.slc
.ws
.client
.WebServiceUtils
;
37 public class SlcExecutionWsIntegrationTest
extends AbstractSpringTestCase
{
38 private Log log
= LogFactory
.getLog(getClass());
40 private WebServiceTemplate template
;
43 template
= getBean(WebServiceTemplate
.class);
46 public void testSlcExecutionRequests() {
47 SlcExecution slcExec
= createAndSendSlcExecution();
49 slcExec
.setUser("otherUser");
50 log
.info("Send update SlcExecutionRequest for SlcExecution #"
52 template
.marshalSendAndReceive(new SlcExecutionRequest(slcExec
));
55 public void testSlcExecutionStatusRequest() {
56 SlcExecution slcExec
= createAndSendSlcExecution();
58 slcExec
.setStatus(SlcExecution
.STATUS_FINISHED
);
59 log
.info("Send SlcExecutionStatusRequest for SlcExecution #"
61 template
.marshalSendAndReceive(new SlcExecutionStatusRequest(slcExec
62 .getUuid(), slcExec
.getStatus()));
65 public void testSendSlcExecutionStepRequest() {
66 SlcExecution slcExec
= createAndSendSlcExecution();
68 SlcExecutionStep step1
= new SlcExecutionStep(
69 "Logline\nAnother log line.");
70 SlcExecutionStep step2
= new SlcExecutionStep(
71 "Logline2\nAnother log line2.");
72 List
<SlcExecutionStep
> steps
= new Vector
<SlcExecutionStep
>();
76 log
.info("Send SlcExecutionStepsRequest for SlcExecution #"
79 template
.marshalSendAndReceive(new SlcExecutionStepsRequest(slcExec
81 } catch (SoapFaultClientException e
) {
82 WebServiceUtils
.manageSoapException(e
);
87 protected SlcExecution
createAndSendSlcExecution() {
88 SlcExecution slcExec
= SlcExecutionTestUtils
.createSimpleSlcExecution();
90 log
.info("Send create SlcExecutionRequest for SlcExecution #"
92 template
.marshalSendAndReceive(new SlcExecutionRequest(slcExec
));