use of org.apache.sling.validation.impl.model.ResourcePropertyBuilder in project sling by apache.
the class ResourceValidationModelProviderImplTest method testGetValidationModels.
@Test
public void testGetValidationModels() throws Exception {
// build two models manually (which are identical except for the applicable path)
ResourcePropertyBuilder resourcePropertyBuilder = new ResourcePropertyBuilder();
ValidationModel model1 = modelBuilder.resourceProperty(resourcePropertyBuilder.build("property1")).build("sling/validation/test", libsValidatorsRoot.getPath() + "/testValidationModel1");
modelBuilder.setApplicablePath("/content/site2");
ValidationModel model2 = modelBuilder.build("sling/validation/test", libsValidatorsRoot.getPath() + "/testValidationModel2");
// build models in JCR
createValidationModelResource(rr, libsValidatorsRoot.getPath(), "testValidationModel1", model1);
createValidationModelResource(rr, libsValidatorsRoot.getPath(), "testValidationModel2", model2);
// check that both models are returned
Collection<ValidationModel> models = modelProvider.getValidationModels("sling/validation/test");
Assert.assertThat(models, Matchers.containsInAnyOrder(model1, model2));
}
Aggregations