use of org.mule.runtime.api.meta.model.parameter.ParameterGroupModel in project mule by mulesoft.
the class NameClashModelValidatorTestCase method mockParameterGroup.
private void mockParameterGroup(ParameterizedModel model, List<ParameterModel> parameters) {
ParameterGroupModel group = mock(ParameterGroupModel.class);
when(group.getName()).thenReturn(DEFAULT_GROUP_NAME);
when(group.getModelProperty(ParameterGroupModelProperty.class)).thenReturn(empty());
when(group.getParameterModels()).thenReturn(parameters);
when(group.isShowInDsl()).thenReturn(true);
when(model.getParameterGroupModels()).thenReturn(asList(group));
}
use of org.mule.runtime.api.meta.model.parameter.ParameterGroupModel 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));
}
use of org.mule.runtime.api.meta.model.parameter.ParameterGroupModel 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.ParameterGroupModel 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.ParameterGroupModel in project mule by mulesoft.
the class ParameterGroupLayoutOrderTestCase method assertParameterOrder.
private void assertParameterOrder(ParameterizedModel parameterizedModel, String parameterName, int expectedOrder) {
ParameterGroupModel paramOne = getNamedObject(parameterizedModel.getParameterGroupModels(), parameterName);
Optional<LayoutModel> layoutModel = paramOne.getLayoutModel();
assertLayoutModel(parameterName, expectedOrder, layoutModel);
}
Aggregations