20
20
21
21
import org .apache .cayenne .dba .JdbcPkGenerator ;
22
22
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 ;
25
25
import org .apache .cayenne .unit .di .DataChannelInterceptor ;
26
26
import org .apache .cayenne .unit .di .server .CayenneProjects ;
27
27
import org .apache .cayenne .unit .di .server .ServerCase ;
30
30
31
31
import static org .junit .Assert .assertEquals ;
32
32
33
- @ UseServerRuntime (CayenneProjects .TESTMAP_PROJECT )
33
+ @ UseServerRuntime (CayenneProjects .TOONE_PROJECT )
34
34
public class CAY2723IT extends ServerCase {
35
35
@ Inject
36
36
private DataContext context ;
@@ -43,8 +43,7 @@ public void phantomToDepPKUpdate() {
43
43
// try to trigger PK generator. so it wouldn't random fail the actual test
44
44
for (int i = 0 ; i < JdbcPkGenerator .DEFAULT_PK_CACHE_SIZE ; i ++) {
45
45
int queryCounter = queryInterceptor .runWithQueryCounter (() -> {
46
- Painting painting = context .newObject (Painting .class );
47
- painting .setPaintingTitle ("test_warmup" );
46
+ context .newObject (TooneMaster .class );
48
47
context .commitChanges ();
49
48
});
50
49
// PK generator triggered, we are ready
@@ -53,16 +52,12 @@ public void phantomToDepPKUpdate() {
53
52
}
54
53
}
55
54
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 );
58
59
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 );
66
61
67
62
// here should be only single insert of the painting object
68
63
int queryCounter = queryInterceptor .runWithQueryCounter (() -> context .commitChanges ());
0 commit comments