Skip to content
Snippets Groups Projects
Commit 8e1b42d5 authored by OZGCloud's avatar OZGCloud
Browse files

fix bean definition

parent df08c16a
No related branches found
No related tags found
No related merge requests found
......@@ -29,7 +29,11 @@ import org.springframework.context.annotation.Configuration;
import de.ozgcloud.apilib.common.command.OzgCloudCommandService;
import de.ozgcloud.apilib.common.command.grpc.CommandMapper;
import de.ozgcloud.apilib.common.command.grpc.GrpcOzgCloudCommandService;
import de.ozgcloud.apilib.user.GrpcOzgCloudUserProfileService;
import de.ozgcloud.apilib.user.OzgCloudUserProfileService;
import de.ozgcloud.apilib.user.UserProfileMapper;
import de.ozgcloud.bescheid.common.callcontext.BescheidManagerCallContextProvider;
import de.ozgcloud.user.grpc.userprofile.UserProfileServiceGrpc;
import de.ozgcloud.vorgang.grpc.command.CommandServiceGrpc;
import net.devh.boot.grpc.client.inject.GrpcClient;
......@@ -37,13 +41,22 @@ import net.devh.boot.grpc.client.inject.GrpcClient;
public class BescheidManagerConfiguration {
public static final String COMMAND_SERVICE_NAME = "bescheid_OzgCloudCommandService";
public static final String OZGCLOUD_USER_PROFILE_SERVICE_NAME = "bescheid_OzgCloudUserProfileService";
@GrpcClient("command-manager")
private CommandServiceGrpc.CommandServiceBlockingStub commandServiceStub;
@GrpcClient("user-manager")
private UserProfileServiceGrpc.UserProfileServiceBlockingStub userProfileServiceGrpc;
@Bean(COMMAND_SERVICE_NAME)
OzgCloudCommandService grpcOzgCloudCommandService(CommandMapper commandMapper, BescheidManagerCallContextProvider contextProvider) {
return new GrpcOzgCloudCommandService(commandServiceStub, commandMapper, contextProvider,
GrpcOzgCloudCommandService.DEFAULT_COMMAND_REQUEST_THRESHOLD_MILLIS);
}
@Bean(OZGCLOUD_USER_PROFILE_SERVICE_NAME)
OzgCloudUserProfileService ozgCloudUserProfileService(UserProfileMapper mapper, BescheidManagerCallContextProvider contextProvider) {
return new GrpcOzgCloudUserProfileService(userProfileServiceGrpc, mapper, contextProvider);
}
}
......@@ -25,10 +25,12 @@ package de.ozgcloud.bescheid.common.user;
import java.util.Optional;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import de.ozgcloud.apilib.user.OzgCloudUserId;
import de.ozgcloud.apilib.user.OzgCloudUserProfileService;
import de.ozgcloud.bescheid.BescheidManagerConfiguration;
import de.ozgcloud.bescheid.common.callcontext.CurrentUserService;
import de.ozgcloud.common.errorhandling.TechnicalException;
import lombok.RequiredArgsConstructor;
......@@ -38,6 +40,7 @@ import lombok.RequiredArgsConstructor;
public class UserProfileService {
private final CurrentUserService currentUserService;
@Qualifier(BescheidManagerConfiguration.OZGCLOUD_USER_PROFILE_SERVICE_NAME)
private final Optional<OzgCloudUserProfileService> userProfileService;
private final UserProfileMapper mapper;
......
package de.ozgcloud.bescheid;
import org.mapstruct.factory.Mappers;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.info.BuildProperties;
import org.springframework.boot.test.mock.mockito.MockBean;
......@@ -8,6 +9,8 @@ import org.springframework.context.annotation.ComponentScan;
import org.springframework.security.authentication.AuthenticationTrustResolver;
import org.springframework.security.authentication.AuthenticationTrustResolverImpl;
import de.ozgcloud.apilib.user.UserProfileMapper;
@SpringBootApplication
@ComponentScan({ "de.ozgcloud.*" })
public class BescheidTestApplication {
......@@ -19,4 +22,9 @@ public class BescheidTestApplication {
AuthenticationTrustResolver trustResolver() {
return new AuthenticationTrustResolverImpl();
}
@Bean
public UserProfileMapper userProfileMapper() {
return Mappers.getMapper(UserProfileMapper.class);
}
}
......@@ -24,9 +24,16 @@
package de.ozgcloud.vorgang;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import de.ozgcloud.common.test.ITCase;
@SpringBootTest(properties = {
"ozgcloud.processors.0.name=test",
"ozgcloud.processors.0.address=http://localhost:8090/testprocessor",
"ozgcloud.processors.0.forms.0.formEngineName=testFormEngine",
"ozgcloud.processors.0.forms.0.formId=testForm"
})
@ITCase
class VorgangManagerServerApplicationTests {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment