Closedown
This commit is contained in:
@@ -225,74 +225,80 @@ public class EditTestingList extends javax.swing.JPanel {
|
||||
* @throws IOException
|
||||
*/
|
||||
public void loadTests() {
|
||||
Properties propDevice = new Properties();
|
||||
Properties propTest = new Properties();
|
||||
//String fileName = TESTS_DEVICES_DEFAULT_DIR;
|
||||
//File folder = new File(fileName);
|
||||
File testsFolder = null;
|
||||
String sTestName;
|
||||
int iCounter = 0;
|
||||
try {
|
||||
Properties propDevice = new Properties();
|
||||
Properties propTest = new Properties();
|
||||
//String fileName = TESTS_DEVICES_DEFAULT_DIR;
|
||||
//File folder = new File(fileName);
|
||||
TestingList testingList = new TestingList();
|
||||
|
||||
File testsFolder = null;
|
||||
String sTestName;
|
||||
int iCounter = 0;
|
||||
//search devices and their tests
|
||||
//Scan the list of devices
|
||||
File[] listOfFiles = (TestingList.TESTS_DEVICES_DEFAULT_DIR.toFile()).listFiles();
|
||||
for (File listOfFile : listOfFiles) {
|
||||
propDevice.clear();
|
||||
if (listOfFile.isFile()) {
|
||||
} else if (listOfFile.isDirectory()) {
|
||||
File configFile = new File(listOfFile.getPath() + FilenameUtils.separatorsToSystem("/.config"));
|
||||
if (configFile.exists() && !configFile.isDirectory()) {
|
||||
InputStream is = null;
|
||||
try {
|
||||
is = new FileInputStream(configFile);
|
||||
} catch (FileNotFoundException ex) {
|
||||
Logger.getLogger(EditTestingList.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
if(is != null){
|
||||
//Scan the list of devices
|
||||
File[] listOfFiles = (testingList.TESTS_DEVICES_DEFAULT_DIR.toFile()).listFiles();
|
||||
for (File listOfFile : listOfFiles) {
|
||||
propDevice.clear();
|
||||
if (listOfFile.isFile()) {
|
||||
} else if (listOfFile.isDirectory()) {
|
||||
File configFile = new File(listOfFile.getPath() + FilenameUtils.separatorsToSystem("/.config"));
|
||||
if (configFile.exists() && !configFile.isDirectory()) {
|
||||
InputStream is = null;
|
||||
try {
|
||||
propDevice.load(is);
|
||||
} catch (IOException ex) {
|
||||
is = new FileInputStream(configFile);
|
||||
} catch (FileNotFoundException ex) {
|
||||
Logger.getLogger(EditTestingList.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
//config of device was loaded. now load the config of each test belonging to the device
|
||||
//sTestName = TESTS_TESTS_DEFAULT_DIR + propDevice.getProperty("tests");
|
||||
//testsFolder = new File(sTestName);
|
||||
testsFolder = Paths.get(TestingList.TESTS_TESTS_DEFAULT_DIR.toString(), propDevice.getProperty("tests")).toFile();
|
||||
if (testsFolder.exists() && testsFolder.isDirectory()) {
|
||||
File[] listOfTests = testsFolder.listFiles();
|
||||
for (File listOfTest : listOfTests) {
|
||||
propTest.clear();
|
||||
if (listOfTest.isDirectory()) {
|
||||
configFile = new File(listOfTest.getPath() + FilenameUtils.separatorsToSystem("/.config"));
|
||||
if (configFile.exists() && !configFile.isDirectory()) {
|
||||
InputStream ist = null;
|
||||
try {
|
||||
ist = new FileInputStream(configFile);
|
||||
} catch (FileNotFoundException ex) {
|
||||
Logger.getLogger(EditTestingList.class.getName()).log(Level.SEVERE, null, ex);
|
||||
if(is != null){
|
||||
try {
|
||||
propDevice.load(is);
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(EditTestingList.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
//config of device was loaded. now load the config of each test belonging to the device
|
||||
//sTestName = TESTS_TESTS_DEFAULT_DIR + propDevice.getProperty("tests");
|
||||
//testsFolder = new File(sTestName);
|
||||
testsFolder = Paths.get(testingList.TESTS_TESTS_DEFAULT_DIR.toString(), propDevice.getProperty("tests")).toFile();
|
||||
if (testsFolder.exists() && testsFolder.isDirectory()) {
|
||||
File[] listOfTests = testsFolder.listFiles();
|
||||
for (File listOfTest : listOfTests) {
|
||||
propTest.clear();
|
||||
if (listOfTest.isDirectory()) {
|
||||
configFile = new File(listOfTest.getPath() + FilenameUtils.separatorsToSystem("/.config"));
|
||||
if (configFile.exists() && !configFile.isDirectory()) {
|
||||
InputStream ist = null;
|
||||
try {
|
||||
ist = new FileInputStream(configFile);
|
||||
} catch (FileNotFoundException ex) {
|
||||
Logger.getLogger(EditTestingList.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
try {
|
||||
propTest.load(ist);
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(EditTestingList.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
addToTable("",
|
||||
propDevice.getProperty("name"),
|
||||
propDevice.getProperty("description"),
|
||||
propDevice.getProperty("tests"),
|
||||
"path",
|
||||
propTest.getProperty("name"),
|
||||
propTest.getProperty("parameters"));
|
||||
iCounter++;
|
||||
}
|
||||
try {
|
||||
propTest.load(ist);
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(EditTestingList.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
addToTable("",
|
||||
propDevice.getProperty("name"),
|
||||
propDevice.getProperty("description"),
|
||||
propDevice.getProperty("tests"),
|
||||
"path",
|
||||
propTest.getProperty("name"),
|
||||
propTest.getProperty("parameters"));
|
||||
iCounter++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
SwingUtils.showMessage(this, "loadTests()", "Could not find any test");
|
||||
else{
|
||||
SwingUtils.showMessage(this, "loadTests()", "Could not find any test");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
Logger.getLogger(EditTestingList.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user