use of org.mule.runtime.core.privileged.transformer.ExtendedTransformationService in project mule by mulesoft.
the class MuleMessageDataTypePropagationTestCase method setUp.
@Before
public void setUp() throws Exception {
when(muleContext.getConfiguration().getDefaultEncoding()).thenReturn(DEFAULT_ENCODING.name());
registerIntoMockContext(muleContext, OBJECT_DEFAULT_RETRY_POLICY_TEMPLATE, mock(RetryPolicyTemplate.class));
transformationService = new ExtendedTransformationService(muleContext);
}
use of org.mule.runtime.core.privileged.transformer.ExtendedTransformationService in project mule by mulesoft.
the class PipelineMessageNotificationTestCase method createMocks.
@Before
public void createMocks() throws Exception {
muleContext.dispose();
muleContext = mockContextWithServices();
when(muleContext.getStatistics()).thenReturn(new AllStatistics());
when(muleContext.getConfiguration()).thenReturn(new DefaultMuleConfiguration());
notificationFirer = ((MuleContextWithRegistries) muleContext).getRegistry().lookupObject(NotificationDispatcher.class);
when(muleContext.getDefaultErrorHandler(empty())).thenReturn(new ErrorHandlerFactory().createDefault(notificationFirer));
mockErrorTypeLocator();
when(muleContext.getTransformationService()).thenReturn(new ExtendedTransformationService(muleContext));
}
use of org.mule.runtime.core.privileged.transformer.ExtendedTransformationService in project mule by mulesoft.
the class TransformationServiceNullTransformationTestCase method transformerIsNeverCalledWithANullValue.
@Test
public void transformerIsNeverCalledWithANullValue() throws MuleException {
MuleContext muleContext = mock(MuleContext.class);
MuleConfiguration muleConfiguration = mock(MuleConfiguration.class);
when(muleContext.getConfiguration()).thenReturn(muleConfiguration);
ExtendedTransformationService transformationService = new ExtendedTransformationService(muleContext);
Transformer transformer1 = mock(Transformer.class);
when(transformer1.transform(any(Object.class))).thenReturn(null);
when(transformer1.isSourceDataTypeSupported(any(DataType.class))).thenReturn(true);
when(transformer1.getReturnDataType()).thenReturn(DataType.OBJECT);
Transformer transformer2 = mock(Transformer.class);
when(transformer2.transform(any(Object.class))).thenReturn("foo");
when(transformer2.isSourceDataTypeSupported(any(DataType.class))).thenReturn(true);
when(transformer2.getReturnDataType()).thenReturn(DataType.OBJECT);
Message message = transformationService.applyTransformers(of(""), null, transformer1, transformer2);
assertEquals("foo", message.getPayload().getValue());
verify(transformer1, never()).transform(null);
verify(transformer1, never()).isAcceptNull();
verify(transformer2, never()).transform(null);
verify(transformer2, never()).isAcceptNull();
}
use of org.mule.runtime.core.privileged.transformer.ExtendedTransformationService in project mule by mulesoft.
the class TransformationServiceTestCase method setUp.
@Before
public void setUp() throws Exception {
when(muleContext.getDataTypeConverterResolver()).thenReturn(conversionResolver);
this.transformationService = new ExtendedTransformationService(muleContext);
}
Aggregations