use of org.mule.runtime.policy.api.OperationPolicyPointcutParametersFactory in project mule by mulesoft.
the class PolicyPointcutParametersManagerTestCase method mockOperationFactory.
private OperationPolicyPointcutParametersFactory mockOperationFactory(boolean supportsIdentifier, PolicyPointcutParameters sourceParameters) {
OperationPolicyPointcutParametersFactory factory = mock(OperationPolicyPointcutParametersFactory.class);
when(factory.supportsOperationIdentifier(identifier)).thenReturn(supportsIdentifier);
PolicyPointcutParameters parameters = new PolicyPointcutParameters(component, sourceParameters);
when(factory.createPolicyPointcutParameters(any())).thenReturn(parameters);
return factory;
}
use of org.mule.runtime.policy.api.OperationPolicyPointcutParametersFactory 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());
}
Aggregations