use of org.mule.runtime.policy.api.PolicyPointcutParameters in project mule by mulesoft.
the class PolicyPointcutParametersManagerTestCase method createOperationParametersWhenOneFactorySupportsIdentifierMultipleTimes.
@Test
public void createOperationParametersWhenOneFactorySupportsIdentifierMultipleTimes() {
Map<String, Object> operationParameters = new HashMap<>();
PolicyPointcutParameters sourceParameters = parametersManager.createSourcePointcutParameters(component, event);
OperationPolicyPointcutParametersFactory factory = mockOperationFactory(true, sourceParameters);
operationPointcutFactories.add(factory);
sourcePointcutFactories.add(mockSourceFactory(true));
parametersManager.createOperationPointcutParameters(component, event, operationParameters);
PolicyPointcutParameters parameters = parametersManager.createOperationPointcutParameters(component, event, operationParameters);
assertThat(parameters.getComponent(), is(component));
assertThat(parameters.getSourceParameters(), is(of(sourceParameters)));
verify(factory, times(2)).supportsOperationIdentifier(identifier);
verify(factory, times(2)).createPolicyPointcutParameters(any());
}
use of org.mule.runtime.policy.api.PolicyPointcutParameters in project mule by mulesoft.
the class PolicyPointcutParametersManagerTestCase method mockSourceFactory.
private SourcePolicyPointcutParametersFactory mockSourceFactory(boolean supportsIdentifier) {
SourcePolicyPointcutParametersFactory factory = mock(SourcePolicyPointcutParametersFactory.class);
when(factory.supportsSourceIdentifier(identifier)).thenReturn(supportsIdentifier);
PolicyPointcutParameters parameters = new PolicyPointcutParameters(component);
when(factory.createPolicyPointcutParameters(component, event.getMessage().getAttributes())).thenReturn(parameters);
return factory;
}
Aggregations