@@ -105,23 +105,23 @@ public void checkSyncStrategy() {
105105 // Subject with one concept attribute, location migrated
106106 ObservationCollection observations = ObservationCollectionBuilder .withOneObservation (concept1 , concept1 .getAnswerConcept ("Answer 11" ).getUuid ());
107107 Individual s1 = testSubjectService .save (new SubjectBuilder ().withMandatoryFieldsForNewEntity ().withSubjectType (subjectType ).withLocation (catchmentData .getAddressLevel1 ()).withObservations (observations ).build ());
108- subjectMigrationService .markSubjectMigrationIfRequired (s1 .getUuid (), catchmentData .getAddressLevel2 (), observations , false );
108+ subjectMigrationService .markSubjectMigrationIfRequired (s1 .getUuid (), null , catchmentData .getAddressLevel2 (), null , observations , false );
109109 List syncDetails = getSyncDetails ();
110110 assertTrue (syncDetails .contains (EntitySyncStatusContract .createForComparison (SyncEntityName .SubjectMigration .name (), subjectType .getUuid ())));
111111 assertEquals (1 , getMigrations (subjectType , DateTime .now ().minusDays (1 ), DateTime .now ()).size ());
112112 assertTrue (hasMigrationFor (subjectType , DateTime .now ().minusDays (1 ), DateTime .now (), s1 ));
113113
114114 // Subject with one concept attribute, attribute migrated
115115 Individual s3 = testSubjectService .save (new SubjectBuilder ().withMandatoryFieldsForNewEntity ().withSubjectType (subjectType ).withLocation (catchmentData .getAddressLevel1 ()).withObservations (ObservationCollectionBuilder .withOneObservation (concept1 , concept1 .getAnswerConcept ("Answer 11" ).getUuid ())).build ());
116- subjectMigrationService .markSubjectMigrationIfRequired (s3 .getUuid (), catchmentData .getAddressLevel1 (), ObservationCollectionBuilder .withOneObservation (concept1 , concept1 .getAnswerConcept ("Answer 12" ).getUuid ()), false );
116+ subjectMigrationService .markSubjectMigrationIfRequired (s3 .getUuid (), null , catchmentData .getAddressLevel1 (), null , ObservationCollectionBuilder .withOneObservation (concept1 , concept1 .getAnswerConcept ("Answer 12" ).getUuid ()), false );
117117 assertTrue (hasMigrationFor (subjectType , DateTime .now ().minusDays (1 ), DateTime .now (), s3 ));
118118 assertEquals (2 , getMigrations (subjectType , DateTime .now ().minusDays (1 ), DateTime .now ()).size ());
119119
120120 // Subject migrated but its old and new attributes are not assigned to user
121121 observations = ObservationCollectionBuilder .withOneObservation (concept1 , concept1 .getAnswerConcept ("Answer 12" ).getUuid ());
122122 ObservationCollection newObservations = ObservationCollectionBuilder .withOneObservation (concept1 , concept1 .getAnswerConcept ("Answer 13" ).getUuid ());
123123 Individual s7 = testSubjectService .save (new SubjectBuilder ().withMandatoryFieldsForNewEntity ().withSubjectType (subjectType ).withLocation (catchmentData .getAddressLevel1 ()).withObservations (observations ).build ());
124- subjectMigrationService .markSubjectMigrationIfRequired (s7 .getUuid (), catchmentData .getAddressLevel1 (), newObservations , false );
124+ subjectMigrationService .markSubjectMigrationIfRequired (s7 .getUuid (), null , catchmentData .getAddressLevel1 (), null , newObservations , false );
125125 assertFalse (hasMigrationFor (subjectType , DateTime .now ().minusDays (1 ), DateTime .now (), s7 ));
126126 assertEquals (2 , getMigrations (subjectType , DateTime .now ().minusDays (1 ), DateTime .now ()).size ());
127127
@@ -140,23 +140,23 @@ public void checkSyncStrategy() {
140140 // Subject with two concept attributes, location migrated
141141 observations = new ObservationCollectionBuilder ().addObservation (concept1 , concept1 .getAnswerConcept ("Answer 12" )).addObservation (concept2 , concept2 .getAnswerConcept ("Answer 22" )).build ();
142142 Individual s2 = testSubjectService .save (new SubjectBuilder ().withMandatoryFieldsForNewEntity ().withSubjectType (subjectType ).withLocation (catchmentData .getAddressLevel1 ()).withObservations (observations ).build ());
143- subjectMigrationService .markSubjectMigrationIfRequired (s2 .getUuid (), catchmentData .getAddressLevel2 (), observations , false );
143+ subjectMigrationService .markSubjectMigrationIfRequired (s2 .getUuid (), null , catchmentData .getAddressLevel2 (), null , observations , false );
144144 assertTrue (hasMigrationFor (subjectType , DateTime .now ().minusDays (1 ), DateTime .now (), s2 ));
145145
146146 // Subject with two concept attributes, first attribute migrated
147147 Individual s4 = testSubjectService .save (new SubjectBuilder ().withMandatoryFieldsForNewEntity ().withSubjectType (subjectType ).withLocation (catchmentData .getAddressLevel1 ()).withObservations (new ObservationCollectionBuilder ().addObservation (concept1 , concept1 .getAnswerConcept ("Answer 11" )).addObservation (concept2 , concept2 .getAnswerConcept ("Answer 21" )).build ()).build ());
148- subjectMigrationService .markSubjectMigrationIfRequired (s4 .getUuid (), catchmentData .getAddressLevel1 (), new ObservationCollectionBuilder ().addObservation (concept1 , concept1 .getAnswerConcept ("Answer 12" )).addObservation (concept2 , concept2 .getAnswerConcept ("Answer 21" )).build (), false );
148+ subjectMigrationService .markSubjectMigrationIfRequired (s4 .getUuid (), null , catchmentData .getAddressLevel1 (), null , new ObservationCollectionBuilder ().addObservation (concept1 , concept1 .getAnswerConcept ("Answer 12" )).addObservation (concept2 , concept2 .getAnswerConcept ("Answer 21" )).build (), false );
149149 assertTrue (hasMigrationFor (subjectType , DateTime .now ().minusDays (1 ), DateTime .now (), s4 ));
150150
151151 // Subject with two concept attributes, second attribute migrated
152152 Individual s5 = testSubjectService .save (new SubjectBuilder ().withMandatoryFieldsForNewEntity ().withSubjectType (subjectType ).withLocation (catchmentData .getAddressLevel1 ()).withObservations (new ObservationCollectionBuilder ().addObservation (concept1 , concept1 .getAnswerConcept ("Answer 11" )).addObservation (concept2 , concept2 .getAnswerConcept ("Answer 21" )).build ()).build ());
153- subjectMigrationService .markSubjectMigrationIfRequired (s5 .getUuid (), catchmentData .getAddressLevel1 (), new ObservationCollectionBuilder ().addObservation (concept1 , concept1 .getAnswerConcept ("Answer 11" )).addObservation (concept2 , concept2 .getAnswerConcept ("Answer 22" )).build (), false );
153+ subjectMigrationService .markSubjectMigrationIfRequired (s5 .getUuid (), null , catchmentData .getAddressLevel1 (), null , new ObservationCollectionBuilder ().addObservation (concept1 , concept1 .getAnswerConcept ("Answer 11" )).addObservation (concept2 , concept2 .getAnswerConcept ("Answer 22" )).build (), false );
154154 boolean hasMigrationFor = hasMigrationFor (subjectType , DateTime .now ().minusDays (1 ), DateTime .now (), s5 );
155155 assertTrue (hasMigrationFor );
156156
157157 // Subject with two concept attributes, both attributes migrated
158158 Individual s6 = testSubjectService .save (new SubjectBuilder ().withMandatoryFieldsForNewEntity ().withSubjectType (subjectType ).withLocation (catchmentData .getAddressLevel1 ()).withObservations (new ObservationCollectionBuilder ().addObservation (concept1 , concept1 .getAnswerConcept ("Answer 11" )).addObservation (concept2 , concept2 .getAnswerConcept ("Answer 21" )).build ()).build ());
159- subjectMigrationService .markSubjectMigrationIfRequired (s6 .getUuid (), catchmentData .getAddressLevel1 (), new ObservationCollectionBuilder ().addObservation (concept1 , concept1 .getAnswerConcept ("Answer 12" )).addObservation (concept2 , concept2 .getAnswerConcept ("Answer 22" )).build (), false );
159+ subjectMigrationService .markSubjectMigrationIfRequired (s6 .getUuid (), null , catchmentData .getAddressLevel1 (), null , new ObservationCollectionBuilder ().addObservation (concept1 , concept1 .getAnswerConcept ("Answer 12" )).addObservation (concept2 , concept2 .getAnswerConcept ("Answer 22" )).build (), false );
160160 assertTrue (hasMigrationFor (subjectType , DateTime .now ().minusDays (1 ), DateTime .now (), s6 ));
161161
162162 // User without sync attributes setup will not get any migration as that is more performance optimised. Setting
@@ -178,7 +178,7 @@ public void migrations_created_by_one_user_is_returned_for_another_user_even_whe
178178 ObservationCollection observations = ObservationCollectionBuilder .withOneObservation (concept1 , concept1 .getAnswerConcept ("Answer 11" ).getUuid ());
179179 ObservationCollection newObservations = ObservationCollectionBuilder .withOneObservation (concept1 , concept1 .getAnswerConcept ("Answer 11" ).getUuid ());
180180 Individual s = testSubjectService .save (new SubjectBuilder ().withMandatoryFieldsForNewEntity ().withSubjectType (subjectType ).withLocation (catchmentData .getAddressLevel1 ()).withObservations (observations ).build ());
181- subjectMigrationService .markSubjectMigrationIfRequired (s .getUuid (), catchmentData .getAddressLevel2 (), newObservations , false );
181+ subjectMigrationService .markSubjectMigrationIfRequired (s .getUuid (), null , catchmentData .getAddressLevel2 (), null , newObservations , false );
182182 assertTrue (getSyncDetails ().contains (EntitySyncStatusContract .createForComparison (SyncEntityName .SubjectMigration .name (), subjectType .getUuid ())));
183183 assertEquals (1 , getMigrations (subjectType , DateTime .now ().minusDays (1 ), DateTime .now ()).size ());
184184
0 commit comments