Search in sources :

Example 11 with TypeWrapper

use of org.mule.runtime.module.extension.internal.loader.java.type.runtime.TypeWrapper in project mule by mulesoft.

the class OperationReturnTypeModelValidatorTestCase method resultWithoutGenerics.

@Test(expected = IllegalModelDefinitionException.class)
public void resultWithoutGenerics() {
    when(methodElement.getReturnType()).thenReturn(new TypeWrapper(forType(new TypeToken<Result>() {
    }.getType()), typeLoader));
    validate(extensionModel, validator);
}
Also used : TypeWrapper(org.mule.runtime.module.extension.internal.loader.java.type.runtime.TypeWrapper) TypeToken(com.google.common.reflect.TypeToken) SmallTest(org.mule.tck.size.SmallTest) Test(org.junit.Test)

Example 12 with TypeWrapper

use of org.mule.runtime.module.extension.internal.loader.java.type.runtime.TypeWrapper in project mule by mulesoft.

the class OperationReturnTypeModelValidatorTestCase method completitionCallbackWithoutGenerics.

@Test(expected = IllegalModelDefinitionException.class)
public void completitionCallbackWithoutGenerics() {
    when(methodElement.getReturnType()).thenReturn(new TypeWrapper(forType(new TypeToken<Void>() {
    }.getType()), typeLoader));
    ExtensionParameter completionCallbackParam = mock(ExtensionParameter.class);
    when(completionCallbackParam.getType()).thenReturn(new TypeWrapper(forType(new TypeToken<CompletionCallback>() {
    }.getType()), typeLoader));
    when(methodElement.getParameters()).thenReturn(singletonList(completionCallbackParam));
    validate(extensionModel, validator);
}
Also used : TypeWrapper(org.mule.runtime.module.extension.internal.loader.java.type.runtime.TypeWrapper) ExtensionParameter(org.mule.runtime.module.extension.api.loader.java.type.ExtensionParameter) TypeToken(com.google.common.reflect.TypeToken) SmallTest(org.mule.tck.size.SmallTest) Test(org.junit.Test)

Example 13 with TypeWrapper

use of org.mule.runtime.module.extension.internal.loader.java.type.runtime.TypeWrapper in project mule by mulesoft.

the class ParameterGroupModelValidatorTestCase method invalidModelDueEmptyParameterGroup.

@Test(expected = IllegalModelDefinitionException.class)
public void invalidModelDueEmptyParameterGroup() {
    ParameterGroupDescriptor descriptor = new ParameterGroupDescriptor("name", new TypeWrapper(EmptyGroupPojo.class, typeLoader), null, mock(AnnotatedElement.class), null);
    when(groupModel.getModelProperty(ParameterGroupModelProperty.class)).thenReturn(of(new ParameterGroupModelProperty(descriptor)));
    validate(extensionModel, validator);
}
Also used : TypeWrapper(org.mule.runtime.module.extension.internal.loader.java.type.runtime.TypeWrapper) ParameterGroupDescriptor(org.mule.runtime.module.extension.internal.loader.ParameterGroupDescriptor) AnnotatedElement(java.lang.reflect.AnnotatedElement) ParameterGroupModelProperty(org.mule.runtime.module.extension.internal.loader.java.property.ParameterGroupModelProperty) SmallTest(org.mule.tck.size.SmallTest) Test(org.junit.Test)

Example 14 with TypeWrapper

use of org.mule.runtime.module.extension.internal.loader.java.type.runtime.TypeWrapper in project mule by mulesoft.

the class ParameterGroupModelValidatorTestCase method invalidModelDueToNonInstantiableParameterGroup.

@Test(expected = IllegalModelDefinitionException.class)
public void invalidModelDueToNonInstantiableParameterGroup() {
    TypeWrapper type = new TypeWrapper(Serializable.class, typeLoader);
    ParameterGroupDescriptor descriptor = new ParameterGroupDescriptor("name", type, null, mock(AnnotatedElement.class), null);
    when(groupModel.getModelProperty(ParameterGroupModelProperty.class)).thenReturn(of(new ParameterGroupModelProperty(descriptor)));
    when(groupModel.getParameterModels()).thenReturn(asList(parameterModel));
    validate(extensionModel, validator);
}
Also used : TypeWrapper(org.mule.runtime.module.extension.internal.loader.java.type.runtime.TypeWrapper) ParameterGroupDescriptor(org.mule.runtime.module.extension.internal.loader.ParameterGroupDescriptor) AnnotatedElement(java.lang.reflect.AnnotatedElement) ParameterGroupModelProperty(org.mule.runtime.module.extension.internal.loader.java.property.ParameterGroupModelProperty) SmallTest(org.mule.tck.size.SmallTest) Test(org.junit.Test)

Aggregations

TypeWrapper (org.mule.runtime.module.extension.internal.loader.java.type.runtime.TypeWrapper)14 Test (org.junit.Test)10 SmallTest (org.mule.tck.size.SmallTest)10 TypeToken (com.google.common.reflect.TypeToken)6 ParameterGroupDescriptor (org.mule.runtime.module.extension.internal.loader.ParameterGroupDescriptor)5 ParameterGroupModelProperty (org.mule.runtime.module.extension.internal.loader.java.property.ParameterGroupModelProperty)4 AnnotatedElement (java.lang.reflect.AnnotatedElement)3 Before (org.junit.Before)2 StringType (org.mule.metadata.api.model.StringType)2 Result (org.mule.runtime.extension.api.runtime.operation.Result)2 HashMap (java.util.HashMap)1 AnyType (org.mule.metadata.api.model.AnyType)1 ArrayType (org.mule.metadata.api.model.ArrayType)1 MetadataType (org.mule.metadata.api.model.MetadataType)1 ObjectType (org.mule.metadata.api.model.ObjectType)1 VoidType (org.mule.metadata.api.model.VoidType)1 JavaTypeLoader (org.mule.metadata.java.api.JavaTypeLoader)1 MessageMetadataType (org.mule.metadata.message.api.MessageMetadataType)1 ParameterGroupDeclarer (org.mule.runtime.api.meta.model.declaration.fluent.ParameterGroupDeclarer)1 CollectionDataType (org.mule.runtime.api.metadata.CollectionDataType)1