Mercurial > hg > orthanc-databases
comparison MySQL/UnitTests/UnitTestsMain.cpp @ 219:dd6cfc250747
removed useless class StorageAreaBuffer
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 29 Mar 2021 14:52:55 +0200 |
parents | ee5858d438dc |
children | 94c9908e6aca |
comparison
equal
deleted
inserted
replaced
218:90eb271f85b2 | 219:dd6cfc250747 |
---|---|
161 std::string uuid = boost::lexical_cast<std::string>(i); | 161 std::string uuid = boost::lexical_cast<std::string>(i); |
162 std::string value = "Value " + boost::lexical_cast<std::string>(i * 2); | 162 std::string value = "Value " + boost::lexical_cast<std::string>(i * 2); |
163 storageArea.Create(transaction, uuid, value.c_str(), value.size(), OrthancPluginContentType_Unknown); | 163 storageArea.Create(transaction, uuid, value.c_str(), value.size(), OrthancPluginContentType_Unknown); |
164 } | 164 } |
165 | 165 |
166 OrthancDatabases::StorageAreaBuffer buffer(NULL /* we are running unit tests */); | 166 std::string buffer; |
167 ASSERT_THROW(storageArea.Read(buffer, transaction, "nope", OrthancPluginContentType_Unknown), | 167 ASSERT_THROW(storageArea.ReadToString(buffer, transaction, "nope", OrthancPluginContentType_Unknown), |
168 Orthanc::OrthancException); | 168 Orthanc::OrthancException); |
169 | 169 |
170 ASSERT_EQ(10, CountFiles(db)); | 170 ASSERT_EQ(10, CountFiles(db)); |
171 storageArea.Remove(transaction, "5", OrthancPluginContentType_Unknown); | 171 storageArea.Remove(transaction, "5", OrthancPluginContentType_Unknown); |
172 | 172 |
178 std::string expected = "Value " + boost::lexical_cast<std::string>(i * 2); | 178 std::string expected = "Value " + boost::lexical_cast<std::string>(i * 2); |
179 std::string content; | 179 std::string content; |
180 | 180 |
181 if (i == 5) | 181 if (i == 5) |
182 { | 182 { |
183 ASSERT_THROW(storageArea.Read(buffer, transaction, uuid, OrthancPluginContentType_Unknown), | 183 ASSERT_THROW(storageArea.ReadToString(buffer, transaction, uuid, OrthancPluginContentType_Unknown), |
184 Orthanc::OrthancException); | 184 Orthanc::OrthancException); |
185 } | 185 } |
186 else | 186 else |
187 { | 187 { |
188 storageArea.Read(buffer, transaction, uuid, OrthancPluginContentType_Unknown); | 188 storageArea.ReadToString(buffer, transaction, uuid, OrthancPluginContentType_Unknown); |
189 | 189 ASSERT_EQ(expected, buffer); |
190 std::string s; | |
191 buffer.ToString(s); | |
192 ASSERT_EQ(expected, s); | |
193 } | 190 } |
194 } | 191 } |
195 | 192 |
196 for (int i = 0; i < 10; i++) | 193 for (int i = 0; i < 10; i++) |
197 { | 194 { |