~ubuntu-branches/ubuntu/utopic/nordugrid-arc/utopic

« back to all changes in this revision

Viewing changes to src/hed/acc/JobDescriptionParser/test/ARCJSDLParserTest.cpp

  • Committer: Package Import Robot
  • Author(s): Mattias Ellert
  • Date: 2014-05-01 20:51:02 UTC
  • mfrom: (1.1.11)
  • Revision ID: package-import@ubuntu.com-20140501205102-icy9t3348uxobyx7
Tags: 4.1.0-1
* 4.1.0 Release
* Call dh_autoreconf to support ppc64le (Closes: #744639)

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
  CPPUNIT_TEST(TestBasicJSDLCompliance);
32
32
  CPPUNIT_TEST(TestPOSIXCompliance);
33
33
  CPPUNIT_TEST(TestHPCCompliance);
 
34
  CPPUNIT_TEST(TestRangeValueType);
34
35
  CPPUNIT_TEST_SUITE_END();
35
36
 
36
37
public:
52
53
  void TestBasicJSDLCompliance();
53
54
  void TestPOSIXCompliance();
54
55
  void TestHPCCompliance();
 
56
  void TestRangeValueType();
55
57
 
56
58
private:
57
59
  Arc::JobDescription INJOB;
633
635
  CPPUNIT_ASSERT_EQUAL_MESSAGE("HPC compliance failure", (std::string)"value3", (std::string)pApp["Environment"][2]);
634
636
}
635
637
 
 
638
void ARCJSDLParserTest::TestRangeValueType() {
 
639
  /** Testing compliance with the RangeValue_Type **/
 
640
  MESSAGE = "Error: The parser does not comply with the JSDL RangeValue_Type type.";
 
641
 
 
642
  const std::string beforeElement = "<?xml version=\"1.0\"?>"
 
643
"<JobDefinition xmlns=\"http://schemas.ggf.org/jsdl/2005/11/jsdl\""
 
644
" xmlns:posix-jsdl=\"http://schemas.ggf.org/jsdl/2005/11/jsdl-posix\"><JobDescription>"
 
645
"<Application><posix-jsdl:POSIXApplication><posix-jsdl:Executable>executable</posix-jsdl:Executable></posix-jsdl:POSIXApplication></Application>"
 
646
"<Resources><IndividualCPUTime>";
 
647
  const std::string afterElement ="</IndividualCPUTime></Resources></JobDescription></JobDefinition>";
 
648
 
 
649
  std::string element;
 
650
 
 
651
  element = "<Exact>3600.3</Exact>";
 
652
  CPPUNIT_ASSERT_MESSAGE(MESSAGE, PARSER.Parse(beforeElement + element + afterElement, OUTJOBS));
 
653
  CPPUNIT_ASSERT_EQUAL_MESSAGE(MESSAGE, 1, (int)OUTJOBS.size());
 
654
  CPPUNIT_ASSERT_EQUAL_MESSAGE(MESSAGE, 3600, OUTJOBS.front().Resources.IndividualCPUTime.range.max);
 
655
  CPPUNIT_ASSERT_EQUAL_MESSAGE(MESSAGE, -1, OUTJOBS.front().Resources.IndividualCPUTime.range.min);
 
656
 
 
657
  element = "<LowerBoundedRange>134.5</LowerBoundedRange>";
 
658
  CPPUNIT_ASSERT_MESSAGE(MESSAGE, PARSER.Parse(beforeElement + element + afterElement, OUTJOBS));
 
659
  CPPUNIT_ASSERT_EQUAL_MESSAGE(MESSAGE, 1, (int)OUTJOBS.size());
 
660
  CPPUNIT_ASSERT_EQUAL_MESSAGE(MESSAGE, -1, OUTJOBS.front().Resources.IndividualCPUTime.range.max);
 
661
  CPPUNIT_ASSERT_EQUAL_MESSAGE(MESSAGE, 134, OUTJOBS.front().Resources.IndividualCPUTime.range.min);
 
662
 
 
663
  element = "<UpperBoundedRange>234.5</UpperBoundedRange>";
 
664
  CPPUNIT_ASSERT_MESSAGE(MESSAGE, PARSER.Parse(beforeElement + element + afterElement, OUTJOBS));
 
665
  CPPUNIT_ASSERT_EQUAL_MESSAGE(MESSAGE, 1, (int)OUTJOBS.size());
 
666
  CPPUNIT_ASSERT_EQUAL_MESSAGE(MESSAGE, 234, OUTJOBS.front().Resources.IndividualCPUTime.range.max);
 
667
  CPPUNIT_ASSERT_EQUAL_MESSAGE(MESSAGE, -1, OUTJOBS.front().Resources.IndividualCPUTime.range.min);
 
668
 
 
669
  element = "<UpperBoundedRange>234.5</UpperBoundedRange><LowerBoundedRange>123.4</LowerBoundedRange>";
 
670
  CPPUNIT_ASSERT_MESSAGE(MESSAGE, PARSER.Parse(beforeElement + element + afterElement, OUTJOBS));
 
671
  CPPUNIT_ASSERT_EQUAL_MESSAGE(MESSAGE, 1, (int)OUTJOBS.size());
 
672
  CPPUNIT_ASSERT_EQUAL_MESSAGE(MESSAGE, 234, OUTJOBS.front().Resources.IndividualCPUTime.range.max);
 
673
  CPPUNIT_ASSERT_EQUAL_MESSAGE(MESSAGE, 123, OUTJOBS.front().Resources.IndividualCPUTime.range.min);
 
674
 
 
675
  element = "<Range><UpperBound>234.5</UpperBound><LowerBound>123.4</LowerBound></Range>";
 
676
  CPPUNIT_ASSERT_MESSAGE(MESSAGE, PARSER.Parse(beforeElement + element + afterElement, OUTJOBS));
 
677
  CPPUNIT_ASSERT_EQUAL_MESSAGE(MESSAGE, 1, (int)OUTJOBS.size());
 
678
  CPPUNIT_ASSERT_EQUAL_MESSAGE(MESSAGE, 234, OUTJOBS.front().Resources.IndividualCPUTime.range.max);
 
679
  CPPUNIT_ASSERT_EQUAL_MESSAGE(MESSAGE, 123, OUTJOBS.front().Resources.IndividualCPUTime.range.min);
 
680
 
 
681
  element = "<Range><UpperBound>123.4</UpperBound><LowerBound>234.5</LowerBound></Range>";
 
682
  CPPUNIT_ASSERT_MESSAGE(MESSAGE, !PARSER.Parse(beforeElement + element + afterElement, OUTJOBS));
 
683
 
 
684
  element = "<Range><UpperBound>234.5</UpperBound></Range><Range><LowerBound>123.4</LowerBound></Range>";
 
685
  CPPUNIT_ASSERT_MESSAGE(MESSAGE, !PARSER.Parse(beforeElement + element + afterElement, OUTJOBS));
 
686
 
 
687
  element = "<Exact>234.5</Exact><Exact>123.4</Exact>";
 
688
  CPPUNIT_ASSERT_MESSAGE(MESSAGE, !PARSER.Parse(beforeElement + element + afterElement, OUTJOBS));
 
689
 
 
690
  element = "<Exact epsilon=\"1.2\">234.5</Exact>";
 
691
  CPPUNIT_ASSERT_MESSAGE(MESSAGE, !PARSER.Parse(beforeElement + element + afterElement, OUTJOBS));
 
692
 
 
693
  element = "<LowerBoundedRange exclusiveBound=\"1.2\">234.5</LowerBoundedRange>";
 
694
  CPPUNIT_ASSERT_MESSAGE(MESSAGE, !PARSER.Parse(beforeElement + element + afterElement, OUTJOBS));
 
695
}
 
696
 
636
697
CPPUNIT_TEST_SUITE_REGISTRATION(ARCJSDLParserTest);