Allow DMF to be disabled
Signed-off-by: Kai Zimmermann <kai.zimmermann@bosch-si.com>
This commit is contained in:
@@ -61,7 +61,7 @@ public class AmqpControllerAuthenticationTest {
|
||||
private AmqpMessageHandlerService amqpMessageHandlerService;
|
||||
private MessageConverter messageConverter;
|
||||
private TenantConfigurationManagement tenantConfigurationManagement;
|
||||
private AmqpControllerAuthentfication authenticationManager;
|
||||
private AmqpControllerAuthentication authenticationManager;
|
||||
|
||||
private static final TenantConfigurationValue<Boolean> CONFIG_VALUE_FALSE = TenantConfigurationValue
|
||||
.<Boolean> builder().value(Boolean.FALSE).build();
|
||||
@@ -77,9 +77,6 @@ public class AmqpControllerAuthenticationTest {
|
||||
amqpMessageHandlerService = new AmqpMessageHandlerService(rabbitTemplate,
|
||||
mock(AmqpMessageDispatcherService.class));
|
||||
|
||||
authenticationManager = new AmqpControllerAuthentfication();
|
||||
authenticationManager.setControllerManagement(mock(ControllerManagement.class));
|
||||
|
||||
final DdiSecurityProperties secruityProperties = mock(DdiSecurityProperties.class);
|
||||
final Rp rp = mock(Rp.class);
|
||||
final org.eclipse.hawkbit.security.DdiSecurityProperties.Authentication ddiAuthentication = mock(
|
||||
@@ -90,23 +87,22 @@ public class AmqpControllerAuthenticationTest {
|
||||
when(secruityProperties.getAuthentication()).thenReturn(ddiAuthentication);
|
||||
when(ddiAuthentication.getAnonymous()).thenReturn(anonymous);
|
||||
when(anonymous.isEnabled()).thenReturn(false);
|
||||
authenticationManager.setSecruityProperties(secruityProperties);
|
||||
|
||||
tenantConfigurationManagement = mock(TenantConfigurationManagement.class);
|
||||
authenticationManager.setTenantConfigurationManagement(tenantConfigurationManagement);
|
||||
|
||||
when(tenantConfigurationManagement.getConfigurationValue(any(), eq(Boolean.class)))
|
||||
.thenReturn(CONFIG_VALUE_FALSE);
|
||||
|
||||
final ControllerManagement controllerManagement = mock(ControllerManagement.class);
|
||||
when(controllerManagement.getSecurityTokenByControllerId(anyString())).thenReturn(CONTROLLLER_ID);
|
||||
authenticationManager.setControllerManagement(controllerManagement);
|
||||
amqpMessageHandlerService.setArtifactManagement(mock(ArtifactManagement.class));
|
||||
|
||||
final SecurityContextTenantAware tenantAware = new SecurityContextTenantAware();
|
||||
authenticationManager.setTenantAware(tenantAware);
|
||||
final SystemSecurityContext systemSecurityContext = new SystemSecurityContext(tenantAware);
|
||||
authenticationManager.setSystemSecurityContext(systemSecurityContext);
|
||||
|
||||
authenticationManager = new AmqpControllerAuthentication(controllerManagement, tenantConfigurationManagement,
|
||||
tenantAware, secruityProperties, systemSecurityContext);
|
||||
|
||||
authenticationManager.postConstruct();
|
||||
amqpMessageHandlerService.setAuthenticationManager(authenticationManager);
|
||||
}
|
||||
|
||||
@@ -79,17 +79,16 @@ public class AmqpMessageDispatcherServiceTest extends AbstractIntegrationTest {
|
||||
super.before();
|
||||
this.rabbitTemplate = Mockito.mock(RabbitTemplate.class);
|
||||
when(rabbitTemplate.getMessageConverter()).thenReturn(new Jackson2JsonMessageConverter());
|
||||
amqpMessageDispatcherService = new AmqpMessageDispatcherService(rabbitTemplate);
|
||||
amqpMessageDispatcherService = spy(amqpMessageDispatcherService);
|
||||
|
||||
senderService = Mockito.mock(DefaultAmqpSenderService.class);
|
||||
amqpMessageDispatcherService.setAmqpSenderService(senderService);
|
||||
|
||||
final ArtifactUrlHandler artifactUrlHandlerMock = Mockito.mock(ArtifactUrlHandler.class);
|
||||
when(artifactUrlHandlerMock.getUrl(anyString(), anyLong(), anyString(), anyString(), anyObject()))
|
||||
.thenReturn("http://mockurl");
|
||||
|
||||
amqpMessageDispatcherService.setArtifactUrlHandler(artifactUrlHandlerMock);
|
||||
amqpMessageDispatcherService = new AmqpMessageDispatcherService(rabbitTemplate, senderService,
|
||||
artifactUrlHandlerMock);
|
||||
amqpMessageDispatcherService = spy(amqpMessageDispatcherService);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ public class AmqpMessageHandlerServiceTest {
|
||||
private ArtifactManagement artifactManagementMock;
|
||||
|
||||
@Mock
|
||||
private AmqpControllerAuthentfication authenticationManagerMock;
|
||||
private AmqpControllerAuthentication authenticationManagerMock;
|
||||
|
||||
@Mock
|
||||
private ArtifactRepository artifactRepositoryMock;
|
||||
|
||||
Reference in New Issue
Block a user