Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update to 2.2.14 #1006

Merged
merged 2 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading