use of com.github._1c_syntax.mdclasses.Configuration in project mdclasses by 1c-syntax.
the class ConfigurationTest method testErrors.
@Test
void testErrors() {
Path srcPath = Paths.get("src/test/resources/metadata");
Configuration configuration = Configuration.create(srcPath);
assertThat(configuration).isNotNull();
File file = new File("src/test/resources/metadata/Module.os");
assertThat(configuration.getModuleType(Absolute.uri(file))).isEqualTo(ModuleType.UNKNOWN);
}
use of com.github._1c_syntax.mdclasses.Configuration 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);
}
use of com.github._1c_syntax.mdclasses.Configuration in project mdclasses by 1c-syntax.
the class MDOUtils method moduleTypesForMDOTypes.
private Map<MDOType, Set<ModuleType>> moduleTypesForMDOTypes() {
Map<MDOType, Set<ModuleType>> result = new EnumMap<>(MDOType.class);
for (MDOType mdoType : MDOType.values()) {
Set<ModuleType> types = new HashSet<>();
switch(mdoType) {
case INTEGRATION_SERVICE:
types.add(ModuleType.IntegrationServiceModule);
break;
case BOT:
types.add(ModuleType.BotModule);
break;
case ACCOUNTING_REGISTER:
case ACCUMULATION_REGISTER:
case CALCULATION_REGISTER:
case INFORMATION_REGISTER:
types.add(ModuleType.ManagerModule);
types.add(ModuleType.RecordSetModule);
break;
case BUSINESS_PROCESS:
case CATALOG:
case CHART_OF_ACCOUNTS:
case CHART_OF_CALCULATION_TYPES:
case CHART_OF_CHARACTERISTIC_TYPES:
case DATA_PROCESSOR:
case DOCUMENT:
case EXCHANGE_PLAN:
case REPORT:
case TASK:
types.add(ModuleType.ManagerModule);
types.add(ModuleType.ObjectModule);
break;
case COMMAND_GROUP:
case COMMON_ATTRIBUTE:
case COMMON_PICTURE:
case COMMON_TEMPLATE:
case DEFINED_TYPE:
case DOCUMENT_NUMERATOR:
case EVENT_SUBSCRIPTION:
case FUNCTIONAL_OPTION:
case ROLE:
case SCHEDULED_JOB:
case SESSION_PARAMETER:
case STYLE_ITEM:
case STYLE:
case SUBSYSTEM:
case WS_REFERENCE:
case XDTO_PACKAGE:
break;
case COMMON_COMMAND:
case COMMAND:
types.add(ModuleType.CommandModule);
break;
case COMMON_FORM:
case FORM:
types.add(ModuleType.FormModule);
break;
case COMMON_MODULE:
types.add(ModuleType.CommonModule);
break;
case CONFIGURATION:
types.add(ModuleType.ApplicationModule);
types.add(ModuleType.SessionModule);
types.add(ModuleType.ExternalConnectionModule);
types.add(ModuleType.ManagedApplicationModule);
types.add(ModuleType.OrdinaryApplicationModule);
break;
case CONSTANT:
types.add(ModuleType.ValueManagerModule);
break;
case DOCUMENT_JOURNAL:
case ENUM:
case FILTER_CRITERION:
case SETTINGS_STORAGE:
types.add(ModuleType.ManagerModule);
break;
case HTTP_SERVICE:
types.add(ModuleType.HTTPServiceModule);
break;
case SEQUENCE:
types.add(ModuleType.RecordSetModule);
break;
case WEB_SERVICE:
types.add(ModuleType.WEBServiceModule);
break;
default:
}
result.put(mdoType, types);
}
return result;
}
use of com.github._1c_syntax.mdclasses.Configuration in project mdclasses by 1c-syntax.
the class MDConfigurationTest method testEDTEng.
@Test
void testEDTEng() {
var mdo = getMDObjectEDTEn("Configuration/Configuration.mdo");
checkBaseField(mdo, MDConfiguration.class, "Configuration", "04c0322d-92da-49ab-87e5-82c8dcd50888");
checkNoChildren(mdo);
assertThat(((AbstractMDObjectBSL) mdo).getModules()).isEmpty();
var configuration = (MDConfiguration) mdo;
assertThat(CompatibilityMode.compareTo(configuration.getCompatibilityMode(), new CompatibilityMode(3, 14))).isZero();
assertThat(CompatibilityMode.compareTo(configuration.getConfigurationExtensionCompatibilityMode(), new CompatibilityMode(3, 14))).isZero();
assertThat(configuration.getDataLockControlMode()).isEqualTo(DataLockControlMode.AUTOMATIC_AND_MANAGED);
assertThat(configuration.getDefaultLanguage().isRight()).isTrue();
assertThat(configuration.getDefaultLanguage().get().getName()).isEqualTo("English");
assertThat(configuration.getDefaultRunMode()).isEqualTo("ManagedApplication");
assertThat(configuration.getModalityUseMode()).isEqualTo(UseMode.DONT_USE);
assertThat(configuration.getObjectAutonumerationMode()).isEqualTo("NotAutoFree");
assertThat(configuration.getScriptVariant()).isEqualTo(ScriptVariant.ENGLISH);
assertThat(configuration.getSynchronousExtensionAndAddInCallUseMode()).isEqualTo(UseMode.USE);
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(3).allMatch(Either::isRight);
}
use of com.github._1c_syntax.mdclasses.Configuration in project mdclasses by 1c-syntax.
the class MDConfigurationTest method testDesigner.
@Override
@Test
void testDesigner() {
var mdo = getMDObjectDesigner("Configuration.xml");
checkBaseField(mdo, MDConfiguration.class, "Конфигурация", "46c7c1d0-b04d-4295-9b04-ae3207c18d29");
checkNoChildren(mdo);
checkModules(((AbstractMDObjectBSL) mdo).getModules(), 3, "Ext", 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.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.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.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);
checkCommonAttributes(configuration);
}
Aggregations