|
72 | 72 | import org.springframework.data.couchbase.domain.AirportMini;
|
73 | 73 | import org.springframework.data.couchbase.domain.AirportRepository;
|
74 | 74 | import org.springframework.data.couchbase.domain.AirportRepositoryScanConsistencyTest;
|
| 75 | +import org.springframework.data.couchbase.domain.Course; |
75 | 76 | import org.springframework.data.couchbase.domain.Iata;
|
76 | 77 | import org.springframework.data.couchbase.domain.NaiveAuditorAware;
|
77 | 78 | import org.springframework.data.couchbase.domain.Person;
|
@@ -855,7 +856,45 @@ void updateObject() throws Exception {
|
855 | 856 | Optional<UserSubmission> fetched = userSubmissionRepository.findById(userSubmission.getId());
|
856 | 857 | assertEquals(address, fetched.get().getAddress());
|
857 | 858 | } finally {
|
858 |
| - airportRepository.deleteById(userSubmission.getId()); |
| 859 | + userSubmissionRepository.deleteById(userSubmission.getId()); |
| 860 | + } |
| 861 | + } |
| 862 | + |
| 863 | + @Test |
| 864 | + void namedParameterList() throws Exception { |
| 865 | + UserSubmission userSubmission = new UserSubmission(); |
| 866 | + userSubmission.setId("123"); |
| 867 | + try { |
| 868 | + userSubmission.setUsername("updateObject"); |
| 869 | + userSubmissionRepository.save(userSubmission); |
| 870 | + Course[] courses = new Course[]{ new Course("1", "2", "3"), new Course("4","5","6")}; |
| 871 | + userSubmissionRepository.setNamedCourses(userSubmission.getId(), courses); |
| 872 | + Optional<UserSubmission> fetched = userSubmissionRepository.findById(userSubmission.getId()); |
| 873 | + assertEquals(courses.length, fetched.get().getCourses().size()); |
| 874 | + for(int i=0; i< courses.length; i++){ |
| 875 | + assertEquals(courses[i], fetched.get().getCourses().get(i)); |
| 876 | + } |
| 877 | + } finally { |
| 878 | + userSubmissionRepository.deleteById(userSubmission.getId()); |
| 879 | + } |
| 880 | + } |
| 881 | + |
| 882 | + @Test |
| 883 | + void orderedParameterList() throws Exception { |
| 884 | + UserSubmission userSubmission = new UserSubmission(); |
| 885 | + userSubmission.setId("123"); |
| 886 | + try { |
| 887 | + userSubmission.setUsername("updateObject"); |
| 888 | + userSubmissionRepository.save(userSubmission); |
| 889 | + Course[] courses = new Course[]{ new Course("1", "2", "3"), new Course("4","5","6")}; |
| 890 | + userSubmissionRepository.setOrderedCourses(userSubmission.getId(), courses); |
| 891 | + Optional<UserSubmission> fetched = userSubmissionRepository.findById(userSubmission.getId()); |
| 892 | + assertEquals(courses.length, fetched.get().getCourses().size()); |
| 893 | + for(int i=0; i< courses.length; i++){ |
| 894 | + assertEquals(courses[i], fetched.get().getCourses().get(i)); |
| 895 | + } |
| 896 | + } finally { |
| 897 | + userSubmissionRepository.deleteById(userSubmission.getId()); |
859 | 898 | }
|
860 | 899 | }
|
861 | 900 |
|
|
0 commit comments