use of org.mule.runtime.api.meta.model.parameter.ParameterModel in project mule by mulesoft.
the class NameClashModelValidatorTestCase method connectionProviderWithRepeatedParameterName.
@Test
public void connectionProviderWithRepeatedParameterName() {
exception.expect(IllegalModelDefinitionException.class);
ParameterModel offending = getParameter(SIMPLE_PARAM_NAME, String.class);
mockParameters(connectionProviderModel, simpleConfigParam, topLevelConfigParam, offending);
validate();
}
use of org.mule.runtime.api.meta.model.parameter.ParameterModel in project mule by mulesoft.
the class NameClashModelValidatorTestCase method connectionProviderNameClashesWithOperationParameterType.
@Test
public void connectionProviderNameClashesWithOperationParameterType() {
exception.expect(IllegalModelDefinitionException.class);
String clashingName = SIMPLE_PARAM_NAME + CONNECTION_PROVIDER_SUFFIX;
when(connectionProviderModel.getName()).thenReturn(clashingName);
ParameterModel offending = getParameter(clashingName, TopLevelTest.class);
when(operationModel.getAllParameterModels()).thenReturn(asList(topLevelOperationParam, offending));
validate();
}
use of org.mule.runtime.api.meta.model.parameter.ParameterModel in project mule by mulesoft.
the class NameClashModelValidatorTestCase method sourceWithRepeatedParameterNameAmongCallbackAndSource.
@Test
public void sourceWithRepeatedParameterNameAmongCallbackAndSource() {
exception.expect(IllegalModelDefinitionException.class);
ParameterModel offending = getParameter(SIMPLE_PARAM_NAME, String.class);
SourceCallbackModel sourceCallbackModel = mock(SourceCallbackModel.class);
mockParameters(sourceCallbackModel, simpleConfigParam);
ParameterGroupModel group = mock(ParameterGroupModel.class);
when(group.getName()).thenReturn(DEFAULT_GROUP_NAME);
when(group.getModelProperty(ParameterGroupModelProperty.class)).thenReturn(empty());
when(group.isShowInDsl()).thenReturn(false);
when(group.getParameterModels()).thenReturn(asList(offending));
SourceModel sourceModel = new ImmutableSourceModel(SOURCE_NAME, "", false, false, asList(group), emptyList(), null, null, of(sourceCallbackModel), empty(), empty(), false, false, false, null, SOURCE, emptySet(), emptySet(), emptySet());
when(extensionModel.getSourceModels()).thenReturn(asList(sourceModel));
validate();
}
use of org.mule.runtime.api.meta.model.parameter.ParameterModel in project mule by mulesoft.
the class NameClashModelValidatorTestCase method contentParameterClashWithAttributeParameterWithinSameGroup.
@Test
public void contentParameterClashWithAttributeParameterWithinSameGroup() {
exception.expect(IllegalModelDefinitionException.class);
ParameterGroupModel group = mock(ParameterGroupModel.class);
ParameterModel contentParam = getParameter(CHILD_SINGULAR_PARAM_NAME, Object.class);
when(contentParam.getRole()).thenReturn(PRIMARY_CONTENT);
ParameterModel notContentParam = getParameter(CHILD_SINGULAR_PARAM_NAME, String.class);
when(notContentParam.getRole()).thenReturn(BEHAVIOUR);
when(group.getName()).thenReturn(DEFAULT_GROUP_NAME);
when(group.getModelProperty(ParameterGroupModelProperty.class)).thenReturn(empty());
when(group.getParameterModels()).thenReturn(asList(contentParam));
ParameterGroupModel anotherGroup = mock(ParameterGroupModel.class);
when(anotherGroup.getName()).thenReturn("My Group");
when(anotherGroup.isShowInDsl()).thenReturn(false);
when(anotherGroup.getParameterModels()).thenReturn(asList(notContentParam));
when(operationModel.getParameterGroupModels()).thenReturn(asList(group, anotherGroup));
validate();
}
use of org.mule.runtime.api.meta.model.parameter.ParameterModel in project mule by mulesoft.
the class NameClashModelValidatorTestCase method contentParameterValidationIsSkipped.
@Test
public void contentParameterValidationIsSkipped() {
ParameterModel offending = getParameter(SIMPLE_PARAM_NAME, String.class);
when(offending.getRole()).thenReturn(CONTENT);
when(connectionProviderModel.getAllParameterModels()).thenReturn(asList(simpleConnectionProviderParam, topLevelConnectionProviderParam, offending));
validate();
}
Aggregations