use of org.mule.runtime.api.metadata.descriptor.ComponentMetadataDescriptor in project mule by mulesoft.
the class MetadataNegativeTestCase method failWithDynamicConfigurationWhenRetrievingMetadata.
@Test
public void failWithDynamicConfigurationWhenRetrievingMetadata() throws IOException {
location = builder().globalName(RESOLVER_WITH_DYNAMIC_CONFIG).addProcessorsPart().addIndexPart(0).build();
MetadataKey key = newKey(AMERICA, CONTINENT).withChild(newKey(USA, COUNTRY).withChild(newKey(SAN_FRANCISCO, CITY))).build();
MetadataResult<ComponentMetadataDescriptor<OperationModel>> result = getComponentDynamicMetadata(key);
assertFailureResult(result, 1);
assertMetadataFailure(result.getFailures().get(0), CONFIGURATION_CANNOT_BE_DYNAMIC, INVALID_CONFIGURATION, MetadataResolvingException.class.getName(), COMPONENT);
}
use of org.mule.runtime.api.metadata.descriptor.ComponentMetadataDescriptor in project mule by mulesoft.
the class MetadataNegativeTestCase method failToGetMetadataWithMissingMetadataKeyLevels.
@Test
public void failToGetMetadataWithMissingMetadataKeyLevels() throws Exception {
assumeThat(resolutionType, is(ResolutionType.EXPLICIT_RESOLUTION));
location = builder().globalName(INCOMPLETE_MULTILEVEL_KEY_RESOLVER).addProcessorsPart().addIndexPart(0).build();
final MetadataKey metadataKey = newKey(AMERICA, CONTINENT).withChild(newKey(USA, COUNTRY)).build();
final MetadataResult<ComponentMetadataDescriptor<OperationModel>> result = getComponentDynamicMetadata(metadataKey);
assertMetadataFailure(result.getFailures().get(0), "Missing levels: [city]", INVALID_METADATA_KEY, "", COMPONENT);
}
use of org.mule.runtime.api.metadata.descriptor.ComponentMetadataDescriptor in project mule by mulesoft.
the class MetadataOperationTestCase method operationReceivesListOfObjects.
@Test
public void operationReceivesListOfObjects() throws Exception {
location = Location.builder().globalName("objectListAsInput").addProcessorsPart().addIndexPart(0).build();
MetadataResult<ComponentMetadataDescriptor<OperationModel>> operationMetadata = metadataService.getOperationMetadata(location);
MetadataType objects = getParameter(operationMetadata.get().getModel(), "objects").getType();
assertThat(objects, is(instanceOf(ArrayType.class)));
assertThat(((ArrayType) objects).getType(), is(personType));
}
use of org.mule.runtime.api.metadata.descriptor.ComponentMetadataDescriptor in project mule by mulesoft.
the class MetadataOperationTestCase method getResolvedTypeFromList.
private MetadataType getResolvedTypeFromList() {
final MetadataResult<ComponentMetadataDescriptor<OperationModel>> result = metadataService.getOperationMetadata(location);
assertSuccessResult(result);
ComponentMetadataDescriptor<OperationModel> descriptor = result.get();
MetadataType param = descriptor.getModel().getOutput().getType();
assertThat(param, is(instanceOf(ArrayType.class)));
assertThat(getId(param).get(), is(List.class.getName()));
return param;
}
use of org.mule.runtime.api.metadata.descriptor.ComponentMetadataDescriptor in project mule by mulesoft.
the class MetadataOperationTestCase method operationWhichReturnsListOfMessages.
@Test
public void operationWhichReturnsListOfMessages() throws Exception {
location = Location.builder().globalName("listOfMessages").addProcessorsPart().addIndexPart(0).build();
final MetadataResult<ComponentMetadataDescriptor<OperationModel>> result = metadataService.getOperationMetadata(location);
assertSuccessResult(result);
ComponentMetadataDescriptor<OperationModel> descriptor = result.get();
MetadataType param = descriptor.getModel().getOutput().getType();
assertThat(param, is(instanceOf(ArrayType.class)));
assertMessageType(((ArrayType) param).getType(), TYPE_LOADER.load(String.class), TYPE_LOADER.load(StringAttributes.class));
}
Aggregations