@@ -478,4 +478,7 @@ public class AmqpMessageHandlerService extends BaseAmqpService {
|
|||||||
this.entityFactory = entityFactory;
|
this.entityFactory = entityFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setSystemSecurityContext(final SystemSecurityContext systemSecurityContext) {
|
||||||
|
this.systemSecurityContext = systemSecurityContext;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ import org.eclipse.hawkbit.repository.model.LocalArtifact;
|
|||||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||||
import org.eclipse.hawkbit.repository.model.TargetInfo;
|
import org.eclipse.hawkbit.repository.model.TargetInfo;
|
||||||
import org.eclipse.hawkbit.security.SecurityTokenGenerator;
|
import org.eclipse.hawkbit.security.SecurityTokenGenerator;
|
||||||
|
import org.eclipse.hawkbit.security.SystemSecurityContext;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
@@ -112,6 +113,9 @@ public class AmqpMessageHandlerServiceTest {
|
|||||||
@Mock
|
@Mock
|
||||||
private RabbitTemplate rabbitTemplate;
|
private RabbitTemplate rabbitTemplate;
|
||||||
|
|
||||||
|
@Mock
|
||||||
|
private SystemSecurityContext systemSecurityContextMock;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void before() throws Exception {
|
public void before() throws Exception {
|
||||||
messageConverter = new Jackson2JsonMessageConverter();
|
messageConverter = new Jackson2JsonMessageConverter();
|
||||||
@@ -124,6 +128,7 @@ public class AmqpMessageHandlerServiceTest {
|
|||||||
amqpMessageHandlerService.setHostnameResolver(hostnameResolverMock);
|
amqpMessageHandlerService.setHostnameResolver(hostnameResolverMock);
|
||||||
amqpMessageHandlerService.setEventBus(eventBus);
|
amqpMessageHandlerService.setEventBus(eventBus);
|
||||||
amqpMessageHandlerService.setEntityFactory(entityFactoryMock);
|
amqpMessageHandlerService.setEntityFactory(entityFactoryMock);
|
||||||
|
amqpMessageHandlerService.setSystemSecurityContext(systemSecurityContextMock);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -367,6 +372,8 @@ public class AmqpMessageHandlerServiceTest {
|
|||||||
when(controllerManagementMock.findSoftwareModulesByDistributionSet(Matchers.any()))
|
when(controllerManagementMock.findSoftwareModulesByDistributionSet(Matchers.any()))
|
||||||
.thenReturn(softwareModuleList);
|
.thenReturn(softwareModuleList);
|
||||||
|
|
||||||
|
when(systemSecurityContextMock.runAsSystem(anyObject())).thenReturn("securityToken");
|
||||||
|
|
||||||
final MessageProperties messageProperties = createMessageProperties(MessageType.EVENT);
|
final MessageProperties messageProperties = createMessageProperties(MessageType.EVENT);
|
||||||
messageProperties.setHeader(MessageHeaderKey.TOPIC, EventTopic.UPDATE_ACTION_STATUS.name());
|
messageProperties.setHeader(MessageHeaderKey.TOPIC, EventTopic.UPDATE_ACTION_STATUS.name());
|
||||||
final ActionUpdateStatus actionUpdateStatus = createActionUpdateStatus(ActionStatus.FINISHED, 23L);
|
final ActionUpdateStatus actionUpdateStatus = createActionUpdateStatus(ActionStatus.FINISHED, 23L);
|
||||||
|
|||||||
Reference in New Issue
Block a user