Search in sources :

Example 51 with ParameterModel

use of org.mule.runtime.api.meta.model.parameter.ParameterModel in project mule by mulesoft.

the class NameClashModelValidatorTestCase method repeatedChildElementSupportAndOperation.

@Test
public void repeatedChildElementSupportAndOperation() {
    exception.expect(IllegalModelDefinitionException.class);
    when(operationModel.getName()).thenReturn(REPEATED_NAME);
    when(operationModel.getAllParameterModels()).thenReturn(emptyList());
    ParameterModel param = getParameter(UNIQUE_PARAM_NAME, ChildElementTest.class);
    when(param.getRole()).thenReturn(BEHAVIOUR);
    when(constructModel.getAllParameterModels()).thenReturn(asList(param));
    mockParameterGroup(constructModel, asList(param));
    validate();
}
Also used : ParameterModel(org.mule.runtime.api.meta.model.parameter.ParameterModel) SmallTest(org.mule.tck.size.SmallTest) Test(org.junit.Test)

Example 52 with ParameterModel

use of org.mule.runtime.api.meta.model.parameter.ParameterModel in project mule by mulesoft.

the class NameClashModelValidatorTestCase method mapSingularizeClashOnTopLevelParameterSameType.

@Test
public void mapSingularizeClashOnTopLevelParameterSameType() {
    ParameterModel offending = getParameter(TOP_LEVEL_PLURAL_PARAM_NAME, topLevelMap);
    ParameterModel singular = getParameter(TOP_LEVEL_SINGULAR_PARAM_NAME, TopLevelTest.class);
    when(operationModel.getAllParameterModels()).thenReturn(asList(singular, offending));
    validate();
}
Also used : ParameterModel(org.mule.runtime.api.meta.model.parameter.ParameterModel) SmallTest(org.mule.tck.size.SmallTest) Test(org.junit.Test)

Example 53 with ParameterModel

use of org.mule.runtime.api.meta.model.parameter.ParameterModel in project mule by mulesoft.

the class NameClashModelValidatorTestCase method listSingularizeClashOnConstruct.

@Test
public void listSingularizeClashOnConstruct() {
    exception.expect(IllegalModelDefinitionException.class);
    when(constructModel.getName()).thenReturn(CHILD_SINGULAR_PARAM_NAME);
    ParameterModel offending = getParameter(CHILD_PLURAL_PARAM_NAME, childTestList);
    when(constructModel.getAllParameterModels()).thenReturn(asList(offending));
    validate();
}
Also used : ParameterModel(org.mule.runtime.api.meta.model.parameter.ParameterModel) SmallTest(org.mule.tck.size.SmallTest) Test(org.junit.Test)

Example 54 with ParameterModel

use of org.mule.runtime.api.meta.model.parameter.ParameterModel in project mule by mulesoft.

the class NameClashModelValidatorTestCase method configNameClashesWithOperationParameterType.

@Test
public void configNameClashesWithOperationParameterType() {
    exception.expect(IllegalModelDefinitionException.class);
    ParameterModel offending = getParameter(SIMPLE_PARAM_NAME, TopLevelConfig.class);
    when(configurationModel.getName()).thenReturn(TopLevelConfig.class.getName());
    mockParameters(operationModel, topLevelConfigParam, offending);
    validate();
}
Also used : ParameterModel(org.mule.runtime.api.meta.model.parameter.ParameterModel) SmallTest(org.mule.tck.size.SmallTest) Test(org.junit.Test)

Example 55 with ParameterModel

use of org.mule.runtime.api.meta.model.parameter.ParameterModel in project mule by mulesoft.

the class NameClashModelValidatorTestCase method mockParameterGroups.

private void mockParameterGroups(ParameterizedModel model, boolean showInDsl) {
    ParameterGroupModel group = mock(ParameterGroupModel.class);
    ParameterModel parameterModel = getParameter(SIMPLE_PARAM_NAME, Object.class);
    when(group.getName()).thenReturn(DEFAULT_GROUP_NAME);
    when(group.getModelProperty(ParameterGroupModelProperty.class)).thenReturn(empty());
    when(group.getParameterModels()).thenReturn(asList(parameterModel));
    ParameterGroupModel anotherGroup = mock(ParameterGroupModel.class);
    when(anotherGroup.getName()).thenReturn("My Group");
    when(anotherGroup.isShowInDsl()).thenReturn(showInDsl);
    when(anotherGroup.getParameterModels()).thenReturn(asList(parameterModel));
    when(model.getParameterGroupModels()).thenReturn(asList(group, anotherGroup));
}
Also used : ParameterModel(org.mule.runtime.api.meta.model.parameter.ParameterModel) ParameterGroupModel(org.mule.runtime.api.meta.model.parameter.ParameterGroupModel)

Aggregations

ParameterModel (org.mule.runtime.api.meta.model.parameter.ParameterModel)133 Test (org.junit.Test)91 SmallTest (org.mule.tck.size.SmallTest)68 OperationModel (org.mule.runtime.api.meta.model.operation.OperationModel)29 ExtensionModel (org.mule.runtime.api.meta.model.ExtensionModel)21 List (java.util.List)19 ParameterGroupModel (org.mule.runtime.api.meta.model.parameter.ParameterGroupModel)19 Optional (java.util.Optional)16 SourceModel (org.mule.runtime.api.meta.model.source.SourceModel)15 Collectors.toList (java.util.stream.Collectors.toList)13 ObjectType (org.mule.metadata.api.model.ObjectType)13 String.format (java.lang.String.format)12 ConfigurationModel (org.mule.runtime.api.meta.model.config.ConfigurationModel)12 ParameterizedModel (org.mule.runtime.api.meta.model.parameter.ParameterizedModel)12 ExtensionsTypeLoaderFactory (org.mule.runtime.extension.api.declaration.type.ExtensionsTypeLoaderFactory)12 StringType (org.mule.metadata.api.model.StringType)11 ClassTypeLoader (org.mule.metadata.api.ClassTypeLoader)10 ArrayType (org.mule.metadata.api.model.ArrayType)10 MetadataType (org.mule.metadata.api.model.MetadataType)10 Map (java.util.Map)9