Search in sources :

Example 1 with AnnotatedProcessor

use of org.mule.runtime.core.privileged.processor.AnnotatedProcessor in project mule by mulesoft.

the class MessagingExceptionTestCase method withAnnotatedFailingProcessorNoPathResolver.

@Test
public void withAnnotatedFailingProcessorNoPathResolver() {
    AnnotatedProcessor mockProcessor = mock(AnnotatedProcessor.class);
    when(mockProcessor.getAnnotation(eq(docNameAttrName))).thenReturn("Mock Component");
    configureProcessorLocation(mockProcessor);
    MessagingException exception = new MessagingException(createStaticMessage(""), testEvent, mockProcessor);
    exception.getInfo().putAll(locationProvider.getContextInfo(createInfo(testEvent, exception, mockProcessor), mockProcessor));
    assertThat(exception.getInfo().get(INFO_LOCATION_KEY).toString(), is("Mock@1 @ MessagingExceptionTestCase:muleApp.xml:10 (Mock Component)"));
}
Also used : AnnotatedProcessor(org.mule.runtime.core.privileged.processor.AnnotatedProcessor) MessagingException(org.mule.runtime.core.internal.exception.MessagingException) SmallTest(org.mule.tck.size.SmallTest) Test(org.junit.Test)

Example 2 with AnnotatedProcessor

use of org.mule.runtime.core.privileged.processor.AnnotatedProcessor in project mule by mulesoft.

the class MessagingExceptionTestCase method withAnnotatedFailingProcessorNotPathResolver.

@Test
public void withAnnotatedFailingProcessorNotPathResolver() {
    AnnotatedProcessor mockProcessor = mock(AnnotatedProcessor.class);
    when(mockProcessor.getAnnotation(eq(docNameAttrName))).thenReturn("Mock Component");
    configureProcessorLocation(mockProcessor);
    MessagingException exception = new MessagingException(createStaticMessage(""), testEvent, mockProcessor);
    exception.getInfo().putAll(locationProvider.getContextInfo(createInfo(testEvent, exception, mockProcessor), mockProcessor));
    assertThat(exception.getInfo().get(INFO_LOCATION_KEY).toString(), is("Mock@1 @ MessagingExceptionTestCase:muleApp.xml:10 (Mock Component)"));
}
Also used : AnnotatedProcessor(org.mule.runtime.core.privileged.processor.AnnotatedProcessor) MessagingException(org.mule.runtime.core.internal.exception.MessagingException) SmallTest(org.mule.tck.size.SmallTest) Test(org.junit.Test)

Example 3 with AnnotatedProcessor

use of org.mule.runtime.core.privileged.processor.AnnotatedProcessor in project mule by mulesoft.

the class MessagingExceptionTestCase method withAnnotatedFailingProcessorPathResolver.

@Test
public void withAnnotatedFailingProcessorPathResolver() {
    AnnotatedProcessor mockProcessor = mock(AnnotatedProcessor.class);
    when(mockProcessor.getAnnotation(eq(docNameAttrName))).thenReturn("Mock Component");
    configureProcessorLocation(mockProcessor);
    when(mockComponentLocation.getLocation()).thenReturn("flow/processor");
    MessagingException exception = new MessagingException(createStaticMessage(""), testEvent, mockProcessor);
    exception.getInfo().putAll(locationProvider.getContextInfo(createInfo(testEvent, exception, mockProcessor), mockProcessor));
    assertThat(exception.getInfo().get(INFO_LOCATION_KEY).toString(), is("flow/processor @ MessagingExceptionTestCase:muleApp.xml:10 (Mock Component)"));
}
Also used : AnnotatedProcessor(org.mule.runtime.core.privileged.processor.AnnotatedProcessor) MessagingException(org.mule.runtime.core.internal.exception.MessagingException) SmallTest(org.mule.tck.size.SmallTest) Test(org.junit.Test)

Example 4 with AnnotatedProcessor

use of org.mule.runtime.core.privileged.processor.AnnotatedProcessor in project mule by mulesoft.

the class MessagingExceptionTestCase method withFailingProcessorNotPathResolver.

@Test
public void withFailingProcessorNotPathResolver() {
    AnnotatedProcessor mockProcessor = mock(AnnotatedProcessor.class);
    when(mockProcessor.getLocation()).thenReturn(fromSingleComponent("Mock@1"));
    when(mockProcessor.toString()).thenReturn("Mock@1");
    MessagingException exception = new MessagingException(createStaticMessage(""), testEvent, mockProcessor);
    exception.getInfo().putAll(locationProvider.getContextInfo(createInfo(testEvent, exception, mockProcessor), mockProcessor));
    assertThat(exception.getInfo().get(INFO_LOCATION_KEY).toString(), is("Mock@1 @ MessagingExceptionTestCase:unknown:-1"));
}
Also used : AnnotatedProcessor(org.mule.runtime.core.privileged.processor.AnnotatedProcessor) MessagingException(org.mule.runtime.core.internal.exception.MessagingException) SmallTest(org.mule.tck.size.SmallTest) Test(org.junit.Test)

Example 5 with AnnotatedProcessor

use of org.mule.runtime.core.privileged.processor.AnnotatedProcessor in project mule by mulesoft.

the class MessagingExceptionTestCase method withFailingProcessorPathResolver.

@Test
public void withFailingProcessorPathResolver() {
    AnnotatedProcessor mockProcessor = mock(AnnotatedProcessor.class);
    configureProcessorLocation(mockProcessor);
    when(mockComponentLocation.getLocation()).thenReturn("flow/processor");
    MessagingException exception = new MessagingException(createStaticMessage(""), testEvent, mockProcessor);
    exception.getInfo().putAll(locationProvider.getContextInfo(createInfo(testEvent, exception, mockProcessor), mockProcessor));
    assertThat(exception.getInfo().get(INFO_LOCATION_KEY).toString(), is("flow/processor @ MessagingExceptionTestCase:muleApp.xml:10"));
}
Also used : AnnotatedProcessor(org.mule.runtime.core.privileged.processor.AnnotatedProcessor) MessagingException(org.mule.runtime.core.internal.exception.MessagingException) SmallTest(org.mule.tck.size.SmallTest) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)6 MessagingException (org.mule.runtime.core.internal.exception.MessagingException)6 AnnotatedProcessor (org.mule.runtime.core.privileged.processor.AnnotatedProcessor)6 SmallTest (org.mule.tck.size.SmallTest)6