From 42cdd2feda41180d040213d1c7cca5b19e2f1e1e Mon Sep 17 00:00:00 2001 From: Chris Bono Date: Fri, 4 Oct 2024 11:16:48 -0500 Subject: [PATCH] Rename BaseGrpcServerFactory to DefaultGrpcServerFactory --- ...Factory.java => DefaultGrpcServerFactory.java} | 7 ++++--- .../grpc/server/NettyGrpcServerFactory.java | 2 +- .../grpc/server/ShadedNettyGrpcServerFactory.java | 2 +- ...toryTests.java => GrpcServerFactoryTests.java} | 4 ++-- .../server/GrpcServerFactoryConfigurations.java | 8 ++++---- .../server/GrpcServerAutoConfigurationTests.java | 15 ++++++++------- 6 files changed, 20 insertions(+), 18 deletions(-) rename spring-grpc-core/src/main/java/org/springframework/grpc/server/{BaseGrpcServerFactory.java => DefaultGrpcServerFactory.java} (92%) rename spring-grpc-core/src/test/java/org/springframework/grpc/server/{DefaultGrpcServerFactoryTests.java => GrpcServerFactoryTests.java} (88%) diff --git a/spring-grpc-core/src/main/java/org/springframework/grpc/server/BaseGrpcServerFactory.java b/spring-grpc-core/src/main/java/org/springframework/grpc/server/DefaultGrpcServerFactory.java similarity index 92% rename from spring-grpc-core/src/main/java/org/springframework/grpc/server/BaseGrpcServerFactory.java rename to spring-grpc-core/src/main/java/org/springframework/grpc/server/DefaultGrpcServerFactory.java index 196e3cc..2fb0e26 100644 --- a/spring-grpc-core/src/main/java/org/springframework/grpc/server/BaseGrpcServerFactory.java +++ b/spring-grpc-core/src/main/java/org/springframework/grpc/server/DefaultGrpcServerFactory.java @@ -30,7 +30,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** - * Base implementation for {@link GrpcServerFactory gRPC service factories}. + * Default implementation for {@link GrpcServerFactory gRPC service factories}. *

