Imported Upstream version 1.1.0
[platform/upstream/iotivity.git] / service / resource-container / unittests / TestBundle / include / TestBundleActivator.h
1 //******************************************************************
2 //
3 // Copyright 2015 Samsung Electronics All Rights Reserved.
4 //
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
6 //
7 // Licensed under the Apache License, Version 2.0 (the "License");
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
10 //
11 //      http://www.apache.org/licenses/LICENSE-2.0
12 //
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an "AS IS" BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
18 //
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
20
21 #ifndef TESTBUNDLE_H_
22 #define TESTBUNDLE_H_
23
24 #include <vector>
25
26 #include "ResourceContainerBundleAPI.h"
27 #include "BundleActivator.h"
28 #include "BundleResource.h"
29
30 using namespace OIC::Service;
31
32 class TestBundleActivator : public BundleActivator
33 {
34     public:
35         TestBundleActivator();
36         ~TestBundleActivator();
37
38         void activateBundle(ResourceContainerBundleAPI *resourceContainer, std::string bundleId);
39         void deactivateBundle();
40
41         void createResource(resourceInfo resourceInfo);
42         void destroyResource(BundleResource::Ptr pBundleResource);
43
44         ResourceContainerBundleAPI *m_pResourceContainer;
45         std::string m_bundleId;
46         BundleResource::Ptr m_pTestResource;
47 };
48
49 /*Fake bundle resource class for testing*/
50 class TestBundleResource : public BundleResource
51 {
52     public:
53         void initAttributes() { };
54
55         RCSResourceAttributes handleGetAttributesRequest()
56         {
57             return BundleResource::getAttributes();
58         }
59
60         void handleSetAttributesRequest(
61             const RCSResourceAttributes &value)
62         {
63             BundleResource::setAttributes(value);
64         }
65 };
66
67 #endif /* TESTBUNDLE_H_ */