]>
git.argeo.org Git - lgpl/argeo-commons.git/blob - server/runtime/org.argeo.server.jcr/src/test/java/org/argeo/jcr/MapperTest.java
2 * Copyright (C) 2010 Mathieu Baudier <mbaudier@argeo.org>
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.
17 package org
.argeo
.jcr
;
21 import javax
.jcr
.Node
;
23 import org
.argeo
.server
.jackrabbit
.unit
.AbstractJcrTestCase
;
24 import org
.springframework
.core
.io
.ClassPathResource
;
25 import org
.springframework
.core
.io
.Resource
;
27 public class MapperTest
extends AbstractJcrTestCase
{
28 public void testSimpleObject() throws Exception
{
29 SimpleObject mySo
= new SimpleObject();
31 mySo
.setString("hello world");
33 OtherObject oo1
= new OtherObject();
34 oo1
.setKey("someKey");
35 oo1
.setValue("stringValue");
36 mySo
.setOtherObject(oo1
);
38 OtherObject oo2
= new OtherObject();
39 oo2
.setKey("anotherSimpleObject");
40 oo2
.setValue(new SimpleObject());
41 mySo
.setAnotherObject(oo2
);
43 BeanNodeMapper bnm
= new BeanNodeMapper();
45 Node node
= bnm
.save(session(), mySo
);
50 protected File
getRepositoryFile() throws Exception
{
51 Resource res
= new ClassPathResource(
52 "org/argeo/server/jcr/repository.xml");