"git@code.ornl.gov:mantidproject/mantid.git" did not exist on "1eb97d12a910100b0603da53fa1d5b3fcb897653"
Newer
Older
Federico Montesino Pouzols
committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#ifndef COMPUTERESOURCEINFOTEST_H_
#define COMPUTERESOURCEINFOTEST_H_
#include "MantidKernel/FacilityInfo.h"
#include <Poco/DOM/AutoPtr.h>
#include <Poco/DOM/Document.h>
#include <Poco/DOM/DOMParser.h>
using namespace Mantid::Kernel;
class ComputeResourceInfoTest : public CxxTest::TestSuite {
public:
void test_noComputeResource() {
FacilityInfo *fac = NULL;
TS_ASSERT_THROWS_NOTHING(fac = createCRInfoInMinimalFacility(""));
TS_ASSERT_THROWS_NOTHING(
fac = createCRInfoInMinimalFacility("<computeResource />"));
ComputeResourceInfo cr = fac->computeResInfos().front();
}
void test_normalFermi() {
const std::string fermi = "<computeResource name=\"" + fermiName +
"\">"
"<baseURL>" +
fermiURL + "</baseURL>"
"</computeResource>";
FacilityInfo *fac = NULL;
TS_ASSERT_THROWS_NOTHING(fac = createCRInfoInMinimalFacility(fermi));
ComputeResourceInfo cr = fac->computeResInfos().front();
}
void test_brokenFermi() {
// wrong 'baseURL' tag
const std::string fermi = "<computeResource name=\"" + fermiName + "\">"
"<URL>" +
fermiURL + "</URL>"
"</computeResource>";
FacilityInfo *fac = NULL;
TS_ASSERT_THROWS(fac = createCRInfoInMinimalFacility(fermi),
std::runtime_error);
ComputeResourceInfo cr = fac->computeResInfos().front();
}
void test_normalSCARF() {
const std::string type = "SCARFLSFJobManager";
const std::string scarf = "<computeResource name=\"" + scarfName +
"\" JobManagerType=\"" + type + "\">"
"<baseURL>" +
scarfURL + "</baseURL>"
"</computeResource>";
FacilityInfo *fac = NULL;
TS_ASSERT_THROWS_NOTHING(fac = createCRInfoInMinimalFacility(scarf));
ComputeResourceInfo cr = fac->computeResInfos().front();
}
void test_brokenSCARF() {}
private:
/// make a minimal facilities file/xml string includin the compute resource
/// passed
FacilityInfo *createCRInfoInMinimalFacility(const std::string &crStr) {
const std::string xmlStr =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
"<facilities>"
" <facility name=\"ATestFacility\" FileExtensions=\".xyz\">" +
crStr + " </facility>"
"</facilities>";
return createFacility(xmlStr);
}
FacilityInfo *createFacility(const std::string &xml) {
Poco::XML::DOMParser parser;
Poco::AutoPtr<Poco::XML::Document> pDoc = parser.parseString(xml);
Poco::XML::Element *pRootElem = pDoc->documentElement();
Poco::XML::Element *elem = pRootElem->getChildElement("facility");
return new FacilityInfo(elem);
}
private:
static const std::string fermiName;
static const std::string fermiURL;
static const std::string scarfName;
static const std::string scarfURL;
};
const std::string ComputeResourceInfoTest::fermiURL =
"https://fermi.ornl.gov/MantidRemote";
const std::string ComputeResourceInfoTest::fermiName = "Fermi";
const std::string ComputeResourceInfoTest::scarfURL =
"https://portal.scarf.rl.ac.uk";
const std::string ComputeResourceInfoTest::scarfName = "SCARF@STFC";
#endif // COMPUTERESOURCEINFOTEST_H_