use of org.mule.runtime.api.meta.model.operation.OperationModel in project mule by mulesoft.
the class ErrorsDeclarationEnricherTestCase method operationInheritsExtensionErrorThrows.
@Test
public void operationInheritsExtensionErrorThrows() {
extensionModel = loadExtension(HeisenbergWithExtensionThrows.class);
OperationModel someOperation = extensionModel.getOperationModel("someOperation").get();
Optional<ErrorModel> operationError = someOperation.getErrorModels().stream().filter(errorModel -> errorModel.getType().equals(EXTENSION.getType())).findFirst();
assertThat(operationError.isPresent(), is(true));
}
use of org.mule.runtime.api.meta.model.operation.OperationModel in project mule by mulesoft.
the class MetadataOperationTestCase method outputMetadataWithoutKeysWithKeyId.
@Test
public void outputMetadataWithoutKeysWithKeyId() throws Exception {
location = Location.builder().globalName(OUTPUT_METADATA_WITHOUT_KEYS_WITH_KEY_ID).addProcessorsPart().addIndexPart(0).build();
final ComponentMetadataDescriptor<OperationModel> metadataDescriptor = getSuccessComponentDynamicMetadataWithKey(PERSON_METADATA_KEY);
final OperationModel typedModel = metadataDescriptor.getModel();
assertExpectedOutput(typedModel, personType, void.class);
assertExpectedType(getParameter(typedModel, "type"), String.class);
}
use of org.mule.runtime.api.meta.model.operation.OperationModel in project mule by mulesoft.
the class MetadataOperationTestCase method contentAndOutputMetadataWithoutKeyId.
@Test
public void contentAndOutputMetadataWithoutKeyId() throws Exception {
location = Location.builder().globalName(CONTENT_AND_OUTPUT_METADATA_WITHOUT_KEY_ID).addProcessorsPart().addIndexPart(0).build();
final ComponentMetadataDescriptor<OperationModel> metadataDescriptor = getSuccessComponentDynamicMetadata(NULL_METADATA_KEY);
final OperationModel typedModel = metadataDescriptor.getModel();
assertExpectedOutput(typedModel, personType, void.class);
assertExpectedType(getParameter(typedModel, "content"), personType, true);
}
use of org.mule.runtime.api.meta.model.operation.OperationModel in project mule by mulesoft.
the class MetadataOperationTestCase method attributesUnionTypeMetadata.
@Test
public void attributesUnionTypeMetadata() throws Exception {
location = Location.builder().globalName(OUTPUT_ATTRIBUTES_WITH_DECLARED_SUBTYPES_METADATA).addProcessorsPart().addIndexPart(0).build();
final ComponentMetadataDescriptor<OperationModel> metadataDescriptor = getSuccessComponentDynamicMetadata(NULL_METADATA_KEY);
final OperationModel typedModel = metadataDescriptor.getModel();
assertExpectedOutput(typedModel, Shape.class, AbstractOutputAttributes.class);
}
use of org.mule.runtime.api.meta.model.operation.OperationModel in project mule by mulesoft.
the class MetadataOperationTestCase method attributesDynamicPersonTypeMetadata.
@Test
public void attributesDynamicPersonTypeMetadata() throws Exception {
location = Location.builder().globalName(OUTPUT_ATTRIBUTES_WITH_DYNAMIC_METADATA).addProcessorsPart().addIndexPart(0).build();
final ComponentMetadataDescriptor<OperationModel> metadataDescriptor = getSuccessComponentDynamicMetadataWithKey(PERSON_METADATA_KEY);
final OperationModel typedModel = metadataDescriptor.getModel();
MetadataType type = typedModel.getOutputAttributes().getType();
assertThat(type, is(instanceOf(ObjectType.class)));
ObjectType dictionary = (ObjectType) type;
assertThat(dictionary.getOpenRestriction().get(), is(instanceOf(StringType.class)));
}
Aggregations