comparison UnitTestsSources/MultiThreadingTests.cpp @ 2663:228e2783ce83 jobs

some jobs might not be serializable
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 07 Jun 2018 18:18:02 +0200
parents 47d812308d63
children a21b244efb37
comparison
equal deleted inserted replaced
2662:47d812308d63 2663:228e2783ce83
56 #include "../OrthancServer/ServerJobs/Operations/ModifyInstanceOperation.h" 56 #include "../OrthancServer/ServerJobs/Operations/ModifyInstanceOperation.h"
57 #include "../OrthancServer/ServerJobs/Operations/StorePeerOperation.h" 57 #include "../OrthancServer/ServerJobs/Operations/StorePeerOperation.h"
58 #include "../OrthancServer/ServerJobs/Operations/StoreScuOperation.h" 58 #include "../OrthancServer/ServerJobs/Operations/StoreScuOperation.h"
59 #include "../OrthancServer/ServerJobs/Operations/SystemCallOperation.h" 59 #include "../OrthancServer/ServerJobs/Operations/SystemCallOperation.h"
60 60
61 #include "../OrthancServer/ServerJobs/ArchiveJob.h"
62
61 63
62 64
63 using namespace Orthanc; 65 using namespace Orthanc;
64 66
65 namespace 67 namespace
123 virtual void GetJobType(std::string& type) 125 virtual void GetJobType(std::string& type)
124 { 126 {
125 type = "DummyJob"; 127 type = "DummyJob";
126 } 128 }
127 129
128 virtual void Serialize(Json::Value& value) 130 virtual bool Serialize(Json::Value& value)
129 { 131 {
132 return true;
130 } 133 }
131 134
132 virtual void GetPublicContent(Json::Value& value) 135 virtual void GetPublicContent(Json::Value& value)
133 { 136 {
134 value["hello"] = "world"; 137 value["hello"] = "world";
861 job.SetPermissive(true); 864 job.SetPermissive(true);
862 ASSERT_THROW(job.ExecuteStep(), OrthancException); // Not started yet 865 ASSERT_THROW(job.ExecuteStep(), OrthancException); // Not started yet
863 job.Start(); 866 job.Start();
864 job.ExecuteStep(); 867 job.ExecuteStep();
865 job.ExecuteStep(); 868 job.ExecuteStep();
866 job.Serialize(s); 869 ASSERT_TRUE(job.Serialize(s));
867 } 870 }
868 871
869 { 872 {
870 DummyUnserializer unserializer; 873 DummyUnserializer unserializer;
871 ASSERT_THROW(unserializer.UnserializeValue(s), OrthancException); 874 ASSERT_THROW(unserializer.UnserializeValue(s), OrthancException);
1142 } 1145 }
1143 1146
1144 1147
1145 TEST_F(OrthancJobsSerialization, Jobs) 1148 TEST_F(OrthancJobsSerialization, Jobs)
1146 { 1149 {
1147 // TODO : ArchiveJob 1150 // ArchiveJob
1151
1152 Json::Value s;
1153
1154 {
1155 boost::shared_ptr<TemporaryFile> tmp(new TemporaryFile);
1156 ArchiveJob job(tmp, GetContext(), false, false);
1157 ASSERT_FALSE(job.Serialize(s));
1158 }
1148 1159
1149 // TODO : DicomModalityStoreJob 1160 // TODO : DicomModalityStoreJob
1150 1161
1151 // TODO : OrthancPeerStoreJob 1162 // TODO : OrthancPeerStoreJob
1152 1163