убрал наличие бд в тестах.

This commit is contained in:
2023-11-26 00:30:43 +03:00
parent 93ccdc3522
commit 253de8526a
11 changed files with 165 additions and 146 deletions

View File

@@ -122,11 +122,9 @@ public class DBProjectFile extends ProjectFile {
//для совместимости пусть палки будут от винды всегда.
name = path.substring(father.Home.getAbsolutePath().length() + 1).replace('/', '\\');
}
public boolean isMakefile() {
return file.getName().equalsIgnoreCase("makefile");
}
public boolean isActiveProgram() {
return fileType.equals(FileType.program)
&& languageName.equals(father.languageName) && !state.equals(FileState.Excluded);
@@ -393,9 +391,7 @@ public class DBProjectFile extends ProjectFile {
public String getQObjectName() {
return Utils.DQuotes(getUnixName() + ".o");
}
public String getQSourceName() {
return Utils.DQuotes(getUnixName());
}
@Override
public String toString() {
return name;
@@ -473,18 +469,5 @@ public class DBProjectFile extends ProjectFile {
return res;
}
//---
public String getStyleOptions() {
if (languageName == LanguageName.fortran) {
switch (style) {
case fixed:
case extended:
return "-FI";
case free:
return "-f90";
case none:
break;
}
}
return "";
}
}

View File

@@ -24,7 +24,10 @@ public class ProjectFile extends DBObject {
public Object getPK() {
return file.getName();
}
public void AutoDetectProperties() {
public void AutoDetectProperties(){
AutoDetectProperties(file.getName());
}
public void AutoDetectProperties(String name_in) {
//проверка запретных имен.
String[] forbiddenNames = new String[]{
Constants.INTERRUPT,
@@ -39,13 +42,13 @@ public class ProjectFile extends DBObject {
"Makefile"
};
for (String forbidden : forbiddenNames) {
if (file.getName().equalsIgnoreCase(forbidden)) {
if (name_in.equalsIgnoreCase(forbidden)) {
fileType = FileType.forbidden;
return;
}
}
//-
switch (Utils.getExtension(file)) {
switch (Utils.getExtensionByName(name_in)) {
case "f":
case "fdv":
case "for":
@@ -84,7 +87,7 @@ public class ProjectFile extends DBObject {
fileType = FileType.forbidden;
break;
case "":
if (Utils.isDigit(file.getName())) {
if (Utils.isDigit(name_in)) {
fileType = FileType.forbidden;
} else {
state = FileState.Excluded;
@@ -133,4 +136,21 @@ public class ProjectFile extends DBObject {
public String toString() {
return file.getName();
}
public String getQSourceName() {
return Utils.DQuotes(getUnixName());
}
public String getStyleOptions() {
if (languageName == LanguageName.fortran) {
switch (style) {
case fixed:
case extended:
return "-FI";
case free:
return "-f90";
case none:
break;
}
}
return "";
}
}

View File

@@ -32,7 +32,6 @@ import ProjectData.SapforData.Regions.RegionsSet;
import ProjectData.SapforData.Variants.ParallelVariant;
import ProjectData.SapforData.Variants.VariantsSet;
import TestingSystem.Common.Test.ProjectFiles_json;
import TestingSystem.Common.Test.Test;
import Visual_DVM_2021.Passes.PassCode_2021;
import Visual_DVM_2021.Passes.PassException;
import com.mxgraph.swing.mxGraphComponent;
@@ -210,26 +209,6 @@ public class db_project_info extends DBObject {
ExtractStoredInfo(stored_info);
db.Disconnect();
}
//для запуска тестов.
public db_project_info(Test test) throws Exception {
Home = test.getServerPath();
//-
CheckVisualiserDirectories();
db = new ProjectDatabase(this);
db.Connect();
db.CreateAllTables();
db.prepareTablesStatements();
db.Synchronize(); //Отличие от обычного. тут сразу же и синхрон файлов.
db_project_info stored_info = db.LoadOnlyProjectInfo();
if (stored_info == null) {
name = Home.getName();
description = "";
creationDate = Utils.getDateNumber(); //----------------------------------------------------------------------------->>>
db.Insert(this);
} else
ExtractStoredInfo(stored_info);
db.Disconnect();
}
//-
public void Open() throws Exception {
db.Connect();
@@ -1557,16 +1536,4 @@ public class db_project_info extends DBObject {
}
return true;
}
public void clearData() throws Exception {
File project_data = new File(Home, Constants.data);
File[] files = project_data.listFiles();
if (files != null) {
for (File file : files) {
System.out.println(file.getAbsolutePath());
if (!file.getName().equalsIgnoreCase("new_project_base.sqlite")) {
Utils.forceDeleteWithCheck(file);
}
}
}
}
}