1
1
package ca .uhn .fhir .jpa .interceptor ;
2
2
3
3
import static ca .uhn .fhir .interceptor .model .RequestPartitionId .defaultPartition ;
4
+ import static ca .uhn .fhir .interceptor .model .RequestPartitionId .fromPartitionId ;
4
5
import static org .junit .jupiter .api .Assertions .assertNotNull ;
6
+
5
7
import ca .uhn .fhir .i18n .Msg ;
6
8
import ca .uhn .fhir .interceptor .api .Hook ;
7
9
import ca .uhn .fhir .interceptor .api .Interceptor ;
14
16
import ca .uhn .fhir .jpa .interceptor .ex .PartitionInterceptorReadAllPartitions ;
15
17
import ca .uhn .fhir .jpa .interceptor .ex .PartitionInterceptorReadPartitionsBasedOnScopes ;
16
18
import ca .uhn .fhir .jpa .model .entity .ResourceTable ;
17
- import ca .uhn .fhir .jpa .partition .IPartitionLookupSvc ;
18
19
import ca .uhn .fhir .jpa .searchparam .SearchParameterMap ;
19
20
import ca .uhn .fhir .rest .api .RestOperationTypeEnum ;
20
21
import ca .uhn .fhir .rest .api .server .IBundleProvider ;
32
33
import org .hl7 .fhir .r4 .model .StructureDefinition ;
33
34
import org .hl7 .fhir .r4 .model .Subscription ;
34
35
import org .junit .jupiter .api .Test ;
35
- import org .springframework .beans .factory .annotation .Autowired ;
36
36
import org .springframework .mock .web .MockHttpServletRequest ;
37
37
38
38
import jakarta .servlet .http .HttpServletRequest ;
46
46
import static org .assertj .core .api .Assertions .assertThat ;
47
47
import static org .junit .jupiter .api .Assertions .fail ;
48
48
import static org .junit .jupiter .api .Assertions .assertEquals ;
49
- import static org .junit .jupiter .api .Assertions .fail ;
50
49
51
50
import static org .mockito .ArgumentMatchers .eq ;
52
51
import static org .mockito .Mockito .mock ;
@@ -105,14 +104,14 @@ public void testCrossPartitionUpdate() {
105
104
assertEquals (2 , writeIndex .get ());
106
105
} finally {
107
106
myInterceptorRegistry .unregisterInterceptor (myPartitionInterceptor );
108
- myInterceptorRegistry .unregisterInterceptorsIf (t -> t instanceof MySubscriptionReadInterceptor );
109
- myInterceptorRegistry .unregisterInterceptorsIf (t -> t instanceof MySubscriptionWriteInterceptor );
107
+ myInterceptorRegistry .unregisterInterceptorsIf (MySubscriptionReadInterceptor . class :: isInstance );
108
+ myInterceptorRegistry .unregisterInterceptorsIf (MySubscriptionWriteInterceptor . class :: isInstance );
110
109
}
111
110
}
112
111
113
112
@ Test
114
113
public void testCreateNonPartionableResourceWithPartitionDate () {
115
- addNextTargetPartitionForCreate (defaultPartition ( LocalDate .of (2021 , 2 , 22 )));
114
+ addNextTargetPartitionForCreate (fromPartitionId ( null , LocalDate .of (2021 , 2 , 22 )));
116
115
117
116
StructureDefinition sd = new StructureDefinition ();
118
117
sd .setUrl ("http://foo" );
@@ -129,7 +128,7 @@ public void testCreateNonPartionableResourceWithPartitionDate() {
129
128
130
129
@ Test
131
130
public void testCreateNonPartionableResourceWithNullPartitionReturned () {
132
- addNextTargetPartitionForCreate (RequestPartitionId .defaultPartition ());
131
+ addNextTargetPartitionForCreate (RequestPartitionId .allPartitions ());
133
132
134
133
StructureDefinition sd = new StructureDefinition ();
135
134
sd .setUrl ("http://foo" );
@@ -177,7 +176,7 @@ public void testSearch_InterceptorForAllPartitions() {
177
176
IIdType patientId1 = createPatient (withCreatePartition (1 ), withActiveTrue ());
178
177
IIdType patientId2 = createPatient (withCreatePartition (2 ), withActiveTrue ());
179
178
180
-
179
+ ourLog . info ( "Created patients: {}, {}, {}" , patientIdNull , patientId1 , patientId2 );
181
180
PartitionInterceptorReadAllPartitions interceptor = new PartitionInterceptorReadAllPartitions ();
182
181
myInterceptorRegistry .registerInterceptor (interceptor );
183
182
try {
0 commit comments