diff --git a/Code/Mantid/DataHandling/test/LoadMappingTableTest.h b/Code/Mantid/DataHandling/test/LoadMappingTableTest.h index 27efba83732a0c671b726b50733bd04605e3bf51..182c62c067cf8c0a81f12a5ff551c92ef78ea258 100644 --- a/Code/Mantid/DataHandling/test/LoadMappingTableTest.h +++ b/Code/Mantid/DataHandling/test/LoadMappingTableTest.h @@ -12,6 +12,7 @@ #include "MantidKernel/ConfigService.h" #include "MantidKernel/TimeSeriesProperty.h" #include "MantidAPI/SpectraDetectorMap.h" +#include "Poco/Path.h" using namespace Mantid::API; using namespace Mantid::Kernel; @@ -23,8 +24,8 @@ class LoadMappingTableTest : public CxxTest::TestSuite public: LoadMappingTableTest() { - // - inputFile = "../../../../Test/Data/HET15869.RAW"; + // + inputFile = Poco::Path(Poco::Path::current()).resolve("../../../../Test/Data/HET15869.RAW").toString(); outputSpace = "outerWS"; //initialise framework manager to allow logging Mantid::API::FrameworkManager::Instance(); diff --git a/Code/Mantid/DataHandling/test/LoadRKHTest.h b/Code/Mantid/DataHandling/test/LoadRKHTest.h index 0f45901ab4d81e32a33ba78b3caee1eff7dd392c..08a275539576db2652c5b2c6b6d0b38163782181 100644 --- a/Code/Mantid/DataHandling/test/LoadRKHTest.h +++ b/Code/Mantid/DataHandling/test/LoadRKHTest.h @@ -8,14 +8,16 @@ #include "MantidDataHandling/LoadRKH.h" #include "MantidDataObjects/Workspace1D.h" +#include "Poco/Path.h" class LoadRKHTest : public CxxTest::TestSuite { public: // A sample file is in the repository - LoadRKHTest() : inputFile("../../../../Test/Data/DIRECT.041") + LoadRKHTest() : inputFile("") { + inputFile = Poco::Path(Poco::Path::current()).resolve("../../../../Test/Data/DIRECT.041").toString(); } void testInit() diff --git a/Code/Mantid/DataHandling/test/LoadRaw2Test.h b/Code/Mantid/DataHandling/test/LoadRaw2Test.h index 3a1eae594c4438d168f6c9fb8e7f7245f1d438a3..4dc45fdc6dba2976759c8a750ddaf2c2e3255a45 100644 --- a/Code/Mantid/DataHandling/test/LoadRaw2Test.h +++ b/Code/Mantid/DataHandling/test/LoadRaw2Test.h @@ -11,6 +11,7 @@ #include "MantidKernel/ConfigService.h" #include "MantidKernel/TimeSeriesProperty.h" #include "MantidAPI/SpectraDetectorMap.h" +#include "Poco/Path.h" using namespace Mantid::API; using namespace Mantid::Kernel; @@ -24,7 +25,7 @@ public: LoadRaw2Test() { // Path to test input file assumes Test directory checked out from SVN - inputFile = "../../../../Test/Data/HET15869.RAW"; + inputFile = Poco::Path(Poco::Path::current()).resolve("../../../../Test/Data/HET15869.RAW").toString(); } void testInit() diff --git a/Code/Mantid/DataHandling/test/LoadRawTest.h b/Code/Mantid/DataHandling/test/LoadRawTest.h index 5697d5567d4be204436e16e790d5d7a830ada563..820c8bf6ae12fc70bbbd1ead87915e06d6baf5b3 100644 --- a/Code/Mantid/DataHandling/test/LoadRawTest.h +++ b/Code/Mantid/DataHandling/test/LoadRawTest.h @@ -12,6 +12,7 @@ #include "MantidKernel/ConfigService.h" #include "MantidKernel/TimeSeriesProperty.h" #include "MantidAPI/SpectraDetectorMap.h" +#include "Poco/Path.h" using namespace Mantid::API; using namespace Mantid::Kernel; @@ -25,7 +26,7 @@ public: LoadRawTest() { // Path to test input file assumes Test directory checked out from SVN - inputFile = "../../../../Test/Data/HET15869.RAW"; + inputFile = Poco::Path(Poco::Path::current()).resolve("../../../../Test/Data/HET15869.RAW").toString(); } void testInit() diff --git a/Code/Mantid/DataHandling/test/ManagedRawFileWorkspace2DTest.h b/Code/Mantid/DataHandling/test/ManagedRawFileWorkspace2DTest.h index 2467122bcebcae797dfa9d54125c9627eda356d6..6872650597bffacc095268996f56d35001309c63 100644 --- a/Code/Mantid/DataHandling/test/ManagedRawFileWorkspace2DTest.h +++ b/Code/Mantid/DataHandling/test/ManagedRawFileWorkspace2DTest.h @@ -8,6 +8,7 @@ #include "MantidDataHandling/LoadRaw2.h" #include "MantidKernel/TimeSeriesProperty.h" #include "MantidAPI/SpectraDetectorMap.h" +#include "Poco/Path.h" using namespace Mantid::API; using namespace Mantid::Kernel; @@ -98,7 +99,8 @@ public: // Should fail because mandatory parameter has not been set TS_ASSERT_THROWS(loader.execute(),std::runtime_error); - std::string inputFile = "../../../../Test/Data/HET15869.RAW"; + std::string inputFile = Poco::Path(Poco::Path::current()).resolve("../../../../Test/Data/HET15869.RAW").toString(); + // Now set it... loader.setPropertyValue("Filename", inputFile); diff --git a/Code/Mantid/DataHandling/test/SaveCSVTest.h b/Code/Mantid/DataHandling/test/SaveCSVTest.h index 1ed8b02bc1e451ea6961b66dfc87a25026ad5034..7866a20a1e10a482ce94afb10a850d7cb5e29aff 100644 --- a/Code/Mantid/DataHandling/test/SaveCSVTest.h +++ b/Code/Mantid/DataHandling/test/SaveCSVTest.h @@ -59,14 +59,16 @@ public: algToBeTested.setPropertyValue("InputWorkspace", "SAVECSVTEST-testSpace"); // Should fail because mandatory parameter has not been set - TS_ASSERT_THROWS(algToBeTested.execute(),std::runtime_error); + algToBeTested.execute(); + TS_ASSERT_EQUALS(algToBeTested.isExecuted(), false) // Now set it... // specify name of file to save 1D-workspace to outputFile = "testOfSaveCSV.csv"; algToBeTested.setPropertyValue("Filename", outputFile); - + outputFile = algToBeTested.getPropertyValue("Filename"); + std::string result; TS_ASSERT_THROWS_NOTHING( result = algToBeTested.getPropertyValue("Filename") ) TS_ASSERT( ! result.compare(outputFile)); diff --git a/Code/Mantid/Kernel/src/FileProperty.cpp b/Code/Mantid/Kernel/src/FileProperty.cpp index 57f6a2cb23d5e1e9851400acb4e9f32be9ad1c6d..a331a2c30b91fb1e755754f3f856747f93bef3b8 100644 --- a/Code/Mantid/Kernel/src/FileProperty.cpp +++ b/Code/Mantid/Kernel/src/FileProperty.cpp @@ -43,7 +43,7 @@ bool FileProperty::isLoadProperty() const std::string FileProperty::setValue(const std::string & filename) { // If the path is absolute then don't do any searching - if( Poco::Path(filename).isAbsolute() ) + if( filename.empty() || Poco::Path(filename).isAbsolute()) { return PropertyWithValue<std::string>::setValue(filename); } diff --git a/Code/Mantid/Nexus/test/LoadMuonNexusTest.h b/Code/Mantid/Nexus/test/LoadMuonNexusTest.h index d4739239511d1cd42299291fff09540c724126ee..6b6f5a1117753b06fea37ff8bad32d804fb84c29 100644 --- a/Code/Mantid/Nexus/test/LoadMuonNexusTest.h +++ b/Code/Mantid/Nexus/test/LoadMuonNexusTest.h @@ -165,7 +165,7 @@ public: { //test for multi period // Now set required filename and output workspace name - inputFile2 = "../../../../Test/Nexus/emu00006475.nxs"; + inputFile2 = Poco::Path(Poco::Path::current()).resolve("../../../../Test/Nexus/emu00006475.nxs").toString(); nxLoad.setPropertyValue("FileName", inputFile2); outputSpace="outer2"; diff --git a/Code/Mantid/Nexus/test/LoadNexusTest.h b/Code/Mantid/Nexus/test/LoadNexusTest.h index a06105fc237b96ac5095bf28eb5304cec792d167..a3875b2c6fc1e885f91243c6f3bff6e4c7bd8f37 100644 --- a/Code/Mantid/Nexus/test/LoadNexusTest.h +++ b/Code/Mantid/Nexus/test/LoadNexusTest.h @@ -89,7 +89,7 @@ public: alg2.setPropertyValue("OutputWorkspace", outputSpace); // specify name of file to load workspace from - inputFile = "../../../../Test/Nexus/emu00006475.nxs"; + inputFile = Poco::Path(Poco::Path::current()).resolve("../../../../Test/Nexus/emu00006475.nxs").toString(); alg2.setPropertyValue("FileName", inputFile); std::string result; diff --git a/Code/Mantid/Nexus/test/SaveNeXusTest.h b/Code/Mantid/Nexus/test/SaveNeXusTest.h index 81d6c4ec45c7c5eb034ce014d72f4842147f1b6a..8e8825011c05a3221630c1e21c77b760274d872a 100644 --- a/Code/Mantid/Nexus/test/SaveNeXusTest.h +++ b/Code/Mantid/Nexus/test/SaveNeXusTest.h @@ -44,7 +44,7 @@ void testExecOnMuon() nxLoad.initialize(); // Now set required filename and output workspace name inputFile = Poco::Path(Poco::Path::current()).resolve("../../../../Test/Nexus/emu00006473.nxs").toString(); - nxLoad.setPropertyValue("FileName", inputFile); + nxLoad.setPropertyValue("Filename", inputFile); outputSpace="outer"; nxLoad.setPropertyValue("OutputWorkspace", outputSpace); // @@ -64,7 +64,8 @@ void testExecOnMuon() // specify parameters to algorithm algToBeTested.setPropertyValue("InputWorkspace", outputSpace); outputFile = "testOfSaveNexus.nxs"; - algToBeTested.setPropertyValue("FileName", outputFile); + algToBeTested.setPropertyValue("Filename", outputFile); + outputFile = algToBeTested.getPropertyValue("Filename"); title="Testing SaveNexus with Muon data"; algToBeTested.setPropertyValue("Title", title); // comment line below to check the contents of the o/p file manually diff --git a/Code/Mantid/Nexus/test/SaveNexusProcessedTest.h b/Code/Mantid/Nexus/test/SaveNexusProcessedTest.h index cc41bee4563ce04c0f572201e74cfe9fb10d9d66..70808df87d939d62d01a69e6049fdeb733022bc0 100644 --- a/Code/Mantid/Nexus/test/SaveNexusProcessedTest.h +++ b/Code/Mantid/Nexus/test/SaveNexusProcessedTest.h @@ -19,6 +19,7 @@ #include "MantidNexus/LoadNeXus.h" #include "MantidKernel/UnitFactory.h" #include "Poco/File.h" +#include "Poco/Path.h" #include "MantidDataHandling/LoadRaw3.h" using namespace Mantid::API; @@ -79,13 +80,14 @@ public: //entryName = "test"; dataName = "spectra"; title = "A simple workspace saved in Processed Nexus format"; - TS_ASSERT_THROWS_NOTHING(algToBeTested.setPropertyValue("FileName", outputFile)); + TS_ASSERT_THROWS_NOTHING(algToBeTested.setPropertyValue("Filename", outputFile)); + outputFile = algToBeTested.getPropertyValue("Filename"); //algToBeTested.setPropertyValue("EntryName", entryName); algToBeTested.setPropertyValue("Title", title); if( Poco::File(outputFile).exists() ) Poco::File(outputFile).remove(); std::string result; - TS_ASSERT_THROWS_NOTHING( result = algToBeTested.getPropertyValue("FileName") ) + TS_ASSERT_THROWS_NOTHING( result = algToBeTested.getPropertyValue("Filename") ) TS_ASSERT( ! result.compare(outputFile)); //TS_ASSERT_THROWS_NOTHING( result = algToBeTested.getPropertyValue("EntryName") ) //TS_ASSERT( ! result.compare(entryName)); @@ -104,8 +106,8 @@ void testExecOnMuon() std::string outputSpace,inputFile; nxLoad.initialize(); // Now set required filename and output workspace name - inputFile = "../../../../Test/Nexus/emu00006473.nxs"; - nxLoad.setPropertyValue("FileName", inputFile); + inputFile = Poco::Path(Poco::Path::current()).resolve("../../../../Test/Nexus/emu00006473.nxs").toString(); + nxLoad.setPropertyValue("Filename", inputFile); outputSpace="outer"; nxLoad.setPropertyValue("OutputWorkspace", outputSpace); // @@ -131,7 +133,8 @@ void testExecOnMuon() //entryName = "entry4"; dataName = "spectra"; title = "A save of a 2D workspace from Muon file"; - algToBeTested.setPropertyValue("FileName", outputFile); + algToBeTested.setPropertyValue("Filename", outputFile); + outputFile = algToBeTested.getPropertyValue("Filename"); //algToBeTested.setPropertyValue("EntryName", entryName); algToBeTested.setPropertyValue("Title", title); algToBeTested.setPropertyValue("Append", "0"); @@ -182,11 +185,11 @@ void testExecOnLoadraw() //entryName = "entry4"; dataName = "spectra"; title = "A save of a workspace from Loadraw file"; - algToBeTested.setPropertyValue("FileName", outputFile); + algToBeTested.setPropertyValue("Filename", outputFile); //algToBeTested.setPropertyValue("EntryName", entryName); algToBeTested.setPropertyValue("Title", title); - algToBeTested.setPropertyValue("Append", "0"); - + algToBeTested.setPropertyValue("Append", "0"); + outputFile = algToBeTested.getPropertyValue("Filename"); std::string result; TS_ASSERT_THROWS_NOTHING( result = algToBeTested.getPropertyValue("Filename") ); TS_ASSERT( ! result.compare(outputFile)); @@ -211,7 +214,7 @@ void testExecOnMuonXml() nxLoad.initialize(); // Now set required filename and output workspace name inputFile = "../../../../Test/Nexus/emu00006473.nxs"; - nxLoad.setPropertyValue("FileName", inputFile); + nxLoad.setPropertyValue("Filename", inputFile); outputSpace="outer"; nxLoad.setPropertyValue("OutputWorkspace", outputSpace); // @@ -234,10 +237,10 @@ void testExecOnMuonXml() //entryName = "entry4"; dataName = "spectra"; title = "A save of a 2D workspace from Muon file"; - algToBeTested.setPropertyValue("FileName", outputFile); + algToBeTested.setPropertyValue("Filename", outputFile); //algToBeTested.setPropertyValue("EntryName", entryName); algToBeTested.setPropertyValue("Title", title); - + outputFile = algToBeTested.getPropertyValue("Filename"); std::string result; TS_ASSERT_THROWS_NOTHING( result = algToBeTested.getPropertyValue("Filename") ); TS_ASSERT( ! result.compare(outputFile));