01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one
03: * or more contributor license agreements. See the NOTICE file
04: * distributed with this work for additional information
05: * regarding copyright ownership. The ASF licenses this file
06: * to you under the Apache License, Version 2.0 (the
07: * "License"); you may not use this file except in compliance
08: * with the License. You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing,
13: * software distributed under the License is distributed on an
14: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15: * KIND, either express or implied. See the License for the
16: * specific language governing permissions and limitations
17: * under the License.
18: */
19: package org.apache.openjpa.persistence.annotations;
20:
21: import javax.persistence.*;
22:
23: import org.apache.openjpa.jdbc.meta.*;
24: import org.apache.openjpa.meta.*;
25: import org.apache.openjpa.persistence.OpenJPAEntityManager;
26: import org.apache.openjpa.persistence.OpenJPAPersistence;
27: import org.apache.openjpa.persistence.JPAFacadeHelper;
28:
29: import org.apache.openjpa.persistence.common.utils.*;
30:
31: import org.apache.openjpa.persistence.annotations.common.apps.annotApp.annotype.*;
32:
33: public class TestAnnotationBasics extends AnnotationTestCase {
34:
35: public TestAnnotationBasics(String name) {
36: super (name, "annotationcactusapp");
37: }
38:
39: public void testSingleFieldIdentity() {
40: OpenJPAEntityManager em = (OpenJPAEntityManager) currentEntityManager();
41: ClassMetaData meta = JPAFacadeHelper.getMetaData(em,
42: Entity1.class);
43: assertTrue("Entity1 should use application identity",
44: ClassMetaData.ID_APPLICATION == meta.getIdentityType());
45: assertTrue("Entity1 should use single-field identity", meta
46: .isOpenJPAIdentity());
47: }
48: /*
49: public void testVersionField() {
50: ClassMapping mapping = (ClassMapping) getConfiguration().
51: getMetaDataRepositoryInstance().getMetaData(Entity1.class,
52: null, true);
53: FieldMapping fm = mapping.getFieldMapping("versionField");
54: assertTrue(fm.isVersion());
55: String col = mapping.getVersion().getColumns()[0].getName();
56: assertTrue(col, "VERSIONFIELD".equalsIgnoreCase(col));
57: }
58: */
59: }
|