no message

This commit is contained in:
2024-09-24 23:34:41 +03:00
parent 33e6abfbf5
commit bb671c5166
12 changed files with 40 additions and 36 deletions

19
.idea/workspace.xml generated
View File

@@ -8,12 +8,17 @@
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="e42177c3-2328-4b27-8a01-35779b2beb99" name="Default Changelist" comment=""> <list default="true" id="e42177c3-2328-4b27-8a01-35779b2beb99" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Repository/Server/ServerCode.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Repository/Server/ServerCode.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/properties" beforeDir="false" afterPath="$PROJECT_DIR$/properties" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/TestingSystem/Common/TestingServer.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/Common/TestingServer.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/Common/Constants.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Common/Constants.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/TestingSystem/SAPFOR/SapforConfiguration/SapforConfigurationDBTable.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/SAPFOR/SapforConfiguration/SapforConfigurationDBTable.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/Common/Global.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Common/Global.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/TestingSystem/SAPFOR/SapforPackage/SapforPackage.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/SAPFOR/SapforPackage/SapforPackage.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/Common/Utils/Utils.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Common/Utils/Utils.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/StartSelectedSAPFORConfigurations.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/StartSelectedSAPFORConfigurations.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/Repository/BugReport/BugReportInterface.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Repository/BugReport/BugReportInterface.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/TestPass.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/TestPass.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/Repository/RepositoryServer.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Repository/RepositoryServer.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Repository/Server/ComponentsServer.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Repository/Server/ComponentsServer.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/TestingSystem/SAPFOR/SapforTestingPlanner.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/SAPFOR/SapforTestingPlanner.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/AppendBugReportField.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/AppendBugReportField.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/PublishBugReport.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/PublishBugReport.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/UpdateBugReportField.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/UpdateBugReportField.java" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -112,10 +117,10 @@
<recent name="C:\Users\misha\Documents\visual_sapfor_2023\libs" /> <recent name="C:\Users\misha\Documents\visual_sapfor_2023\libs" />
</key> </key>
<key name="MoveMembersDialog.RECENTS_KEY"> <key name="MoveMembersDialog.RECENTS_KEY">
<recent name="Common.Constants" />
<recent name="Common.Utils.Utils" /> <recent name="Common.Utils.Utils" />
<recent name="Repository.Component.Sapfor.Sapfor" /> <recent name="Repository.Component.Sapfor.Sapfor" />
<recent name="TestingSystem.Group.GroupsDBTable" /> <recent name="TestingSystem.Group.GroupsDBTable" />
<recent name="Common.Constants" />
<recent name="SapforTestingSystem.SapforTask.SapforTask" /> <recent name="SapforTestingSystem.SapforTask.SapforTask" />
</key> </key>
<key name="MoveFile.RECENT_KEYS"> <key name="MoveFile.RECENT_KEYS">

View File

@@ -37,6 +37,6 @@
"TestingKernels": 64, "TestingKernels": 64,
"AutoCheckTesting": true, "AutoCheckTesting": true,
"CheckTestingIntervalSeconds": 10, "CheckTestingIntervalSeconds": 10,
"EmailOnTestingProgress": false, "EmailOnTestingProgress": true,
"eraseTestingWorkspaces": true "eraseTestingWorkspaces": true
} }

View File

@@ -8,7 +8,7 @@ public class Constants {
public static final int Nan = -1; public static final int Nan = -1;
public static final int planner_version = 3; public static final int planner_version = 3;
//-- //--
//SVN //SVN vmk-post@yandex.ru
public static final String REPOSITORY_AUTHENTICATION = "--username dvmhuser --password dvmh2013 --non-interactive"; public static final String REPOSITORY_AUTHENTICATION = "--username dvmhuser --password dvmh2013 --non-interactive";
public static final String DVM_REPOSITORY = "http://svn.dvm-system.org/svn/dvmhrepo/dvm"; public static final String DVM_REPOSITORY = "http://svn.dvm-system.org/svn/dvmhrepo/dvm";
public static final String SAPFOR_REPOSITORY = "http://svn.dvm-system.org/svn/dvmhrepo/sapfor"; public static final String SAPFOR_REPOSITORY = "http://svn.dvm-system.org/svn/dvmhrepo/sapfor";
@@ -475,4 +475,9 @@ public class Constants {
}; };
//все запретные символы через пробел. //все запретные символы через пробел.
public static String all_forbidden_characters_string = ""; public static String all_forbidden_characters_string = "";
public static Vector<String> admins_mails = new Vector_<>(
"vmk-post@yandex.ru",
"79854210702@ya.ru"
);
} }

