Skip to content

Commit

Permalink
update to 2.2.14 (#1006)
Browse files Browse the repository at this point in the history
* update to 2.2.14

* fix test
  • Loading branch information
lvjing2 authored Sep 13, 2024
1 parent aafbe4c commit 9b66342
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 35 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</modules>

<properties>
<sofa.ark.version>2.2.14-SNAPSHOT</sofa.ark.version>
<sofa.ark.version>2.2.14</sofa.ark.version>
<sofa.ark.version.old>2.2.13</sofa.ark.version.old>
<project.encoding>UTF-8</project.encoding>
<java.version>1.8</java.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -348,4 +348,4 @@ private boolean isInsideNestedJar(String dir) {
protected WebServer getWebServer(Tomcat tomcat) {
return new ArkTomcatWebServer(tomcat, getPort() >= 0, tomcat);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<EmbeddedServerService> reference = null;
RegistryServiceHolder holder = null;
if (ArkClient.getInjectionService() != null) {
holder = new RegistryServiceHolder();
ArkClient.getInjectionService().inject(holder);
if (holder.getRegistryService() != null) {
ServiceReference<EmbeddedServerService> 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
Expand Down

0 comments on commit 9b66342

Please sign in to comment.