Package org.objectweb.speedo.runtime.relations.mn

Source Code of org.objectweb.speedo.runtime.relations.mn.TestMN

/**
* Copyright (C) 2001-2004 France Telecom R&D
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/
package org.objectweb.speedo.runtime.relations.mn;

import org.objectweb.speedo.SpeedoTestHelper;
import org.objectweb.speedo.pobjects.relations.mn.Qsdfgh;
import org.objectweb.speedo.pobjects.relations.mn.p1.Azerty;

import javax.jdo.PersistenceManager;

/**
*
* @author S.Chassande-Barrioz
*/
public class TestMN extends SpeedoTestHelper {

  public TestMN(String s) {
    super(s);
  }

  protected String getLoggerName() {
    return LOG_NAME + "rt.relations.mn";
  }

  public void testA() {
    PersistenceManager pm = pmf.getPersistenceManager();
    pm.currentTransaction().begin();
    Qsdfgh q0 = (Qsdfgh) pm.getObjectById(
        pm.newObjectIdInstance(Qsdfgh.class, "q0"), false);
    Qsdfgh q1 = (Qsdfgh) pm.getObjectById(
        pm.newObjectIdInstance(Qsdfgh.class, "q1"), false);
    Azerty a0 = (Azerty) pm.getObjectById(
        pm.newObjectIdInstance(Azerty.class, "a0"), false);
    a0.qsds.remove(q0);
    a0.qsds.remove(q1);
    pm.currentTransaction().commit();
    pm.close();

    pm = pmf.getPersistenceManager();
    pm.currentTransaction().begin();
    q0 = (Qsdfgh) pm.getObjectById(
        pm.newObjectIdInstance(Qsdfgh.class, "q0"), false);
    q1 = (Qsdfgh) pm.getObjectById(
        pm.newObjectIdInstance(Qsdfgh.class, "q1"), false);
    a0 = (Azerty) pm.getObjectById(
        pm.newObjectIdInstance(Azerty.class, "a0"), false);
    a0.qsds.add(q0);
    a0.qsds.add(q1);
    pm.currentTransaction().commit();
    pm.close();

    pm = pmf.getPersistenceManager();
    pm.currentTransaction().begin();
    q0 = (Qsdfgh) pm.getObjectById(
        pm.newObjectIdInstance(Qsdfgh.class, "q0"), false);
    q1 = (Qsdfgh) pm.getObjectById(
        pm.newObjectIdInstance(Qsdfgh.class, "q1"), false);
    a0 = (Azerty) pm.getObjectById(
        pm.newObjectIdInstance(Azerty.class, "a0"), false);
    a0.qsds.remove(q0);
    a0.qsds.remove(q1);
    pm.currentTransaction().commit();
    pm.close();

    pm = pmf.getPersistenceManager();
    pm.currentTransaction().begin();
    q0 = (Qsdfgh) pm.getObjectById(
        pm.newObjectIdInstance(Qsdfgh.class, "q0"), false);
    q1 = (Qsdfgh) pm.getObjectById(
        pm.newObjectIdInstance(Qsdfgh.class, "q1"), false);
    a0 = (Azerty) pm.getObjectById(
        pm.newObjectIdInstance(Azerty.class, "a0"), false);
    a0.qsds.add(q0);
    a0.qsds.add(q1);
    pm.currentTransaction().commit();
    pm.close();

    pm = pmf.getPersistenceManager();
    pm.currentTransaction().begin();
    q0 = (Qsdfgh) pm.getObjectById(
        pm.newObjectIdInstance(Qsdfgh.class, "q0"), false);
    q1 = (Qsdfgh) pm.getObjectById(
        pm.newObjectIdInstance(Qsdfgh.class, "q1"), false);
    a0 = (Azerty) pm.getObjectById(
        pm.newObjectIdInstance(Azerty.class, "a0"), false);
    a0.qsds.remove(q0);
    a0.qsds.remove(q1);
    pm.currentTransaction().commit();
    pm.close();

    pm = pmf.getPersistenceManager();
    pm.currentTransaction().begin();
    q0 = (Qsdfgh) pm.getObjectById(
        pm.newObjectIdInstance(Qsdfgh.class, "q0"), false);
    q1 = (Qsdfgh) pm.getObjectById(
        pm.newObjectIdInstance(Qsdfgh.class, "q1"), false);
    a0 = (Azerty) pm.getObjectById(
        pm.newObjectIdInstance(Azerty.class, "a0"), false);
    a0.qsds.add(q0);
    a0.qsds.add(q1);
    pm.currentTransaction().commit();
    pm.close();

    pm = pmf.getPersistenceManager();
    pm.currentTransaction().begin();
    q0 = (Qsdfgh) pm.getObjectById(
        pm.newObjectIdInstance(Qsdfgh.class, "q0"), false);
    q1 = (Qsdfgh) pm.getObjectById(
        pm.newObjectIdInstance(Qsdfgh.class, "q1"), false);
    a0 = (Azerty) pm.getObjectById(
        pm.newObjectIdInstance(Azerty.class, "a0"), false);
    a0.qsds.remove(q0);
    a0.qsds.remove(q1);
    pm.currentTransaction().commit();
    pm.close();

    pm = pmf.getPersistenceManager();
    pm.currentTransaction().begin();
    q0 = (Qsdfgh) pm.getObjectById(
        pm.newObjectIdInstance(Qsdfgh.class, "q0"), false);
    q1 = (Qsdfgh) pm.getObjectById(
        pm.newObjectIdInstance(Qsdfgh.class, "q1"), false);
    a0 = (Azerty) pm.getObjectById(
        pm.newObjectIdInstance(Azerty.class, "a0"), false);
    a0.qsds.add(q0);
    a0.qsds.add(q1);
    pm.currentTransaction().commit();
    pm.close();
  }
}
TOP

Related Classes of org.objectweb.speedo.runtime.relations.mn.TestMN

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.