Search in sources :

Example 6 with EValidator

use of org.eclipse.emf.ecore.EValidator in project xtext-core by eclipse.

the class Bug367679Test method assertValidatorExists.

protected void assertValidatorExists() {
    EValidator eValidator = EValidator.Registry.INSTANCE.getEValidator(XtextPackage.eINSTANCE);
    Assert.assertNotNull(eValidator);
    Assert.assertTrue(eValidator instanceof CompositeEValidator);
}
Also used : CompositeEValidator(org.eclipse.xtext.validation.CompositeEValidator) EValidator(org.eclipse.emf.ecore.EValidator) CompositeEValidator(org.eclipse.xtext.validation.CompositeEValidator)

Example 7 with EValidator

use of org.eclipse.emf.ecore.EValidator in project xtext-core by eclipse.

the class AbstractCompositeValidatorTest method testBug_279962.

@Test
public void testBug_279962() {
    EValidator validator = registry.getEValidator(pack);
    assertTrue(validator instanceof CompositeEValidator);
    CompositeEValidator composite = (CompositeEValidator) validator;
    int prevSize = composite.getContents().size();
    get(Val_279962_01.class);
    get(Val_279962_04.class);
    assertEquals(prevSize + 2, composite.getContents().size());
    assertNotNull(validator);
    Resource resource = get(XtextResource.class);
    Model model = EnumRulesTestLanguageFactory.eINSTANCE.createModel();
    resource.getContents().add(model);
    // do not expect an exception
    validator.validate(model, new BasicDiagnostic(), null);
    assertEquals(prevSize + 4, composite.getContents().size());
}
Also used : BasicDiagnostic(org.eclipse.emf.common.util.BasicDiagnostic) XtextResource(org.eclipse.xtext.resource.XtextResource) Resource(org.eclipse.emf.ecore.resource.Resource) Model(org.eclipse.xtext.enumrules.enumRulesTestLanguage.Model) EValidator(org.eclipse.emf.ecore.EValidator) Test(org.junit.Test)

Example 8 with EValidator

use of org.eclipse.emf.ecore.EValidator in project xtext-core by eclipse.

the class CompositeValidatorWithEObjectValidatorTest method testContentsSize.

@Override
@Test
public void testContentsSize() {
    EValidator validator = registry.getEValidator(pack);
    assertNotNull(validator);
    assertTrue(validator instanceof CompositeEValidator);
    CompositeEValidator composite = (CompositeEValidator) validator;
    Collection<EValidatorEqualitySupport> contents = composite.getContents();
    assertEquals(3, contents.size());
}
Also used : EValidatorEqualitySupport(org.eclipse.xtext.validation.CompositeEValidator.EValidatorEqualitySupport) EValidator(org.eclipse.emf.ecore.EValidator) Test(org.junit.Test)

Example 9 with EValidator

use of org.eclipse.emf.ecore.EValidator in project xtext-core by eclipse.

the class CompositeValidatorWithoutEObjectValidatorTest method testContentsSize.

@Override
@Test
public void testContentsSize() {
    EValidator validator = registry.getEValidator(pack);
    assertNotNull(validator);
    assertTrue(validator instanceof CompositeEValidator);
    CompositeEValidator composite = (CompositeEValidator) validator;
    Collection<EValidatorEqualitySupport> contents = composite.getContents();
    assertEquals(2, contents.size());
}
Also used : EValidatorEqualitySupport(org.eclipse.xtext.validation.CompositeEValidator.EValidatorEqualitySupport) EValidator(org.eclipse.emf.ecore.EValidator) Test(org.junit.Test)

Aggregations

EValidator (org.eclipse.emf.ecore.EValidator)9 Test (org.junit.Test)4 EValidatorEqualitySupport (org.eclipse.xtext.validation.CompositeEValidator.EValidatorEqualitySupport)3 BasicDiagnostic (org.eclipse.emf.common.util.BasicDiagnostic)2 DiagnosticChain (org.eclipse.emf.common.util.DiagnosticChain)2 EObject (org.eclipse.emf.ecore.EObject)2 CompositeEValidator (org.eclipse.xtext.validation.CompositeEValidator)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Diagnostic (org.eclipse.emf.common.util.Diagnostic)1 EClass (org.eclipse.emf.ecore.EClass)1 EDataType (org.eclipse.emf.ecore.EDataType)1 Resource (org.eclipse.emf.ecore.resource.Resource)1 Model (org.eclipse.xtext.enumrules.enumRulesTestLanguage.Model)1 LangATestLanguageStandaloneSetup (org.eclipse.xtext.linking.LangATestLanguageStandaloneSetup)1 Type (org.eclipse.xtext.linking.langATestLanguage.Type)1 XtextResource (org.eclipse.xtext.resource.XtextResource)1 AbstractDeclarativeValidator (org.eclipse.xtext.validation.AbstractDeclarativeValidator)1