Skip to content

Commit

Permalink
fixed the following unit test failures
Browse files Browse the repository at this point in the history
        712 - AlgorithmsTest_CreateDummyCalFileTest (Failed)
        1181 - MDAlgorithmsTest_LoadMDTest (Timeout)
        1195 - MDAlgorithmsTest_MergeMDFilesTest (Failed)

re #11818
  • Loading branch information
NickDraper committed May 28, 2015
1 parent 0e064a7 commit 5ac567b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 57 deletions.
51 changes: 3 additions & 48 deletions Code/Mantid/Framework/Algorithms/src/CreateDummyCalFile.cpp
Expand Up @@ -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<Document> 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;
Expand Down
7 changes: 0 additions & 7 deletions Code/Mantid/Framework/DataHandling/test/LoadEventNexusTest.h
Expand Up @@ -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 <cxxtest/TestSuite.h>
#include <iostream>
#include <Poco/File.h>

using namespace Mantid::Geometry;
using namespace Mantid::API;
Expand Down
9 changes: 7 additions & 2 deletions Code/Mantid/Framework/MDAlgorithms/src/LoadMD.cpp
Expand Up @@ -370,8 +370,13 @@ void LoadMD::doLoad(typename MDEventWorkspace<MDE, nd>::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());
Expand Down

0 comments on commit 5ac567b

Please sign in to comment.