View File

@@ -56,10 +56,6 @@ public class Global {
public static MessagesServer messagesServer = null; public static MessagesServer messagesServer = null;
//-------------------------------------------------- //--------------------------------------------------
public static GlobalDatabase db = null; public static GlobalDatabase db = null;
public static String[] admins_mails = new String[]{
"vmk-post@yandex.ru",
"79854210702@ya.ru"
};
//- //-
public static String Home; public static String Home;
public static File ComponentsDirectory; public static File ComponentsDirectory;

View File

@@ -7,7 +7,6 @@ import GlobalData.Settings.SettingName;
import GlobalData.Tasks.TaskState; import GlobalData.Tasks.TaskState;
import ProjectData.Files.DBProjectFile; import ProjectData.Files.DBProjectFile;
import ProjectData.Project.db_project_info; import ProjectData.Project.db_project_info;
import Visual_DVM_2021.Passes.PassCode_2021;
import Visual_DVM_2021.Passes.PassException; import Visual_DVM_2021.Passes.PassException;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.GsonBuilder; import com.google.gson.GsonBuilder;
@@ -1312,5 +1311,13 @@ public class Utils {
} }
return ids; return ids;
} }
public static void addDefaultMails(Vector<String> mails) {
if (!mails.contains(Constants.MailAddress))
mails.add(Constants.MailAddress);
for (String mail : Constants.admins_mails) {
if (!mails.contains(mail))
mails.add(mail);
}
}
} }

View File

