use of org.mule.runtime.api.metadata.MetadataKey in project mule by mulesoft.
the class InvokeKeysResolver method buildServiceKey.
private MetadataKey buildServiceKey(ForwardingSoapClient connection, WebServiceDefinition ws) {
String serviceId = ws.getServiceId();
SoapMetadataResolver resolver = connection.getSoapClient(serviceId).getMetadataResolver();
MetadataKeyBuilder key = newKey(serviceId).withDisplayName(ws.getFriendlyName());
List<String> excludedOperations = ws.getExcludedOperations();
resolver.getAvailableOperations().stream().filter(ope -> !excludedOperations.contains(ope)).forEach(ope -> key.withChild(newKey(ope).withDisplayName(NameUtils.titleize(ope))));
return key.build();
}
use of org.mule.runtime.api.metadata.MetadataKey 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.MetadataKey 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.MetadataKey in project mule by mulesoft.
the class MetadataOperationTestCase method shouldInheritOperationResolvers.
@Test
public void shouldInheritOperationResolvers() throws Exception {
location = Location.builder().globalName(SHOULD_INHERIT_OPERATION_PARENT_RESOLVERS).addProcessorsPart().addIndexPart(0).build();
final MetadataResult<MetadataKeysContainer> metadataKeysResult = metadataService.getMetadataKeys(location);
assertSuccessResult(metadataKeysResult);
final Set<MetadataKey> metadataKeys = getKeysFromContainer(metadataKeysResult.get());
assertThat(metadataKeys.size(), is(3));
assertThat(metadataKeys, hasItems(metadataKeyWithId(PERSON), metadataKeyWithId(CAR), metadataKeyWithId(HOUSE)));
final ComponentMetadataDescriptor<OperationModel> metadataDescriptor = getSuccessComponentDynamicMetadata(PERSON_METADATA_KEY);
final OperationModel typedModel = metadataDescriptor.getModel();
assertExpectedOutput(typedModel, personType, void.class);
assertExpectedType(getParameter(typedModel, "type"), String.class);
// TODO MULE-14190: Revamp MetadataScope annotation
// assertExpectedType(getParameter(typedModel, "content"), personType, true);
}
use of org.mule.runtime.api.metadata.MetadataKey in project mule by mulesoft.
the class MetadataOperationTestCase method injectComposedMetadataKeyIdInstanceInMetadataResolver.
@Test
public void injectComposedMetadataKeyIdInstanceInMetadataResolver() throws Exception {
location = Location.builder().globalName(SIMPLE_MULTILEVEL_KEY_RESOLVER).addProcessorsPart().addIndexPart(0).build();
MetadataKey key = LOCATION_MULTILEVEL_KEY;
final MetadataResult<ComponentMetadataDescriptor<OperationModel>> metadataResult = metadataService.getOperationMetadata(location, key);
assertSuccessResult(metadataResult);
assertResolvedKey(metadataResult, LOCATION_MULTILEVEL_KEY);
}
Aggregations