Add RemoveBucketRequest unit tests 87/234787/5
authorZofia Abramowska <z.abramowska@samsung.com>
Thu, 28 May 2020 16:16:50 +0000 (18:16 +0200)
committerZofia Abramowska <z.abramowska@samsung.com>
Thu, 9 Jul 2020 18:06:21 +0000 (20:06 +0200)
Change-Id: I2b0653f614d516f1b701cde904d8fc81c2a4bb7c

test/CMakeLists.txt
test/common/protocols/admin/removebucketrequest.cpp [new file with mode: 0644]

index 06ca1a2d404163a1e83be5e262e62e330143eb6b..552ebde7ba396a69d19cc11f8171e256ebbbdabc 100644 (file)
@@ -124,6 +124,7 @@ SET(CYNARA_TESTS_SOURCES
     common/protocols/admin/insertorupdatebucketrequest.cpp
     common/protocols/admin/listrequest.cpp
     common/protocols/admin/listresponse.cpp
+    common/protocols/admin/removebucketrequest.cpp
     common/protocols/monitor/flushrequest.cpp
     common/protocols/monitor/getentriesrequest.cpp
     common/protocols/monitor/getentriesresponse.cpp
diff --git a/test/common/protocols/admin/removebucketrequest.cpp b/test/common/protocols/admin/removebucketrequest.cpp
new file mode 100644 (file)
index 0000000..efdc36d
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License");
+ *    you may not use this file except in compliance with the License.
+ *    You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS,
+ *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *    See the License for the specific language governing permissions and
+ *    limitations under the License.
+ */
+/**
+ * @file        test/common/protocols/admin/removebucketrequest.cpp
+ * @author      Zofia Abramowska <z.abramowska@samsung.com>
+ * @version     1.0
+ * @brief       Tests for Cynara::RemoveBucketRequest usage in Cynara::ProtocolAdmin
+ */
+
+#include <gtest/gtest.h>
+
+#include <protocol/ProtocolAdmin.h>
+#include <request/RemoveBucketRequest.h>
+
+#include <RequestTestHelper.h>
+#include <TestDataCollection.h>
+
+namespace {
+
+template<>
+void compare(const Cynara::RemoveBucketRequest &req1,
+             const Cynara::RemoveBucketRequest &req2)
+{
+    EXPECT_EQ(req1.bucketId(), req2.bucketId());
+    EXPECT_EQ(req1.sequenceNumber(), req2.sequenceNumber());
+}
+
+} /* namespace anonymous */
+
+using namespace Cynara;
+using namespace RequestTestHelper;
+using namespace TestDataCollection;
+
+/* *** compare by objects test cases *** */
+
+TEST(ProtocolAdmin, RemoveBucketRequestPositive) {
+    for (auto &bucket : Buckets::all) {
+        for (auto &sequenceNumber : SN::all) {
+            auto request = std::make_shared<RemoveBucketRequest>(bucket, sequenceNumber);
+            auto protocol = std::make_shared<ProtocolAdmin>();
+            testRequest(request, protocol);
+        }
+    }
+}
+
+TEST(ProtocolAdmin, RemoveBucketRequestBinaryPositive) {
+    for (auto &bucket : Buckets::all) {
+        for (auto &sequenceNumber : SN::all) {
+            auto request = std::make_shared<RemoveBucketRequest>(bucket, sequenceNumber);
+            auto protocol = std::make_shared<ProtocolAdmin>();
+            binaryTestRequest(request, protocol);
+        }
+    }
+}