Search in sources :

Example 1 with OutputLogger

use of com.blackducksoftware.integration.hub.alert.OutputLogger in project hub-alert by blackducksoftware.

the class RealTimeListenerTest method testReceiveMessageException.

@SuppressWarnings("unchecked")
@Test
public void testReceiveMessageException() throws IOException, Exception {
    try (OutputLogger outputLogger = new OutputLogger()) {
        final Gson gson = new Gson();
        final MockNotificationEntity notificationEntity = new MockNotificationEntity();
        final NotificationModel model = new NotificationModel(notificationEntity.createEntity(), Collections.emptyList());
        final ChannelTemplateManager channelTemplateManager = Mockito.mock(ChannelTemplateManager.class);
        final ProjectDataFactory projectDataFactory = Mockito.mock(ProjectDataFactory.class);
        final NotificationEventManager eventManager = Mockito.mock(NotificationEventManager.class);
        Mockito.doNothing().when(channelTemplateManager).sendEvents(Mockito.any());
        Mockito.doThrow(new NullPointerException("null error")).when(projectDataFactory).createProjectDataCollection(Mockito.anyCollection(), Mockito.any());
        final RealTimeListener realTimeListener = new RealTimeListener(gson, channelTemplateManager, projectDataFactory, eventManager);
        final RealTimeEvent realTimeEvent = new RealTimeEvent(Arrays.asList(model));
        final String realTimeEventString = gson.toJson(realTimeEvent);
        realTimeListener.receiveMessage(realTimeEventString);
        assertTrue(outputLogger.isLineContainingText("null"));
    }
}
Also used : MockNotificationEntity(com.blackducksoftware.integration.hub.alert.mock.entity.MockNotificationEntity) ChannelTemplateManager(com.blackducksoftware.integration.hub.alert.channel.ChannelTemplateManager) NotificationEventManager(com.blackducksoftware.integration.hub.alert.digest.filter.NotificationEventManager) OutputLogger(com.blackducksoftware.integration.hub.alert.OutputLogger) Gson(com.google.gson.Gson) RealTimeEvent(com.blackducksoftware.integration.hub.alert.event.RealTimeEvent) NotificationModel(com.blackducksoftware.integration.hub.alert.hub.model.NotificationModel) ProjectDataFactory(com.blackducksoftware.integration.hub.alert.digest.model.ProjectDataFactory) Test(org.junit.Test)

Example 2 with OutputLogger

use of com.blackducksoftware.integration.hub.alert.OutputLogger in project hub-alert by blackducksoftware.

the class EmailChannelTestIT method sendEmailNullGlobalTest.

@Test
public void sendEmailNullGlobalTest() throws Exception {
    final OutputLogger outputLogger = new OutputLogger();
    final EmailGroupChannel emailChannel = new EmailGroupChannel(null, gson, null, null, null, null);
    emailChannel.sendMessage(new EmailGroupEvent(null, 1L), null);
    assertTrue(outputLogger.isLineContainingText("No configuration found with id"));
    outputLogger.close();
}
Also used : OutputLogger(com.blackducksoftware.integration.hub.alert.OutputLogger) Test(org.junit.Test) ExternalConnectionTest(com.blackducksoftware.integration.test.annotation.ExternalConnectionTest) ChannelTest(com.blackducksoftware.integration.hub.alert.channel.ChannelTest)

Example 3 with OutputLogger

use of com.blackducksoftware.integration.hub.alert.OutputLogger in project hub-alert by blackducksoftware.

the class CommonConfigTest method init.

@Before
public void init() throws IOException {
    outputLogger = new OutputLogger();
    globalProperties = new TestGlobalProperties();
}
Also used : OutputLogger(com.blackducksoftware.integration.hub.alert.OutputLogger) TestGlobalProperties(com.blackducksoftware.integration.hub.alert.TestGlobalProperties) Before(org.junit.Before)

Example 4 with OutputLogger

use of com.blackducksoftware.integration.hub.alert.OutputLogger in project hub-alert by blackducksoftware.

the class ChannelTest method init.

@Before
public void init() throws IOException {
    gson = new Gson();
    properties = new TestProperties();
    outputLogger = new OutputLogger();
}
Also used : TestProperties(com.blackducksoftware.integration.hub.alert.TestProperties) Gson(com.google.gson.Gson) OutputLogger(com.blackducksoftware.integration.hub.alert.OutputLogger) Before(org.junit.Before)

Example 5 with OutputLogger

use of com.blackducksoftware.integration.hub.alert.OutputLogger in project hub-alert by blackducksoftware.

the class LoginActionsTestIT method init.

@Before
public void init() throws IOException {
    outputLogger = new OutputLogger();
    mockLoginRestModel.setHubUsername(properties.getProperty(TestPropertyKey.TEST_USERNAME));
    mockLoginRestModel.setHubPassword(properties.getProperty(TestPropertyKey.TEST_PASSWORD));
}
Also used : OutputLogger(com.blackducksoftware.integration.hub.alert.OutputLogger) Before(org.junit.Before)

Aggregations

OutputLogger (com.blackducksoftware.integration.hub.alert.OutputLogger)6 Before (org.junit.Before)3 Test (org.junit.Test)3 Gson (com.google.gson.Gson)2 IntegrationException (com.blackducksoftware.integration.exception.IntegrationException)1 TestGlobalProperties (com.blackducksoftware.integration.hub.alert.TestGlobalProperties)1 TestProperties (com.blackducksoftware.integration.hub.alert.TestProperties)1 ChannelTemplateManager (com.blackducksoftware.integration.hub.alert.channel.ChannelTemplateManager)1 ChannelTest (com.blackducksoftware.integration.hub.alert.channel.ChannelTest)1 NotificationEventManager (com.blackducksoftware.integration.hub.alert.digest.filter.NotificationEventManager)1 ProjectDataFactory (com.blackducksoftware.integration.hub.alert.digest.model.ProjectDataFactory)1 RealTimeEvent (com.blackducksoftware.integration.hub.alert.event.RealTimeEvent)1 NotificationModel (com.blackducksoftware.integration.hub.alert.hub.model.NotificationModel)1 MockNotificationEntity (com.blackducksoftware.integration.hub.alert.mock.entity.MockNotificationEntity)1 ComponentVersionView (com.blackducksoftware.integration.hub.api.generated.view.ComponentVersionView)1 NotificationContentItem (com.blackducksoftware.integration.hub.notification.NotificationContentItem)1 NotificationEvent (com.blackducksoftware.integration.hub.notification.NotificationEvent)1 ProjectVersionModel (com.blackducksoftware.integration.hub.notification.ProjectVersionModel)1 ProjectService (com.blackducksoftware.integration.hub.service.ProjectService)1 ExternalConnectionTest (com.blackducksoftware.integration.test.annotation.ExternalConnectionTest)1