@Test public void fireNotificationForEvent() { when(messageSource.getLocation()).thenReturn(TEST_CONNECTOR_LOCATION); final FlowConstruct flowConstruct = mock(FlowConstruct.class, withSettings().extraInterfaces(Component.class)); when(flowConstruct.getMuleContext()).thenReturn(muleContext); final int action = 100; helper.fireNotification(messageSource, event, TEST_CONNECTOR_LOCATION, action); assertConnectorMessageNotification(eventNotificationHandler, messageSource, TEST_CONNECTOR_LOCATION, action); }
@Before public void before() { when(muleContext.getNotificationManager()).thenReturn(eventNotificationHandler); when(event.getMessage()).thenReturn(message); initMocks(eventNotificationHandler); helper = new NotificationHelper(eventNotificationHandler, TestServerNotification.class, false); }
@Test public void fireNotificationUsingLocation() { final LocationPart flowPart = mock(LocationPart.class); when(flowPart.getPartPath()).thenReturn("flowName"); final ComponentLocation location = mock(ComponentLocation.class); when(location.getParts()).thenReturn(Collections.singletonList(flowPart)); when(location.getComponentIdentifier()).thenReturn(TypedComponentIdentifier.builder() .type(SOURCE) .identifier(buildFromStringRepresentation("http:listener")) .build()); when(messageSource.getLocation()).thenReturn(location); final FlowConstruct flowConstruct = mock(FlowConstruct.class, withSettings().extraInterfaces(Component.class)); when(flowConstruct.getMuleContext()).thenReturn(muleContext); final int action = 100; helper.fireNotification(messageSource, event, location, action); assertConnectorMessageNotification(eventNotificationHandler, messageSource, location, action); }
@Before public void before() { when(muleContext.getNotificationManager()).thenReturn(eventNotificationHandler); when(event.getMessage()).thenReturn(message); when(message.getPayload()).thenReturn(new TypedValue("", DataType.STRING)); initMocks(eventNotificationHandler); helper = new NotificationHelper(eventNotificationHandler, TestServerNotification.class, false); }
@Test public void fireNotificationForEvent() { when(messageSource.getLocation()).thenReturn(TEST_CONNECTOR_LOCATION); final FlowConstruct flowConstruct = mock(FlowConstruct.class, withSettings().extraInterfaces(Component.class)); when(flowConstruct.getMuleContext()).thenReturn(muleContext); final int action = 100; helper.fireNotification(messageSource, event, TEST_CONNECTOR_LOCATION, action); assertConnectorMessageNotification(eventNotificationHandler, messageSource, TEST_CONNECTOR_LOCATION, action); }
@Test public void fireNotificationUsingLocation() { final LocationPart flowPart = mock(LocationPart.class); when(flowPart.getPartPath()).thenReturn("flowName"); final ComponentLocation location = mock(ComponentLocation.class); when(location.getParts()).thenReturn(Collections.singletonList(flowPart)); when(location.getComponentIdentifier()).thenReturn(TypedComponentIdentifier.builder() .type(SOURCE) .identifier(buildFromStringRepresentation("http:listener")) .build()); when(messageSource.getLocation()).thenReturn(location); final FlowConstruct flowConstruct = mock(FlowConstruct.class, withSettings().extraInterfaces(Component.class)); when(flowConstruct.getMuleContext()).thenReturn(muleContext); final int action = 100; helper.fireNotification(messageSource, event, location, action); assertConnectorMessageNotification(eventNotificationHandler, messageSource, location, action); }