Enable subscriptions and upgrade to jetty 12
This commit is contained in:
@@ -164,7 +164,6 @@ class ExampleServerDstu3IT implements IServerSupport {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled
|
||||
void testWebsocketSubscription() throws Exception {
|
||||
/*
|
||||
* Create subscription
|
||||
|
||||
@@ -217,7 +217,6 @@ class ExampleServerR4IT implements IServerSupport {
|
||||
ourClient.transaction().withBundle(bundle).execute();
|
||||
}
|
||||
|
||||
@Disabled
|
||||
@Test
|
||||
@Order(1)
|
||||
void testWebsocketSubscription() throws Exception {
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
package ca.uhn.fhir.jpa.starter;
|
||||
|
||||
import static ca.uhn.fhir.util.TestUtil.waitForSize;
|
||||
import static org.awaitility.Awaitility.await;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.rest.api.CacheControlDirective;
|
||||
import ca.uhn.fhir.rest.api.EncodingEnum;
|
||||
@@ -11,10 +7,6 @@ import ca.uhn.fhir.rest.api.MethodOutcome;
|
||||
import ca.uhn.fhir.rest.client.api.IGenericClient;
|
||||
import ca.uhn.fhir.rest.client.api.ServerValidationModeEnum;
|
||||
import ca.uhn.fhir.rest.client.interceptor.LoggingInterceptor;
|
||||
import java.net.URI;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import jakarta.websocket.ContainerProvider;
|
||||
import jakarta.websocket.Session;
|
||||
import jakarta.websocket.WebSocketContainer;
|
||||
@@ -26,20 +18,25 @@ import org.hl7.fhir.r5.model.Patient;
|
||||
import org.hl7.fhir.r5.model.Subscription;
|
||||
import org.hl7.fhir.r5.model.SubscriptionTopic;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.web.server.LocalServerPort;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
import static ca.uhn.fhir.util.TestUtil.waitForSize;
|
||||
import static org.awaitility.Awaitility.await;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = {Application.class}, properties =
|
||||
{
|
||||
"spring.datasource.url=jdbc:h2:mem:dbr5",
|
||||
"hapi.fhir.fhir_version=r5",
|
||||
"hapi.fhir.cr_enabled=false",
|
||||
// "hapi.fhir.subscription.websocket_enabled=true"
|
||||
"hapi.fhir.subscription.websocket_enabled=true"
|
||||
})
|
||||
public class ExampleServerR5IT {
|
||||
|
||||
@@ -68,7 +65,6 @@ public class ExampleServerR5IT {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled
|
||||
void testWebsocketSubscription() throws Exception {
|
||||
String endpoint = "ws://localhost:" + port + "/websocket";
|
||||
/*
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package ca.uhn.fhir.jpa.starter;
|
||||
|
||||
import org.eclipse.jetty.webapp.WebAppContext;
|
||||
import org.eclipse.jetty.websocket.server.config.JettyWebSocketServletContainerInitializer;
|
||||
import org.eclipse.jetty.ee10.webapp.WebAppContext;
|
||||
import org.eclipse.jetty.ee10.websocket.jakarta.server.config.JakartaWebSocketServletContainerInitializer;
|
||||
import org.springframework.boot.web.embedded.jetty.JettyServletWebServerFactory;
|
||||
import org.springframework.boot.web.server.WebServerFactoryCustomizer;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
@@ -15,18 +15,18 @@ import org.springframework.context.annotation.Configuration;
|
||||
public class JpaStarterWebsocketDispatcherConfig {
|
||||
|
||||
@Bean
|
||||
public Jetty10WebSocketServletWebServerCustomizer jetty10WebSocketServletWebServerCustomizer() {
|
||||
return new Jetty10WebSocketServletWebServerCustomizer();
|
||||
public Jetty12WebSocketServletWebServerCustomizer jetty10WebSocketServletWebServerCustomizer() {
|
||||
return new Jetty12WebSocketServletWebServerCustomizer();
|
||||
}
|
||||
|
||||
static class Jetty10WebSocketServletWebServerCustomizer implements WebServerFactoryCustomizer<JettyServletWebServerFactory> {
|
||||
static class Jetty12WebSocketServletWebServerCustomizer implements WebServerFactoryCustomizer<JettyServletWebServerFactory> {
|
||||
|
||||
@Override
|
||||
public void customize(JettyServletWebServerFactory factory) {
|
||||
|
||||
factory.addServerCustomizers(server -> {
|
||||
WebAppContext ctx = (WebAppContext) server.getHandler();
|
||||
JettyWebSocketServletContainerInitializer.configure(ctx, null);
|
||||
JakartaWebSocketServletContainerInitializer.configure(ctx, null);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user