]> git.argeo.org Git - gpl/argeo-slc.git/blob - org.argeo.slc.core/src/test/java/org/argeo/slc/hibernate/structure/tree/TreeSRegistryDaoHibernateTest.java
Test exception
[gpl/argeo-slc.git] / org.argeo.slc.core / src / test / java / org / argeo / slc / hibernate / structure / tree / TreeSRegistryDaoHibernateTest.java
1 package org.argeo.slc.hibernate.structure.tree;
2
3 import org.argeo.slc.core.structure.SimpleSElement;
4 import org.argeo.slc.core.structure.tree.TreeSPath;
5 import org.argeo.slc.core.structure.tree.TreeSRegistry;
6 import org.argeo.slc.dao.structure.tree.TreeSPathDao;
7 import org.argeo.slc.dao.structure.tree.TreeSRegistryDao;
8 import org.argeo.slc.unit.AbstractSpringTestCase;
9
10 public class TreeSRegistryDaoHibernateTest extends AbstractSpringTestCase {
11
12 public void testCreate() {
13 TreeSRegistryDao treeSRegistryDao = (TreeSRegistryDao) getContext()
14 .getBean("treeSRegistryDao");
15
16 TreeSPathDao treeSPathDao = (TreeSPathDao) getContext().getBean(
17 "treeSPathDao");
18
19 TreeSPath root = TreeSPath.parseToCreatePath("/root");
20 TreeSPath path = root.createChild("test");
21
22 treeSPathDao.create(root);
23 treeSPathDao.create(path);
24
25 TreeSRegistry registry = new TreeSRegistry();
26 registry.setStatus(TreeSRegistry.STATUS_ACTIVE);
27 String desc = "desc";
28 registry.register(path, new SimpleSElement(desc));
29
30 treeSRegistryDao.create(registry);
31
32 TreeSRegistry registry2 = treeSRegistryDao.getActiveTreeSRegistry();
33 SimpleSElement element = registry2.getElements().get(path);
34 assertEquals(desc, element.getLabel());
35 }
36
37 @Override
38 protected String getApplicationContextLocation() {
39 return "org/argeo/slc/hibernate/applicationContext.xml";
40 }
41
42 }