Rename package

This commit is contained in:
Dave Syer
2024-09-06 11:07:52 +01:00
parent aeef454cb0
commit f4d7625de8
10 changed files with 27 additions and 13 deletions

View File

@@ -10,14 +10,18 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.test.autoconfigure.actuate.observability.AutoConfigureObservability;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.TestConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.grpc.sample.proto.HelloReply;
import org.springframework.grpc.sample.proto.HelloRequest;
import org.springframework.grpc.sample.proto.SimpleGrpc;
import org.springframework.test.annotation.DirtiesContext;
import io.grpc.Grpc;
import io.grpc.InsecureChannelCredentials;
@SpringBootTest(properties = { "grpc.client.test.address=static://localhost:9090",
"grpc.client.test.negotiationType=plaintext", "debug=true" })
@Disabled("Until client is autoconfigured")
public class GrpcServerApplicationTests {
private static Log log = LogFactory.getLog(GrpcServerApplicationTests.class);
@@ -42,4 +46,13 @@ public class GrpcServerApplicationTests {
assertEquals("Hello ==> Alien", response.getMessage());
}
@TestConfiguration
static class ExtraConfiguration {
@Bean
SimpleGrpc.SimpleBlockingStub stub() {
var channel = Grpc.newChannelBuilderForAddress("0.0.0.0", 9090, InsecureChannelCredentials.create())
.build();
return SimpleGrpc.newBlockingStub(channel);
}
}
}

View File

@@ -32,6 +32,7 @@ class YetAnotherApplicationTests {
@TestConfiguration
static class ExtraConfiguration {
}
}

View File

@@ -1,5 +0,0 @@
/**
* Grpc server events.
*/
package org.springframework.grpc.server.event;

View File

@@ -16,7 +16,7 @@
* Partial copy from net.devh:grpc-spring-boot-starter.
*/
package org.springframework.grpc.server.event;
package org.springframework.grpc.server.lifecycle;
import static java.util.Objects.requireNonNull;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
@@ -113,7 +113,7 @@ public class GrpcServerLifecycle implements SmartLifecycle {
this.server = localServer.start();
final String address = this.server.getListenSockets().toString();
final int port = this.server.getPort();
logger.info("gRPC Server started, listening on address: " + address + ", port: " + port);
logger.info("gRPC Server started, listening on address: " + this.server.getListenSockets());
this.eventPublisher.publishEvent(new GrpcServerStartedEvent(this, localServer, address, port));
// Prevent the JVM from shutting down while the server is running

View File

@@ -16,7 +16,7 @@
* Partial copy from net.devh:grpc-spring-boot-starter.
*/
package org.springframework.grpc.server.event;
package org.springframework.grpc.server.lifecycle;
import static java.util.Objects.requireNonNull;

View File

@@ -16,7 +16,7 @@
* Partial copy from net.devh:grpc-spring-boot-starter.
*/
package org.springframework.grpc.server.event;
package org.springframework.grpc.server.lifecycle;
import java.time.Clock;

View File

@@ -16,7 +16,7 @@
* Partial copy from net.devh:grpc-spring-boot-starter.
*/
package org.springframework.grpc.server.event;
package org.springframework.grpc.server.lifecycle;
import static java.util.Objects.requireNonNull;

View File

@@ -15,7 +15,7 @@
*
* Partial copy from net.devh:grpc-spring-boot-starter.
*/
package org.springframework.grpc.server.event;
package org.springframework.grpc.server.lifecycle;
import java.time.Clock;

View File

@@ -0,0 +1,5 @@
/**
* Grpc server events.
*/
package org.springframework.grpc.server.lifecycle;

View File

@@ -25,7 +25,7 @@ import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.grpc.server.GrpcServerFactory;
import org.springframework.grpc.server.event.GrpcServerLifecycle;
import org.springframework.grpc.server.lifecycle.GrpcServerLifecycle;
import io.grpc.BindableService;
import io.grpc.ServerServiceDefinition;