1 package org
.argeo
.slc
.hibernate
.test
.tree
;
3 import org
.springframework
.oxm
.Marshaller
;
4 import org
.springframework
.oxm
.Unmarshaller
;
5 import org
.springframework
.xml
.transform
.StringResult
;
6 import org
.springframework
.xml
.transform
.StringSource
;
8 import org
.argeo
.slc
.core
.structure
.tree
.TreeSPath
;
9 import org
.argeo
.slc
.core
.test
.tree
.TreeTestResult
;
10 import org
.argeo
.slc
.core
.test
.tree
.TreeTestResultTestUtils
;
11 import org
.argeo
.slc
.dao
.test
.tree
.TreeTestResultDao
;
12 import org
.argeo
.slc
.unit
.AbstractSpringTestCase
;
13 import org
.argeo
.slc
.unit
.test
.tree
.UnitTestTreeUtil
;
15 public class CastorTestResultDaoHibernateTest
extends AbstractSpringTestCase
{
17 public void testUnmarshallAndCreate() throws Exception
{
18 TreeTestResult ttr
= TreeTestResultTestUtils
19 .createCompleteTreeTestResult();
21 StringResult result
= new StringResult();
22 getBean(Marshaller
.class).marshal(ttr
, result
);
24 StringSource source
= new StringSource(result
.toString());
25 TreeTestResult ttrUnm
= (TreeTestResult
) getBean(Unmarshaller
.class)
28 for (TreeSPath path
: ttrUnm
.getResultParts().keySet()) {
29 log
.debug("Path: " + path
.getClass() + ": " + path
);
32 TreeTestResultDao ttrDao
= getBean(TreeTestResultDao
.class);
33 ttrDao
.create(ttrUnm
);
34 TreeTestResult ttrPersist
= ttrDao
.getTestResult(ttr
.getUuid());
36 UnitTestTreeUtil
.assertTreeTestResult(ttr
, ttrPersist
);
40 protected String
getApplicationContextLocation() {
41 return "org/argeo/slc/hibernate/withCastor.xml";