diff --git a/plugins/org.obeonetwork.m2doc.genconf/src/org/obeonetwork/m2doc/genconf/GenconfUtils.java b/plugins/org.obeonetwork.m2doc.genconf/src/org/obeonetwork/m2doc/genconf/GenconfUtils.java index 678d2c978..923b39159 100644 --- a/plugins/org.obeonetwork.m2doc.genconf/src/org/obeonetwork/m2doc/genconf/GenconfUtils.java +++ b/plugins/org.obeonetwork.m2doc.genconf/src/org/obeonetwork/m2doc/genconf/GenconfUtils.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2017 Obeo. + * Copyright (c) 2017, 2023 Obeo. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at @@ -499,8 +499,9 @@ private static List generate(Generation generation, IClassProvider classPro Map definitions = GenconfUtils.getVariables(generation, resourceSetForModels); // validate template + final boolean ignoreVersionCheck = Boolean.valueOf(options.get(M2DocUtils.IGNORE_VERSION_CHECK_OPTION)); final URI resultValidationURI = validate(uriConverter, generatedURI, validationURI, documentTemplate, - queryEnvironment, monitor); + queryEnvironment, ignoreVersionCheck, monitor); // launch generation final boolean updateFields = Boolean.valueOf(options.get(M2DocUtils.UPDATE_FIELDS_OPTION)); @@ -576,8 +577,10 @@ public static boolean validate(Generation generation, IClassProvider classProvid } // validate template + final Map options = getOptions(generation); + final boolean ignoreVersionCheck = Boolean.valueOf(options.get(M2DocUtils.IGNORE_VERSION_CHECK_OPTION)); res = validate(resourceSetForModel.getURIConverter(), templateURI, validationURI, documentTemplate, - queryEnvironment, monitor) != null; + queryEnvironment, ignoreVersionCheck, monitor) != null; } // validate output path @@ -620,6 +623,8 @@ public static boolean validate(Generation generation, IClassProvider classProvid * DocumentTemplate * @param queryEnvironment * the {@link IReadOnlyQueryEnvironment} + * @param ignoreVersionCheck + * ignore the {@link M2DocUtils#VERSION} check * @param monitor * the {@link Monitor} * @return the validation {@link URI} if the validation isn't OK, null otherwise @@ -629,11 +634,12 @@ public static boolean validate(Generation generation, IClassProvider classProvid * IOException */ private static URI validate(URIConverter uriConverter, URI generatedURI, URI validationURI, - DocumentTemplate documentTemplate, IReadOnlyQueryEnvironment queryEnvironment, Monitor monitor) - throws DocumentGenerationException, IOException { + DocumentTemplate documentTemplate, IReadOnlyQueryEnvironment queryEnvironment, boolean ignoreVersionCheck, + Monitor monitor) throws DocumentGenerationException, IOException { final URI res; - final ValidationMessageLevel validationLevel = M2DocUtils.validate(documentTemplate, queryEnvironment, monitor); + final ValidationMessageLevel validationLevel = M2DocUtils.validate(documentTemplate, queryEnvironment, + ignoreVersionCheck, monitor); if (validationLevel != ValidationMessageLevel.OK) { if (validationURI != null) { res = validationURI; diff --git a/plugins/org.obeonetwork.m2doc/src/org/obeonetwork/m2doc/generator/M2DocValidator.java b/plugins/org.obeonetwork.m2doc/src/org/obeonetwork/m2doc/generator/M2DocValidator.java index 0b54c7c67..8a51c77b9 100644 --- a/plugins/org.obeonetwork.m2doc/src/org/obeonetwork/m2doc/generator/M2DocValidator.java +++ b/plugins/org.obeonetwork.m2doc/src/org/obeonetwork/m2doc/generator/M2DocValidator.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2016, 2022 Obeo. + * Copyright (c) 2016, 2023 Obeo. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at @@ -124,6 +124,24 @@ public class M2DocValidator extends TemplateSwitch { */ public ValidationMessageLevel validate(DocumentTemplate documentTemplate, IReadOnlyQueryEnvironment queryEnv, Monitor monitor) { + return validate(documentTemplate, queryEnv, false, monitor); + } + + /** + * Validates the given {@link DocumentTemplate} against the given {@link IQueryEnvironment} and variables types. + * + * @param documentTemplate + * the {@link DocumentTemplate} + * @param queryEnv + * the {@link IQueryEnvironment} + * @param ignoreVersionCheck + * ignore the {@link M2DocUtils#VERSION} check + * @param monitor + * the {@link Monitor} + * @return the {@link ValidationMessageLevel} + */ + public ValidationMessageLevel validate(DocumentTemplate documentTemplate, IReadOnlyQueryEnvironment queryEnv, + boolean ignoreVersionCheck, Monitor monitor) { progressMonitor = monitor; progressMonitor.beginTask("Validating " + documentTemplate.eResource().getURI(), TOTAL_VALIDATE_MONITOR_WORK); @@ -137,7 +155,7 @@ public ValidationMessageLevel validate(DocumentTemplate documentTemplate, IReadO if (templateProperties.getM2DocVersion() == null) { documentTemplate.getBody().getValidationMessages().add(new TemplateValidationMessage( ValidationMessageLevel.WARNING, "No M2Doc version set in the template.", run)); - } else if (!M2DocUtils.VERSION.equals(templateProperties.getM2DocVersion())) { + } else if (!ignoreVersionCheck && !M2DocUtils.VERSION.equals(templateProperties.getM2DocVersion())) { documentTemplate.getBody().getValidationMessages().add( new TemplateValidationMessage(ValidationMessageLevel.WARNING, "M2Doc version mismatch: template is " + templateProperties.getM2DocVersion() + " and runtime is " + M2DocUtils.VERSION, run)); diff --git a/plugins/org.obeonetwork.m2doc/src/org/obeonetwork/m2doc/util/M2DocUtils.java b/plugins/org.obeonetwork.m2doc/src/org/obeonetwork/m2doc/util/M2DocUtils.java index b7c73ee14..665a6c43c 100644 --- a/plugins/org.obeonetwork.m2doc/src/org/obeonetwork/m2doc/util/M2DocUtils.java +++ b/plugins/org.obeonetwork.m2doc/src/org/obeonetwork/m2doc/util/M2DocUtils.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2016, 2021 Obeo. + * Copyright (c) 2016, 2023 Obeo. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at @@ -146,6 +146,11 @@ public final class M2DocUtils { */ public static final String INSTALL_CROSS_REFERENCE_ADAPTER_OPTION = "InstallCrossReferenceAdapter"; + /** + * The ignore {@link #VERSION} check option. + */ + public static final String IGNORE_VERSION_CHECK_OPTION = "IgnoreVersionCheck"; + /** * The {@link List} of {@link #registerServicesConfigurator(IServicesConfiguratorDescriptor) registered} * {@link IServicesConfiguratorDescriptor}. @@ -742,8 +747,26 @@ public static DocumentTemplate parseUserContent(URIConverter uriConverter, URI d */ public static ValidationMessageLevel validate(DocumentTemplate documentTemplate, IReadOnlyQueryEnvironment queryEnvironment, Monitor monitor) { + return validate(documentTemplate, queryEnvironment, false, monitor); + } + + /** + * Validates the given {@link DocumentTemplate} with the given {@link IReadOnlyQueryEnvironment} and variables types. + * + * @param documentTemplate + * the {@link DocumentTemplate} + * @param queryEnvironment + * the {@link IReadOnlyQueryEnvironment} + * @param ignoreVersionCheck + * ignore the {@link #VERSION} check + * @param monitor + * used to track the progress will generating + * @return the {@link ValidationMessageLevel} + */ + public static ValidationMessageLevel validate(DocumentTemplate documentTemplate, + IReadOnlyQueryEnvironment queryEnvironment, boolean ignoreVersionCheck, Monitor monitor) { final M2DocValidator validator = new M2DocValidator(); - return validator.validate(documentTemplate, queryEnvironment, monitor); + return validator.validate(documentTemplate, queryEnvironment, ignoreVersionCheck, monitor); } /** @@ -984,6 +1007,7 @@ public static Map getInitializedOptions(Map opti final Map res = new LinkedHashMap<>(); res.put(M2DocUtils.UPDATE_FIELDS_OPTION, Boolean.FALSE.toString()); + res.put(M2DocUtils.IGNORE_VERSION_CHECK_OPTION, Boolean.FALSE.toString()); for (IServicesConfigurator configurator : getConfigurators()) { res.putAll(configurator.getInitializedOptions(options)); } @@ -1004,6 +1028,7 @@ public static List getPossibleOptionNames() { } res.add(UPDATE_FIELDS_OPTION); + res.add(IGNORE_VERSION_CHECK_OPTION); res.add(INSTALL_CROSS_REFERENCE_ADAPTER_OPTION); return res; diff --git a/tests/org.obeonetwork.m2doc.genconf.tests/src/org/obeonetwork/m2doc/genconf/tests/GenconfUtilsTests.java b/tests/org.obeonetwork.m2doc.genconf.tests/src/org/obeonetwork/m2doc/genconf/tests/GenconfUtilsTests.java index 1379e3aee..74ac4b477 100644 --- a/tests/org.obeonetwork.m2doc.genconf.tests/src/org/obeonetwork/m2doc/genconf/tests/GenconfUtilsTests.java +++ b/tests/org.obeonetwork.m2doc.genconf.tests/src/org/obeonetwork/m2doc/genconf/tests/GenconfUtilsTests.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2017 Obeo. + * Copyright (c) 2017, 2023 Obeo. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at @@ -176,11 +176,13 @@ public void initializeOptionsNotExistingOption() { GenconfUtils.initializeOptions(generation); - assertEquals(2, generation.getOptions().size()); + assertEquals(3, generation.getOptions().size()); assertEquals(M2DocUtils.UPDATE_FIELDS_OPTION, generation.getOptions().get(0).getName()); assertEquals("false", generation.getOptions().get(0).getValue()); - assertEquals(TestServiceConfigurator.OPTION, generation.getOptions().get(1).getName()); - assertEquals(TestServiceConfigurator.VALUE, generation.getOptions().get(1).getValue()); + assertEquals(M2DocUtils.IGNORE_VERSION_CHECK_OPTION, generation.getOptions().get(1).getName()); + assertEquals("false", generation.getOptions().get(1).getValue()); + assertEquals(TestServiceConfigurator.OPTION, generation.getOptions().get(2).getName()); + assertEquals(TestServiceConfigurator.VALUE, generation.getOptions().get(2).getValue()); } @Test @@ -193,11 +195,13 @@ public void initializeOptionsExistingOption() { GenconfUtils.initializeOptions(generation); - assertEquals(2, generation.getOptions().size()); + assertEquals(3, generation.getOptions().size()); assertEquals(TestServiceConfigurator.OPTION, generation.getOptions().get(0).getName()); assertEquals(TestServiceConfigurator.VALUE, generation.getOptions().get(0).getValue()); assertEquals(M2DocUtils.UPDATE_FIELDS_OPTION, generation.getOptions().get(1).getName()); assertEquals("false", generation.getOptions().get(1).getValue()); + assertEquals(M2DocUtils.IGNORE_VERSION_CHECK_OPTION, generation.getOptions().get(2).getName()); + assertEquals("false", generation.getOptions().get(2).getValue()); } @Test diff --git a/tests/org.obeonetwork.m2doc.rcptt/commands/Edit Generation Configurations/Generation Selected - Variables and options page add all options.test b/tests/org.obeonetwork.m2doc.rcptt/commands/Edit Generation Configurations/Generation Selected - Variables and options page add all options.test index c7605c63f..4b3b0ecae 100644 --- a/tests/org.obeonetwork.m2doc.rcptt/commands/Edit Generation Configurations/Generation Selected - Variables and options page add all options.test +++ b/tests/org.obeonetwork.m2doc.rcptt/commands/Edit Generation Configurations/Generation Selected - Variables and options page add all options.test @@ -6,8 +6,8 @@ Element-Type: testcase Element-Version: 3.0 External-Reference: Id: _JCraAIXQEeiTHPcT0aJVUA -Runtime-Version: 2.3.0.201806262310 -Save-Time: 2/11/20 1:08 PM +Runtime-Version: 2.5.4.202210020716 +Save-Time: 9/13/23, 3:31 PM Testcase-Type: ecl ------=_.content-0a7243a0-75d3-3d5f-9791-539de0e5b7ac @@ -44,7 +44,7 @@ with [get-window "Generation configuration"] { get-window "Set option name and value." | get-button OK | click } with [get-window "Generation configuration"] { - get-table | get-property itemCount | equals 9 | verify-true + get-table | get-property itemCount | equals 10 | verify-true get-button Add | get-property enablement | equals false | verify-true } get-window "Generation configuration" | get-button Cancel | click diff --git a/tests/org.obeonetwork.m2doc.rcptt/commands/Edit Generation Configurations/Generation Selected - Variables and options page initialization.test b/tests/org.obeonetwork.m2doc.rcptt/commands/Edit Generation Configurations/Generation Selected - Variables and options page initialization.test index 4d1652747..4746b1d8f 100644 --- a/tests/org.obeonetwork.m2doc.rcptt/commands/Edit Generation Configurations/Generation Selected - Variables and options page initialization.test +++ b/tests/org.obeonetwork.m2doc.rcptt/commands/Edit Generation Configurations/Generation Selected - Variables and options page initialization.test @@ -6,8 +6,8 @@ Element-Type: testcase Element-Version: 3.0 External-Reference: Id: _DwnzUH31Eeiu8KolG1i86A -Runtime-Version: 2.3.0.201806262310 -Save-Time: 2/11/20 1:16 PM +Runtime-Version: 2.5.4.202210020716 +Save-Time: 9/13/23, 3:24 PM Testcase-Type: ecl ------=_.content-0a7243a0-75d3-3d5f-9791-539de0e5b7ac @@ -28,9 +28,11 @@ with [get-window "Generation configuration"] { } get-window "Generation configuration" | get-tab-folder | get-tab-item "Options (expert)" | click with [get-window "Generation configuration"] { - get-table | get-property itemCount | equals 2 | verify-true + get-table | get-property itemCount | equals 3 | verify-true get-table | get-item -path UpdateFields | get-property "columns[0]" | equals UpdateFields | verify-true get-table | get-item -path UpdateFields | get-property "columns[1]" | equals "false" | verify-true + get-table | get-item -path IgnoreVersionCheck | get-property "columns[0]" | equals IgnoreVersionCheck | verify-true + get-table | get-item -path IgnoreVersionCheck | get-property "columns[1]" | equals "false" | verify-true get-button Add | get-property enablement | equals true | verify-true get-button Edit | get-property enablement | equals false | verify-true get-button Remove | get-property enablement | equals false | verify-true diff --git a/tests/org.obeonetwork.m2doc.rcptt/commands/Edit Generation Configurations/Generation Selected - Variables and options page remove option.test b/tests/org.obeonetwork.m2doc.rcptt/commands/Edit Generation Configurations/Generation Selected - Variables and options page remove option.test index 9c33d034e..a6935ec61 100644 --- a/tests/org.obeonetwork.m2doc.rcptt/commands/Edit Generation Configurations/Generation Selected - Variables and options page remove option.test +++ b/tests/org.obeonetwork.m2doc.rcptt/commands/Edit Generation Configurations/Generation Selected - Variables and options page remove option.test @@ -6,8 +6,8 @@ Element-Type: testcase Element-Version: 3.0 External-Reference: Id: _jODMwH9kEei7rrjWYcYqJw -Runtime-Version: 2.3.0.201806262310 -Save-Time: 2/11/20 1:08 PM +Runtime-Version: 2.5.4.202210020716 +Save-Time: 9/13/23, 3:32 PM Testcase-Type: ecl ------=_.content-0a7243a0-75d3-3d5f-9791-539de0e5b7ac @@ -36,6 +36,6 @@ with [get-window "Generation configuration"] { get-table | select SiriusSession get-button Remove | click } -get-window "Generation configuration" | get-table | get-property itemCount | equals 1 | verify-true +get-window "Generation configuration" | get-table | get-property itemCount | equals 2 | verify-true get-window "Generation configuration" | get-button Cancel | click ------=_.content-0a7243a0-75d3-3d5f-9791-539de0e5b7ac-- diff --git a/tests/org.obeonetwork.m2doc.rcptt/commands/Edit Generation Configurations/UTF-8 model.test b/tests/org.obeonetwork.m2doc.rcptt/commands/Edit Generation Configurations/UTF-8 model.test index 035475757..bd24116d2 100644 --- a/tests/org.obeonetwork.m2doc.rcptt/commands/Edit Generation Configurations/UTF-8 model.test +++ b/tests/org.obeonetwork.m2doc.rcptt/commands/Edit Generation Configurations/UTF-8 model.test @@ -7,7 +7,7 @@ Element-Version: 3.0 External-Reference: Id: _hosBgEzBEe6RxPWQEeDEcQ Runtime-Version: 2.5.4.202210020716 -Save-Time: 9/6/23, 4:31 PM +Save-Time: 9/13/23, 3:20 PM Testcase-Type: ecl ------=_.content-0a7243a0-75d3-3d5f-9791-539de0e5b7ac @@ -41,5 +41,6 @@ get-editor "asImageByRepresentationDescriptionName.genconf" | get-text-viewer | + " \n" + " \n" + " \n" + + " \n" + "" | verify-true ------=_.content-0a7243a0-75d3-3d5f-9791-539de0e5b7ac-- diff --git a/tests/org.obeonetwork.m2doc.rcptt/commands/Initialize Generation/Initialize Generation - Variables and options page initialization.test b/tests/org.obeonetwork.m2doc.rcptt/commands/Initialize Generation/Initialize Generation - Variables and options page initialization.test index 4c3c90cc4..eec4f3882 100644 --- a/tests/org.obeonetwork.m2doc.rcptt/commands/Initialize Generation/Initialize Generation - Variables and options page initialization.test +++ b/tests/org.obeonetwork.m2doc.rcptt/commands/Initialize Generation/Initialize Generation - Variables and options page initialization.test @@ -6,8 +6,8 @@ Element-Type: testcase Element-Version: 3.0 External-Reference: Id: _uSzOkH3uEeii_sZyBcvLmQ -Runtime-Version: 2.3.0.201806262310 -Save-Time: 2/11/20 1:07 PM +Runtime-Version: 2.5.4.202210020716 +Save-Time: 9/13/23, 3:26 PM Testcase-Type: ecl ------=_.content-0a7243a0-75d3-3d5f-9791-539de0e5b7ac @@ -28,7 +28,7 @@ with [get-window "Generation configuration"] { } get-window "Generation configuration" | get-tab-folder | get-tab-item "Options (expert)" | click with [get-window "Generation configuration"] { - get-table | get-property itemCount | equals 1 | verify-true + get-table | get-property itemCount | equals 2 | verify-true get-button Add | get-property enablement | equals true | verify-true get-button Edit | get-property enablement | equals false | verify-true get-button Remove | get-property enablement | equals false | verify-true diff --git a/tests/org.obeonetwork.m2doc.rcptt/commands/New Generation Wizard/Template Selected/Template Selected - Variables and options page initialization.test b/tests/org.obeonetwork.m2doc.rcptt/commands/New Generation Wizard/Template Selected/Template Selected - Variables and options page initialization.test index 58153a4fb..28e24ee72 100644 --- a/tests/org.obeonetwork.m2doc.rcptt/commands/New Generation Wizard/Template Selected/Template Selected - Variables and options page initialization.test +++ b/tests/org.obeonetwork.m2doc.rcptt/commands/New Generation Wizard/Template Selected/Template Selected - Variables and options page initialization.test @@ -7,7 +7,7 @@ Element-Version: 3.0 External-Reference: Id: _kz6UQH3YEeiOZoLGvms2Lg Runtime-Version: 2.5.4.202210020716 -Save-Time: 2/13/23, 10:17 AM +Save-Time: 9/13/23, 4:28 PM Testcase-Type: ecl ------=_.content-0a7243a0-75d3-3d5f-9791-539de0e5b7ac @@ -32,7 +32,7 @@ with [get-window -class WizardDialog] { } get-window -class WizardDialog | get-tab-folder | get-tab-item "Options (expert)" | click with [get-window -class WizardDialog] { - get-table | get-property itemCount | equals 1 | verify-true + get-table | get-property itemCount | equals 2 | verify-true get-button Add | get-property enablement | equals true | verify-true get-button Edit | get-property enablement | equals false | verify-true get-button Remove | get-property enablement | equals false | verify-true diff --git a/tests/org.obeonetwork.m2doc.tests/resources/static/wrongM2DocVersionIgnoreVersionCheck/wrongM2DocVersionIgnoreVersionCheck-expected-ast.txt b/tests/org.obeonetwork.m2doc.tests/resources/static/wrongM2DocVersionIgnoreVersionCheck/wrongM2DocVersionIgnoreVersionCheck-expected-ast.txt new file mode 100644 index 000000000..1dfc02b05 --- /dev/null +++ b/tests/org.obeonetwork.m2doc.tests/resources/static/wrongM2DocVersionIgnoreVersionCheck/wrongM2DocVersionIgnoreVersionCheck-expected-ast.txt @@ -0,0 +1,9 @@ + +=== HEADER === + +=== BODY === + + A simple demonstration of a static text :Some text.End of demonstration. +=== FOOTER === + +=== TEMPLATES === \ No newline at end of file diff --git a/tests/org.obeonetwork.m2doc.tests/resources/static/wrongM2DocVersionIgnoreVersionCheck/wrongM2DocVersionIgnoreVersionCheck-expected-generation-messages.txt b/tests/org.obeonetwork.m2doc.tests/resources/static/wrongM2DocVersionIgnoreVersionCheck/wrongM2DocVersionIgnoreVersionCheck-expected-generation-messages.txt new file mode 100644 index 000000000..e69de29bb diff --git a/tests/org.obeonetwork.m2doc.tests/resources/static/wrongM2DocVersionIgnoreVersionCheck/wrongM2DocVersionIgnoreVersionCheck-expected-generation.docx b/tests/org.obeonetwork.m2doc.tests/resources/static/wrongM2DocVersionIgnoreVersionCheck/wrongM2DocVersionIgnoreVersionCheck-expected-generation.docx new file mode 100644 index 000000000..8b3f1fe0b Binary files /dev/null and b/tests/org.obeonetwork.m2doc.tests/resources/static/wrongM2DocVersionIgnoreVersionCheck/wrongM2DocVersionIgnoreVersionCheck-expected-generation.docx differ diff --git a/tests/org.obeonetwork.m2doc.tests/resources/static/wrongM2DocVersionIgnoreVersionCheck/wrongM2DocVersionIgnoreVersionCheck-expected-validation.docx b/tests/org.obeonetwork.m2doc.tests/resources/static/wrongM2DocVersionIgnoreVersionCheck/wrongM2DocVersionIgnoreVersionCheck-expected-validation.docx new file mode 100644 index 000000000..e69de29bb diff --git a/tests/org.obeonetwork.m2doc.tests/resources/static/wrongM2DocVersionIgnoreVersionCheck/wrongM2DocVersionIgnoreVersionCheck-template.docx b/tests/org.obeonetwork.m2doc.tests/resources/static/wrongM2DocVersionIgnoreVersionCheck/wrongM2DocVersionIgnoreVersionCheck-template.docx new file mode 100644 index 000000000..42c7d9979 Binary files /dev/null and b/tests/org.obeonetwork.m2doc.tests/resources/static/wrongM2DocVersionIgnoreVersionCheck/wrongM2DocVersionIgnoreVersionCheck-template.docx differ diff --git a/tests/org.obeonetwork.m2doc.tests/resources/static/wrongM2DocVersionIgnoreVersionCheck/wrongM2DocVersionIgnoreVersionCheck.genconf b/tests/org.obeonetwork.m2doc.tests/resources/static/wrongM2DocVersionIgnoreVersionCheck/wrongM2DocVersionIgnoreVersionCheck.genconf new file mode 100644 index 000000000..2d81e2282 --- /dev/null +++ b/tests/org.obeonetwork.m2doc.tests/resources/static/wrongM2DocVersionIgnoreVersionCheck/wrongM2DocVersionIgnoreVersionCheck.genconf @@ -0,0 +1,4 @@ + + + + diff --git a/tests/org.obeonetwork.m2doc.tests/src/org/obeonetwork/m2doc/tests/AbstractTemplatesTestSuite.java b/tests/org.obeonetwork.m2doc.tests/src/org/obeonetwork/m2doc/tests/AbstractTemplatesTestSuite.java index c269193c6..382f06716 100644 --- a/tests/org.obeonetwork.m2doc.tests/src/org/obeonetwork/m2doc/tests/AbstractTemplatesTestSuite.java +++ b/tests/org.obeonetwork.m2doc.tests/src/org/obeonetwork/m2doc/tests/AbstractTemplatesTestSuite.java @@ -307,8 +307,10 @@ public void parsing() throws FileNotFoundException, IOException { */ @Test public void validation() throws IOException, DocumentGenerationException { + final boolean ignoreVersionCheck = Boolean + .valueOf(GenconfUtils.getOptions(generation).get(M2DocUtils.IGNORE_VERSION_CHECK_OPTION)); final ValidationMessageLevel validationLevel = M2DocUtils.validate(documentTemplate, queryEnvironment, - new BasicMonitor()); + ignoreVersionCheck, new BasicMonitor()); final URI expectedValidationURI = getExpectedValidatedURI(new File(testFolderPath)); final URI outputURI; diff --git a/tests/org.obeonetwork.m2doc.tests/src/org/obeonetwork/m2doc/tests/M2DocUtilsTests.java b/tests/org.obeonetwork.m2doc.tests/src/org/obeonetwork/m2doc/tests/M2DocUtilsTests.java index fa175f15c..22ca6306b 100644 --- a/tests/org.obeonetwork.m2doc.tests/src/org/obeonetwork/m2doc/tests/M2DocUtilsTests.java +++ b/tests/org.obeonetwork.m2doc.tests/src/org/obeonetwork/m2doc/tests/M2DocUtilsTests.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2017 Obeo. + * Copyright (c) 2017, 2023 Obeo. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at @@ -151,8 +151,9 @@ public void getInitializedOptions() { final Map initializedOptions = M2DocUtils.getInitializedOptions(options); - assertEquals(2, initializedOptions.size()); + assertEquals(3, initializedOptions.size()); assertEquals("false", initializedOptions.get(M2DocUtils.UPDATE_FIELDS_OPTION)); + assertEquals("false", initializedOptions.get(M2DocUtils.IGNORE_VERSION_CHECK_OPTION)); assertEquals(TestServiceConfigurator.VALUE, initializedOptions.get(TestServiceConfigurator.OPTION)); } diff --git a/tests/org.obeonetwork.m2doc.tests/src/org/obeonetwork/m2doc/tests/generator/M2DocValidatorTests.java b/tests/org.obeonetwork.m2doc.tests/src/org/obeonetwork/m2doc/tests/generator/M2DocValidatorTests.java index 6c00b684d..684d371f9 100644 --- a/tests/org.obeonetwork.m2doc.tests/src/org/obeonetwork/m2doc/tests/generator/M2DocValidatorTests.java +++ b/tests/org.obeonetwork.m2doc.tests/src/org/obeonetwork/m2doc/tests/generator/M2DocValidatorTests.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2016 Obeo. + * Copyright (c) 2016, 2023 Obeo. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at @@ -73,7 +73,7 @@ public void conditionalInferedTypeInElse() throws IOException { selfTypes.add(new EClassifierType(queryEnvironment, EcorePackage.eINSTANCE.getEClassifier())); selfTypes.add(new EClassifierType(queryEnvironment, EcorePackage.eINSTANCE.getEPackage())); - validator.validate(documentTemplate, queryEnvironment, new BasicMonitor()); + validator.validate(documentTemplate, queryEnvironment, false, new BasicMonitor()); assertEquals(0, conditional.getValidationMessages().size()); @@ -104,7 +104,7 @@ public void tableRowCellTemplate() { final DocumentTemplate documentTemplate = M2DocTestUtils.createDocumentTemplate(body); final M2DocValidator validator = new M2DocValidator(); - validator.validate(documentTemplate, queryEnvironment, new BasicMonitor()); + validator.validate(documentTemplate, queryEnvironment, false, new BasicMonitor()); assertEquals(1, query.getValidationMessages().size()); assertTemplateValidationMessage(query.getValidationMessages().get(0), ValidationMessageLevel.ERROR,