01: /**
02: * Copyright (C) 2001-2006 France Telecom R&D
03: */package org.objectweb.speedo.runtime.query;
04:
05: import org.objectweb.speedo.SpeedoTestHelper;
06: import org.objectweb.speedo.pobjects.basic.BasicA;
07:
08: import javax.jdo.PersistenceManager;
09: import javax.jdo.Query;
10:
11: public class TestDeleteQuery extends SpeedoTestHelper {
12:
13: public TestDeleteQuery(String s) {
14: super (s);
15: }
16:
17: protected String getLoggerName() {
18: return LOG_NAME + ".rt.query.TestDeleteQuery";
19: }
20:
21: public void testSimpleDelete() {
22: final int NB_OBJ = 50;
23: PersistenceManager pm = pmf.getPersistenceManager();
24: pm.currentTransaction().begin();
25: for (int i = 0; i < NB_OBJ; i++) {
26: pm.makePersistent(new BasicA("testSimpleDelete_" + i, i));
27: }
28: pm.currentTransaction().commit();
29: pm.evictAll();
30: pm.currentTransaction().begin();
31: Query q = pm.newQuery(BasicA.class);
32: long l = q.deletePersistentAll();
33: pm.currentTransaction().commit();
34: pm.close();
35: assertEquals("Bad number of delete object", NB_OBJ, l);
36: }
37: }
|