Package org.apache.cayenne.jpa.itest.ch2

Source Code of org.apache.cayenne.jpa.itest.ch2._2_1_8_1_BidiOneToOneRelationshipsTest

/*****************************************************************
*   Licensed to the Apache Software Foundation (ASF) under one
*  or more contributor license agreements.  See the NOTICE file
*  distributed with this work for additional information
*  regarding copyright ownership.  The ASF licenses this file
*  to you under the Apache License, Version 2.0 (the
*  "License"); you may not use this file except in compliance
*  with the License.  You may obtain a copy of the License at
*
*    http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing,
*  software distributed under the License is distributed on an
*  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
*  KIND, either express or implied.  See the License for the
*  specific language governing permissions and limitations
*  under the License.
****************************************************************/
package org.apache.cayenne.jpa.itest.ch2;

import org.apache.cayenne.itest.jpa.EntityManagerCase;
import org.apache.cayenne.jpa.itest.ch2.entity.BidiOneToOneOwned;
import org.apache.cayenne.jpa.itest.ch2.entity.BidiOneToOneOwner;

public class _2_1_8_1_BidiOneToOneRelationshipsTest extends EntityManagerCase {

    // TODO: andrus 8/10/2006 - placeholder test, as there are no succeeding tests in this
    // class yet.
    public void testDummy() {

    }

    // TODO: andrus 8/10/2006 - fails
    public void _testDefaults() throws Exception {

        getTableHelper("BidiOneToOneOwned").deleteAll().setColumns("id").insert(5);
        getTableHelper("BidiOneToOneOwner")
                .deleteAll()
                .setColumns("id", "owned_id")
                .insert(4, 5);

        BidiOneToOneOwner owner = getEntityManager().find(BidiOneToOneOwner.class, 4);
        assertNotNull(owner);

        BidiOneToOneOwned owned = getEntityManager().find(BidiOneToOneOwned.class, 5);
        assertNotNull(owned);

        assertSame(owned, owner.getOwned());
        assertSame(owner, owned.getOwner());
    }
}
TOP

Related Classes of org.apache.cayenne.jpa.itest.ch2._2_1_8_1_BidiOneToOneRelationshipsTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.