From 5ac567bcec5e0b9f6724650ed88e7fcfd7bbc9b4 Mon Sep 17 00:00:00 2001 From: Nick Draper Date: Thu, 28 May 2015 16:46:31 +0100 Subject: [PATCH] fixed the following unit test failures 712 - AlgorithmsTest_CreateDummyCalFileTest (Failed) 1181 - MDAlgorithmsTest_LoadMDTest (Timeout) 1195 - MDAlgorithmsTest_MergeMDFilesTest (Failed) re #11818 --- .../Algorithms/src/CreateDummyCalFile.cpp | 51 ++----------------- .../DataHandling/test/LoadEventNexusTest.h | 7 --- .../Framework/MDAlgorithms/src/LoadMD.cpp | 9 +++- 3 files changed, 10 insertions(+), 57 deletions(-) diff --git a/Code/Mantid/Framework/Algorithms/src/CreateDummyCalFile.cpp b/Code/Mantid/Framework/Algorithms/src/CreateDummyCalFile.cpp index a52545be0479..58cc3b4a8d5d 100644 --- a/Code/Mantid/Framework/Algorithms/src/CreateDummyCalFile.cpp +++ b/Code/Mantid/Framework/Algorithms/src/CreateDummyCalFile.cpp @@ -61,55 +61,10 @@ void CreateDummyCalFile::exec() { // Get some stuff from the input workspace Instrument_const_sptr inst = inputW->getInstrument(); - std::string instname = inst->getName(); - - // Check that the instrument is in store - // Get only the first 3 letters - std::string instshort = instname; - std::transform(instshort.begin(), instshort.end(), instshort.begin(), - toupper); - instshort = instshort + "_Definition.xml"; - // Determine the search directory for XML instrument definition files (IDFs) - std::string directoryName = - Kernel::ConfigService::Instance().getInstrumentDirectory(); - - // Set up the DOM parser and parse xml file - DOMParser pParser; - Poco::AutoPtr pDoc; - try { - pDoc = pParser.parse(directoryName + instshort); - } catch (...) { - g_log.error("Unable to parse file " + m_filename); - throw Kernel::Exception::FileError("Unable to parse File:", m_filename); - } - // Get pointer to root element - Element *pRootElem = pDoc->documentElement(); - if (!pRootElem->hasChildNodes()) { - g_log.error("XML file: " + m_filename + "contains no root element."); - throw Kernel::Exception::InstrumentDefinitionError( - "No root element in XML instrument file", m_filename); - } + if (!inst) + throw std::invalid_argument("The InputWorkspace does not have an instrument definition"); - // Handle used in the singleton constructor for instrument file should append - // the value - // of the last-modified tag inside the file to determine if it is already in - // memory so that - // changes to the instrument file will cause file to be reloaded. - auto temp = - instshort + - pRootElem->getAttribute( - "last-modified"); // Generate the mangled name by hand (old-style) - - // If instrument not in store, insult the user - if (!API::InstrumentDataService::Instance().doesExist(temp)) { - Mantid::Geometry::IDFObject idf(directoryName + instshort); - temp = idf.getMangledName(); // new style. - if (!API::InstrumentDataService::Instance().doesExist(temp)) { - g_log.error("Instrument " + instshort + " is not present in data store."); - throw std::runtime_error("Instrument " + instshort + - " is not present in data store."); - } - } + std::string instname = inst->getName(); // Get the names of groups groups = instname; diff --git a/Code/Mantid/Framework/DataHandling/test/LoadEventNexusTest.h b/Code/Mantid/Framework/DataHandling/test/LoadEventNexusTest.h index d90f01212397..4f9281c61eaa 100644 --- a/Code/Mantid/Framework/DataHandling/test/LoadEventNexusTest.h +++ b/Code/Mantid/Framework/DataHandling/test/LoadEventNexusTest.h @@ -6,19 +6,12 @@ #include "MantidAPI/FrameworkManager.h" #include "MantidAPI/MatrixWorkspace.h" #include "MantidAPI/Workspace.h" -#include "MantidAPI/WorkspaceGroup.h" -#include "MantidAPI/WorkspaceOpOverloads.h" -#include "MantidDataHandling/LoadInstrument.h" #include "MantidDataObjects/EventWorkspace.h" -#include "MantidDataObjects/Workspace2D.h" -#include "MantidKernel/PhysicalConstants.h" #include "MantidKernel/Property.h" -#include "MantidKernel/Timer.h" #include "MantidKernel/TimeSeriesProperty.h" #include "MantidDataHandling/LoadEventNexus.h" #include #include -#include using namespace Mantid::Geometry; using namespace Mantid::API; diff --git a/Code/Mantid/Framework/MDAlgorithms/src/LoadMD.cpp b/Code/Mantid/Framework/MDAlgorithms/src/LoadMD.cpp index 3b33597fc7fd..9f75e0fa4b75 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/LoadMD.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/LoadMD.cpp @@ -370,8 +370,13 @@ void LoadMD::doLoad(typename MDEventWorkspace::sptr ws) { prog->report("Opening file."); std::string title; - m_file->getAttr("title", title); - ws->setTitle("title"); + try{ + m_file->getAttr("title", title); + } catch (std::exception&) + { + //Leave the title blank if error on loading + } + ws->setTitle(title); // Load the WorkspaceHistory "process" ws->history().loadNexus(m_file.get());