]> git.argeo.org Git - lgpl/argeo-commons.git/blob - server/runtime/org.argeo.server.jcr/src/test/java/org/argeo/jcr/MapperTest.java
Add license headers
[lgpl/argeo-commons.git] / server / runtime / org.argeo.server.jcr / src / test / java / org / argeo / jcr / MapperTest.java
1 /*
2 * Copyright (C) 2010 Mathieu Baudier <mbaudier@argeo.org>
3 *
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
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
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.
15 */
16
17 package org.argeo.jcr;
18
19 import java.io.File;
20
21 import javax.jcr.Node;
22
23 import org.argeo.server.jackrabbit.unit.AbstractJcrTestCase;
24 import org.springframework.core.io.ClassPathResource;
25 import org.springframework.core.io.Resource;
26
27 public class MapperTest extends AbstractJcrTestCase {
28 public void testSimpleObject() throws Exception {
29 SimpleObject mySo = new SimpleObject();
30 mySo.setInteger(100);
31 mySo.setString("hello world");
32
33 OtherObject oo1 = new OtherObject();
34 oo1.setKey("someKey");
35 oo1.setValue("stringValue");
36 mySo.setOtherObject(oo1);
37
38 OtherObject oo2 = new OtherObject();
39 oo2.setKey("anotherSimpleObject");
40 oo2.setValue(new SimpleObject());
41 mySo.setAnotherObject(oo2);
42
43 BeanNodeMapper bnm = new BeanNodeMapper();
44
45 Node node = bnm.save(session(), mySo);
46 session().save();
47 JcrUtils.debug(node);
48 }
49
50 protected File getRepositoryFile() throws Exception {
51 Resource res = new ClassPathResource(
52 "org/argeo/server/jcr/repository.xml");
53 return res.getFile();
54 }
55
56 }