19
19
import static org .junit .jupiter .api .Assertions .*;
20
20
21
21
import java .util .ArrayList ;
22
- import java .util .Arrays ;
23
22
import java .util .List ;
24
23
import java .util .Optional ;
25
24
import java .util .UUID ;
28
27
import org .springframework .beans .factory .annotation .Autowired ;
29
28
import org .springframework .context .annotation .Configuration ;
30
29
import org .springframework .data .couchbase .config .AbstractCouchbaseConfiguration ;
31
- import org .springframework .data .couchbase .domain .Course ;
32
30
import org .springframework .data .couchbase .domain .Library ;
33
31
import org .springframework .data .couchbase .domain .LibraryRepository ;
34
- import org .springframework .data .couchbase .domain .Submission ;
32
+ import org .springframework .data .couchbase .domain .SubscriptionToken ;
33
+ import org .springframework .data .couchbase .domain .SubscriptionTokenRepository ;
35
34
import org .springframework .data .couchbase .domain .User ;
36
35
import org .springframework .data .couchbase .domain .UserRepository ;
37
- import org .springframework .data .couchbase .domain .UserSubmission ;
38
- import org .springframework .data .couchbase .domain .UserSubmissionRepository ;
39
36
import org .springframework .data .couchbase .repository .config .EnableCouchbaseRepositories ;
40
37
import org .springframework .data .couchbase .util .ClusterAwareIntegrationTests ;
41
38
import org .springframework .data .couchbase .util .ClusterType ;
@@ -54,7 +51,16 @@ public class CouchbaseRepositoryKeyValueIntegrationTests extends ClusterAwareInt
54
51
55
52
@ Autowired UserRepository userRepository ;
56
53
@ Autowired LibraryRepository libraryRepository ;
57
- @ Autowired UserSubmissionRepository userSubmissionRepository ;
54
+ @ Autowired SubscriptionTokenRepository subscriptionTokenRepository ;
55
+
56
+ @ Test
57
+ void subscriptionToken (){
58
+ SubscriptionToken st = new SubscriptionToken ("id" , 0 , "type" , "Dave Smith" ,
59
+ "app123" , "dev123" , 0 );
60
+ st = subscriptionTokenRepository .save (st );
61
+ st = subscriptionTokenRepository .findById (st .getId ()).get ();
62
+ assertNotNull (st );
63
+ }
58
64
59
65
@ Test
60
66
@ IgnoreWhen (clusterTypes = ClusterType .MOCKED )
@@ -95,31 +101,6 @@ void saveAndFindByIdWithList() {
95
101
assertFalse (userRepository .existsById (library .getId ()));
96
102
}
97
103
98
- @ Test
99
- @ IgnoreWhen (clusterTypes = ClusterType .MOCKED )
100
- void saveAndFindByWithNestedId () {
101
- UserSubmission user = new UserSubmission ();
102
- user .setId (UUID .randomUUID ().toString ());
103
- user .setSubmissions (
104
- Arrays .asList (new Submission (UUID .randomUUID ().toString (), user .getId (), "tid" , "status" , 123 )));
105
- user .setCourses (Arrays .asList (new Course (UUID .randomUUID ().toString (), user .getId (), "581" )));
106
-
107
- // this currently fails when using mocked in integration.properties with status "UNKNOWN"
108
- assertFalse (userRepository .existsById (user .getId ()));
109
-
110
- userSubmissionRepository .save (user );
111
-
112
- Optional <UserSubmission > found = userSubmissionRepository .findById (user .getId ());
113
- assertTrue (found .isPresent ());
114
- found .ifPresent (u -> assertEquals (user , u ));
115
-
116
- assertTrue (userRepository .existsById (user .getId ()));
117
- assertEquals (user .getSubmissions ().get (0 ).getId (), found .get ().getSubmissions ().get (0 ).getId ());
118
- assertEquals (user .getCourses ().get (0 ).getId (), found .get ().getCourses ().get (0 ).getId ());
119
- assertEquals (user , found .get ());
120
- userSubmissionRepository .delete (user );
121
- }
122
-
123
104
@ Configuration
124
105
@ EnableCouchbaseRepositories ("org.springframework.data.couchbase" )
125
106
static class Config extends AbstractCouchbaseConfiguration {
0 commit comments