use of org.apache.metron.rest.service.KafkaService in project metron by apache.
the class AlertsUIServiceImplTest method setUp.
@SuppressWarnings("unchecked")
@Before
public void setUp() throws Exception {
kafkaService = mock(KafkaService.class);
environment = mock(Environment.class);
userSettingsClient = mock(UserSettingsClient.class);
alertsUIService = new AlertsUIServiceImpl(kafkaService, environment, userSettingsClient);
// assume user1 is logged in for tests
Authentication authentication = Mockito.mock(Authentication.class);
UserDetails userDetails = Mockito.mock(UserDetails.class);
when(authentication.getPrincipal()).thenReturn(userDetails);
when(userDetails.getUsername()).thenReturn(user1);
SecurityContextHolder.getContext().setAuthentication(authentication);
}
Aggregations