Add tests for ListRequest and ListResponse
[platform/core/security/cynara.git] / test / common / protocols / TestDataCollection.h
1 /*
2  * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  *    Licensed under the Apache License, Version 2.0 (the "License");
5  *    you may not use this file except in compliance with the License.
6  *    You may obtain a copy of the License at
7  *
8  *        http://www.apache.org/licenses/LICENSE-2.0
9  *
10  *    Unless required by applicable law or agreed to in writing, software
11  *    distributed under the License is distributed on an "AS IS" BASIS,
12  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  *    See the License for the specific language governing permissions and
14  *    limitations under the License.
15  */
16 /**
17  * @file        test/common/protocols/TestDataCollection.h
18  * @author      Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
19  * @version     1.0
20  * @brief       Collection of sample data for protocol tests
21  */
22
23 #ifndef TEST_COMMON_PROTOCOLS_TESTDATACOLLECTION_H_
24 #define TEST_COMMON_PROTOCOLS_TESTDATACOLLECTION_H_
25
26 #include <cstdint>
27
28 #include <types/PolicyBucketId.h>
29 #include <types/PolicyKey.h>
30 #include <types/PolicyResult.h>
31 #include <types/PolicyType.h>
32 #include <types/ProtocolFields.h>
33
34 namespace {
35 namespace TestDataCollection {
36
37 typedef Cynara::PolicyKeyFeature PKF;
38
39 namespace Keys {
40     static const Cynara::PolicyKey k_nun(PKF::create(""), PKF::create("u"), PKF::create(""));
41     static const Cynara::PolicyKey k_cup(PKF::create("c"), PKF::create("u"), PKF::create("p"));
42     static const Cynara::PolicyKey k_www(PKF::createWildcard(), PKF::createWildcard(),
43                                          PKF::createWildcard());
44     static const Cynara::PolicyKey k_wuw(PKF::createWildcard(), PKF::create("u"),
45                                          PKF::createWildcard());
46     static const Cynara::PolicyKey k_aaa(PKF::createAny(), PKF::createAny(), PKF::createAny());
47     static const Cynara::PolicyKey k_wua(PKF::createWildcard(), PKF::create("u"), PKF::createAny());
48     static const Cynara::PolicyKey k_nua(PKF::create(""), PKF::create("u"), PKF::createAny());
49 } /* namespace Keys */
50
51 namespace SN {
52     static const Cynara::ProtocolFrameSequenceNumber min(0);
53     static const Cynara::ProtocolFrameSequenceNumber min_1(min + 1);
54     static const Cynara::ProtocolFrameSequenceNumber min_2(min + 2);
55     static const Cynara::ProtocolFrameSequenceNumber max(UINT16_MAX);
56     static const Cynara::ProtocolFrameSequenceNumber max_1(max - 1);
57     static const Cynara::ProtocolFrameSequenceNumber max_2(max - 2);
58     static const Cynara::ProtocolFrameSequenceNumber mid((min + max) / 2);
59 } /* namespace SN */
60
61 namespace Buckets {
62     static const Cynara::PolicyBucketId empty("");
63     static const Cynara::PolicyBucketId not_empty("testBucket_1");
64 } /* namespace Buckets */
65
66 namespace Types {
67     static const Cynara::PolicyType allow(Cynara::PredefinedPolicyType::ALLOW);
68     static const Cynara::PolicyType deny(Cynara::PredefinedPolicyType::DENY);
69     static const Cynara::PolicyType bucket(Cynara::PredefinedPolicyType::BUCKET);
70     static const Cynara::PolicyType none(Cynara::PredefinedPolicyType::NONE);
71     static const Cynara::PolicyType plugin_type(100);
72 } /* namespace Types */
73
74 namespace Results {
75     static const Cynara::PolicyResult allow(Types::allow, "");
76     static const Cynara::PolicyResult deny(Types::deny, "");
77     static const Cynara::PolicyResult bucket_empty(Types::bucket, Buckets::empty);
78     static const Cynara::PolicyResult bucket_not_empty(Types::bucket, Buckets::not_empty);
79     static const Cynara::PolicyResult none(Types::none, "");
80     static const Cynara::PolicyResult plugin_1(Types::plugin_type, "");
81     static const Cynara::PolicyResult plugin_2(Types::plugin_type, "meta_data_2");
82 } /* namespace Results */
83 } /* namespace TestDataCollection */
84 } /* namespace anonymous */
85
86 #endif /* TEST_COMMON_PROTOCOLS_TESTDATACOLLECTION_H_ */