use of com.github._1c_syntax.mdclasses.common.CompatibilityMode in project mdclasses by 1c-syntax.
the class ConfigurationTest method testDesignerExt2.
@Test
void testDesignerExt2() {
File srcPath = new File("src/test/resources/metadata/original_ext2");
Configuration configuration = Configuration.create(srcPath.toPath());
assertThat(configuration).isInstanceOf(ConfigurationExtension.class);
assertThat(CompatibilityMode.compareTo(configuration.getCompatibilityMode(), new CompatibilityMode(3, 10))).isZero();
assertThat(CompatibilityMode.compareTo(configuration.getConfigurationExtensionCompatibilityMode(), new CompatibilityMode(3, 10))).isZero();
assertThat(configuration.getConfigurationSource()).isEqualTo(ConfigurationSource.DESIGNER);
assertThat(configuration.getDataLockControlMode()).isEqualTo(DataLockControlMode.AUTOMATIC);
assertThat(configuration.getDefaultLanguage().getName()).isEqualTo("Русский");
assertThat(configuration.getDefaultRunMode()).isEqualTo(ApplicationRunMode.MANAGED_APPLICATION);
assertThat(configuration.getModalityUseMode()).isEqualTo(UseMode.USE);
assertThat(configuration.getObjectAutonumerationMode()).isEmpty();
assertThat(configuration.getScriptVariant()).isEqualTo(ScriptVariant.RUSSIAN);
assertThat(configuration.getSynchronousExtensionAndAddInCallUseMode()).isEqualTo(UseMode.USE);
assertThat(configuration.getSynchronousPlatformExtensionAndAddInCallUseMode()).isEqualTo(UseMode.USE);
assertThat(((ConfigurationExtension) configuration).getConfigurationExtensionPurpose()).isEqualTo(ConfigurationExtensionPurpose.ADD_ON);
assertThat(((ConfigurationExtension) configuration).getNamePrefix()).isEqualTo("Расш1_");
assertThat(configuration.getModulesByType()).hasSize(2);
assertThat(configuration.getModulesBySupport()).isEmpty();
assertThat(configuration.getModules()).hasSize(2);
assertThat(configuration.getRoles()).isEmpty();
assertThat(configuration.getChildren()).hasSize(5);
checkChildCount(configuration, MDOType.CONFIGURATION, 1);
checkChildCount(configuration, MDOType.COMMON_MODULE, 2);
checkChildCount(configuration, MDOType.LANGUAGE, 1);
checkChildCount(configuration, MDOType.SUBSYSTEM, 1);
assertThat(configuration.getChildrenByMdoRef()).hasSize(5);
assertThat(configuration.getCommonModule("ПростойОбщийМодуль")).isPresent();
assertThat(configuration.getCommonModule("НесуществующийМодуль")).isNotPresent();
assertThat(configuration.getChildren()).filteredOn(mdObjectBase -> mdObjectBase.getObjectBelonging() == ObjectBelonging.ADOPTED).hasSize(4);
assertThat(configuration.getChildren()).filteredOn(mdObjectBase -> mdObjectBase.getObjectBelonging() == ObjectBelonging.OWN).hasSize(1);
}
use of com.github._1c_syntax.mdclasses.common.CompatibilityMode in project mdclasses by 1c-syntax.
the class ConfigurationTest method testEDTEn.
@Test
void testEDTEn() {
File srcPath = new File("src/test/resources/metadata/edt_en");
Configuration configuration = Configuration.create(srcPath.toPath());
assertThat(configuration).isNotInstanceOf(ConfigurationExtension.class);
assertThat(configuration.getName()).isEqualTo("Configuration");
assertThat(configuration.getUuid()).isEqualTo("04c0322d-92da-49ab-87e5-82c8dcd50888");
assertThat(configuration.getConfigurationSource()).isEqualTo(ConfigurationSource.EDT);
assertThat(CompatibilityMode.compareTo(configuration.getCompatibilityMode(), new CompatibilityMode(3, 14))).isZero();
assertThat(CompatibilityMode.compareTo(configuration.getConfigurationExtensionCompatibilityMode(), new CompatibilityMode(3, 14))).isZero();
assertThat(configuration.getScriptVariant()).isEqualTo(ScriptVariant.ENGLISH);
assertThat(configuration.getDefaultRunMode()).isEqualTo(ApplicationRunMode.MANAGED_APPLICATION);
assertThat(configuration.getDefaultLanguage().getName()).isEqualTo("English");
assertThat(configuration.getDataLockControlMode()).isEqualTo(DataLockControlMode.AUTOMATIC_AND_MANAGED);
assertThat(configuration.getObjectAutonumerationMode()).isEqualTo("NotAutoFree");
assertThat(configuration.getModalityUseMode()).isEqualTo(UseMode.DONT_USE);
assertThat(configuration.getSynchronousExtensionAndAddInCallUseMode()).isEqualTo(UseMode.USE);
assertThat(configuration.getSynchronousPlatformExtensionAndAddInCallUseMode()).isEqualTo(UseMode.DONT_USE);
assertThat(configuration.getModulesByType()).hasSize(2);
assertThat(configuration.getModulesBySupport()).isEmpty();
assertThat(configuration.getModulesByObject()).hasSize(2);
assertThat(configuration.getModules()).hasSize(2);
assertThat(configuration.getCommonModules()).hasSize(2);
assertThat(configuration.getLanguages()).hasSize(1);
assertThat(configuration.getRoles()).isEmpty();
assertThat(configuration.getChildren()).hasSize(4);
checkChildCount(configuration, MDOType.COMMON_MODULE, 2);
checkChildCount(configuration, MDOType.LANGUAGE, 1);
assertThat(configuration.getChildrenByMdoRef()).hasSize(4);
assertThat(configuration.getCommonModule("CommonModule")).isPresent();
assertThat(configuration.getCommonModule("CommonModule3")).isNotPresent();
}
use of com.github._1c_syntax.mdclasses.common.CompatibilityMode in project mdclasses by 1c-syntax.
the class ConfigurationTest method testDesigner.
@Test
void testDesigner() {
File srcPath = new File("src/test/resources/metadata/original");
Configuration configuration = Configuration.create(srcPath.toPath());
assertThat(configuration).isNotInstanceOf(ConfigurationExtension.class);
assertThat(CompatibilityMode.compareTo(configuration.getCompatibilityMode(), new CompatibilityMode(3, 10))).isZero();
assertThat(CompatibilityMode.compareTo(configuration.getConfigurationExtensionCompatibilityMode(), new CompatibilityMode(3, 10))).isZero();
assertThat(configuration.getConfigurationSource()).isEqualTo(ConfigurationSource.DESIGNER);
assertThat(configuration.getDataLockControlMode()).isEqualTo(DataLockControlMode.AUTOMATIC);
assertThat(configuration.getDefaultLanguage().getName()).isEqualTo("Русский");
assertThat(configuration.getDefaultRunMode()).isEqualTo(ApplicationRunMode.MANAGED_APPLICATION);
assertThat(configuration.getModalityUseMode()).isEqualTo(UseMode.DONT_USE);
assertThat(configuration.getObjectAutonumerationMode()).isEqualTo("NotAutoFree");
assertThat(configuration.getScriptVariant()).isEqualTo(ScriptVariant.RUSSIAN);
assertThat(configuration.getSynchronousExtensionAndAddInCallUseMode()).isEqualTo(UseMode.USE);
assertThat(configuration.getSynchronousPlatformExtensionAndAddInCallUseMode()).isEqualTo(UseMode.DONT_USE);
assertThat(configuration.isUseManagedFormInOrdinaryApplication()).isTrue();
assertThat(configuration.isUseOrdinaryFormInManagedApplication()).isFalse();
assertThat(configuration.getModulesByType()).hasSize(18);
assertThat(configuration.getCopyrights()).hasSize(2).anyMatch(copyright -> copyright.getContent().equals("Моя Программа") && copyright.getLanguage().equals("ru")).anyMatch(copyright -> copyright.getContent().equals("My program") && copyright.getLanguage().equals("en"));
assertThat(configuration.getBriefInformation()).hasSize(2).anyMatch(briefInfo -> briefInfo.getLanguage().equals("ru") && briefInfo.getContent().equals("Краткая информация")).anyMatch(briefInfo -> briefInfo.getLanguage().equals("en") && briefInfo.getContent().equals("Short info"));
assertThat(configuration.getDetailedInformation()).hasSize(2).anyMatch(briefInfo -> briefInfo.getLanguage().equals("ru") && briefInfo.getContent().equals("Подробная информация")).anyMatch(briefInfo -> briefInfo.getLanguage().equals("en") && briefInfo.getContent().equals("Detailed info"));
assertThat(configuration.getModulesBySupport()).isEmpty();
assertThat(configuration.getModulesByObject()).hasSize(18);
assertThat(configuration.getModules()).hasSize(18);
assertThat(configuration.getCommonModules()).hasSize(6);
assertThat(configuration.getLanguages()).hasSize(3);
assertThat(configuration.getRoles()).hasSize(1);
assertThat(configuration.getChildren()).hasSize(112);
checkChildCount(configuration, MDOType.CONFIGURATION, 1);
checkChildCount(configuration, MDOType.COMMAND, 1);
checkChildCount(configuration, MDOType.FORM, 8);
checkChildCount(configuration, MDOType.TEMPLATE, 2);
checkChildCount(configuration, MDOType.ATTRIBUTE, 34);
checkChildCount(configuration, MDOType.WS_OPERATION, 2);
checkChildCount(configuration, MDOType.HTTP_SERVICE_URL_TEMPLATE, 1);
checkChildCount(configuration, MDOType.HTTP_SERVICE_METHOD, 2);
checkChildCount(configuration, MDOType.ACCOUNTING_REGISTER, 1);
checkChildCount(configuration, MDOType.ACCUMULATION_REGISTER, 1);
checkChildCount(configuration, MDOType.BUSINESS_PROCESS, 1);
checkChildCount(configuration, MDOType.CALCULATION_REGISTER, 1);
checkChildCount(configuration, MDOType.CATALOG, 1);
checkChildCount(configuration, MDOType.CHART_OF_ACCOUNTS, 1);
checkChildCount(configuration, MDOType.CHART_OF_CALCULATION_TYPES, 1);
checkChildCount(configuration, MDOType.CHART_OF_CHARACTERISTIC_TYPES, 1);
checkChildCount(configuration, MDOType.COMMAND_GROUP, 1);
checkChildCount(configuration, MDOType.COMMON_ATTRIBUTE, 1);
checkChildCount(configuration, MDOType.COMMON_COMMAND, 1);
checkChildCount(configuration, MDOType.COMMON_FORM, 1);
checkChildCount(configuration, MDOType.COMMON_MODULE, 6);
checkChildCount(configuration, MDOType.COMMON_PICTURE, 1);
checkChildCount(configuration, MDOType.COMMON_TEMPLATE, 10);
checkChildCount(configuration, MDOType.CONSTANT, 1);
checkChildCount(configuration, MDOType.DATA_PROCESSOR, 1);
checkChildCount(configuration, MDOType.DEFINED_TYPE, 1);
checkChildCount(configuration, MDOType.DOCUMENT_JOURNAL, 1);
checkChildCount(configuration, MDOType.DOCUMENT_NUMERATOR, 1);
checkChildCount(configuration, MDOType.DOCUMENT, 1);
checkChildCount(configuration, MDOType.ENUM, 1);
checkChildCount(configuration, MDOType.EVENT_SUBSCRIPTION, 1);
checkChildCount(configuration, MDOType.EXCHANGE_PLAN, 1);
checkChildCount(configuration, MDOType.FILTER_CRITERION, 1);
checkChildCount(configuration, MDOType.FUNCTIONAL_OPTION, 1);
checkChildCount(configuration, MDOType.FUNCTIONAL_OPTIONS_PARAMETER, 1);
checkChildCount(configuration, MDOType.HTTP_SERVICE, 1);
checkChildCount(configuration, MDOType.INFORMATION_REGISTER, 2);
checkChildCount(configuration, MDOType.INTERFACE, 1);
checkChildCount(configuration, MDOType.LANGUAGE, 3);
checkChildCount(configuration, MDOType.REPORT, 1);
checkChildCount(configuration, MDOType.ROLE, 1);
checkChildCount(configuration, MDOType.SCHEDULED_JOB, 1);
checkChildCount(configuration, MDOType.SEQUENCE, 1);
checkChildCount(configuration, MDOType.SESSION_PARAMETER, 1);
checkChildCount(configuration, MDOType.SETTINGS_STORAGE, 1);
checkChildCount(configuration, MDOType.STYLE_ITEM, 1);
checkChildCount(configuration, MDOType.STYLE, 1);
checkChildCount(configuration, MDOType.SUBSYSTEM, 1);
checkChildCount(configuration, MDOType.TASK, 1);
checkChildCount(configuration, MDOType.WEB_SERVICE, 1);
checkChildCount(configuration, MDOType.WS_REFERENCE, 1);
checkChildCount(configuration, MDOType.XDTO_PACKAGE, 1);
assertThat(configuration.getChildrenByMdoRef()).hasSize(111);
assertThat(configuration.getCommonModule("ГлобальныйОбщийМодуль")).isPresent();
assertThat(configuration.getCommonModule("ГлобальныйОбщийМодуль3")).isNotPresent();
checkFillPath(configuration.getChildren());
checkFormData(configuration.getChildren());
var modulesByType = configuration.getModulesByMDORef("CommonModule.ГлобальныйОбщийМодуль");
assertThat(modulesByType).hasSize(1).containsKey(ModuleType.CommonModule);
modulesByType = configuration.getModulesByMDORef("WSReference.WSСсылка");
assertThat(modulesByType).isEmpty();
modulesByType = configuration.getModulesByMDORef(configuration.getCommonModule("ГлобальныйОбщийМодуль").get().getMdoReference());
assertThat(modulesByType).hasSize(1).containsKey(ModuleType.CommonModule);
}
use of com.github._1c_syntax.mdclasses.common.CompatibilityMode in project mdclasses by 1c-syntax.
the class MDConfigurationTest method testEDT.
@Override
@Test
void testEDT() {
var mdo = getMDObjectEDT("Configuration/Configuration.mdo");
checkBaseField(mdo, MDConfiguration.class, "Конфигурация", "46c7c1d0-b04d-4295-9b04-ae3207c18d29");
checkNoChildren(mdo);
checkModules(((AbstractMDObjectBSL) mdo).getModules(), 3, "Configuration", ModuleType.SessionModule, ModuleType.ExternalConnectionModule, ModuleType.ManagedApplicationModule);
var configuration = (MDConfiguration) mdo;
assertThat(CompatibilityMode.compareTo(configuration.getCompatibilityMode(), new CompatibilityMode(3, 10))).isZero();
assertThat(CompatibilityMode.compareTo(configuration.getConfigurationExtensionCompatibilityMode(), new CompatibilityMode(3, 10))).isZero();
assertThat(configuration.getDataLockControlMode()).isEqualTo(DataLockControlMode.AUTOMATIC);
assertThat(configuration.getDefaultLanguage().isRight()).isTrue();
assertThat(configuration.getDefaultLanguage().get().getName()).isEqualTo("Русский");
assertThat(configuration.getDefaultRunMode()).isEqualTo("ManagedApplication");
assertThat(configuration.getModalityUseMode()).isEqualTo(UseMode.USE);
assertThat(configuration.getObjectAutonumerationMode()).isEqualTo("NotAutoFree");
assertThat(configuration.getScriptVariant()).isEqualTo(ScriptVariant.RUSSIAN);
assertThat(configuration.getSynchronousExtensionAndAddInCallUseMode()).isEqualTo(UseMode.USE_WITH_WARNINGS);
assertThat(configuration.getSynchronousPlatformExtensionAndAddInCallUseMode()).isEqualTo(UseMode.DONT_USE);
assertThat(configuration.getConfigurationExtensionPurpose()).isEqualTo(ConfigurationExtensionPurpose.PATCH);
assertThat(configuration.getObjectBelonging()).isEqualTo(ObjectBelonging.OWN);
assertThat(configuration.getNamePrefix()).isEmpty();
assertThat(configuration.getChildren()).hasSize(61).allMatch(Either::isRight);
checkChildCount(configuration, MDOType.ACCOUNTING_REGISTER, 1);
checkChildCount(configuration, MDOType.ACCUMULATION_REGISTER, 1);
checkChildCount(configuration, MDOType.BUSINESS_PROCESS, 1);
checkChildCount(configuration, MDOType.CALCULATION_REGISTER, 1);
checkChildCount(configuration, MDOType.CATALOG, 1);
checkChildCount(configuration, MDOType.CHART_OF_ACCOUNTS, 1);
checkChildCount(configuration, MDOType.CHART_OF_CALCULATION_TYPES, 1);
checkChildCount(configuration, MDOType.CHART_OF_CHARACTERISTIC_TYPES, 1);
checkChildCount(configuration, MDOType.COMMAND_GROUP, 1);
checkChildCount(configuration, MDOType.COMMON_ATTRIBUTE, 1);
checkChildCount(configuration, MDOType.COMMON_COMMAND, 1);
checkChildCount(configuration, MDOType.COMMON_FORM, 1);
checkChildCount(configuration, MDOType.COMMON_MODULE, 6);
checkChildCount(configuration, MDOType.COMMON_PICTURE, 1);
checkChildCount(configuration, MDOType.COMMON_TEMPLATE, 10);
checkChildCount(configuration, MDOType.CONSTANT, 1);
checkChildCount(configuration, MDOType.DATA_PROCESSOR, 1);
checkChildCount(configuration, MDOType.DEFINED_TYPE, 1);
checkChildCount(configuration, MDOType.DOCUMENT_JOURNAL, 1);
checkChildCount(configuration, MDOType.DOCUMENT_NUMERATOR, 1);
checkChildCount(configuration, MDOType.DOCUMENT, 1);
checkChildCount(configuration, MDOType.ENUM, 1);
checkChildCount(configuration, MDOType.EVENT_SUBSCRIPTION, 1);
checkChildCount(configuration, MDOType.EXCHANGE_PLAN, 1);
checkChildCount(configuration, MDOType.FILTER_CRITERION, 1);
checkChildCount(configuration, MDOType.FUNCTIONAL_OPTION, 1);
checkChildCount(configuration, MDOType.FUNCTIONAL_OPTIONS_PARAMETER, 1);
checkChildCount(configuration, MDOType.HTTP_SERVICE, 1);
checkChildCount(configuration, MDOType.INFORMATION_REGISTER, 2);
checkChildCount(configuration, MDOType.LANGUAGE, 3);
checkChildCount(configuration, MDOType.REPORT, 1);
checkChildCount(configuration, MDOType.ROLE, 1);
checkChildCount(configuration, MDOType.SCHEDULED_JOB, 1);
checkChildCount(configuration, MDOType.SEQUENCE, 1);
checkChildCount(configuration, MDOType.SESSION_PARAMETER, 1);
checkChildCount(configuration, MDOType.SETTINGS_STORAGE, 1);
checkChildCount(configuration, MDOType.STYLE_ITEM, 1);
checkChildCount(configuration, MDOType.STYLE, 1);
checkChildCount(configuration, MDOType.SUBSYSTEM, 2);
checkChildCount(configuration, MDOType.TASK, 1);
checkChildCount(configuration, MDOType.WEB_SERVICE, 1);
checkChildCount(configuration, MDOType.WS_REFERENCE, 1);
checkChildCount(configuration, MDOType.XDTO_PACKAGE, 1);
checkSubsystems(configuration, 5);
checkCommonAttributes(configuration);
}
use of com.github._1c_syntax.mdclasses.common.CompatibilityMode in project bsl-language-server by 1c-syntax.
the class DiagnosticsTest method testCompatibilityMode.
@Test
void testCompatibilityMode() {
// given
documentContext = spy(TestUtils.getDocumentContext(""));
var serverContext = spy(context);
var bslConfiguration = spy(serverContext.getConfiguration());
doReturn(serverContext).when(documentContext).getServerContext();
doReturn(bslConfiguration).when(serverContext).getConfiguration();
configuration.getDiagnosticsOptions().setMode(Mode.ON);
// when-then pairs
doReturn(new CompatibilityMode(3, 10)).when(bslConfiguration).getCompatibilityMode();
assertThat(diagnosticsConfiguration.diagnostics(documentContext)).anyMatch(diagnostic -> diagnostic instanceof DeprecatedFindDiagnostic);
doReturn(new CompatibilityMode(3, 6)).when(bslConfiguration).getCompatibilityMode();
assertThat(diagnosticsConfiguration.diagnostics(documentContext)).anyMatch(diagnostic -> diagnostic instanceof DeprecatedFindDiagnostic);
doReturn(new CompatibilityMode(2, 16)).when(bslConfiguration).getCompatibilityMode();
assertThat(diagnosticsConfiguration.diagnostics(documentContext)).noneMatch(diagnostic -> diagnostic instanceof DeprecatedFindDiagnostic);
}
Aggregations