/**
* 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 TestMNCreate extends SpeedoTestHelper {
public TestMNCreate(String s) {
super(s);
}
protected String getLoggerName() {
return LOG_NAME + "rt.relations.mn";
}
public void testA() {
PersistenceManager pm = pmf.getPersistenceManager();
Azerty[] as = new Azerty[4];
Qsdfgh[] qs = new Qsdfgh[4];
for(int i=0; i<4; i++) {
as[i] = new Azerty("a" + i);
qs[i] = new Qsdfgh("q" + i);
}
pm.currentTransaction().begin();
as[0].qsds.add(qs[0]);
as[0].qsds.add(qs[1]);
pm.makePersistent(as[0]);
as[1].qsds.add(qs[0]);
as[1].qsds.add(qs[1]);
as[1].qsds.add(qs[2]);
pm.makePersistent(as[1]);
as[2].qsds.add(qs[1]);
as[2].qsds.add(qs[2]);
pm.makePersistent(as[2]);
pm.makePersistent(as[3]);
pm.makePersistent(qs[3]);
pm.currentTransaction().commit();
pm.close();
}
}