use of org.mule.runtime.api.meta.model.operation.OperationModel in project mule by mulesoft.
the class ExportedArtifactsCollectorTestCase method withMethod.
private void withMethod(OperationModel operationModel, Optional<Method> optionalMethod) {
when(operationModel.getModelProperty(ImplementingMethodModelProperty.class)).thenReturn(optionalMethod.map(ImplementingMethodModelProperty::new));
when(operationModel.getModelProperty(ExtensionOperationDescriptorModelProperty.class)).thenReturn(optionalMethod.map(method -> new ExtensionOperationDescriptorModelProperty(new MethodWrapper(method, loader))));
}
use of org.mule.runtime.api.meta.model.operation.OperationModel in project mule by mulesoft.
the class ErrorsDeclarationEnricherTestCase method extensionErrorsInheritFromMuleErrors.
@Test
public void extensionErrorsInheritFromMuleErrors() {
extensionModel = loadExtension(HeisenbergExtension.class);
OperationModel cureCancer = getNamedObject(extensionModel.getOperationModels(), "cureCancer");
assertThat(cureCancer.getErrorModels(), hasItem(hasProperty(TYPE, is(HEALTH.getType()))));
Optional<ErrorModel> healthError = extensionModel.getErrorModels().stream().filter(errorModel -> errorModel.getType().equals(HEALTH.getType())).findFirst();
assertThat(healthError.isPresent(), is(true));
Optional<ErrorModel> optConnectivityError = healthError.get().getParent();
assertThat(optConnectivityError.isPresent(), is(true));
ErrorModel connectivityError = optConnectivityError.get();
assertThat(connectivityError.getType(), is(CONNECTIVITY_ERROR_IDENTIFIER));
assertThat(connectivityError.getNamespace(), is(HEISENBERG));
Optional<ErrorModel> optMuleConnectivityError = connectivityError.getParent();
assertThat(optMuleConnectivityError.isPresent(), is(true));
ErrorModel muleConnectivityError = optMuleConnectivityError.get();
assertThat(muleConnectivityError.getType(), is(CONNECTIVITY_ERROR_IDENTIFIER));
assertThat(muleConnectivityError.getNamespace(), is(MULE_NAMESPACE));
}
use of org.mule.runtime.api.meta.model.operation.OperationModel in project mule by mulesoft.
the class ErrorsDeclarationEnricherTestCase method operationThrowsOverridesExtensionThrows.
@Test
public void operationThrowsOverridesExtensionThrows() {
extensionModel = loadExtension(HeisenbergWithOperationThrows.class);
OperationModel someOperation = extensionModel.getOperationModel("someOperation").get();
Optional<ErrorModel> operationError = someOperation.getErrorModels().stream().filter(errorModel -> errorModel.getType().equals(OPERATION.getType())).findFirst();
assertThat(operationError.isPresent(), is(true));
}
use of org.mule.runtime.api.meta.model.operation.OperationModel in project mule by mulesoft.
the class ErrorsDeclarationEnricherTestCase method operationsWithConnectionsThrowsConnectivityError.
@Test
public void operationsWithConnectionsThrowsConnectivityError() {
extensionModel = loadExtension(HeisenbergExtension.class);
OperationModel callSaul = getNamedObject(extensionModel.getConfigurationModel("config").get().getOperationModels(), "callSaul");
Set<ErrorModel> errorTypesIdentifiers = callSaul.getErrorModels();
assertThat(errorTypesIdentifiers, hasItem(hasProperty(TYPE, is(CONNECTIVITY_ERROR_IDENTIFIER))));
}
use of org.mule.runtime.api.meta.model.operation.OperationModel in project mule by mulesoft.
the class StereotypesDeclarationEnricherTestCase method operationParameterWithFlowReferenceParameter.
@Test
public void operationParameterWithFlowReferenceParameter() {
OperationModel operation = configuration.getOperationModel("withFlowReference").get();
assertThat(operation.getAllParameterModels(), hasSize(1));
ParameterModel param = operation.getAllParameterModels().get(0);
List<StereotypeModel> stereotypes = param.getAllowedStereotypes();
assertThat(stereotypes, hasSize(1));
assertThat(stereotypes.get(0), is(FLOW));
}
Aggregations