use of com.github._1c_syntax.mdclasses.Configuration in project bsl-language-server by 1c-syntax.
the class CommonModuleNameGlobalDiagnosticTest method getDocumentContextFromFile.
@SneakyThrows
void getDocumentContextFromFile() {
Path path = Absolute.path(PATH_TO_METADATA);
Path testFile = Paths.get(PATH_TO_MODULE_FILE).toAbsolutePath();
initServerContext(path);
var configuration = context.getConfiguration();
documentContext = spy(TestUtils.getDocumentContext(testFile.toUri(), FileUtils.readFileToString(testFile.toFile(), StandardCharsets.UTF_8), context));
module = spy((MDCommonModule) configuration.getModulesByObject().get(documentContext.getUri()));
}
use of com.github._1c_syntax.mdclasses.Configuration in project bsl-language-server by 1c-syntax.
the class CommonModuleNameServerCallDiagnosticTest method getDocumentContextFromFile.
@SneakyThrows
void getDocumentContextFromFile() {
Path path = Absolute.path(PATH_TO_METADATA);
Path testFile = Paths.get(PATH_TO_MODULE_FILE).toAbsolutePath();
initServerContext(path);
var configuration = context.getConfiguration();
documentContext = spy(TestUtils.getDocumentContext(testFile.toUri(), FileUtils.readFileToString(testFile.toFile(), StandardCharsets.UTF_8), context));
module = spy((MDCommonModule) configuration.getModulesByObject().get(documentContext.getUri()));
}
use of com.github._1c_syntax.mdclasses.Configuration in project bsl-language-server by 1c-syntax.
the class GenerateStandardRegionsSupplier method getRegionsLanguage.
private ScriptVariant getRegionsLanguage(DocumentContext documentContext, FileType fileType) {
ScriptVariant regionsLanguage;
Configuration configuration = documentContext.getServerContext().getConfiguration();
if (configuration.getConfigurationSource() == ConfigurationSource.EMPTY || fileType == FileType.OS) {
regionsLanguage = getScriptVariantFromConfigLanguage();
} else {
regionsLanguage = documentContext.getServerContext().getConfiguration().getScriptVariant();
}
return regionsLanguage;
}
use of com.github._1c_syntax.mdclasses.Configuration 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.Configuration 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();
}
Aggregations