use of org.mule.runtime.api.meta.model.parameter.ParameterModel in project mule by mulesoft.
the class MetadataComponentModelValidatorTestCase method noMetadataKey.
@Test
public void noMetadataKey() {
ParameterModel param = mock(ParameterModel.class);
when(sourceModel.getModelProperty(MetadataKeyIdModelProperty.class)).thenReturn(empty());
when(sourceModel.getAllParameterModels()).thenReturn(singletonList(param));
validate(extensionModel, validator);
}
use of org.mule.runtime.api.meta.model.parameter.ParameterModel in project mule by mulesoft.
the class MetadataComponentModelValidatorTestCase method getMockKeyPartParam.
private ParameterModel getMockKeyPartParam(Object defaultValue, int order) {
ParameterModel param = mock(ParameterModel.class);
when(param.getDefaultValue()).thenReturn(defaultValue);
when(param.getModelProperty(MetadataKeyPartModelProperty.class)).thenReturn(of(new MetadataKeyPartModelProperty(order)));
return param;
}
use of org.mule.runtime.api.meta.model.parameter.ParameterModel in project mule by mulesoft.
the class MetadataComponentModelValidatorTestCase method metadataKeyWithoutDefaultValues.
@Test
public void metadataKeyWithoutDefaultValues() {
ParameterModel param1 = getMockKeyPartParam(null, 1);
ParameterModel param2 = getMockKeyPartParam(null, 2);
MetadataKeyIdModelProperty keyIdModelProperty = new MetadataKeyIdModelProperty(loader.load(InvalidMetadataKeyIdPojo.class), EMPTY);
when(sourceModel.getModelProperty(MetadataKeyIdModelProperty.class)).thenReturn(of(keyIdModelProperty));
when(sourceModel.getAllParameterModels()).thenReturn(asList(param1, param2));
validate(extensionModel, validator);
}
use of org.mule.runtime.api.meta.model.parameter.ParameterModel in project mule by mulesoft.
the class NameClashModelValidatorTestCase method mapSingularizeClashOnConstruct.
@Test
public void mapSingularizeClashOnConstruct() {
exception.expect(IllegalModelDefinitionException.class);
when(constructModel.getName()).thenReturn(CHILD_SINGULAR_PARAM_NAME);
ParameterModel offending = getParameter(CHILD_PLURAL_PARAM_NAME, childTestMap);
when(constructModel.getAllParameterModels()).thenReturn(asList(offending));
validate();
}
use of org.mule.runtime.api.meta.model.parameter.ParameterModel in project mule by mulesoft.
the class NameClashModelValidatorTestCase method topLevelParameterClashOnSubtypeWithDifferentType.
@Test
public void topLevelParameterClashOnSubtypeWithDifferentType() {
exception.expect(IllegalModelDefinitionException.class);
ParameterModel offending = getParameter(TOP_LEVEL_SINGULAR_PARAM_NAME, TopLevelTest.class);
mockParameters(operationModel, offending);
when(extensionModel.getSubTypes()).thenReturn(ImmutableSet.of(new SubTypesModel(toMetadataType(ChildTest.class), ImmutableSet.of(toMetadataType(TopLevelSubtype.class)))));
validate();
}
Aggregations