Search in sources :

Example 1 with InterceptorsModelProperty

use of org.mule.runtime.module.extension.internal.loader.java.property.InterceptorsModelProperty in project mule by mulesoft.

the class MuleExtensionUtils method getOrCreateInterceptorModelProperty.

private static InterceptorsModelProperty getOrCreateInterceptorModelProperty(BaseDeclaration declaration) {
    InterceptorsModelProperty property = (InterceptorsModelProperty) declaration.getModelProperty(InterceptorsModelProperty.class).orElse(null);
    if (property == null) {
        property = new InterceptorsModelProperty(emptyList());
        declaration.addModelProperty(property);
    }
    return property;
}
Also used : InterceptorsModelProperty(org.mule.runtime.module.extension.internal.loader.java.property.InterceptorsModelProperty)

Example 2 with InterceptorsModelProperty

use of org.mule.runtime.module.extension.internal.loader.java.property.InterceptorsModelProperty in project mule by mulesoft.

the class ConnectionDeclarationEnricherTestCase method enrichConnectedOperation.

@Test
public void enrichConnectedOperation() throws Exception {
    enricher.enrich(extensionLoadingContext);
    verify(connectedOperation).addModelProperty(isA(InterceptorsModelProperty.class));
    InterceptorsModelProperty interceptors = connectedOperation.getModelProperty(InterceptorsModelProperty.class).get();
    assertThat(interceptors.getInterceptorFactories(), hasSize(2));
    assertThat(interceptors.getInterceptorFactories().get(0).createInterceptor(), is(instanceOf(ConnectionInterceptor.class)));
    assertThat(interceptors.getInterceptorFactories().get(1).createInterceptor(), is(instanceOf(CursorResetInterceptor.class)));
}
Also used : InterceptorsModelProperty(org.mule.runtime.module.extension.internal.loader.java.property.InterceptorsModelProperty) SmallTest(org.mule.tck.size.SmallTest) Test(org.junit.Test)

Aggregations

InterceptorsModelProperty (org.mule.runtime.module.extension.internal.loader.java.property.InterceptorsModelProperty)2 Test (org.junit.Test)1 SmallTest (org.mule.tck.size.SmallTest)1