1 package org
.argeo
.slc
.jcr
.dao
;
3 import java
.net
.InetAddress
;
5 import javax
.jcr
.Session
;
7 import org
.argeo
.jcr
.JcrUtils
;
8 import org
.argeo
.slc
.dao
.process
.SlcExecutionDao
;
9 import org
.argeo
.slc
.process
.SlcExecution
;
10 import org
.argeo
.slc
.process
.SlcExecutionStep
;
11 import org
.argeo
.slc
.unit
.AbstractSpringTestCase
;
12 import org
.argeo
.slc
.unit
.process
.SlcExecutionTestUtils
;
14 public class SlcExecutionDaoJcrTest
extends AbstractSpringTestCase
{
15 private SlcExecutionDao slcExecutionDao
;
16 private Session session
;
20 protected void setUp() throws Exception
{
22 slcExecutionDao
= getBean(SlcExecutionDao
.class);
23 session
= getBean(Session
.class);
24 host
= InetAddress
.getLocalHost().getCanonicalHostName();
27 public void testCreate() throws Exception
{
28 SlcExecution slcExecution0
= SlcExecutionTestUtils
29 .createSimpleSlcExecution();
30 slcExecution0
.setHost(host
);
31 slcExecutionDao
.create(slcExecution0
);
33 SlcExecution slcExecution
= SlcExecutionTestUtils
34 .createSlcExecutionWithRealizedFlows();
35 slcExecution
.setHost(host
);
36 String uuid
= slcExecution
.getUuid();
37 slcExecutionDao
.create(slcExecution
);
39 JcrUtils
.debug(session
.getRootNode());
41 SlcExecution slcExecutionPersist
= slcExecutionDao
42 .getSlcExecution(uuid
);
43 SlcExecutionTestUtils
.assertSlcExecution(slcExecution
,
47 public void testUpdate() throws Exception
{
48 SlcExecution slcExecution0
= SlcExecutionTestUtils
49 .createSimpleSlcExecution();
50 slcExecution0
.setHost(host
);
51 slcExecutionDao
.create(slcExecution0
);
52 String uuid
= slcExecution0
.getUuid();
54 SlcExecution slcExecution
= SlcExecutionTestUtils
55 .createSlcExecutionWithRealizedFlows();
56 slcExecution
.setUuid(uuid
);
57 slcExecution
.setHost(host
);
58 slcExecution
.getSteps().add(new SlcExecutionStep("My log"));
59 slcExecutionDao
.update(slcExecution
);
61 JcrUtils
.debug(session
.getRootNode());
63 SlcExecution slcExecutionPersist
= slcExecutionDao
64 .getSlcExecution(uuid
);
65 SlcExecutionTestUtils
.assertSlcExecution(slcExecution
,
70 // protected void tearDown() {
73 // } catch (Exception e) {
74 // log.debug("pbs Remain while closing jcr test env.");
75 // log.debug("Exc Name : " + e.getClass().getName());