From 4310325dc351509d10740728e3fc9d4c77c0b0d2 Mon Sep 17 00:00:00 2001 From: stellar Date: Tue, 26 Mar 2024 21:26:08 +0800 Subject: [PATCH] feat:Update org.apache.dubbo.dependency.FileTest in 3.3 to support check dubbo-all-shaded and dubbo-core-spi (#13961) --- dubbo-distribution/dubbo-all-shaded/pom.xml | 42 ++++- dubbo-distribution/dubbo-core-spi/pom.xml | 147 ++++++++++++++++-- .../org/apache/dubbo/dependency/FileTest.java | 77 ++++++++- 3 files changed, 250 insertions(+), 16 deletions(-) diff --git a/dubbo-distribution/dubbo-all-shaded/pom.xml b/dubbo-distribution/dubbo-all-shaded/pom.xml index 8f60eb20b5d..b0591156921 100644 --- a/dubbo-distribution/dubbo-all-shaded/pom.xml +++ b/dubbo-distribution/dubbo-all-shaded/pom.xml @@ -708,9 +708,6 @@ META-INF/dubbo/internal/org.apache.dubbo.registry.integration.RegistryProtocolListener - - META-INF/dubbo/internal/org.apache.dubbo.registry.xds.XdsCertificateSigner - META-INF/dubbo/internal/org.apache.dubbo.rpc.protocol.rest.filter.RestResponseInterceptor @@ -768,6 +765,18 @@ META-INF/dubbo/internal/org.apache.dubbo.remoting.http.HttpBinder + + META-INF/dubbo/internal/org.apache.dubbo.remoting.http12.message.HttpMessageEncoderFactory + + + META-INF/dubbo/internal/org.apache.dubbo.remoting.http12.message.HttpMessageDecoderFactory + + + META-INF/dubbo/internal/org.apache.dubbo.remoting.http12.h2.Http2ServerTransportListenerFactory + + + META-INF/dubbo/internal/org.apache.dubbo.remoting.http12.h1.Http1ServerTransportListenerFactory + META-INF/dubbo/internal/org.apache.dubbo.remoting.telnet.TelnetHandler @@ -921,15 +930,42 @@ META-INF/dubbo/internal/org.apache.dubbo.metrics.collector.MetricsCollector + META-INF/dubbo/internal/org.apache.dubbo.spring.security.jackson.ObjectMapperCodecCustomer + META-INF/dubbo/internal/org.apache.dubbo.rpc.protocol.rest.annotation.param.parse.provider.BaseProviderParamParser + META-INF/dubbo/internal/org.apache.dubbo.rpc.model.PackableMethodFactory + + META-INF/dubbo/internal/org.apache.dubbo.aot.api.ReflectionTypeDescriberRegistrar + + + + META-INF/dubbo/internal/org.apache.dubbo.aot.api.ProxyDescriberRegistrar + + + + META-INF/dubbo/internal/org.apache.dubbo.aot.api.ResourceDescriberRegistrar + + + + META-INF/dubbo/internal/org.apache.dubbo.common.json.JsonUtil + + + + META-INF/dubbo/internal/org.apache.dubbo.config.CommonConfigPostProcessor + + + + META-INF/dubbo/internal/org.apache.dubbo.registry.integration.ServiceURLCustomizer + + diff --git a/dubbo-distribution/dubbo-core-spi/pom.xml b/dubbo-distribution/dubbo-core-spi/pom.xml index 8da62e1e038..6ef9c5d928e 100644 --- a/dubbo-distribution/dubbo-core-spi/pom.xml +++ b/dubbo-distribution/dubbo-core-spi/pom.xml @@ -280,6 +280,14 @@ META-INF/dubbo/internal/org.apache.dubbo.qos.probe.StartupProbe + + META-INF/dubbo/internal/org.apache.dubbo.qos.permission.PermissionChecker + + + + META-INF/dubbo/internal/org.apache.dubbo.rpc.PenetrateAttachmentSelector + + META-INF/dubbo/internal/org.apache.dubbo.registry.AddressListener @@ -295,9 +303,6 @@ META-INF/dubbo/internal/org.apache.dubbo.registry.client.RegistryClusterIdentifier - - META-INF/dubbo/internal/org.apache.dubbo.registry.client.ServiceDiscovery - META-INF/dubbo/internal/org.apache.dubbo.registry.client.ServiceDiscoveryFactory @@ -308,7 +313,7 @@ META-INF/dubbo/internal/org.apache.dubbo.registry.client.metadata.MetadataServiceURLBuilder - META-INF/dubbo/internal/org.apache.dubbo.registry.client.metadata.SubscribedURLsSynthesizer + META-INF/dubbo/internal/org.apache.dubbo.common.ssl.CertProvider META-INF/dubbo/internal/org.apache.dubbo.registry.client.migration.MigrationAddressComparator @@ -319,6 +324,30 @@ META-INF/dubbo/internal/org.apache.dubbo.registry.integration.RegistryProtocolListener + + META-INF/dubbo/internal/org.apache.dubbo.rpc.protocol.rest.filter.RestResponseInterceptor + + + META-INF/dubbo/internal/org.apache.dubbo.rpc.protocol.rest.filter.RestRequestFilter + + + META-INF/dubbo/internal/org.apache.dubbo.rpc.protocol.rest.filter.RestResponseFilter + + + META-INF/dubbo/internal/org.apache.dubbo.metadata.rest.NoAnnotatedParameterRequestTagProcessor + + + META-INF/dubbo/internal/org.apache.dubbo.rpc.protocol.rest.message.HttpMessageCodec + + + META-INF/dubbo/internal/org.apache.dubbo.rpc.protocol.rest.annotation.consumer.HttpConnectionPreBuildIntercept + + + META-INF/dubbo/internal/org.apache.dubbo.rpc.protocol.rest.annotation.param.parse.consumer.BaseConsumerParamParser + + + META-INF/dubbo/internal/org.apache.dubbo.remoting.http.factory.RestClientFactory + META-INF/dubbo/internal/org.apache.dubbo.remoting.ChannelHandler @@ -334,6 +363,12 @@ META-INF/dubbo/internal/org.apache.dubbo.remoting.Transporter + + META-INF/dubbo/internal/org.apache.dubbo.rpc.protocol.dubbo.ByteAccessor + + + META-INF/dubbo/internal/org.apache.dubbo.remoting.api.pu.PortUnificationTransporter + META-INF/dubbo/internal/org.apache.dubbo.remoting.api.connection.ConnectionManager @@ -346,6 +381,18 @@ META-INF/dubbo/internal/org.apache.dubbo.remoting.http.HttpBinder + + META-INF/dubbo/internal/org.apache.dubbo.remoting.http12.message.HttpMessageEncoderFactory + + + META-INF/dubbo/internal/org.apache.dubbo.remoting.http12.message.HttpMessageDecoderFactory + + + META-INF/dubbo/internal/org.apache.dubbo.remoting.http12.h2.Http2ServerTransportListenerFactory + + + META-INF/dubbo/internal/org.apache.dubbo.remoting.http12.h1.Http1ServerTransportListenerFactory + META-INF/dubbo/internal/org.apache.dubbo.remoting.telnet.TelnetHandler @@ -418,6 +465,12 @@ META-INF/dubbo/internal/org.apache.dubbo.rpc.cluster.router.state.StateRouterFactory + + META-INF/dubbo/internal/org.apache.dubbo.rpc.cluster.router.condition.matcher.pattern.ValuePattern + + + META-INF/dubbo/internal/org.apache.dubbo.rpc.cluster.router.condition.matcher.ConditionMatcherFactory + META-INF/dubbo/internal/org.apache.dubbo.rpc.model.ApplicationInitListener @@ -428,33 +481,103 @@ META-INF/dubbo/internal/org.apache.dubbo.rpc.model.ScopeModelInitializer - META-INF/dubbo/internal/org.apache.dubbo.rpc.protocol.grpc.interceptors.ClientInterceptor + META-INF/dubbo/internal/org.apache.dubbo.rpc.protocol.injvm.ParamDeepCopyUtil - META-INF/dubbo/internal/org.apache.dubbo.rpc.protocol.grpc.interceptors.GrpcConfigurator + META-INF/dubbo/internal/org.apache.dubbo.rpc.PathResolver - META-INF/dubbo/internal/org.apache.dubbo.rpc.protocol.grpc.interceptors.ServerInterceptor + META-INF/dubbo/internal/org.apache.dubbo.validation.Validation - META-INF/dubbo/internal/org.apache.dubbo.rpc.protocol.grpc.interceptors.ServerTransportFilter + META-INF/dubbo/internal/org.apache.dubbo.registry.client.metadata.ServiceInstanceNotificationCustomizer - META-INF/dubbo/internal/org.apache.dubbo.rpc.protocol.injvm.ParamDeepCopyUtil + META-INF/dubbo/internal/org.apache.dubbo.rpc.protocol.tri.compressor.Compressor - META-INF/dubbo/internal/org.apache.dubbo.rpc.protocol.tri.Compressor + META-INF/dubbo/internal/org.apache.dubbo.rpc.protocol.tri.compressor.DeCompressor - META-INF/dubbo/internal/org.apache.dubbo.rpc.PathResolver + META-INF/dubbo/internal/org.apache.dubbo.rpc.protocol.tri.rest.argument.ArgumentConverter - META-INF/dubbo/internal/org.apache.dubbo.validation.Validation + META-INF/dubbo/internal/org.apache.dubbo.rpc.protocol.tri.rest.argument.ArgumentResolver + + + META-INF/dubbo/internal/org.apache.dubbo.rpc.protocol.tri.rest.filter.RestExtension + + + META-INF/dubbo/internal/org.apache.dubbo.rpc.protocol.tri.rest.filter.RestExtensionAdapter + + + META-INF/dubbo/internal/org.apache.dubbo.rpc.protocol.tri.rest.mapping.RequestMappingResolver + + + META-INF/dubbo/internal/org.apache.dubbo.rpc.protocol.tri.route.RequestHandlerMapping + + + META-INF/dubbo/internal/org.apache.dubbo.remoting.http12.message.HttpMessageAdapterFactory + + + META-INF/dubbo/internal/org.apache.dubbo.metrics.service.MetricsService + + + META-INF/dubbo/internal/org.apache.dubbo.metrics.service.MetricsServiceExporter + + + META-INF/dubbo/internal/org.apache.dubbo.metrics.report.MetricsReporterFactory + + + META-INF/dubbo/internal/org.apache.dubbo.common.threadpool.event.ThreadPoolExhaustedListener + + + META-INF/dubbo/internal/org.apache.dubbo.remoting.api.pu.PortUnificationTransporter + + + META-INF/dubbo/internal/org.apache.dubbo.rpc.cluster.router.mesh.util.TracingContextProvider + + + META-INF/dubbo/internal/org.apache.dubbo.metadata.rest.ServiceRestMetadataResolver + + + META-INF/dubbo/internal/org.apache.dubbo.rpc.executor.IsolationExecutorSupportFactory + + + META-INF/dubbo/internal/org.apache.dubbo.metrics.collector.MetricsCollector + + + + META-INF/dubbo/internal/org.apache.dubbo.spring.security.jackson.ObjectMapperCodecCustomer + + META-INF/dubbo/internal/org.apache.dubbo.rpc.protocol.rest.annotation.param.parse.provider.BaseProviderParamParser + + + + META-INF/dubbo/internal/org.apache.dubbo.rpc.model.PackableMethodFactory + + + META-INF/dubbo/internal/org.apache.dubbo.aot.api.ReflectionTypeDescriberRegistrar + + + + META-INF/dubbo/internal/org.apache.dubbo.aot.api.ProxyDescriberRegistrar + + + + META-INF/dubbo/internal/org.apache.dubbo.aot.api.ResourceDescriberRegistrar + + + META-INF/dubbo/internal/org.apache.dubbo.common.json.JsonUtil + META-INF/dubbo/internal/org.apache.dubbo.config.CommonConfigPostProcessor + + META-INF/dubbo/internal/org.apache.dubbo.registry.integration.ServiceURLCustomizer + diff --git a/dubbo-test/dubbo-test-modules/src/test/java/org/apache/dubbo/dependency/FileTest.java b/dubbo-test/dubbo-test-modules/src/test/java/org/apache/dubbo/dependency/FileTest.java index 5f9f02e3cca..baac484a844 100644 --- a/dubbo-test/dubbo-test-modules/src/test/java/org/apache/dubbo/dependency/FileTest.java +++ b/dubbo-test/dubbo-test-modules/src/test/java/org/apache/dubbo/dependency/FileTest.java @@ -389,15 +389,20 @@ void checkDubboAllShade() throws DocumentException { } @Test - void checkDubboAllTransform() throws DocumentException { + void checkDubboTransform() throws DocumentException { File baseFile = getBaseFile(); List spis = new LinkedList<>(); readSPI(baseFile, spis); String dubboAllPath = "dubbo-distribution" + File.separator + "dubbo-all" + File.separator + "pom.xml"; + String dubboAllShadedPath = + "dubbo-distribution" + File.separator + "dubbo-all-shaded" + File.separator + "pom.xml"; + String dubboCoreSPIPath = "dubbo-distribution" + File.separator + "dubbo-core-spi" + File.separator + "pom.xml"; SAXReader reader = new SAXReader(); Document dubboAll = reader.read(new File(baseFile, dubboAllPath)); + Document dubboAllShaded = reader.read(new File(baseFile, dubboAllShadedPath)); + Document dubboCoreSPI = reader.read(new File(baseFile, dubboCoreSPIPath)); List transformsInDubboAll = dubboAll.getRootElement().element("build").element("plugins").elements("plugin").stream() @@ -415,6 +420,38 @@ void checkDubboAllTransform() throws DocumentException { .map(resource -> resource.substring(resource.lastIndexOf("/") + 1)) .collect(Collectors.toList()); + List transformsInDubboAllShaded = + dubboAllShaded.getRootElement().element("build").element("plugins").elements("plugin").stream() + .filter(ele -> ele.elementText("artifactId").equals("maven-shade-plugin")) + .map(ele -> ele.element("executions")) + .map(ele -> ele.elements("execution")) + .flatMap(Collection::stream) + .filter(ele -> ele.elementText("phase").equals("package")) + .map(ele -> ele.element("configuration")) + .map(ele -> ele.element("transformers")) + .map(ele -> ele.elements("transformer")) + .flatMap(Collection::stream) + .map(ele -> ele.elementText("resource")) + .map(String::trim) + .map(resource -> resource.substring(resource.lastIndexOf("/") + 1)) + .collect(Collectors.toList()); + + List transformsInDubboCoreSPI = + dubboCoreSPI.getRootElement().element("build").element("plugins").elements("plugin").stream() + .filter(ele -> ele.elementText("artifactId").equals("maven-shade-plugin")) + .map(ele -> ele.element("executions")) + .map(ele -> ele.elements("execution")) + .flatMap(Collection::stream) + .filter(ele -> ele.elementText("phase").equals("package")) + .map(ele -> ele.element("configuration")) + .map(ele -> ele.element("transformers")) + .map(ele -> ele.elements("transformer")) + .flatMap(Collection::stream) + .map(ele -> ele.elementText("resource")) + .map(String::trim) + .map(resource -> resource.substring(resource.lastIndexOf("/") + 1)) + .collect(Collectors.toList()); + List expectedSpis = new LinkedList<>(spis); expectedSpis.removeAll(transformsInDubboAll); Assertions.assertTrue( @@ -430,6 +467,44 @@ void checkDubboAllTransform() throws DocumentException { "Class without `@SPI` declaration should not be added to dubbo-all(dubbo-distribution" + File.separator + "dubbo-all" + File.separator + "pom.xml in shade plugin) to being transformed. Found spis: " + unexpectedSpis); + + expectedSpis = new LinkedList<>(spis); + expectedSpis.removeAll(transformsInDubboAllShaded); + Assertions.assertTrue( + expectedSpis.isEmpty(), + "Newly created SPI interface must be added to dubbo-all-shaded(dubbo-distribution" + File.separator + + "dubbo-all-shaded" + File.separator + + "pom.xml in shade plugin) to being transformed. Found spis: " + + expectedSpis); + + unexpectedSpis = new LinkedList<>(transformsInDubboAllShaded); + unexpectedSpis.removeAll(spis); + Assertions.assertTrue( + unexpectedSpis.isEmpty(), + "Class without `@SPI` declaration should not be added to dubbo-all-shaded(dubbo-distribution" + + File.separator + + "dubbo-all-shaded" + File.separator + + "pom.xml in shade plugin) to being transformed. Found spis: " + + unexpectedSpis); + + expectedSpis = new LinkedList<>(spis); + expectedSpis.removeAll(transformsInDubboCoreSPI); + Assertions.assertTrue( + expectedSpis.isEmpty(), + "Newly created SPI interface must be added to dubbo-core-spi(dubbo-distribution" + File.separator + + "dubbo-core-spi" + File.separator + + "pom.xml in shade plugin) to being transformed. Found spis: " + + expectedSpis); + + unexpectedSpis = new LinkedList<>(transformsInDubboCoreSPI); + unexpectedSpis.removeAll(spis); + Assertions.assertTrue( + unexpectedSpis.isEmpty(), + "Class without `@SPI` declaration should not be added to dubbo-core-spi(dubbo-distribution" + + File.separator + + "dubbo-core-spi" + File.separator + + "pom.xml in shade plugin) to being transformed. Found spis: " + + unexpectedSpis); } @Test