Skip to content

Commit 22363d8

Browse files
committed
Improve test stability
1 parent 1f7f2a6 commit 22363d8

File tree

1 file changed

+9
-14
lines changed

1 file changed

+9
-14
lines changed

cayenne-server/src/test/java/org/apache/cayenne/access/CAY2723IT.java

+9-14
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020

2121
import org.apache.cayenne.dba.JdbcPkGenerator;
2222
import org.apache.cayenne.di.Inject;
23-
import org.apache.cayenne.testdo.testmap.Painting;
24-
import org.apache.cayenne.testdo.testmap.PaintingInfo;
23+
import org.apache.cayenne.testdo.toone.TooneDep;
24+
import org.apache.cayenne.testdo.toone.TooneMaster;
2525
import org.apache.cayenne.unit.di.DataChannelInterceptor;
2626
import org.apache.cayenne.unit.di.server.CayenneProjects;
2727
import org.apache.cayenne.unit.di.server.ServerCase;
@@ -30,7 +30,7 @@
3030

3131
import static org.junit.Assert.assertEquals;
3232

33-
@UseServerRuntime(CayenneProjects.TESTMAP_PROJECT)
33+
@UseServerRuntime(CayenneProjects.TOONE_PROJECT)
3434
public class CAY2723IT extends ServerCase {
3535
@Inject
3636
private DataContext context;
@@ -43,8 +43,7 @@ public void phantomToDepPKUpdate() {
4343
// try to trigger PK generator. so it wouldn't random fail the actual test
4444
for (int i = 0; i < JdbcPkGenerator.DEFAULT_PK_CACHE_SIZE; i++) {
4545
int queryCounter = queryInterceptor.runWithQueryCounter(() -> {
46-
Painting painting = context.newObject(Painting.class);
47-
painting.setPaintingTitle("test_warmup");
46+
context.newObject(TooneMaster.class);
4847
context.commitChanges();
4948
});
5049
// PK generator triggered, we are ready
@@ -53,16 +52,12 @@ public void phantomToDepPKUpdate() {
5352
}
5453
}
5554

56-
Painting painting = context.newObject(Painting.class);
57-
painting.setPaintingTitle("test_p_123");
55+
TooneMaster master = context.newObject(TooneMaster.class);
56+
TooneDep dep = context.newObject(TooneDep.class);
57+
master.setToDependent(dep);
58+
master.setToDependent(null);
5859

59-
PaintingInfo paintingInfo = context.newObject(PaintingInfo.class);
60-
paintingInfo.setTextReview("test_a_123");
61-
62-
painting.setToPaintingInfo(paintingInfo);
63-
painting.setToPaintingInfo(null);
64-
65-
context.deleteObject(paintingInfo);
60+
context.deleteObject(dep);
6661

6762
// here should be only single insert of the painting object
6863
int queryCounter = queryInterceptor.runWithQueryCounter(() -> context.commitChanges());

0 commit comments

Comments
 (0)