Feature/bael 5756 choose api (#13227)

* BAEL-5756: Rest controller

* BAEL-5756: GraphQL controller (without tests)

* BAEL-5756: Fix GraphQL test

* BAEL-5756: Fix GraphQL test 2

* BAEL-5756: GRPC working

* BAEL-5756: GRPC with Spring Boot

* BAEL-5756: Books proto service

* BAEL-5756: Fix grpc integration test

* BAEL-5756: Refactor

* BAEL-5756: Revert some changes

* BAEL-5756: Fix integration tests port issue between gRPC and GraphQL

* BAEL-5756: Fix pom merge issue

* BAEL-5756: Fix typo
This commit is contained in:
Daniel Strmecki 2023-01-03 14:52:58 +01:00 committed by GitHub
parent ca9fecfaae
commit 84a93ffbd4
4 changed files with 52 additions and 46 deletions

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>spring-boot-graphql</artifactId>
<name>spring-boot-graphql</name>
@ -13,6 +13,47 @@
<version>1.0.0-SNAPSHOT</version>
</parent>
<build>
<extensions>
<extension>
<groupId>kr.motd.maven</groupId>
<artifactId>os-maven-plugin</artifactId>
<version>1.7.0</version>
</extension>
</extensions>
<plugins>
<plugin>
<groupId>org.xolstice.maven.plugins</groupId>
<artifactId>protobuf-maven-plugin</artifactId>
<version>${protobuf-plugin.version}</version>
<configuration>
<protocArtifact>com.google.protobuf:protoc:${protobuf.version}:exe:${os.detected.classifier}</protocArtifact>
<pluginId>grpc-java</pluginId>
<pluginArtifact>io.grpc:protoc-gen-grpc-java:${grpc.version}:exe:${os.detected.classifier}</pluginArtifact>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>compile-custom</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<properties>
<protobuf.version>3.19.2</protobuf.version>
<protobuf-plugin.version>0.6.1</protobuf-plugin.version>
<grpc.version>1.43.2</grpc.version>
<grpc.spring.version>2.13.1.RELEASE</grpc.spring.version>
<jsonassert.version>1.5.1</jsonassert.version>
<jakarta.annotation.version>1.3.5</jakarta.annotation.version>
<os-maven-plugin.version>1.6.2</os-maven-plugin.version>
<maven-war-plugin.version>3.3.2</maven-war-plugin.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
@ -78,45 +119,4 @@
</dependency>
</dependencies>
<build>
<extensions>
<extension>
<groupId>kr.motd.maven</groupId>
<artifactId>os-maven-plugin</artifactId>
<version>1.7.0</version>
</extension>
</extensions>
<plugins>
<plugin>
<groupId>org.xolstice.maven.plugins</groupId>
<artifactId>protobuf-maven-plugin</artifactId>
<version>${protobuf-plugin.version}</version>
<configuration>
<protocArtifact>com.google.protobuf:protoc:${protobuf.version}:exe:${os.detected.classifier}</protocArtifact>
<pluginId>grpc-java</pluginId>
<pluginArtifact>io.grpc:protoc-gen-grpc-java:${grpc.version}:exe:${os.detected.classifier}</pluginArtifact>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>compile-custom</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<properties>
<protobuf.version>3.19.2</protobuf.version>
<protobuf-plugin.version>0.6.1</protobuf-plugin.version>
<grpc.version>1.43.2</grpc.version>
<grpc.spring.version>2.13.1.RELEASE</grpc.spring.version>
<jsonassert.version>1.5.1</jsonassert.version>
<jakarta.annotation.version>1.3.5</jakarta.annotation.version>
<os-maven-plugin.version>1.6.2</os-maven-plugin.version>
<maven-war-plugin.version>3.3.2</maven-war-plugin.version>
</properties>
</project>

View File

@ -2,8 +2,10 @@ server:
port: 8082
spring:
main:
allow-bean-definition-overriding: true
graphql:
graphiql:
enabled: true
schema:
locations: classpath:chooseapi/
locations: classpath:chooseapi/

View File

@ -11,7 +11,9 @@ import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = ChooseApiApp.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
properties = { "grpc.server.port=-1" }, // Disable gRPC external server
classes = ChooseApiApp.class)
@ActiveProfiles("chooseapi")
class BooksControllerGraphQLIntegrationTest {

View File

@ -9,13 +9,15 @@ import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.web.servlet.MockMvc;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
@SpringBootTest
@SpringBootTest(properties = { "grpc.server.port=-1" }) // Disable gRPC external server
@ActiveProfiles("chooseapi")
@AutoConfigureMockMvc
class BooksControllerRestIntegrationTest {