use of com.github._1c_syntax.mdclasses.ConfigurationExtension 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.ConfigurationExtension in project mdclasses by 1c-syntax.
the class ConfigurationTest method testDesignerExt.
@Test
void testDesignerExt() {
File srcPath = new File("src/test/resources/metadata/original_ext");
Configuration configuration = Configuration.create(srcPath.toPath());
assertThat(configuration).isInstanceOf(ConfigurationExtension.class);
assertThat(CompatibilityMode.compareTo(configuration.getCompatibilityMode(), new CompatibilityMode(3, 16))).isZero();
assertThat(CompatibilityMode.compareTo(configuration.getConfigurationExtensionCompatibilityMode(), new CompatibilityMode(3, 16))).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.CUSTOMIZATION);
assertThat(((ConfigurationExtension) configuration).getNamePrefix()).isEqualTo("Расш_");
assertThat(configuration.getModulesByType()).hasSize(9);
assertThat(configuration.getModulesBySupport()).isEmpty();
assertThat(configuration.getModules()).hasSize(9);
assertThat(configuration.getRoles()).hasSize(2);
assertThat(configuration.getChildren()).hasSize(142);
checkChildCount(configuration, MDOType.CONFIGURATION, 1);
checkChildCount(configuration, MDOType.COMMAND, 2);
checkChildCount(configuration, MDOType.FORM, 12);
checkChildCount(configuration, MDOType.TEMPLATE, 2);
checkChildCount(configuration, MDOType.ATTRIBUTE, 41);
checkChildCount(configuration, MDOType.ACCOUNTING_REGISTER, 2);
checkChildCount(configuration, MDOType.ACCUMULATION_REGISTER, 2);
checkChildCount(configuration, MDOType.BUSINESS_PROCESS, 1);
checkChildCount(configuration, MDOType.CALCULATION_REGISTER, 2);
checkChildCount(configuration, MDOType.CATALOG, 2);
checkChildCount(configuration, MDOType.CHART_OF_ACCOUNTS, 2);
checkChildCount(configuration, MDOType.CHART_OF_CALCULATION_TYPES, 2);
checkChildCount(configuration, MDOType.CHART_OF_CHARACTERISTIC_TYPES, 2);
checkChildCount(configuration, MDOType.COMMAND_GROUP, 2);
checkChildCount(configuration, MDOType.COMMON_ATTRIBUTE, 1);
checkChildCount(configuration, MDOType.COMMON_COMMAND, 2);
checkChildCount(configuration, MDOType.COMMON_FORM, 2);
checkChildCount(configuration, MDOType.COMMON_MODULE, 9);
checkChildCount(configuration, MDOType.COMMON_PICTURE, 2);
checkChildCount(configuration, MDOType.COMMON_TEMPLATE, 2);
checkChildCount(configuration, MDOType.CONSTANT, 2);
checkChildCount(configuration, MDOType.DATA_PROCESSOR, 2);
checkChildCount(configuration, MDOType.DEFINED_TYPE, 1);
checkChildCount(configuration, MDOType.DOCUMENT_JOURNAL, 1);
checkChildCount(configuration, MDOType.DOCUMENT_NUMERATOR, 1);
checkChildCount(configuration, MDOType.DOCUMENT, 2);
checkChildCount(configuration, MDOType.ENUM, 2);
checkChildCount(configuration, MDOType.EVENT_SUBSCRIPTION, 1);
checkChildCount(configuration, MDOType.EXCHANGE_PLAN, 2);
checkChildCount(configuration, MDOType.FILTER_CRITERION, 2);
checkChildCount(configuration, MDOType.FUNCTIONAL_OPTION, 2);
checkChildCount(configuration, MDOType.FUNCTIONAL_OPTIONS_PARAMETER, 2);
checkChildCount(configuration, MDOType.HTTP_SERVICE, 2);
checkChildCount(configuration, MDOType.INFORMATION_REGISTER, 4);
checkChildCount(configuration, MDOType.INTERFACE, 0);
checkChildCount(configuration, MDOType.LANGUAGE, 1);
checkChildCount(configuration, MDOType.REPORT, 2);
checkChildCount(configuration, MDOType.ROLE, 2);
checkChildCount(configuration, MDOType.SCHEDULED_JOB, 1);
checkChildCount(configuration, MDOType.SEQUENCE, 1);
checkChildCount(configuration, MDOType.SESSION_PARAMETER, 2);
checkChildCount(configuration, MDOType.SETTINGS_STORAGE, 1);
checkChildCount(configuration, MDOType.STYLE_ITEM, 2);
checkChildCount(configuration, MDOType.STYLE, 2);
checkChildCount(configuration, MDOType.SUBSYSTEM, 2);
checkChildCount(configuration, MDOType.TASK, 1);
checkChildCount(configuration, MDOType.WEB_SERVICE, 2);
checkChildCount(configuration, MDOType.WS_REFERENCE, 2);
checkChildCount(configuration, MDOType.XDTO_PACKAGE, 2);
assertThat(configuration.getChildrenByMdoRef()).hasSize(142);
assertThat(configuration.getCommonModule("ПростойОбщийМодуль")).isPresent();
assertThat(configuration.getCommonModule("НесуществующийМодуль")).isNotPresent();
assertThat(configuration.getChildren()).filteredOn(mdObjectBase -> mdObjectBase.getObjectBelonging() == ObjectBelonging.ADOPTED).hasSize(78);
assertThat(configuration.getChildren()).filteredOn(mdObjectBase -> mdObjectBase.getObjectBelonging() == ObjectBelonging.OWN).hasSize(64);
}
use of com.github._1c_syntax.mdclasses.ConfigurationExtension in project mdclasses by 1c-syntax.
the class ConfigurationTest method testEmpty.
@Test
void testEmpty() {
Configuration configuration = Configuration.create(null);
assertThat(configuration).isNotNull();
assertThat(configuration.getConfigurationSource()).isEqualTo(ConfigurationSource.EMPTY);
assertThat(configuration.getRootPath()).isNotPresent();
File file = new File("src/test/resources/metadata/edt/src/Constants/Константа1/ManagerModule.bsl");
assertThat(configuration.getModuleType(Absolute.uri(file))).isEqualTo(ModuleType.UNKNOWN);
Configuration configuration2 = Configuration.create();
assertThat(configuration2).isNotNull();
assertThat(configuration2.getConfigurationSource()).isEqualTo(ConfigurationSource.EMPTY);
assertThat(configuration2.getChildren()).isEmpty();
assertThat(configuration2.getRoles()).isEmpty();
Configuration configuration3 = Configuration.createExtension();
assertThat(configuration3).isNotNull();
assertThat(configuration3.getConfigurationSource()).isEqualTo(ConfigurationSource.EMPTY);
assertThat(configuration3.getChildren()).isEmpty();
assertThat(configuration3.getRoles()).isEmpty();
assertThat(((ConfigurationExtension) configuration3).getConfigurationExtensionPurpose()).isEqualTo(ConfigurationExtensionPurpose.UNDEFINED);
}
use of com.github._1c_syntax.mdclasses.ConfigurationExtension in project mdclasses by 1c-syntax.
the class ConfigurationTest method testEDTExt.
@Test
void testEDTExt() {
File srcPath = new File("src/test/resources/metadata/edt_ext");
Configuration configuration = Configuration.create(srcPath.toPath());
assertThat(configuration).isInstanceOf(ConfigurationExtension.class);
assertThat(configuration.getName()).isEqualTo("Расширение");
assertThat(configuration.getUuid()).isEqualTo("6e50eb82-8de4-4aff-ba5b-6b441963a56a");
assertThat(configuration.getConfigurationSource()).isEqualTo(ConfigurationSource.EDT);
assertThat(CompatibilityMode.compareTo(configuration.getCompatibilityMode(), new CompatibilityMode(3, 10))).isZero();
assertThat(CompatibilityMode.compareTo(configuration.getConfigurationExtensionCompatibilityMode(), new CompatibilityMode(3, 14))).isZero();
assertThat(configuration.getScriptVariant()).isEqualTo(ScriptVariant.RUSSIAN);
assertThat(configuration.getDefaultRunMode()).isEqualTo(ApplicationRunMode.MANAGED_APPLICATION);
assertThat(configuration.getDefaultLanguage().getName()).isEqualTo("Русский");
assertThat(configuration.getDataLockControlMode()).isEqualTo(DataLockControlMode.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(((ConfigurationExtension) configuration).getConfigurationExtensionPurpose()).isEqualTo(ConfigurationExtensionPurpose.PATCH);
assertThat(((ConfigurationExtension) configuration).getNamePrefix()).isEqualTo("Расш_");
assertThat(configuration.getModulesByType()).hasSize(9);
assertThat(configuration.getModulesBySupport()).isEmpty();
assertThat(configuration.getModulesByObject()).hasSize(9);
assertThat(configuration.getCommonModules()).hasSize(9);
assertThat(configuration.getLanguages()).hasSize(1);
assertThat(configuration.getRoles()).hasSize(2);
assertThat(configuration.getChildren()).hasSize(142);
checkChildCount(configuration, MDOType.CONFIGURATION, 1);
checkChildCount(configuration, MDOType.COMMAND, 2);
checkChildCount(configuration, MDOType.FORM, 13);
checkChildCount(configuration, MDOType.TEMPLATE, 2);
checkChildCount(configuration, MDOType.ATTRIBUTE, 42);
checkChildCount(configuration, MDOType.ACCOUNTING_REGISTER, 2);
checkChildCount(configuration, MDOType.ACCUMULATION_REGISTER, 2);
checkChildCount(configuration, MDOType.BUSINESS_PROCESS, 1);
checkChildCount(configuration, MDOType.CALCULATION_REGISTER, 2);
checkChildCount(configuration, MDOType.CATALOG, 2);
checkChildCount(configuration, MDOType.CHART_OF_ACCOUNTS, 2);
checkChildCount(configuration, MDOType.CHART_OF_CALCULATION_TYPES, 2);
checkChildCount(configuration, MDOType.CHART_OF_CHARACTERISTIC_TYPES, 2);
checkChildCount(configuration, MDOType.COMMAND_GROUP, 2);
checkChildCount(configuration, MDOType.COMMON_ATTRIBUTE, 1);
checkChildCount(configuration, MDOType.COMMON_COMMAND, 2);
checkChildCount(configuration, MDOType.COMMON_FORM, 2);
checkChildCount(configuration, MDOType.COMMON_MODULE, 9);
checkChildCount(configuration, MDOType.COMMON_PICTURE, 2);
checkChildCount(configuration, MDOType.COMMON_TEMPLATE, 2);
checkChildCount(configuration, MDOType.CONSTANT, 2);
checkChildCount(configuration, MDOType.DATA_PROCESSOR, 2);
checkChildCount(configuration, MDOType.DEFINED_TYPE, 1);
checkChildCount(configuration, MDOType.DOCUMENT_JOURNAL, 1);
checkChildCount(configuration, MDOType.DOCUMENT_NUMERATOR, 1);
checkChildCount(configuration, MDOType.DOCUMENT, 2);
checkChildCount(configuration, MDOType.ENUM, 2);
checkChildCount(configuration, MDOType.EVENT_SUBSCRIPTION, 1);
checkChildCount(configuration, MDOType.EXCHANGE_PLAN, 2);
checkChildCount(configuration, MDOType.FILTER_CRITERION, 2);
checkChildCount(configuration, MDOType.FUNCTIONAL_OPTION, 2);
checkChildCount(configuration, MDOType.FUNCTIONAL_OPTIONS_PARAMETER, 2);
checkChildCount(configuration, MDOType.HTTP_SERVICE, 2);
checkChildCount(configuration, MDOType.INFORMATION_REGISTER, 4);
checkChildCount(configuration, MDOType.LANGUAGE, 1);
checkChildCount(configuration, MDOType.REPORT, 2);
checkChildCount(configuration, MDOType.ROLE, 2);
checkChildCount(configuration, MDOType.SCHEDULED_JOB, 1);
checkChildCount(configuration, MDOType.SEQUENCE, 1);
checkChildCount(configuration, MDOType.SESSION_PARAMETER, 2);
checkChildCount(configuration, MDOType.SETTINGS_STORAGE, 1);
checkChildCount(configuration, MDOType.STYLE_ITEM, 2);
checkChildCount(configuration, MDOType.SUBSYSTEM, 2);
checkChildCount(configuration, MDOType.TASK, 1);
checkChildCount(configuration, MDOType.WEB_SERVICE, 2);
checkChildCount(configuration, MDOType.WS_REFERENCE, 2);
checkChildCount(configuration, MDOType.XDTO_PACKAGE, 2);
assertThat(configuration.getChildrenByMdoRef()).hasSize(142);
assertThat(configuration.getCommonModule("ПростойОбщийМодуль1")).isPresent();
assertThat(configuration.getCommonModule("НесуществующийМодуль")).isNotPresent();
assertThat(configuration.getChildren()).filteredOn(mdObjectBase -> mdObjectBase.getObjectBelonging() == ObjectBelonging.ADOPTED).hasSize(77);
assertThat(configuration.getChildren()).filteredOn(mdObjectBase -> mdObjectBase.getObjectBelonging() == ObjectBelonging.OWN).hasSize(65);
}
Aggregations