Closedown

This commit is contained in:
boccioli_m
2015-06-09 14:53:53 +02:00
parent 24c0e963d5
commit 4b40f6b711

View File

@@ -2,24 +2,10 @@
* Copyright (c) 2014 Paul Scherrer Institute. All rights reserved.
*/
import ch.psi.pshell.dev.Motor;
import ch.psi.pshell.plot.LinePlotBase;
import ch.psi.pshell.plot.LinePlotJFree;
import ch.psi.pshell.plot.LinePlotSeries;
import ch.psi.pshell.plot.Plot;
import ch.psi.pshell.swing.MotorPanel;
import ch.psi.pshell.ui.App;
import ch.psi.utils.swing.MonitoredPanel;
import ch.psi.pshell.ui.Panel;
import ch.psi.utils.swing.SwingUtils;
import ch.psi.wsaf.ApplicationStateException;
import ch.psi.wsaf.Task;
import ch.psi.wsaf.TaskRunMode;
import ch.psi.wsaf.TaskRunningException;
import java.awt.Color;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
@@ -28,18 +14,12 @@ import java.util.HashMap;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.DefaultTableModel;
import org.fusesource.jansi.Ansi;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Paths;
import java.util.Properties;
import java.util.logging.FileHandler;
import java.util.logging.SimpleFormatter;
@@ -96,8 +76,9 @@ public class TestingList extends Panel {
Logger logger = Logger.getLogger("TestsLog");
//these paths are converted to unix or win path according to host OS
private String TESTS_DEFAULT_DIR = FilenameUtils.separatorsToSystem("/home/script/tests/production");
private String LOG_DEFAULT_DIR = FilenameUtils.separatorsToSystem("/home/script/tests/log/TestsLog.txt");
private String TESTS_DEVICES_DEFAULT_DIR = FilenameUtils.separatorsToSystem("/home/script/tests/production/");
private String TESTS_TESTS_DEFAULT_DIR = FilenameUtils.separatorsToSystem("/home/script/tests/production/");
private String TESTS_LOG_DEFAULT_DIR = FilenameUtils.separatorsToSystem("/home/script/tests/log/TestsLog.txt");
//table1 columns indexes
private int COL_CHECK = 0;
private int COL_TIME = 1;
@@ -109,7 +90,7 @@ public class TestingList extends Panel {
try {
FileHandler fh;
// This block configure the logger with handler and formatter
fh = new FileHandler(new java.io.File( "." ).getCanonicalPath() + LOG_DEFAULT_DIR);
fh = new FileHandler(new java.io.File( "." ).getCanonicalPath() + TESTS_LOG_DEFAULT_DIR);
logger.addHandler(fh);
SimpleFormatter formatter = new SimpleFormatter();
fh.setFormatter(formatter);
@@ -395,21 +376,32 @@ public class TestingList extends Panel {
public void loadTests() throws FileNotFoundException, IOException{
Properties prop = new Properties();
String fileName = new java.io.File( "." ).getCanonicalPath()+ TESTS_DEFAULT_DIR;
String fileName = new java.io.File( "." ).getCanonicalPath()+ TESTS_DEVICES_DEFAULT_DIR;
this.jTextField1.setText(fileName + "\n");
File folder = new File(fileName);
File testsFolder = null;
String sTestName;
//search of devices and their tests
File[] listOfFiles = folder.listFiles();
for (File listOfFile : listOfFiles) {
if (listOfFile.isFile()) {
this.jTextField1.append("File " + listOfFile.getName());
} else if (listOfFile.isDirectory()) {
this.jTextField1.append("Directory " + listOfFile.getName());
File configFile = new File(listOfFile.getPath() + "\\.config");
File configFile = new File(listOfFile.getPath() + FilenameUtils.separatorsToSystem("/.config"));
if(configFile.exists() && !configFile.isDirectory()){
InputStream is = new FileInputStream(configFile);
prop.load(is);
sTestName = new java.io.File( "." ).getCanonicalPath()+ TESTS_TESTS_DEFAULT_DIR + prop.getProperty("tests");
//config of device was loaded. now load the config of each test belonging to the device
testsFolder = new File(sTestName);
File[] listOfTests = testsFolder.listFiles();
for (File listOfTest : listOfTests) {
if (listOfTest.isDirectory()) {
this.jTextField1.append("\nTest " + listOfTest.getName());
}
}
addToTable(prop.getProperty("name"), prop.getProperty("description"), prop.getProperty("tests"));
this.jTextField1.append(prop.getProperty("name"));