From 9b6634291874f44233bc7a75e85c46fad47ad2eb Mon Sep 17 00:00:00 2001 From: leo james Date: Fri, 13 Sep 2024 14:27:55 +0800 Subject: [PATCH] update to 2.2.14 (#1006) * update to 2.2.14 * fix test --- pom.xml | 2 +- .../web/ArkTomcatServletWebServerFactory.java | 2 +- .../ArkTomcatServletWebServerFactoryTest.java | 40 ++++--------------- 3 files changed, 9 insertions(+), 35 deletions(-) diff --git a/pom.xml b/pom.xml index 2f15290df..9774f3efe 100644 --- a/pom.xml +++ b/pom.xml @@ -14,7 +14,7 @@ - 2.2.14-SNAPSHOT + 2.2.14 2.2.13 UTF-8 1.8 diff --git a/sofa-ark-parent/support/ark-springboot-integration/ark-springboot-starter/src/main/java/com/alipay/sofa/ark/springboot/web/ArkTomcatServletWebServerFactory.java b/sofa-ark-parent/support/ark-springboot-integration/ark-springboot-starter/src/main/java/com/alipay/sofa/ark/springboot/web/ArkTomcatServletWebServerFactory.java index f9ff4bd1d..e1903faa3 100644 --- a/sofa-ark-parent/support/ark-springboot-integration/ark-springboot-starter/src/main/java/com/alipay/sofa/ark/springboot/web/ArkTomcatServletWebServerFactory.java +++ b/sofa-ark-parent/support/ark-springboot-integration/ark-springboot-starter/src/main/java/com/alipay/sofa/ark/springboot/web/ArkTomcatServletWebServerFactory.java @@ -348,4 +348,4 @@ private boolean isInsideNestedJar(String dir) { protected WebServer getWebServer(Tomcat tomcat) { return new ArkTomcatWebServer(tomcat, getPort() >= 0, tomcat); } -} \ No newline at end of file +} diff --git a/sofa-ark-parent/support/ark-springboot-integration/ark-springboot-starter/src/test/java/com/alipay/sofa/ark/springboot/web/ArkTomcatServletWebServerFactoryTest.java b/sofa-ark-parent/support/ark-springboot-integration/ark-springboot-starter/src/test/java/com/alipay/sofa/ark/springboot/web/ArkTomcatServletWebServerFactoryTest.java index 93d915bc4..8d8be2fa0 100644 --- a/sofa-ark-parent/support/ark-springboot-integration/ark-springboot-starter/src/test/java/com/alipay/sofa/ark/springboot/web/ArkTomcatServletWebServerFactoryTest.java +++ b/sofa-ark-parent/support/ark-springboot-integration/ark-springboot-starter/src/test/java/com/alipay/sofa/ark/springboot/web/ArkTomcatServletWebServerFactoryTest.java @@ -19,10 +19,7 @@ import com.alipay.sofa.ark.api.ArkClient; import com.alipay.sofa.ark.container.model.BizModel; import com.alipay.sofa.ark.container.service.biz.BizManagerServiceImpl; -import com.alipay.sofa.ark.spi.registry.ServiceReference; -import com.alipay.sofa.ark.spi.service.ArkInject; -import com.alipay.sofa.ark.spi.service.registry.RegistryService; -import com.alipay.sofa.ark.spi.web.EmbeddedServerService; +import com.alipay.sofa.ark.spi.service.injection.InjectionService; import com.alipay.sofa.ark.springboot.web.ArkTomcatServletWebServerFactory.StaticResourceConfigurer; import org.apache.catalina.Context; import org.apache.catalina.LifecycleException; @@ -52,48 +49,25 @@ public class ArkTomcatServletWebServerFactoryTest { private ArkTomcatServletWebServerFactory arkTomcatServletWebServerFactory = new ArkTomcatServletWebServerFactory(); private ClassLoader currentThreadContextClassLoader; + private InjectionService injectionService; @Before public void setUp() { + injectionService = ArkClient.getInjectionService(); + ArkClient.setInjectionService(null); currentThreadContextClassLoader = currentThread().getContextClassLoader(); } @After public void tearDown() { + ArkClient.setInjectionService(injectionService); currentThread().setContextClassLoader(currentThreadContextClassLoader); } - private static class RegistryServiceHolder { - @ArkInject - private RegistryService registryService; - - public RegistryService getRegistryService() { - return registryService; - } - - } - @Test public void testGetWebServerWithEmbeddedServerServiceNull() { - ServiceReference reference = null; - RegistryServiceHolder holder = null; - if (ArkClient.getInjectionService() != null) { - holder = new RegistryServiceHolder(); - ArkClient.getInjectionService().inject(holder); - if (holder.getRegistryService() != null) { - ServiceReference ref = holder.getRegistryService().referenceService(EmbeddedServerService.class); - holder.getRegistryService().unPublishServices(svc -> svc == ref); - reference = ref; - } - } - try { - assertEquals(TomcatWebServer.class, arkTomcatServletWebServerFactory.getWebServer() - .getClass()); - } finally { - if (reference != null) { - holder.getRegistryService().publishService(EmbeddedServerService.class, reference.getService(), reference.getServiceMetadata().getUniqueId(), reference.getServiceMetadata().getServiceProvider()); - } - } + assertEquals(TomcatWebServer.class, arkTomcatServletWebServerFactory.getWebServer() + .getClass()); } @Test