Skip to content
Snippets Groups Projects
Commit 872ca279 authored by OZGCloud's avatar OZGCloud
Browse files

OZG-4696 remove quarkus from interface project

parent adf3ec19
No related branches found
No related tags found
No related merge requests found
Showing
with 99 additions and 36 deletions
...@@ -24,7 +24,9 @@ ...@@ -24,7 +24,9 @@
unter der Lizenz sind dem Lizenztext zu entnehmen. unter der Lizenz sind dem Lizenztext zu entnehmen.
--> -->
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd"> <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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent> <parent>
<groupId>de.itvsh.kop.common</groupId> <groupId>de.itvsh.kop.common</groupId>
...@@ -55,9 +57,10 @@ ...@@ -55,9 +57,10 @@
<jandex-maven-plugin-version>1.2.3</jandex-maven-plugin-version> <jandex-maven-plugin-version>1.2.3</jandex-maven-plugin-version>
<compiler-plugin.version>3.8.1</compiler-plugin.version> <compiler-plugin.version>3.8.1</compiler-plugin.version>
<jacoco.plugin.version>0.8.8</jacoco.plugin.version> <jacoco.plugin.version>0.8.8</jacoco.plugin.version>
<surefire-plugin.version>3.0.0-M7</surefire-plugin.version> <surefire-plugin.version>3.2.2</surefire-plugin.version>
<maven-failsafe-plugin.version>3.0.0-M7</maven-failsafe-plugin.version> <maven-failsafe-plugin.version>3.2.2</maven-failsafe-plugin.version>
<git-commit-id-plugin.version>4.9.10</git-commit-id-plugin.version> <git-commit-id-plugin.version>4.9.10</git-commit-id-plugin.version>
<maven-source.plugin.version>3.3.0</maven-source.plugin.version>
</properties> </properties>
<modules> <modules>
...@@ -210,7 +213,8 @@ ...@@ -210,7 +213,8 @@
<configuration> <configuration>
<propertyName>surefire.jacoco.args</propertyName> <propertyName>surefire.jacoco.args</propertyName>
<exclClassLoaders>*QuarkusClassLoader</exclClassLoaders> <exclClassLoaders>*QuarkusClassLoader</exclClassLoaders>
<destFile>${project.build.directory}/jacoco-quarkus.exec</destFile> <destFile>
${project.build.directory}/jacoco-quarkus.exec</destFile>
<append>true</append> <append>true</append>
</configuration> </configuration>
</execution> </execution>
...@@ -223,6 +227,19 @@ ...@@ -223,6 +227,19 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>${maven-source.plugin.version}</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins> </plugins>
</pluginManagement> </pluginManagement>
</build> </build>
......
...@@ -24,7 +24,9 @@ ...@@ -24,7 +24,9 @@
unter der Lizenz sind dem Lizenztext zu entnehmen. unter der Lizenz sind dem Lizenztext zu entnehmen.
--> -->
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd"> <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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
...@@ -38,11 +40,18 @@ ...@@ -38,11 +40,18 @@
<description>gRPC Interface for User Manager</description> <description>gRPC Interface for User Manager</description>
<dependencies> <dependencies>
<dependency> <!-- <dependency>
<groupId>io.quarkus</groupId> <groupId>io.quarkus</groupId>
<artifactId>quarkus-grpc</artifactId> <artifactId>quarkus-grpc</artifactId>
</dependency>-->
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-stub</artifactId>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-protobuf</artifactId>
</dependency> </dependency>
<!-- Java 9+ compatibility --> <!-- Java 9+ compatibility -->
<dependency> <dependency>
<groupId>javax.annotation</groupId> <groupId>javax.annotation</groupId>
...@@ -51,6 +60,8 @@ ...@@ -51,6 +60,8 @@
</dependencies> </dependencies>
<build> <build>
<sourceDirectory>src/main/proto</sourceDirectory>
<plugins> <plugins>
<plugin> <plugin>
<groupId>io.quarkus.platform</groupId> <groupId>io.quarkus.platform</groupId>
...@@ -60,6 +71,11 @@ ...@@ -60,6 +71,11 @@
<groupId>org.jboss.jandex</groupId> <groupId>org.jboss.jandex</groupId>
<artifactId>jandex-maven-plugin</artifactId> <artifactId>jandex-maven-plugin</artifactId>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
</plugin>
<plugin> <plugin>
<groupId>com.mycila</groupId> <groupId>com.mycila</groupId>
<artifactId>license-maven-plugin</artifactId> <artifactId>license-maven-plugin</artifactId>
...@@ -70,6 +86,32 @@ ...@@ -70,6 +86,32 @@
</mapping> </mapping>
</configuration> </configuration>
</plugin> </plugin>
<plugin>
<groupId>com.github.os72</groupId>
<artifactId>protoc-jar-maven-plugin</artifactId>
<version>${protoc-jar-plugin.version}</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<outputTargets>
<outputTarget>
<type>java</type>
</outputTarget>
<outputTarget>
<type>grpc-java</type>
<pluginArtifact>
io.grpc:protoc-gen-grpc-java:1.58.0</pluginArtifact>
</outputTarget>
</outputTargets>
</configuration>
</execution>
</executions>
</plugin>
</plugins> </plugins>
</build> </build>
</project> </project>
...@@ -32,3 +32,6 @@ option java_outer_classname = "OrganisationsEinheitModelProto"; ...@@ -32,3 +32,6 @@ option java_outer_classname = "OrganisationsEinheitModelProto";
message GrpcOrganisationsEinheit { message GrpcOrganisationsEinheit {
string organisationsEinheitId = 1; string organisationsEinheitId = 1;
} }
message GrpcGetSupportedOrganisationsEinheitenRequest {
}
\ No newline at end of file
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
* unter der Lizenz sind dem Lizenztext zu entnehmen. * unter der Lizenz sind dem Lizenztext zu entnehmen.
*/ */
syntax = "proto3"; syntax = "proto3";
import "google/protobuf/empty.proto";
import "organisationseinheit.model.proto"; import "organisationseinheit.model.proto";
package de.ozgcloud.user.grpc; package de.ozgcloud.user.grpc;
...@@ -32,7 +31,7 @@ option java_package = "de.ozgcloud.user.grpc.organisationseinheit"; ...@@ -32,7 +31,7 @@ option java_package = "de.ozgcloud.user.grpc.organisationseinheit";
option java_outer_classname = "OrganisationsEinheitProto"; option java_outer_classname = "OrganisationsEinheitProto";
service OrganisationsEinheitService { service OrganisationsEinheitService {
rpc GetSupportedOrganisationsEinheiten(google.protobuf.Empty) returns (GrpcGetSupportedOrganisationsEinheitenResponse); rpc GetSupportedOrganisationsEinheiten(GrpcGetSupportedOrganisationsEinheitenRequest) returns (GrpcGetSupportedOrganisationsEinheitenResponse);
} }
message GrpcGetSupportedOrganisationsEinheitenResponse { message GrpcGetSupportedOrganisationsEinheitenResponse {
......
...@@ -56,3 +56,9 @@ message GrpcUserProfileId { ...@@ -56,3 +56,9 @@ message GrpcUserProfileId {
message GrpcDeleteInactiveUserRequest { message GrpcDeleteInactiveUserRequest {
string userId = 1; string userId = 1;
} }
message GrpcFindInactiveUserIdsRequest {
}
message GrpcDeleteInactiveUserResponse {
}
\ No newline at end of file
...@@ -26,7 +26,6 @@ syntax = "proto3"; ...@@ -26,7 +26,6 @@ syntax = "proto3";
package de.ozgcloud.user.grpc; package de.ozgcloud.user.grpc;
import "userprofile.model.proto"; import "userprofile.model.proto";
import "google/protobuf/empty.proto";
option java_multiple_files = true; option java_multiple_files = true;
option java_package = "de.ozgcloud.user.grpc.userprofile"; option java_package = "de.ozgcloud.user.grpc.userprofile";
...@@ -38,8 +37,8 @@ service UserProfileService { ...@@ -38,8 +37,8 @@ service UserProfileService {
rpc GetByExternalId(GrpcGetUserProfileRequest) returns (GrpcGetUserProfileResponse); rpc GetByExternalId(GrpcGetUserProfileRequest) returns (GrpcGetUserProfileResponse);
rpc FindInactiveUserIds(google.protobuf.Empty) returns (GrpcFindInactiveUserIdsResponse); rpc FindInactiveUserIds(GrpcFindInactiveUserIdsRequest) returns (GrpcFindInactiveUserIdsResponse);
rpc DeleteInactiveUser(GrpcDeleteInactiveUserRequest) returns (google.protobuf.Empty); rpc DeleteInactiveUser(GrpcDeleteInactiveUserRequest) returns (GrpcDeleteInactiveUserResponse);
} }
\ No newline at end of file
...@@ -114,6 +114,10 @@ ...@@ -114,6 +114,10 @@
<groupId>io.quarkus</groupId> <groupId>io.quarkus</groupId>
<artifactId>quarkus-scheduler</artifactId> <artifactId>quarkus-scheduler</artifactId>
</dependency> </dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-grpc</artifactId>
</dependency>
<!-- Logging --> <!-- Logging -->
<dependency> <dependency>
......
...@@ -27,8 +27,6 @@ import java.util.Collection; ...@@ -27,8 +27,6 @@ import java.util.Collection;
import jakarta.inject.Inject; import jakarta.inject.Inject;
import com.google.protobuf.Empty;
import de.ozgcloud.user.grpc.organisationseinheit.GrpcGetSupportedOrganisationsEinheitenResponse; import de.ozgcloud.user.grpc.organisationseinheit.GrpcGetSupportedOrganisationsEinheitenResponse;
import de.ozgcloud.user.grpc.organisationseinheit.OrganisationsEinheitServiceGrpc.OrganisationsEinheitServiceImplBase; import de.ozgcloud.user.grpc.organisationseinheit.OrganisationsEinheitServiceGrpc.OrganisationsEinheitServiceImplBase;
import io.grpc.stub.StreamObserver; import io.grpc.stub.StreamObserver;
...@@ -41,7 +39,8 @@ public class OrganisationsEinheitGrpcService extends OrganisationsEinheitService ...@@ -41,7 +39,8 @@ public class OrganisationsEinheitGrpcService extends OrganisationsEinheitService
OrganisationsEinheitService organisationsEinheitService; OrganisationsEinheitService organisationsEinheitService;
@Override @Override
public void getSupportedOrganisationsEinheiten(Empty request, StreamObserver<GrpcGetSupportedOrganisationsEinheitenResponse> responseObserver) { public void getSupportedOrganisationsEinheiten(GrpcGetSupportedOrganisationsEinheitenRequest request,
StreamObserver<GrpcGetSupportedOrganisationsEinheitenResponse> responseObserver) {
var organisationsEinheitIds = organisationsEinheitService.findAllOrganisationsEinheitIds(); var organisationsEinheitIds = organisationsEinheitService.findAllOrganisationsEinheitIds();
var response = GrpcGetSupportedOrganisationsEinheitenResponse.newBuilder() var response = GrpcGetSupportedOrganisationsEinheitenResponse.newBuilder()
.addAllOrganisationseinheiten(mapToGrpc(organisationsEinheitIds)) .addAllOrganisationseinheiten(mapToGrpc(organisationsEinheitIds))
......
...@@ -27,8 +27,6 @@ import java.util.stream.Stream; ...@@ -27,8 +27,6 @@ import java.util.stream.Stream;
import jakarta.inject.Inject; import jakarta.inject.Inject;
import com.google.protobuf.Empty;
import de.ozgcloud.user.User; import de.ozgcloud.user.User;
import de.ozgcloud.user.UserService; import de.ozgcloud.user.UserService;
import de.ozgcloud.user.grpc.userprofile.UserProfileServiceGrpc.UserProfileServiceImplBase; import de.ozgcloud.user.grpc.userprofile.UserProfileServiceGrpc.UserProfileServiceImplBase;
...@@ -65,7 +63,7 @@ public class UserProfileGrpcService extends UserProfileServiceImplBase { ...@@ -65,7 +63,7 @@ public class UserProfileGrpcService extends UserProfileServiceImplBase {
} }
@Override @Override
public void findInactiveUserIds(Empty request, StreamObserver<GrpcFindInactiveUserIdsResponse> responseObserver) { public void findInactiveUserIds(GrpcFindInactiveUserIdsRequest request, StreamObserver<GrpcFindInactiveUserIdsResponse> responseObserver) {
var userIds = service.findAllInactiveUserIds(); var userIds = service.findAllInactiveUserIds();
responseObserver.onNext(buildGrpcGetInactiveUserIdsResponse(userIds)); responseObserver.onNext(buildGrpcGetInactiveUserIdsResponse(userIds));
...@@ -79,10 +77,10 @@ public class UserProfileGrpcService extends UserProfileServiceImplBase { ...@@ -79,10 +77,10 @@ public class UserProfileGrpcService extends UserProfileServiceImplBase {
} }
@Override @Override
public void deleteInactiveUser(GrpcDeleteInactiveUserRequest request, StreamObserver<Empty> responseObserver) { public void deleteInactiveUser(GrpcDeleteInactiveUserRequest request, StreamObserver<GrpcDeleteInactiveUserResponse> responseObserver) {
service.deleteInactive(request.getUserId()); service.deleteInactive(request.getUserId());
responseObserver.onNext(Empty.getDefaultInstance()); responseObserver.onNext(GrpcDeleteInactiveUserResponse.newBuilder().build());
responseObserver.onCompleted(); responseObserver.onCompleted();
} }
} }
\ No newline at end of file
...@@ -3,11 +3,11 @@ package de.ozgcloud.user.organisationseinheit; ...@@ -3,11 +3,11 @@ package de.ozgcloud.user.organisationseinheit;
import static org.mockito.ArgumentMatchers.*; import static org.mockito.ArgumentMatchers.*;
import static org.mockito.Mockito.*; import static org.mockito.Mockito.*;
import org.apache.commons.lang3.StringUtils;
import org.bson.conversions.Bson; import org.bson.conversions.Bson;
import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.mockito.Mock;
import org.mockito.Spy; import org.mockito.Spy;
import com.mongodb.client.DistinctIterable; import com.mongodb.client.DistinctIterable;
...@@ -25,16 +25,16 @@ class OrganisationsEinheitRepositoryTest { ...@@ -25,16 +25,16 @@ class OrganisationsEinheitRepositoryTest {
@DisplayName("Test find Organisationseinheiten Ids") @DisplayName("Test find Organisationseinheiten Ids")
@Nested @Nested
class TestFindOrganisationsEinheitIds { class TestFindOrganisationsEinheitIds {
@Mock
private MongoCollection mongoCollection = mock(MongoCollection.class); private MongoCollection<?> mongoCollection;
private MongoCursor mongoCursor = mock(MongoCursor.class); @Mock
private MongoCursor<String> mongoCursor;
@Test @Test
void shouldFindAllOrganisationsEinheitIds() { void shouldFindAllOrganisationsEinheitIds() {
var iterable = mock(DistinctIterable.class); var iterable = mock(DistinctIterable.class);
when(iterable.iterator()).thenReturn(mongoCursor); when(iterable.iterator()).thenReturn(mongoCursor);
doReturn(mongoCollection).when(organisationsEinheitRepository).mongoCollection(); doReturn(mongoCollection).when(organisationsEinheitRepository).mongoCollection();
when(mongoCursor.next()).thenReturn(StringUtils.EMPTY);
when(mongoCollection.distinct(anyString(), any(Bson.class), any())).thenReturn(iterable); when(mongoCollection.distinct(anyString(), any(Bson.class), any())).thenReturn(iterable);
organisationsEinheitRepository.findAllOrganisationsEinheitIds(); organisationsEinheitRepository.findAllOrganisationsEinheitIds();
......
...@@ -8,8 +8,6 @@ import org.junit.jupiter.api.Test; ...@@ -8,8 +8,6 @@ import org.junit.jupiter.api.Test;
import org.mockito.InjectMocks; import org.mockito.InjectMocks;
import org.mockito.Mock; import org.mockito.Mock;
import com.google.protobuf.Empty;
import de.ozgcloud.user.grpc.organisationseinheit.GrpcGetSupportedOrganisationsEinheitenResponse; import de.ozgcloud.user.grpc.organisationseinheit.GrpcGetSupportedOrganisationsEinheitenResponse;
import io.grpc.stub.StreamObserver; import io.grpc.stub.StreamObserver;
...@@ -31,7 +29,7 @@ public class OrganisationseinheitGrpcServiceTest { ...@@ -31,7 +29,7 @@ public class OrganisationseinheitGrpcServiceTest {
@Test @Test
void shouldGetOrganisationsEinheiten() { void shouldGetOrganisationsEinheiten() {
organisationsEinheitGrpcService.getSupportedOrganisationsEinheiten( organisationsEinheitGrpcService.getSupportedOrganisationsEinheiten(
Empty.getDefaultInstance(), GrpcGetSupportedOrganisationsEinheitenRequest.newBuilder().build(),
streamObserver); streamObserver);
verify(organisationsEinheitService).findAllOrganisationsEinheitIds(); verify(organisationsEinheitService).findAllOrganisationsEinheitIds();
......
...@@ -40,8 +40,6 @@ import org.mockito.InjectMocks; ...@@ -40,8 +40,6 @@ import org.mockito.InjectMocks;
import org.mockito.Mock; import org.mockito.Mock;
import org.mockito.Spy; import org.mockito.Spy;
import com.google.protobuf.Empty;
import de.ozgcloud.user.User; import de.ozgcloud.user.User;
import de.ozgcloud.user.UserService; import de.ozgcloud.user.UserService;
import de.ozgcloud.user.UserTestFactory; import de.ozgcloud.user.UserTestFactory;
...@@ -216,7 +214,7 @@ class UserProfileGrpcServiceTest { ...@@ -216,7 +214,7 @@ class UserProfileGrpcServiceTest {
} }
private void callService() { private void callService() {
grpcService.findInactiveUserIds(Empty.getDefaultInstance(), streamObserver); grpcService.findInactiveUserIds(GrpcFindInactiveUserIdsRequest.newBuilder().build(), streamObserver);
} }
} }
...@@ -224,7 +222,7 @@ class UserProfileGrpcServiceTest { ...@@ -224,7 +222,7 @@ class UserProfileGrpcServiceTest {
class TestDeleteInactiveUser { class TestDeleteInactiveUser {
@Mock @Mock
private StreamObserver<Empty> streamObserver; private StreamObserver<GrpcDeleteInactiveUserResponse> streamObserver;
@Test @Test
void shouldCallService() { void shouldCallService() {
...@@ -237,7 +235,7 @@ class UserProfileGrpcServiceTest { ...@@ -237,7 +235,7 @@ class UserProfileGrpcServiceTest {
void shouldCallOnNext() { void shouldCallOnNext() {
callService(); callService();
verify(streamObserver).onNext(Empty.getDefaultInstance()); verify(streamObserver).onNext(GrpcDeleteInactiveUserResponse.newBuilder().build());
} }
@Test @Test
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment