2 * Copyright (C) 2007-2012 Mathieu Baudier
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.
16 package org
.argeo
.slc
.jcr
.dao
;
18 import java
.net
.InetAddress
;
20 import javax
.jcr
.Session
;
22 import org
.argeo
.jcr
.JcrUtils
;
23 import org
.argeo
.slc
.dao
.process
.SlcExecutionDao
;
24 import org
.argeo
.slc
.process
.SlcExecution
;
25 import org
.argeo
.slc
.process
.SlcExecutionStep
;
26 import org
.argeo
.slc
.unit
.AbstractSpringTestCase
;
27 import org
.argeo
.slc
.unit
.process
.SlcExecutionTestUtils
;
29 public class SlcExecutionDaoJcrTest
extends AbstractSpringTestCase
{
30 private SlcExecutionDao slcExecutionDao
;
31 private Session session
;
35 protected void setUp() throws Exception
{
37 slcExecutionDao
= getBean(SlcExecutionDao
.class);
38 session
= getBean(Session
.class);
42 public void testCreate() throws Exception
{
43 SlcExecution slcExecution0
= SlcExecutionTestUtils
44 .createSimpleSlcExecution();
45 slcExecution0
.setHost(host
);
46 slcExecutionDao
.create(slcExecution0
);
48 SlcExecution slcExecution
= SlcExecutionTestUtils
49 .createSlcExecutionWithRealizedFlows();
50 slcExecution
.setHost(host
);
51 String uuid
= slcExecution
.getUuid();
52 slcExecutionDao
.create(slcExecution
);
54 JcrUtils
.debug(session
.getRootNode());
56 SlcExecution slcExecutionPersist
= slcExecutionDao
57 .getSlcExecution(uuid
);
58 SlcExecutionTestUtils
.assertSlcExecution(slcExecution
,
62 public void testUpdate() throws Exception
{
63 SlcExecution slcExecution0
= SlcExecutionTestUtils
64 .createSimpleSlcExecution();
65 slcExecution0
.setHost(host
);
66 slcExecutionDao
.create(slcExecution0
);
67 String uuid
= slcExecution0
.getUuid();
69 SlcExecution slcExecution
= SlcExecutionTestUtils
70 .createSlcExecutionWithRealizedFlows();
71 slcExecution
.setUuid(uuid
);
72 slcExecution
.setHost(host
);
73 slcExecution
.getSteps().add(new SlcExecutionStep("My log"));
74 slcExecutionDao
.update(slcExecution
);
76 JcrUtils
.debug(session
.getRootNode());
78 SlcExecution slcExecutionPersist
= slcExecutionDao
79 .getSlcExecution(uuid
);
80 SlcExecutionTestUtils
.assertSlcExecution(slcExecution
,
85 // protected void tearDown() {
88 // } catch (Exception e) {
89 // log.debug("pbs Remain while closing jcr test env.");
90 // log.debug("Exc Name : " + e.getClass().getName());