Commit cc225de4 authored by doil.kwon's avatar doil.kwon Committed by Uze Choi

Modify UnitTest Code about "Resource Broker"

- Modify inherit class : "Test" class -> "TestWithMock" class
- Support 4.6, 4.7, 4.8 gcc compiler

Change-Id: Ie4de09086ba737033f17f5d87bf1a809019351b6
Signed-off-by: default avatardoil.kwon <doil.kwon@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/1878Tested-by: default avatarjenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: default avatarUze Choi <uzchoi@samsung.com>
parent dd470a24
......@@ -99,5 +99,5 @@ SConscript('examples/SConscript')
################################################ ######################
SConscript('unittests/SConscript')
SConscript('src/resourceCache/unittests/SConscript')
#SConscript('src/resourceBroker/unittest/SConscript')
SConscript('src/resourceBroker/unittest/SConscript')
......@@ -25,7 +25,6 @@ class DeviceAssociationTest : public TestWithMock
{
public:
MockRepository mocks;
DeviceAssociation * instance;
DevicePresencePtr device;
PrimitiveResource::Ptr pResource;
......@@ -45,15 +44,17 @@ protected:
instance->addDevice(device);
}
void SetUp() override
void SetUp()
{
TestWithMock::SetUp();
instance = DeviceAssociation::getInstance();
device = (DevicePresencePtr)new DevicePresence();
pResource = PrimitiveResource::Ptr(mocks.Mock< PrimitiveResource >(), [](PrimitiveResource*){});
}
void TearDown() override
void TearDown()
{
TestWithMock::TearDown();
device.reset();
pResource.reset();
......
......@@ -20,7 +20,6 @@ class DevicePresenceTest : public TestWithMock
{
public:
MockRepository mocks;
DevicePresence * instance;
PrimitiveResource::Ptr pResource;
BrokerCB cb;
......@@ -28,16 +27,18 @@ public:
protected:
void SetUp() override
void SetUp()
{
TestWithMock::SetUp();
instance = (DevicePresence*)new DevicePresence();
pResource = PrimitiveResource::Ptr(mocks.Mock< PrimitiveResource >(), [](PrimitiveResource*){});
cb = ([](BROKER_STATE)->OCStackResult{return OC_STACK_OK;});
id = 0;
}
void TearDown() override
void TearDown()
{
TestWithMock::TearDown();
pResource.reset();
id = 0;
cb = nullptr;
......
......@@ -18,7 +18,6 @@ class ResourceBrokerTest : public TestWithMock
{
public:
MockRepository mocks;
ResourceBroker * brokerInstance;
PrimitiveResource::Ptr pResource;
BrokerCB cb;
......@@ -26,16 +25,18 @@ public:
protected:
void SetUp() override
void SetUp()
{
TestWithMock::SetUp();
brokerInstance = ResourceBroker::getInstance();
pResource = PrimitiveResource::Ptr(mocks.Mock< PrimitiveResource >(), [](PrimitiveResource*){});
cb = ([](BROKER_STATE)->OCStackResult{return OC_STACK_OK;});
id = 0;
}
void TearDown() override
void TearDown()
{
TestWithMock::TearDown();
pResource.reset();
id = 0;
cb = nullptr;
......
......@@ -28,7 +28,6 @@ public:
typedef std::function<void(const HeaderOptions&, const ResponseStatement&, int)> GetCallback;
MockRepository mocks;
ResourcePresence * instance;
PrimitiveResource::Ptr pResource;
BrokerCB cb;
......@@ -36,16 +35,19 @@ public:
protected:
void SetUp() override
void SetUp()
{
TestWithMock::SetUp();
instance = (ResourcePresence*)new ResourcePresence();
pResource = PrimitiveResource::Ptr(mocks.Mock< PrimitiveResource >(), [](PrimitiveResource*){});
cb = ([](BROKER_STATE)->OCStackResult{return OC_STACK_OK;});
id = 0;
}
void TearDown() override
void TearDown()
{
TestWithMock::TearDown();
pResource.reset();
id = 0;
cb = nullptr;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment