move mdm interceptor registration (#5830)

* licenses

* remove mdm placeholder interceptor

* remove mdm placeholder interceptor

* fix regression

* Remove RTE Placeholder Interceptor.
Add tests to assert proper boot sequence.

* consolidate LogbackCaptureTestExtension (removed the cdr class)

* consolidate LogbackCaptureTestExtension (removed the cdr class)
This commit is contained in:
Ken Stevens 2024-04-08 12:59:54 -03:00 committed by GitHub
parent 5d55594a73
commit eafa2aba29
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
14 changed files with 271 additions and 3 deletions

View File

@ -1,3 +1,22 @@
/*-
* #%L
* HAPI FHIR - Server Framework
* %%
* Copyright (C) 2014 - 2024 Smile CDR, Inc.
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package ca.uhn.fhir.rest.server.provider;
import jakarta.annotation.Nonnull;

View File

@ -1,3 +1,22 @@
/*-
* #%L
* HAPI FHIR - Server Framework
* %%
* Copyright (C) 2014 - 2024 Smile CDR, Inc.
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package ca.uhn.fhir.rest.server.provider;
import jakarta.annotation.Nonnull;

View File

@ -1,3 +1,22 @@
/*-
* #%L
* HAPI FHIR JPA Server - Batch2 specification tests
* %%
* Copyright (C) 2014 - 2024 Smile CDR, Inc.
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package ca.uhn.hapi.fhir.batch2.test;
import ca.uhn.fhir.batch2.model.WorkChunkCompletionEvent;

View File

@ -1,3 +1,22 @@
/*-
* #%L
* HAPI FHIR JPA Server - Batch2 specification tests
* %%
* Copyright (C) 2014 - 2024 Smile CDR, Inc.
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package ca.uhn.hapi.fhir.batch2.test;
import ca.uhn.fhir.batch2.api.IJobPersistence;

View File

@ -1,3 +1,22 @@
/*-
* #%L
* HAPI FHIR JPA Server - Batch2 specification tests
* %%
* Copyright (C) 2014 - 2024 Smile CDR, Inc.
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package ca.uhn.hapi.fhir.batch2.test;
import ca.uhn.fhir.batch2.api.IJobPersistence;

View File

@ -1,3 +1,22 @@
/*-
* #%L
* HAPI FHIR JPA Server - Batch2 specification tests
* %%
* Copyright (C) 2014 - 2024 Smile CDR, Inc.
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package ca.uhn.hapi.fhir.batch2.test;
import ca.uhn.fhir.batch2.model.JobInstance;

View File

@ -1,3 +1,22 @@
/*-
* #%L
* HAPI FHIR JPA Server - Batch2 specification tests
* %%
* Copyright (C) 2014 - 2024 Smile CDR, Inc.
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package ca.uhn.hapi.fhir.batch2.test;
import ca.uhn.fhir.batch2.model.WorkChunk;

View File

@ -1,3 +1,22 @@
/*-
* #%L
* HAPI FHIR JPA Server - Batch2 specification tests
* %%
* Copyright (C) 2014 - 2024 Smile CDR, Inc.
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package ca.uhn.hapi.fhir.batch2.test;
import ca.uhn.fhir.batch2.model.WorkChunk;

View File

@ -1,3 +1,22 @@
/*-
* #%L
* HAPI FHIR JPA Server - Batch2 specification tests
* %%
* Copyright (C) 2014 - 2024 Smile CDR, Inc.
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package ca.uhn.hapi.fhir.batch2.test;
import ca.uhn.fhir.batch2.model.JobInstance;

View File

@ -1,3 +1,22 @@
/*-
* #%L
* HAPI FHIR JPA Server - Batch2 specification tests
* %%
* Copyright (C) 2014 - 2024 Smile CDR, Inc.
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package ca.uhn.hapi.fhir.batch2.test;
public interface WorkChunkTestConstants {

View File

@ -1,3 +1,22 @@
/*-
* #%L
* HAPI FHIR JPA Server - Batch2 specification tests
* %%
* Copyright (C) 2014 - 2024 Smile CDR, Inc.
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package ca.uhn.hapi.fhir.batch2.test.configs;
import ca.uhn.fhir.batch2.channel.BatchJobSender;

View File

@ -41,8 +41,8 @@ public class MdmSubmitterInterceptorLoader {
@Autowired
JpaStorageSettings myStorageSettings;
@Autowired
private IMdmStorageInterceptor myIMdmStorageInterceptor;
@Autowired(required = false)
private IMdmStorageInterceptor myMdmStorageInterceptor;
@Autowired
private MdmSearchExpandingInterceptor myMdmSearchExpandingInterceptorInterceptor;
@ -60,7 +60,9 @@ public class MdmSubmitterInterceptorLoader {
throw new ConfigurationException(
Msg.code(2421) + "MDM requires Message Subscriptions to be enabled in the Storage Settings");
}
myInterceptorService.registerInterceptor(myIMdmStorageInterceptor);
if (myMdmStorageInterceptor != null) {
myInterceptorService.registerInterceptor(myMdmStorageInterceptor);
}
myInterceptorService.registerInterceptor(myMdmSearchExpandingInterceptorInterceptor);
ourLog.info("MDM interceptors registered");
}

View File

@ -86,6 +86,14 @@ public class LogbackCaptureTestExtension implements BeforeEachCallback, AfterEac
this(theClass.getName());
}
public LogbackCaptureTestExtension(Class<?> theClass, Level theLevel) {
this(theClass.getName(), theLevel);
}
public LogbackCaptureTestExtension(org.slf4j.Logger theLogger) {
this((Logger) theLogger);
}
/**
* Returns a copy to avoid concurrent modification errors.
* @return A copy of the log events so far.
@ -154,6 +162,16 @@ public class LogbackCaptureTestExtension implements BeforeEachCallback, AfterEac
.collect(Collectors.toList());
}
/**
* Extract the log messages from the logging events.
* @return a copy of the List of log messages
*
*/
@Nonnull
public List<String> getLogMessages() {
return getLogEvents().stream().map(ILoggingEvent::getMessage).collect(Collectors.toList());
}
// Hamcrest matcher support
public static Matcher<ILoggingEvent> eventWithLevelAndMessageContains(@Nonnull Level theLevel, @Nonnull String thePartialMessage) {
return new LogbackEventMatcher(theLevel, thePartialMessage);

View File

@ -0,0 +1,39 @@
package ca.uhn.test.util;
import ch.qos.logback.classic.spi.ILoggingEvent;
import org.junit.jupiter.api.extension.AfterAllCallback;
import org.junit.jupiter.api.extension.BeforeAllCallback;
import org.junit.jupiter.api.extension.ExtensionContext;
import java.util.List;
/**
* This is a static wrapper around LogbackCaptureTestExtension for use in IT tests when you need to assert on App
* startup log entries
*/
public class StaticLogbackCaptureTestExtension implements BeforeAllCallback, AfterAllCallback {
private final LogbackCaptureTestExtension myLogbackCaptureTestExtension;
public StaticLogbackCaptureTestExtension(LogbackCaptureTestExtension theLogbackCaptureTestExtension) {
myLogbackCaptureTestExtension = theLogbackCaptureTestExtension;
}
public StaticLogbackCaptureTestExtension() {
myLogbackCaptureTestExtension = new LogbackCaptureTestExtension();
}
@Override
public void beforeAll(ExtensionContext theExtensionContext) throws Exception {
myLogbackCaptureTestExtension.beforeEach(theExtensionContext);
}
@Override
public void afterAll(ExtensionContext theExtensionContext) throws Exception {
myLogbackCaptureTestExtension.afterEach(theExtensionContext);
}
public List<ILoggingEvent> filterLoggingEventsWithMessageEqualTo(String theMessageText) {
return myLogbackCaptureTestExtension.filterLoggingEventsWithMessageEqualTo(theMessageText);
}
}