Mercurial > hg > orthanc
comparison UnitTestsSources/MultiThreadingTests.cpp @ 3240:e44e0127e553
Fix issue #134 (/patient/modify gives 500, should really be 400)
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 15 Feb 2019 17:26:45 +0100 |
parents | 2e1808b6146a |
children | bdafff1ce443 763533d6dd67 |
comparison
equal
deleted
inserted
replaced
3239:407e1a188105 | 3240:e44e0127e553 |
---|---|
103 | 103 |
104 virtual JobStepResult Step() ORTHANC_OVERRIDE | 104 virtual JobStepResult Step() ORTHANC_OVERRIDE |
105 { | 105 { |
106 if (fails_) | 106 if (fails_) |
107 { | 107 { |
108 return JobStepResult::Failure(ErrorCode_ParameterOutOfRange); | 108 return JobStepResult::Failure(ErrorCode_ParameterOutOfRange, NULL); |
109 } | 109 } |
110 else if (count_ == steps_ - 1) | 110 else if (count_ == steps_ - 1) |
111 { | 111 { |
112 return JobStepResult::Success(); | 112 return JobStepResult::Success(); |
113 } | 113 } |
722 engine.SetThreadSleep(10); | 722 engine.SetThreadSleep(10); |
723 engine.SetWorkersCount(3); | 723 engine.SetWorkersCount(3); |
724 engine.Start(); | 724 engine.Start(); |
725 | 725 |
726 Json::Value content = Json::nullValue; | 726 Json::Value content = Json::nullValue; |
727 ASSERT_TRUE(engine.GetRegistry().SubmitAndWait(content, new DummyJob(), rand() % 10)); | 727 engine.GetRegistry().SubmitAndWait(content, new DummyJob(), rand() % 10); |
728 ASSERT_EQ(Json::objectValue, content.type()); | 728 ASSERT_EQ(Json::objectValue, content.type()); |
729 ASSERT_EQ("world", content["hello"].asString()); | 729 ASSERT_EQ("world", content["hello"].asString()); |
730 | 730 |
731 content = Json::nullValue; | 731 content = Json::nullValue; |
732 ASSERT_FALSE(engine.GetRegistry().SubmitAndWait(content, new DummyJob(true), rand() % 10)); | 732 ASSERT_THROW(engine.GetRegistry().SubmitAndWait(content, new DummyJob(true), rand() % 10), OrthancException); |
733 ASSERT_EQ(Json::nullValue, content.type()); | 733 ASSERT_EQ(Json::nullValue, content.type()); |
734 | 734 |
735 engine.Stop(); | 735 engine.Stop(); |
736 } | 736 } |
737 | 737 |