--- /dev/null
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * This file is licensed under the terms of MIT License or the Apache License
+ * Version 2.0 of your choice. See the LICENSE.MIT file for MIT license details.
+ * See the LICENSE file or the notice below for Apache License Version 2.0
+ * details.
+ *
+ * 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/client/simplecheckrequest.cpp
+ * @author Zofia Abramowska <z.abramowska@samsung.com>
+ * @version 1.0
+ * @brief Tests for Cynara::SimpleCheckRequest usage in Cynara::ProtocolClient
+ */
+
+#include <gtest/gtest.h>
+
+#include <cynara-limits.h>
+#include <exceptions/InvalidProtocolException.h>
+#include <protocol/ProtocolClient.h>
+#include <request/SimpleCheckRequest.h>
+
+#include <NegativeTestHelper.h>
+#include <RequestTestHelper.h>
+#include <TestDataCollection.h>
+
+namespace {
+
+template<>
+void compare(const Cynara::SimpleCheckRequest &req1, const Cynara::SimpleCheckRequest &req2) {
+ EXPECT_EQ(req1.key(), req2.key());
+ EXPECT_EQ(req1.sequenceNumber(), req2.sequenceNumber());
+}
+
+} /* namespace anonymous */
+
+using namespace Cynara;
+using namespace NegativeTestHelper;
+using namespace RequestTestHelper;
+using namespace TestDataCollection;
+
+/* *** compare by objects test cases *** */
+
+TEST(ProtocolClient, SimpleCheckRequestPositive) {
+ for (auto &key : Keys::all) {
+ for (auto &sequenceNumber : SN::all) {
+ auto request = std::make_shared<SimpleCheckRequest>(key, sequenceNumber);
+ auto protocol = std::make_shared<ProtocolClient>();
+ testRequest(request, protocol);
+ }
+ }
+}
+
+TEST(ProtocolClient, SimpleCheckRequestBinaryPositive) {
+ for (auto &key : Keys::all) {
+ for (auto &sequenceNumber : SN::all) {
+ auto request = std::make_shared<SimpleCheckRequest>(key, sequenceNumber);
+ auto protocol = std::make_shared<ProtocolClient>();
+ binaryTestRequest(request, protocol);
+ }
+ }
+}
+
+TEST(ProtocolClient, SimpleCheckRequestTooLongClientNegative) {
+ PKF tooLongClient = PKF::create(std::string(CYNARA_MAX_ID_LENGTH + 1, 'c'));
+ PolicyKey key(tooLongClient, Keys::k_cup.user(), Keys::k_cup2.privilege());
+ for (auto &sequenceNumber : SN::all) {
+ testInvalidProtocol<ProtocolClient, SimpleCheckRequest>(key, sequenceNumber);
+ }
+}
+
+TEST(ProtocolClient, SimpleCheckRequestTooLongUserNegative) {
+ PKF tooLongUser = PKF::create(std::string(CYNARA_MAX_ID_LENGTH + 1, 'u'));
+ PolicyKey key(Keys::k_cup.client(), tooLongUser, Keys::k_cup2.privilege());
+ for (auto &sequenceNumber : SN::all) {
+ testInvalidProtocol<ProtocolClient, SimpleCheckRequest>(key, sequenceNumber);
+ }
+}
+
+TEST(ProtocolClient, SimpleCheckRequestTooLongPrivilegeNegative) {
+ PKF tooLongPrivilege = PKF::create(std::string(CYNARA_MAX_ID_LENGTH + 1, 'p'));
+ PolicyKey key(Keys::k_cup2.client(), Keys::k_cup.user(), tooLongPrivilege);
+ for (auto &sequenceNumber : SN::all) {
+ testInvalidProtocol<ProtocolClient, SimpleCheckRequest>(key, sequenceNumber);
+ }
+}