use of org.mule.runtime.api.metadata.MetadataKey in project mule by mulesoft.
the class MetadataNoRefDynamicConfigurationTestCase method resolveMetadataWithNoRefDynamicConfig.
@Test
public void resolveMetadataWithNoRefDynamicConfig() throws Exception {
location = builder().globalName(RESOLVER_WITH_IMPLICIT_DYNAMIC_CONFIG).addProcessorsPart().addIndexPart(0).build();
MetadataKey key = newKey(AMERICA).withChild(newKey(USA).withChild(newKey(SAN_FRANCISCO))).build();
final MetadataResult<ComponentMetadataDescriptor<OperationModel>> metadataResult = getComponentDynamicMetadata(key);
assertFailureResult(metadataResult, 1);
assertMetadataFailure(metadataResult.getFailures().get(0), "Configuration used for Metadata fetch cannot be dynamic", INVALID_CONFIGURATION, MetadataResolvingException.class.getName(), COMPONENT, "");
}
use of org.mule.runtime.api.metadata.MetadataKey in project mule by mulesoft.
the class MetadataOperationTestCase method metadataKeyDefaultValue.
@Test
public void metadataKeyDefaultValue() throws Exception {
location = Location.builder().globalName(METADATA_KEY_DEFAULT_VALUE).addProcessorsPart().addIndexPart(0).build();
MetadataResult<ComponentMetadataDescriptor<OperationModel>> result = metadataService.getOperationMetadata(location);
assertSuccessResult(result);
MetadataType type = result.get().getModel().getOutput().getType();
assertThat(type, is(instanceOf(ObjectType.class)));
ObjectType objectType = (ObjectType) type;
assertThat(objectType.getFields(), hasSize(2));
objectType.getFields().forEach(f -> assertThat(f.getKey().getName().getLocalPart(), isOneOf(TIRES, BRAND)));
Optional<MetadataKey> metadataKeyOptional = result.get().getMetadataAttributes().getKey();
assertThat(metadataKeyOptional.isPresent(), is(true));
assertThat(metadataKeyOptional.get().getId(), is(CAR));
}
use of org.mule.runtime.api.metadata.MetadataKey in project mule by mulesoft.
the class QueryMetadataTestCase method getNativeQueryOutputArrayMetadata.
@Test
public void getNativeQueryOutputArrayMetadata() throws Exception {
location = builder().globalName(NATIVE_QUERY_LIST_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();
assertThat(generatedType, is(instanceOf(ArrayType.class)));
assertCircleType((ObjectType) ((ArrayType) generatedType).getType());
}
use of org.mule.runtime.api.metadata.MetadataKey in project mule by mulesoft.
the class QueryMetadataTestCase method getEntityKeys.
@Test
public void getEntityKeys() throws Exception {
MetadataResult<MetadataKeysContainer> metadataKeysResult = metadataService.getEntityKeys(QUERY_LOCATION);
assertThat(metadataKeysResult.isSuccess(), is(true));
MetadataKeysContainer container = metadataKeysResult.get();
Set<MetadataKey> metadataKeys = container.getKeys(container.getCategories().iterator().next()).get();
assertThat(metadataKeys.size(), is(2));
assertThat(metadataKeys, hasItems(metadataKeyWithId(CIRCLE), metadataKeyWithId(SQUARE)));
}
Aggregations