* The server builder implementation is discovered via Java's SPI mechanism. * @@ -39,7 +39,7 @@ import org.apache.commons.logging.LogFactory; * @param the type of server builder * @see ServerProvider#provider() */ -public class BaseGrpcServerFactory> implements GrpcServerFactory { +public class DefaultGrpcServerFactory> implements GrpcServerFactory { // VisibleForSubclass protected final Log logger = LogFactory.getLog(getClass()); @@ -52,7 +52,8 @@ public class BaseGrpcServerFactory> implements GrpcSe private final List> serverBuilderCustomizers; - public BaseGrpcServerFactory(String address, int port, List> serverBuilderCustomizers) { + public DefaultGrpcServerFactory(String address, int port, + List> serverBuilderCustomizers) { this.address = address; this.port = port; this.serverBuilderCustomizers = Objects.requireNonNull(serverBuilderCustomizers, "serverBuilderCustomizers"); diff --git a/spring-grpc-core/src/main/java/org/springframework/grpc/server/NettyGrpcServerFactory.java b/spring-grpc-core/src/main/java/org/springframework/grpc/server/NettyGrpcServerFactory.java index 2dad602..fdae6a3 100644 --- a/spring-grpc-core/src/main/java/org/springframework/grpc/server/NettyGrpcServerFactory.java +++ b/spring-grpc-core/src/main/java/org/springframework/grpc/server/NettyGrpcServerFactory.java @@ -31,7 +31,7 @@ import io.netty.channel.unix.DomainSocketAddress; * @author David Syer * @author Chris Bono */ -public class NettyGrpcServerFactory extends BaseGrpcServerFactory { +public class NettyGrpcServerFactory extends DefaultGrpcServerFactory { private static final String ANY_IP_ADDRESS = "*"; diff --git a/spring-grpc-core/src/main/java/org/springframework/grpc/server/ShadedNettyGrpcServerFactory.java b/spring-grpc-core/src/main/java/org/springframework/grpc/server/ShadedNettyGrpcServerFactory.java index 29d3c02..a7e4930 100644 --- a/spring-grpc-core/src/main/java/org/springframework/grpc/server/ShadedNettyGrpcServerFactory.java +++ b/spring-grpc-core/src/main/java/org/springframework/grpc/server/ShadedNettyGrpcServerFactory.java @@ -31,7 +31,7 @@ import io.grpc.netty.shaded.io.netty.channel.unix.DomainSocketAddress; * @author David Syer * @author Chris Bono */ -public class ShadedNettyGrpcServerFactory extends BaseGrpcServerFactory { +public class ShadedNettyGrpcServerFactory extends DefaultGrpcServerFactory { private static final String ANY_IP_ADDRESS = "*"; diff --git a/spring-grpc-core/src/test/java/org/springframework/grpc/server/DefaultGrpcServerFactoryTests.java b/spring-grpc-core/src/test/java/org/springframework/grpc/server/GrpcServerFactoryTests.java similarity index 88% rename from spring-grpc-core/src/test/java/org/springframework/grpc/server/DefaultGrpcServerFactoryTests.java rename to spring-grpc-core/src/test/java/org/springframework/grpc/server/GrpcServerFactoryTests.java index db9f0ad..76265fe 100644 --- a/spring-grpc-core/src/test/java/org/springframework/grpc/server/DefaultGrpcServerFactoryTests.java +++ b/spring-grpc-core/src/test/java/org/springframework/grpc/server/GrpcServerFactoryTests.java @@ -19,9 +19,9 @@ package org.springframework.grpc.server; import org.junit.jupiter.api.Test; /** - * Tests for {@link DefaultGrpcServerFactory}/ + * Tests for {@link GrpcServerFactory gRPC server factories}. */ -class DefaultGrpcServerFactoryTests { +class GrpcServerFactoryTests { @Test void placeholderTest() { diff --git a/spring-grpc-spring-boot-autoconfigure/src/main/java/org/springframework/grpc/autoconfigure/server/GrpcServerFactoryConfigurations.java b/spring-grpc-spring-boot-autoconfigure/src/main/java/org/springframework/grpc/autoconfigure/server/GrpcServerFactoryConfigurations.java index 65990fb..37820a6 100644 --- a/spring-grpc-spring-boot-autoconfigure/src/main/java/org/springframework/grpc/autoconfigure/server/GrpcServerFactoryConfigurations.java +++ b/spring-grpc-spring-boot-autoconfigure/src/main/java/org/springframework/grpc/autoconfigure/server/GrpcServerFactoryConfigurations.java @@ -28,7 +28,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.grpc.server.BaseGrpcServerFactory; +import org.springframework.grpc.server.DefaultGrpcServerFactory; import org.springframework.grpc.server.GrpcServerFactory; import org.springframework.grpc.server.NettyGrpcServerFactory; import org.springframework.grpc.server.ServerBuilderCustomizer; @@ -90,13 +90,13 @@ class GrpcServerFactoryConfigurations { static class ServiceProviderServerFactoryConfiguration { @Bean - > BaseGrpcServerFactory serviceProviderGrpcServerFactory( + > DefaultGrpcServerFactory serviceProviderGrpcServerFactory( GrpcServerProperties properties, ObjectProvider grpcServicesProvider, ServerBuilderCustomizers serverBuilderCustomizers) { - BaseServerFactoryPropertyMapper mapper = new BaseServerFactoryPropertyMapper<>(properties); + DefaultServerFactoryPropertyMapper mapper = new DefaultServerFactoryPropertyMapper<>(properties); List> builderCustomizers = List.of(mapper::customizeServerBuilder, serverBuilderCustomizers::customize); - BaseGrpcServerFactory factory = new BaseGrpcServerFactory<>(properties.getAddress(), + DefaultGrpcServerFactory factory = new DefaultGrpcServerFactory<>(properties.getAddress(), properties.getPort(), builderCustomizers); grpcServicesProvider.orderedStream().map(BindableService::bindService).forEach(factory::addService); return factory; diff --git a/spring-grpc-spring-boot-autoconfigure/src/test/java/org/springframework/grpc/autoconfigure/server/GrpcServerAutoConfigurationTests.java b/spring-grpc-spring-boot-autoconfigure/src/test/java/org/springframework/grpc/autoconfigure/server/GrpcServerAutoConfigurationTests.java index 5001911..4b9266b 100644 --- a/spring-grpc-spring-boot-autoconfigure/src/test/java/org/springframework/grpc/autoconfigure/server/GrpcServerAutoConfigurationTests.java +++ b/spring-grpc-spring-boot-autoconfigure/src/test/java/org/springframework/grpc/autoconfigure/server/GrpcServerAutoConfigurationTests.java @@ -38,7 +38,7 @@ import org.springframework.boot.test.context.runner.ApplicationContextRunner; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.annotation.Order; -import org.springframework.grpc.server.BaseGrpcServerFactory; +import org.springframework.grpc.server.DefaultGrpcServerFactory; import org.springframework.grpc.server.GrpcServerFactory; import org.springframework.grpc.server.NettyGrpcServerFactory; import org.springframework.grpc.server.ServerBuilderCustomizer; @@ -154,7 +154,7 @@ class GrpcServerAutoConfigurationTests { .withClassLoader(new FilteredClassLoader(NettyServerBuilder.class, io.grpc.netty.shaded.io.grpc.netty.NettyServerBuilder.class)) .run((context) -> assertThat(context).getBean(GrpcServerFactory.class) - .isInstanceOf(BaseGrpcServerFactory.class)); + .isInstanceOf(DefaultGrpcServerFactory.class)); } @Test @@ -171,10 +171,11 @@ class GrpcServerAutoConfigurationTests { @Test void baseServerFactoryAutoConfiguredAsExpected() { - serverFactoryAutoConfiguredAsExpected(this.contextRunner() - .withClassLoader(new FilteredClassLoader(NettyServerBuilder.class, - io.grpc.netty.shaded.io.grpc.netty.NettyServerBuilder.class)), - BaseGrpcServerFactory.class); + serverFactoryAutoConfiguredAsExpected( + this.contextRunner() + .withClassLoader(new FilteredClassLoader(NettyServerBuilder.class, + io.grpc.netty.shaded.io.grpc.netty.NettyServerBuilder.class)), + DefaultGrpcServerFactory.class); } private void serverFactoryAutoConfiguredAsExpected(ApplicationContextRunner contextRunner, @@ -227,7 +228,7 @@ class GrpcServerAutoConfigurationTests { this.contextRunnerWithLifecyle() .withClassLoader(new FilteredClassLoader(NettyServerBuilder.class, io.grpc.netty.shaded.io.grpc.netty.NettyServerBuilder.class)), - builder, BaseGrpcServerFactory.class); + builder, DefaultGrpcServerFactory.class); } @SuppressWarnings("unchecked")