use of org.mule.runtime.api.meta.model.operation.OperationModel in project mule by mulesoft.
the class ExportedPackagesValidatorTestCase 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 ExportedPackagesValidatorTestCase method setUpValidExtension.
private void setUpValidExtension() {
OutputModel appleList = mockOutputModel(ApiTestClass.class);
OperationModel firstOperation = mockOperationModel(appleList, mockOutputModel(ApiTestClass.class));
withMethod(firstOperation, getApiMethods(ApiTestClass.class).stream().filter(m -> m.getName().equals("someOperation")).findFirst());
when(extensionModel.getOperationModels()).thenReturn(asList(firstOperation));
visitableMock(firstOperation);
}
use of org.mule.runtime.api.meta.model.operation.OperationModel in project mule by mulesoft.
the class ExportedPackagesValidatorTestCase method mockOperationModel.
private OperationModel mockOperationModel(OutputModel output, OutputModel attributes, ParameterModel... params) {
OperationModel op = mock(OperationModel.class);
when(op.getOutput()).thenReturn(output);
when(op.getOutputAttributes()).thenReturn(attributes);
if (params != null) {
mockParameters(op, params);
}
return op;
}
use of org.mule.runtime.api.meta.model.operation.OperationModel in project mule by mulesoft.
the class ExtensionDescriptionDocumenterTestCase method assertDescriptionsSingleConfig.
private void assertDescriptionsSingleConfig(ExtensionModel extensionModel) {
assertThat(extensionModel.getConfigurationModels(), hasSize(1));
assertThat(extensionModel.getOperationModels(), hasSize(1));
OperationModel withParameterGroup = extensionModel.getOperationModels().get(0);
assertDescription(withParameterGroup, "Operation with parameter group");
List<ParameterModel> operationParams = withParameterGroup.getAllParameterModels();
assertDescription(operationParams.get(0), "value param description");
assertDescription(operationParams.get(1), "First Description");
assertDescription(operationParams.get(2), "Second Description");
ConfigurationModel config = extensionModel.getConfigurationModels().get(0);
assertDescription(extensionModel, "Test Extension Description with single config");
assertDescription(config, DEFAULT_CONFIG_DESCRIPTION);
assertDescription(config.getAllParameterModels().get(0), "Config parameter");
assertDescription(config.getAllParameterModels().get(1), "Config Parameter with an Optional value");
assertThat(config.getOperationModels(), hasSize(1));
assertDescription(config.getOperationModels().get(0), "Operation with description");
ConnectionProviderModel provider = config.getConnectionProviders().get(0);
assertDescription(provider, "Provider description");
assertDescription(provider.getAllParameterModels().get(0), "Connection Param Description");
assertDescription(provider.getAllParameterModels().get(1), "First Description");
assertDescription(provider.getAllParameterModels().get(2), "Second Description");
}
use of org.mule.runtime.api.meta.model.operation.OperationModel in project mule by mulesoft.
the class ExtensionDescriptionDocumenterTestCase method assertDescriptionsMultipleConfigs.
private void assertDescriptionsMultipleConfigs(ExtensionModel declaration) {
List<ConfigurationModel> configurations = declaration.getConfigurationModels();
assertDescription(declaration, "Test Extension Description");
assertThat(configurations, hasSize(2));
ConfigurationModel first = configurations.get(1);
assertDescription(first, "This is some Config documentation.");
assertDescription(first.getConnectionProviders().get(0), "Another Provider Documentation");
assertDescription(first.getConnectionProviders().get(1), "Provider Documentation");
ConfigurationModel second = configurations.get(0);
assertDescription(second, "This is some Another Config documentation.");
assertDescription(second.getConnectionProviders().get(0), "Another Provider Documentation");
List<ParameterModel> params = first.getAllParameterModels();
assertDescription(params.get(0), "Config parameter");
assertDescription(params.get(1), "Config Parameter with an Optional value");
assertDescription(params.get(2), EXPIRATION_POLICY_DESCRIPTION);
assertDescription(params.get(3), "Group parameter 1");
assertDescription(params.get(4), "Group parameter 2");
assertDescription(params.get(5), "Param with alias");
List<OperationModel> operations = declaration.getOperationModels();
OperationModel operation = getOperationByName(operations, "operation");
assertDescription(operation, "Test Operation");
assertDescription(operation.getAllParameterModels().get(0), "test value");
OperationModel inheritedOperation = getOperationByName(operations, "inheritedOperation");
assertDescription(inheritedOperation, "Inherited Operation Documentation");
assertDescription(inheritedOperation.getAllParameterModels().get(0), "parameter documentation for an inherited operation.");
OperationModel greetFriend = getOperationByName(operations, "greetFriend");
assertDescription(greetFriend, "This method greets a friend");
assertDescription(greetFriend.getAllParameterModels().get(0), "This is one of my friends");
assertDescription(greetFriend.getAllParameterModels().get(1), "Some other friend");
List<OperationModel> connectedOperations = first.getOperationModels();
OperationModel connectedOpe = connectedOperations.get(0);
assertDescription(connectedOpe, "Test Operation with blank parameter description");
assertDescription(connectedOpe.getAllParameterModels().get(0), "");
}
Aggregations