@@ -1,4 +1,5 @@
package Repository.BugReport; package Repository.BugReport;
import Common.Constants;
import Common.Current; import Common.Current;
import Common.Global; import Common.Global;
import Common.Utils.TextLog; import Common.Utils.TextLog;
@@ -64,20 +65,14 @@ public class BugReportInterface {
public static String getMailTitlePrefix(BugReport object) { public static String getMailTitlePrefix(BugReport object) {
return "Ошибка " + Utils.Brackets(object.id) + ", автор " + Utils.Brackets(object.sender_name) + " : "; return "Ошибка " + Utils.Brackets(object.id) + ", автор " + Utils.Brackets(object.sender_name) + " : ";
} }
public static Vector<String> getRecipients(BugReport object, boolean add_defaults) { public static Vector<String> getRecipients(BugReport object) {
Vector<String> res = new Vector<>(); Vector<String> res = new Vector<>();
String[] data = object.targets.split("\n"); String[] data = object.targets.split("\n");
for (String a : data) for (String a : data)
if (a.length() > 0) if (a.length() > 0)
res.add(a); res.add(a);
if (add_defaults) {
// res.add(Email.full_address); //служебный ящик
//добавить админов если их там нет.
Arrays.stream(Global.admins_mails).filter(adm -> !res.contains(adm)).forEach(res::add);
// и себя
if (!res.contains(Current.getAccount().email)) if (!res.contains(Current.getAccount().email))
res.add(Current.getAccount().email); res.add(Current.getAccount().email);
}
return res; return res;
} }
public static File[] getAttachements(BugReport object) { public static File[] getAttachements(BugReport object) {

View File

@@ -105,9 +105,8 @@ public abstract class RepositoryServer<D extends Database> {
Utils.unpackFile(message_in.files.get(aName), f); Utils.unpackFile(message_in.files.get(aName), f);
innerFiles.put(aName, f); innerFiles.put(aName, f);
} }
Vector<String> targets_ = new Vector<>(); Vector<String> targets_ = new Vector<>(message_in.targets);
targets_.add(Constants.MailAddress); //себе. Utils.addDefaultMails(targets_);
targets_.addAll(message_in.targets);
//------------------------------ //------------------------------
Session session = Session.getDefaultInstance(props, Session session = Session.getDefaultInstance(props,
new Authenticator() { new Authenticator() {

View File

@@ -1,4 +1,5 @@
package Repository.Server; package Repository.Server;
import Common.Constants;
import Common.Database.DBObject; import Common.Database.DBObject;
import Common.Global; import Common.Global;
import Common.Utils.Utils; import Common.Utils.Utils;
@@ -61,11 +62,10 @@ public class ComponentsServer extends RepositoryServer<BugReportsDatabase> {
@Override @Override
public void StartAction() throws Exception { public void StartAction() throws Exception {
if (Global.properties.EmailAdminsOnStart) { if (Global.properties.EmailAdminsOnStart) {
Vector<String> targets = new Vector<>(Arrays.asList(Global.admins_mails));
EmailMessage message = new EmailMessage( EmailMessage message = new EmailMessage(
"Сервер Sapfor запущен", "Сервер Sapfor запущен",
new Date().toString(), new Date().toString(),
targets new Vector<>()
); );
Email(message); Email(message);
} }
@@ -405,12 +405,10 @@ public class ComponentsServer extends RepositoryServer<BugReportsDatabase> {
} }
//bonus backup //bonus backup
if (rightNow.get(Calendar.DAY_OF_WEEK) == Calendar.MONDAY) { if (rightNow.get(Calendar.DAY_OF_WEEK) == Calendar.MONDAY) {
Vector<String> targets = new Vector<>();
targets.addAll(Arrays.asList(Global.admins_mails));
EmailMessage message = new EmailMessage( EmailMessage message = new EmailMessage(
"db backup", "db backup",
"копия баз данных журнала ошибок", "копия баз данных журнала ошибок",
targets new Vector<>()
); );
Email(message, db.getFile()); Email(message, db.getFile());
} }

View File

@@ -269,11 +269,10 @@ public class SapforTestingPlanner extends TestingPlanner<SapforPackage> {
String version_s = (version == Constants.Nan) ? "?" : String.valueOf(version); String version_s = (version == Constants.Nan) ? "?" : String.valueOf(version);
String status = done ? "Успешно" : "С ошибками"; String status = done ? "Успешно" : "С ошибками";
//- //-
Vector<String> targets = new Vector<>(Arrays.asList(Global.admins_mails));
EmailMessage message = new EmailMessage( EmailMessage message = new EmailMessage(
"Выполнена сборка системы SAPFOR", "Выполнена сборка системы SAPFOR",
"Версия: " + version_s + "\n" + "Статус: " + status, "Версия: " + version_s + "\n" + "Статус: " + status,
targets new Vector<>()
); );
//- //-
ServerCommand(ServerCode.Email, "", message); ServerCommand(ServerCode.Email, "", message);

View File

@@ -86,7 +86,7 @@ public class AppendBugReportField extends ComponentsRepositoryPass<BugReport> {
new EmailMessage( new EmailMessage(
message_header + " " + Utils.Brackets(Current.getAccount().name), message_header + " " + Utils.Brackets(Current.getAccount().name),
message_text, message_text,
BugReportInterface.getRecipients(target,true) BugReportInterface.getRecipients(target)
) )
); );
} }

View File

@@ -56,7 +56,7 @@ public class PublishBugReport extends Pass_2021<BugReport> {
//3- рассылка //3- рассылка
EmailMessage message = new EmailMessage("Обнаружена ошибка " + Utils.Brackets(target.id), EmailMessage message = new EmailMessage("Обнаружена ошибка " + Utils.Brackets(target.id),
BugReportInterface.getNewMailText(target), BugReportInterface.getNewMailText(target),
BugReportInterface.getRecipients(target, true)); BugReportInterface.getRecipients(target));
if (!target.project_version.isEmpty()) { if (!target.project_version.isEmpty()) {
message.addAttachement(BugReportInterface.getArchiveFile(target)); message.addAttachement(BugReportInterface.getArchiveFile(target));
//со скринами будет небольшой трабл. потому что теретически возможна ситуация, //со скринами будет небольшой трабл. потому что теретически возможна ситуация,

View File

@@ -126,7 +126,7 @@ public class UpdateBugReportField extends ComponentsRepositoryPass<BugReport> {
passes.get(PassCode_2021.Email).Do( passes.get(PassCode_2021.Email).Do(
new EmailMessage(message_header, new EmailMessage(message_header,
message_text, message_text,
BugReportInterface.getRecipients(target, true)) BugReportInterface.getRecipients(target))
); );
} }
} }