fix. в методе keepnewFiles была индийская сортировка. вместо Long.compare было приведение к инту и сравнение. что вызывало исключение.
This commit is contained in:
@@ -1013,13 +1013,14 @@ public class Utils {
|
||||
public static int fromBoolean(boolean flag) {
|
||||
return flag ? 1 : 0;
|
||||
}
|
||||
|
||||
public static void keepNewFiles(File directory, int count) throws Exception {
|
||||
if (count > 0) {
|
||||
File[] old_ = directory.listFiles(pathname -> pathname.isFile());
|
||||
if (old_ != null) {
|
||||
Vector<File> old = new Vector<>();
|
||||
Collections.addAll(old, old_);
|
||||
old.sort((o1, o2) -> (int) (o2.lastModified() - o1.lastModified()));
|
||||
old.sort((o1, o2) -> Long.compare(o2.lastModified(), o1.lastModified()));
|
||||
for (int i = count - 1; i < old.size(); ++i) {
|
||||
File file = old.get(i);
|
||||
System.out.println(file.getName() + ":" + file.lastModified());
|
||||
|
||||
@@ -62,7 +62,7 @@ public class Visualiser extends Component {
|
||||
//http://www.seostella.com/ru/article/2012/02/05/formatirovanie-daty-v-java.html
|
||||
@Override
|
||||
public void GetVersionInfo() {
|
||||
version = 1027;
|
||||
version = 1028;
|
||||
String pattern = "MMM dd yyyy HH:mm:ss";
|
||||
DateFormat df = new SimpleDateFormat(pattern, Locale.ENGLISH);
|
||||
date_text = df.format(getClassBuildTime());
|
||||
|
||||
@@ -286,8 +286,6 @@ public abstract class RepositoryServer<D extends Database> {
|
||||
case GetObjectsCopiesByPK:
|
||||
Print("Получить список копий объектов по ключам");
|
||||
p = (Pair<Class, Object>) request.object;
|
||||
System.out.println(p.getKey());
|
||||
System.out.println(p.getValue());
|
||||
response = new ServerExchangeUnit_2021(ServerCode.OK);
|
||||
response.object = db.getObjectsCopies(p.getKey(), (Vector<Object>) p.getValue());
|
||||
break;
|
||||
|
||||
@@ -55,6 +55,7 @@ public class SapforTasksPackage extends nDBObject {
|
||||
sapfor_process_name = p.sapfor_process_name;
|
||||
state = p.state;
|
||||
needsEmail = p.needsEmail;
|
||||
summary = p.summary;
|
||||
}
|
||||
//---
|
||||
@Description("IGNORE")
|
||||
|
||||
@@ -44,9 +44,6 @@ public class SapforTasksPackageSupervisor {
|
||||
LinkedHashMap<String, Group> groups = new LinkedHashMap<>();
|
||||
//--
|
||||
System.out.println(sapforTasksPackage.id + " — TestsSynchronize");
|
||||
for (String test_id : testsIds) {
|
||||
System.out.println(Utils.Brackets(test_id));
|
||||
}
|
||||
for (Object o : tests_) {
|
||||
Test test = (Test) o;
|
||||
tests.put(test.id, test);
|
||||
@@ -54,20 +51,42 @@ public class SapforTasksPackageSupervisor {
|
||||
groupsIds.add(test.group_id);
|
||||
}
|
||||
//--
|
||||
Vector<Object> groups_ = (Vector<Object>) planner.ServerCommand(ServerCode.GetObjectsCopiesByPK, "", new Pair<>(Group.class, groupsIds));
|
||||
|
||||
for (Object o : groups_) {
|
||||
Group group = (Group) o;
|
||||
groups.put(group.id, group);
|
||||
}
|
||||
//--
|
||||
for (Object o : configurations_) {
|
||||
SapforConfiguration sapforConfiguration = (SapforConfiguration) o;
|
||||
configurations.put(sapforConfiguration.id, sapforConfiguration);
|
||||
}
|
||||
//---
|
||||
|
||||
|
||||
Vector<String> badTests = new Vector<>();
|
||||
for (String testId : testsIds)
|
||||
if (!tests.containsKey(testId))
|
||||
badTests.add(testId);
|
||||
//--
|
||||
Vector<String> badConfigurations = new Vector<>();
|
||||
for (String configurationId : configurationsIds)
|
||||
if (!configurations.containsKey(configurationId))
|
||||
badConfigurations.add(configurationId);
|
||||
//--
|
||||
File sapfor_src = new File(sapforTasksPackage.sapfor_drv);
|
||||
//--
|
||||
Vector<String> notFound = new Vector<>();
|
||||
if (!badTests.isEmpty())
|
||||
notFound.add("Несуществующие тесты: " + String.join("\n", badTests));
|
||||
if (!badConfigurations.isEmpty())
|
||||
notFound.add("Несуществующие конфигурации: " + String.join("\n", badConfigurations));
|
||||
if (!sapfor_src.exists()) {
|
||||
notFound.add("Несуществующий SAPFOR: " + Utils.Brackets(sapfor_src.getAbsolutePath()));
|
||||
}
|
||||
if (!notFound.isEmpty()) {
|
||||
sapforTasksPackage.summary = String.join("\n", notFound);
|
||||
System.out.println(sapforTasksPackage.summary);
|
||||
sapforTasksPackage.state = TasksPackageState.Aborted;
|
||||
return;
|
||||
}
|
||||
Vector<Object> groups_ = (Vector<Object>) planner.ServerCommand(ServerCode.GetObjectsCopiesByPK, "", new Pair<>(Group.class, groupsIds));
|
||||
for (Object o : groups_) {
|
||||
Group group = (Group) o;
|
||||
groups.put(group.id, group);
|
||||
}
|
||||
//--
|
||||
SapforTasksPackage_json package_json = new SapforTasksPackage_json();
|
||||
package_json.kernels = sapforTasksPackage.kernels;
|
||||
@@ -82,6 +101,7 @@ public class SapforTasksPackageSupervisor {
|
||||
Utils.CheckAndCleanDirectory(packageWorkspace);
|
||||
sapforTasksPackage.workspace = packageWorkspace.getAbsolutePath();
|
||||
//копирование тестов по конфигурациям.
|
||||
int actual_tasks_count = 0;
|
||||
for (String configuration_id : configurationsIds) {
|
||||
SapforConfiguration configuration = configurations.get(configuration_id);
|
||||
//--
|
||||
@@ -100,11 +120,13 @@ public class SapforTasksPackageSupervisor {
|
||||
File test_root = new File(configurationWorkspace, test.description);
|
||||
Utils.CheckAndCleanDirectory(test_root);
|
||||
FileUtils.copyDirectory(new File(Global.TestsDirectory, test.id), test_root);
|
||||
actual_tasks_count++;
|
||||
}
|
||||
}
|
||||
sapforTasksPackage.tasksCount = actual_tasks_count;
|
||||
//копирование SAPFOR
|
||||
File sapforFile = new File(sapforTasksPackage.workspace, Utils.getDateName("SAPFOR_F"));
|
||||
FileUtils.copyFile(new File(sapforTasksPackage.sapfor_drv), sapforFile);
|
||||
FileUtils.copyFile(sapfor_src, sapforFile);
|
||||
if (!sapforFile.setExecutable(true))
|
||||
throw new Exception("Не удалось сделать файл " + sapforFile.getName() + " исполняемым!");
|
||||
sapforTasksPackage.sapfor_process_name = package_json.sapfor_drv = sapforFile.getName();
|
||||
|
||||
@@ -216,9 +216,6 @@ public class TestingPlanner {
|
||||
switch (sapforTasksPackage.state) {
|
||||
case RunningExecution:
|
||||
case Aborted:
|
||||
message = new EmailMessage();
|
||||
message.subject = "Состояние пакета задач SAPFOR" + Utils.Brackets(sapforTasksPackage.id) + " изменилось на " + Utils.Brackets(sapforTasksPackage.state.getDescription());
|
||||
break;
|
||||
case Done:
|
||||
//результаты.
|
||||
message = new EmailMessage();
|
||||
|
||||
Reference in New Issue
Block a user