Search in sources :

Example 36 with MetadataType

use of org.mule.metadata.api.model.MetadataType in project mule by mulesoft.

the class IntrospectionUtilsTestCase method resultWithNoGenericsIsAnyType.

@Test
public void resultWithNoGenericsIsAnyType() throws Exception {
    MetadataType resultWithNoGenerics = getMethod("resultWithNoGenerics").getReturnMetadataType();
    MetadataType resultWithWildcardGenerics = getMethod("resultWithWildcardGenerics").getReturnMetadataType();
    assertThat(resultWithNoGenerics, is(instanceOf(AnyType.class)));
    assertThat(resultWithWildcardGenerics, is(instanceOf(AnyType.class)));
}
Also used : IntrospectionUtils.getFieldMetadataType(org.mule.runtime.module.extension.internal.util.IntrospectionUtils.getFieldMetadataType) MetadataType(org.mule.metadata.api.model.MetadataType) MessageMetadataType(org.mule.metadata.message.api.MessageMetadataType) SmallTest(org.mule.tck.size.SmallTest) Test(org.junit.Test)

Example 37 with MetadataType

use of org.mule.metadata.api.model.MetadataType in project mule by mulesoft.

the class IntrospectionUtilsTestCase method assertAttributesType.

private void assertAttributesType(String method) throws Exception {
    MetadataType attributesType = IntrospectionUtils.getMethodReturnAttributesType(getMethod(method));
    assertThat(attributesType, is(instanceOf(ObjectType.class)));
    assertType(attributesType, Object.class);
}
Also used : IntrospectionUtils.getFieldMetadataType(org.mule.runtime.module.extension.internal.util.IntrospectionUtils.getFieldMetadataType) MetadataType(org.mule.metadata.api.model.MetadataType) MessageMetadataType(org.mule.metadata.message.api.MessageMetadataType)

Example 38 with MetadataType

use of org.mule.metadata.api.model.MetadataType in project mule by mulesoft.

the class IntrospectionUtilsTestCase method getMethodReturnType.

@Test
public void getMethodReturnType() throws Exception {
    MetadataType metadataType = IntrospectionUtils.getMethodReturnType(getMethod(FOO));
    assertDictionary(metadataType, Apple.class);
}
Also used : IntrospectionUtils.getFieldMetadataType(org.mule.runtime.module.extension.internal.util.IntrospectionUtils.getFieldMetadataType) MetadataType(org.mule.metadata.api.model.MetadataType) MessageMetadataType(org.mule.metadata.message.api.MessageMetadataType) SmallTest(org.mule.tck.size.SmallTest) Test(org.junit.Test)

Example 39 with MetadataType

use of org.mule.metadata.api.model.MetadataType in project mule by mulesoft.

the class IntrospectionUtilsTestCase method assertPagingProviderReturnResultType.

private void assertPagingProviderReturnResultType(String method) throws Exception {
    MetadataType returnType = IntrospectionUtils.getMethodReturnType(getMethod(method));
    assertThat(returnType, is(instanceOf(ArrayType.class)));
    assertMessageType(((ArrayType) returnType).getType(), is(instanceOf(StringType.class)), is(instanceOf(ObjectType.class)));
}
Also used : IntrospectionUtils.getFieldMetadataType(org.mule.runtime.module.extension.internal.util.IntrospectionUtils.getFieldMetadataType) MetadataType(org.mule.metadata.api.model.MetadataType) MessageMetadataType(org.mule.metadata.message.api.MessageMetadataType)

Example 40 with MetadataType

use of org.mule.metadata.api.model.MetadataType in project mule by mulesoft.

the class IntrospectionUtilsTestCase method getFieldDataType.

@Test
public void getFieldDataType() throws Exception {
    MetadataType type = getFieldMetadataType(IntrospectionUtilsTestCase.class.getDeclaredField("baskets"), TYPE_LOADER);
    assertList(type, FruitBasket.class);
}
Also used : IntrospectionUtils.getFieldMetadataType(org.mule.runtime.module.extension.internal.util.IntrospectionUtils.getFieldMetadataType) MetadataType(org.mule.metadata.api.model.MetadataType) MessageMetadataType(org.mule.metadata.message.api.MessageMetadataType) SmallTest(org.mule.tck.size.SmallTest) Test(org.junit.Test)

Aggregations

MetadataType (org.mule.metadata.api.model.MetadataType)99 ObjectType (org.mule.metadata.api.model.ObjectType)36 ArrayType (org.mule.metadata.api.model.ArrayType)28 Test (org.junit.Test)26 MetadataTypeVisitor (org.mule.metadata.api.visitor.MetadataTypeVisitor)21 Optional (java.util.Optional)20 MessageMetadataType (org.mule.metadata.message.api.MessageMetadataType)18 String.format (java.lang.String.format)17 List (java.util.List)17 ObjectFieldType (org.mule.metadata.api.model.ObjectFieldType)17 StringType (org.mule.metadata.api.model.StringType)15 Map (java.util.Map)14 Collectors.toList (java.util.stream.Collectors.toList)14 ExtensionModel (org.mule.runtime.api.meta.model.ExtensionModel)14 ParameterModel (org.mule.runtime.api.meta.model.parameter.ParameterModel)14 Reference (org.mule.runtime.api.util.Reference)14 DslElementSyntax (org.mule.runtime.extension.api.dsl.syntax.DslElementSyntax)14 ParameterGroupModel (org.mule.runtime.api.meta.model.parameter.ParameterGroupModel)13 Set (java.util.Set)11 ParameterizedModel (org.mule.runtime.api.meta.model.parameter.ParameterizedModel)11