Search in sources :

Example 1 with MetadataKeysContainer

use of org.mule.runtime.api.metadata.MetadataKeysContainer 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);
}
Also used : MetadataKeysContainer(org.mule.runtime.api.metadata.MetadataKeysContainer) MetadataKey(org.mule.runtime.api.metadata.MetadataKey) NullMetadataKey(org.mule.runtime.extension.api.metadata.NullMetadataKey) OperationModel(org.mule.runtime.api.meta.model.operation.OperationModel) Test(org.junit.Test)

Example 2 with MetadataKeysContainer

use of org.mule.runtime.api.metadata.MetadataKeysContainer in project mule by mulesoft.

the class MetadataOperationTestCase method shouldInheritExtensionResolvers.

@Test
@Ignore("MULE-14190: Revamp MetadataScope annotation")
public void shouldInheritExtensionResolvers() throws Exception {
    location = Location.builder().globalName(SHOULD_INHERIT_EXTENSION_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(1));
    assertThat(metadataKeys, hasItems(metadataKeyWithId("APPLE")));
    final ComponentMetadataDescriptor<OperationModel> metadataDescriptor = getSuccessComponentDynamicMetadataWithKey(newKey("APPLE").build());
    final OperationModel typedModel = metadataDescriptor.getModel();
    assertExpectedOutput(typedModel, typeLoader.load(Apple.class), void.class);
}
Also used : MetadataKeysContainer(org.mule.runtime.api.metadata.MetadataKeysContainer) Apple(org.mule.tck.testmodels.fruit.Apple) MetadataKey(org.mule.runtime.api.metadata.MetadataKey) NullMetadataKey(org.mule.runtime.extension.api.metadata.NullMetadataKey) OperationModel(org.mule.runtime.api.meta.model.operation.OperationModel) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 3 with MetadataKeysContainer

use of org.mule.runtime.api.metadata.MetadataKeysContainer 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)));
}
Also used : MetadataKeysContainer(org.mule.runtime.api.metadata.MetadataKeysContainer) MetadataKey(org.mule.runtime.api.metadata.MetadataKey) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)3 MetadataKey (org.mule.runtime.api.metadata.MetadataKey)3 MetadataKeysContainer (org.mule.runtime.api.metadata.MetadataKeysContainer)3 OperationModel (org.mule.runtime.api.meta.model.operation.OperationModel)2 NullMetadataKey (org.mule.runtime.extension.api.metadata.NullMetadataKey)2 Ignore (org.junit.Ignore)1 Apple (org.mule.tck.testmodels.fruit.Apple)1