use of org.mule.metadata.api.model.MetadataType 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));
}
use of org.mule.metadata.api.model.MetadataType in project mule by mulesoft.
the class MetadataOperationTestCase method defaultValueMetadataKey.
@Test
public void defaultValueMetadataKey() throws Exception {
location = Location.builder().globalName(METADATA_KEY_DEFAULT_VALUE).addProcessorsPart().addIndexPart(0).build();
final MetadataResult<ComponentMetadataDescriptor<OperationModel>> result = metadataService.getOperationMetadata(location);
assertSuccessResult(result);
assertResolvedKey(result, CAR_KEY);
ComponentMetadataDescriptor<OperationModel> descriptor = result.get();
MetadataType type = descriptor.getModel().getOutput().getType();
assertThat(type, is(instanceOf(ObjectType.class)));
assertThat(((ObjectType) type).getFields(), hasSize(2));
}
use of org.mule.metadata.api.model.MetadataType in project mule by mulesoft.
the class MetadataOperationTestCase method operationReceivesNullTypeOfList.
@Test
public void operationReceivesNullTypeOfList() throws Exception {
location = Location.builder().globalName("nullListAsInput").addProcessorsPart().addIndexPart(0).build();
MetadataResult<ComponentMetadataDescriptor<OperationModel>> operationMetadata = metadataService.getOperationMetadata(location);
MetadataType objects = getParameter(operationMetadata.get().getModel(), "objects").getType();
assertThat(objects, is(instanceOf(NullType.class)));
}
use of org.mule.metadata.api.model.MetadataType in project mule by mulesoft.
the class QueryMetadataTestCase method getNativeQueryOutputMetadata.
@Test
public void getNativeQueryOutputMetadata() throws Exception {
location = builder().globalName(NATIVE_QUERY_FLOW).addProcessorsPart().addIndexPart(0).build();
MetadataKey nativeKey = newKey(NATIVE_QUERY).build();
MetadataResult<ComponentMetadataDescriptor<OperationModel>> entityMetadata = getComponentDynamicMetadata(nativeKey);
assertThat(entityMetadata.isSuccess(), is(true));
MetadataType generatedType = entityMetadata.get().getModel().getOutput().getType();
assertCircleType((ObjectType) generatedType);
}
use of org.mule.metadata.api.model.MetadataType in project mule by mulesoft.
the class QueryMetadataTestCase method getDsqlQueryAutomaticGeneratedOutputMetadata.
@Test
public void getDsqlQueryAutomaticGeneratedOutputMetadata() throws Exception {
location = QUERY_LOCATION;
MetadataKey dsqlKey = newKey(DSQL_QUERY).build();
MetadataResult<ComponentMetadataDescriptor<OperationModel>> entityMetadata = getComponentDynamicMetadata(dsqlKey);
assertThat(entityMetadata.isSuccess(), is(true));
MetadataType generatedType = entityMetadata.get().getModel().getOutput().getType();
assertThat(generatedType, is(instanceOf(ArrayType.class)));
assertCircleType((ObjectType) ((ArrayType) generatedType).getType());
}
Aggregations