It is to make class names consistent.
All exposed classes in resource-encapsultion layer as the API must start with RCS.
Change-Id: I64280bc959a60d368cfabab731196e35a7383a94
Signed-off-by: coderhyme <jhyo.kim@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/2817
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Hun-je Yeon <hunje.yeon@samsung.com>
Reviewed-by: Madan Lanka <lanka.madan@samsung.com>
try
{
rObject->startCaching(pDataUpdateCB);
- }catch(InvalidParameterException &e)
+ }catch(const RCSInvalidParameterException &e)
{
OIC_HOSTING_LOG(DEBUG,
"[HostingObject::stateChangedCB]startCaching InvalidParameterException:%s",
try
{
rObject->stopCaching();
- }catch(InvalidParameterException &e)
+ }catch(const RCSInvalidParameterException &e)
{
OIC_HOSTING_LOG(DEBUG,
"[HostingObject::stateChangedCB]stopCaching InvalidParameterException:%s",
try
{
rObject->stopMonitoring();
- }catch(InvalidParameterException &e)
+ }catch(const RCSInvalidParameterException &e)
{
OIC_HOSTING_LOG(DEBUG,
"[HostingObject::stateChangedCB]stopWatching InvalidParameterException:%s",
try
{
mirroredServer = createMirroredServer(rObject);
- }catch(PlatformException &e)
+ }catch(const RCSPlatformException &e)
{
OIC_HOSTING_LOG(DEBUG,
"[HostingObject::dataChangedCB]createMirroredServer PlatformException:%s",
}
else
{
- throw PlatformException(OC_STACK_ERROR);
+ throw RCSPlatformException(OC_STACK_ERROR);
}
return retResource;
RequestObject newRequest = { };
newRequest.invokeRequest(remoteObject, RequestObject::RequestMethod::Setter,
resourceAttibutes);
- }catch(PlatformException &e)
+ }catch(const RCSPlatformException &e)
{
OIC_HOSTING_LOG(DEBUG,
"[HostingObject::setRequestHandler] PlatformException:%s",
{
requestMulticastPresence();
requestMulticastDiscovery();
- }catch(PlatformException &e)
+ }catch(const RCSPlatformException &e)
{
OIC_HOSTING_LOG(DEBUG,
"[ResourceHosting::startHosting]PlatformException:%s", e.what());
throw;
- }catch(InvalidParameterException &e)
+ }catch(const RCSInvalidParameterException &e)
{
OIC_HOSTING_LOG(DEBUG,
"[ResourceHosting::startHosting]InvalidParameterException:%s", e.what());
throw;
- }catch(std::exception &e)
+ }catch(const std::exception &e)
{
OIC_HOSTING_LOG(DEBUG,
"[ResourceHosting::startHosting]std::exception:%s", e.what());
std::bind(&ResourceHosting::destroyedHostingObject, this,
HostingObjectWeakPtr(foundHostingObject)));
hostingObjectList.push_back(foundHostingObject);
- }catch(InvalidParameterException &e)
+ }catch(const RCSInvalidParameterException &e)
{
OIC_HOSTING_LOG(DEBUG,
"[ResourceHosting::discoverHandler]InvalidParameterException:%s", e.what());
try
{
ResourceHosting::getInstance()->startHosting();
- }catch(PlatformException &e)
+ }catch(const RCSPlatformException &e)
{
OIC_HOSTING_LOG(DEBUG,
"[OICStartCoordinate] platformException, reason:%s", e.what());
retResult = OC_STACK_ERROR;
throw;
- }catch(InvalidParameterException &e)
+ }catch(const RCSInvalidParameterException &e)
{
OIC_HOSTING_LOG(DEBUG,
"[OICStartCoordinate] InvalidParameterException, reason:%s", e.what());
return taskObj;
}
- catch (const PlatformException& e) {
+ catch (const RCSPlatformException& e) {
throwPlatformException(env, e);
}
res->startMonitoring(
std::bind(onStateChanged, std::placeholders::_1, JavaGlobalRef{ env, listener }));
}
- catch (const BadRequestException& e)
+ catch (const RCSBadRequestException& e)
{
env->ThrowNew(env->FindClass(EXC_NAME_ILLEGAL_STATE), e.what());
}
res->startCaching();
}
}
- catch (const BadRequestException& e)
+ catch (const RCSBadRequestException& e)
{
env->ThrowNew(env->FindClass(EXC_NAME_ILLEGAL_STATE), e.what());
}
{
return res->isCachedAvailable();
}
- catch (const BadRequestException& e)
+ catch (const RCSBadRequestException& e)
{
env->ThrowNew(env->FindClass(EXC_NAME_ILLEGAL_STATE), e.what());
return false;
return newAttributesObject(env, attrs);
}
- catch (const BadRequestException& e)
+ catch (const RCSBadRequestException& e)
{
env->ThrowNew(env->FindClass(EXC_NAME_ILLEGAL_STATE), e.what());
return { };
res->getRemoteAttributes(std::bind(onRemoteAttributesReceived,
std::placeholders::_1, std::placeholders::_2, JavaGlobalRef{ env, listener }));
}
- catch (const PlatformException& e) {
+ catch (const RCSPlatformException& e) {
throwPlatformException(env, e);
}
}
res->setRemoteAttributes(attrs, std::bind(onRemoteAttributesReceived,
std::placeholders::_1, std::placeholders::_2, JavaGlobalRef{ env, listener }));
}
- catch (const PlatformException& e) {
+ catch (const RCSPlatformException& e) {
throwPlatformException(env, e);
}
}
return resourceObj;
}
- catch (const PlatformException& e)
+ catch (const RCSPlatformException& e)
{
LOGE("%s", e.what());
throwPlatformException(env, e);
return valueObj;
}
- catch(const InvalidKeyException& e)
+ catch(const RCSInvalidKeyException& e)
{
return nullptr;
}
{
res->notify();
}
- catch (const PlatformException& e) {
+ catch (const RCSPlatformException& e) {
throwPlatformException(env, e);
}
}
env->DeleteGlobalRef(g_cls_PlatformException);
}
-void throwPlatformException(JNIEnv* env, const OIC::Service::PlatformException& e)
+void throwPlatformException(JNIEnv* env, const OIC::Service::RCSPlatformException& e)
{
auto msg = newStringObject(env, e.getReason());
VERIFY_NO_EXC(env);
{
namespace Service
{
- class PlatformException;
+ class RCSPlatformException;
}
}
void initJavaExceptions(JNIEnvWrapper*);
void clearJavaExceptions(JNIEnvWrapper*);
-void throwPlatformException(JNIEnv*, const OIC::Service::PlatformException&);
+void throwPlatformException(JNIEnv*, const OIC::Service::RCSPlatformException&);
template < typename ENV >
void throwRCSException(ENV* env, const char* msg)
{
createResource();
}
- catch (const PlatformException &e)
+ catch (const RCSPlatformException &e)
{
std::cout << "Exception in initServer : " << e.what() << std::endl;
}
}
}
}
- catch (const BadRequestException& e)
+ catch (const RCSBadRequestException& e)
{
std::cout << "Exception in getCachedAttributes : " << e.what() << std::endl;
}
<< "\tvalue : " << resource->getCachedAttribute(defaultKey).get< int >()
<< std::endl;
}
- catch (const BadRequestException& e)
+ catch (const RCSBadRequestException& e)
{
std::cout << "Exception in getCachedAttribute : " << e.what() << std::endl;
}
- catch (const BadGetException& e)
+ catch (const RCSBadGetException& e)
{
std::cout << "Exception in getCachedAttribute : " << e.what() << std::endl;
}
{
createResource();
}
- catch (const PlatformException& e)
+ catch (const RCSPlatformException& e)
{
std::cout << "Exception in initServer : " << e.what() << std::endl;
}
server = RCSResourceObject::Builder(resourceUri, resourceType,
resourceInterface).setDiscoverable(true).setObservable(true).build();
}
- catch (const PlatformException &e)
+ catch (const RCSPlatformException &e)
{
dlog_print(DLOG_ERROR, LOG_TAG, "#### Create resource exception! (%s)", e.what());
}
logMessage = logMessage + "Started Monitoring <br>";
resource->startMonitoring(&onResourceStateChanged);
}
- catch (const BadRequestException &e)
+ catch (const RCSBadRequestException &e)
{
logMessage = logMessage + "Exception BadRequest<br>";
dlog_print(DLOG_INFO, LOG_TAG, "#### Exception in isMonitoring : %s", e.what());
}
- catch (const InvalidParameterException &e)
+ catch (const RCSInvalidParameterException &e)
{
logMessage = logMessage + "Exception Invalid Param<br>";
dlog_print(DLOG_INFO, LOG_TAG, "#### Exception in isMonitoring : %s", e.what());
logMessage = logMessage + "Caching with callback <br>";
resource->startCaching(&onCacheUpdated);
}
- catch (const BadRequestException &e)
+ catch (const RCSBadRequestException &e)
{
logMessage = logMessage + "Exception BadRequest<br>";
dlog_print(DLOG_INFO, LOG_TAG, "#### Exception in startCaching : %s", e.what());
logMessage = logMessage + "Caching without callback <br>";
resource->startCaching();
}
- catch (const BadRequestException &e)
+ catch (const RCSBadRequestException &e)
{
logMessage = logMessage + "Exception BadRequest<br>";
dlog_print(DLOG_INFO, LOG_TAG, "#### Exception in startCaching : %s", e.what());
}
}
}
- catch (const BadRequestException &e)
+ catch (const RCSBadRequestException &e)
{
logMessage = "Exception Received<br>";
dlog_print(DLOG_INFO, LOG_TAG, "#### Exception in getCachedAttributes : %s", e.what());
int attrValue = resource->getCachedAttribute(defaultKey).get< int >();
logMessage = logMessage + "VALUE:" + to_string(attrValue) + "<br>";
}
- catch (const BadRequestException &e)
+ catch (const RCSBadRequestException &e)
{
logMessage = logMessage + "Exception BadRequest<br>";
dlog_print(DLOG_INFO, LOG_TAG, "#### Exception in getCachedAttribute : %s", e.what());
}
- catch (const BadGetException &e)
+ catch (const RCSBadGetException &e)
{
logMessage = logMessage + "Exception BadGet<br>";
dlog_print(DLOG_INFO, LOG_TAG, "#### Exception in getCachedAttribute : %s", e.what());
server = RCSResourceObject::Builder(resourceUri, resourceType,
resourceInterface).setDiscoverable(true).setObservable(true).build();
}
- catch (const PlatformException &e)
+ catch (const RCSPlatformException &e)
{
dlog_print(DLOG_ERROR, LOG_TAG, "#### Create resource exception! (%s)", e.what());
}
* Thrown when OC layer returns an error.
*
*/
- class PlatformException: public RCSException
+ class RCSPlatformException: public RCSException
{
public:
- explicit PlatformException(OCStackResult reason);
+ explicit RCSPlatformException(OCStackResult reason);
/**
* Returns the reason.
* Thrown when a request is not acceptable.
*
*/
- class BadRequestException: public RCSException
+ class RCSBadRequestException: public RCSException
{
public:
- explicit BadRequestException(const std::string& what);
- explicit BadRequestException(std::string&& what);
+ explicit RCSBadRequestException(const std::string& what);
+ explicit RCSBadRequestException(std::string&& what);
};
/**
* Thrown when a parameter is not valid.
*
*/
- class InvalidParameterException: public RCSException
+ class RCSInvalidParameterException: public RCSException
{
public:
- explicit InvalidParameterException(const std::string& what);
- explicit InvalidParameterException(std::string&& what);
+ explicit RCSInvalidParameterException(const std::string& what);
+ explicit RCSInvalidParameterException(std::string&& what);
};
/**
* Thrown when getting value with wrong template parameter.
*/
- class BadGetException: public RCSException
+ class RCSBadGetException: public RCSException
{
public:
- explicit BadGetException(const std::string& what);
- explicit BadGetException(std::string&& what);
+ explicit RCSBadGetException(const std::string& what);
+ explicit RCSBadGetException(std::string&& what);
};
/**
* Thrown when a key is invalid.
*
*/
- class InvalidKeyException: public RCSException
+ class RCSInvalidKeyException: public RCSException
{
public:
- explicit InvalidKeyException(const std::string& what);
- explicit InvalidKeyException(std::string&& what);
+ explicit RCSInvalidKeyException(const std::string& what);
+ explicit RCSInvalidKeyException(std::string&& what);
};
}
}
catch (const boost::bad_get&)
{
- throw BadGetException{ "Wrong type" };
+ throw RCSBadGetException{ "Wrong type" };
}
}
{
return get< T >() == rhs;
}
- catch (const BadGetException&)
+ catch (const RCSBadGetException&)
{
return false;
}
{
if (delay < 0LL)
{
- throw InvalidParameterException{ "delay can't be negative." };
+ throw RCSInvalidParameterException{ "delay can't be negative." };
}
if (!cb)
{
- throw InvalidParameterException{ "callback is empty." };
+ throw RCSInvalidParameterException{ "callback is empty." };
}
return addTask(convertToTime(Milliseconds{ delay }), std::move(cb), generateId());
if (actual == r) return;
}
- throw PlatformException(actual);
+ throw RCSPlatformException(actual);
}
inline void expectOCStackResult(OCStackResult actual, OCStackResult expected)
{
if (actual != expected)
{
- throw PlatformException(actual);
+ throw RCSPlatformException(actual);
}
}
}
catch (const OC::OCException& e)
{
- throw PlatformException(e.code());
+ throw RCSPlatformException(e.code());
}
}
}
catch (const OC::OCException& e)
{
- throw PlatformException(e.code());
+ throw RCSPlatformException(e.code());
}
}
}
catch (const OC::OCException& e)
{
- throw PlatformException(e.code());
+ throw RCSPlatformException(e.code());
}
}
}
catch (const OC::OCException& e)
{
- throw PlatformException(e.code());
+ throw RCSPlatformException(e.code());
}
}
}
catch (const OC::OCException& e)
{
- throw PlatformException(e.code());
+ throw RCSPlatformException(e.code());
}
}
}
catch (const OC::OCException& e)
{
- throw PlatformException(e.code());
+ throw RCSPlatformException(e.code());
}
}
}
catch (const OC::OCException& e)
{
- throw PlatformException(e.code());
+ throw RCSPlatformException(e.code());
}
}
}
- PlatformException::PlatformException(OCStackResult reason) :
+ RCSPlatformException::RCSPlatformException(OCStackResult reason) :
RCSException{ "Failed : " + OC::OCException::reason(reason) },
m_reason { reason }
{
}
- OCStackResult PlatformException::getReasonCode() const
+ OCStackResult RCSPlatformException::getReasonCode() const
{
return m_reason;
}
- std::string PlatformException::getReason() const
+ std::string RCSPlatformException::getReason() const
{
return OC::OCException::reason(m_reason);
}
- BadRequestException::BadRequestException(const std::string& what) :
+ RCSBadRequestException::RCSBadRequestException(const std::string& what) :
RCSException{ what }
{
}
- BadRequestException::BadRequestException(std::string&& what) :
+ RCSBadRequestException::RCSBadRequestException(std::string&& what) :
RCSException{ std::move(what) }
{
}
- InvalidParameterException::InvalidParameterException(const std::string& what) :
+ RCSInvalidParameterException::RCSInvalidParameterException(const std::string& what) :
RCSException{ what }
{
}
- InvalidParameterException::InvalidParameterException(std::string&& what) :
+ RCSInvalidParameterException::RCSInvalidParameterException(std::string&& what) :
RCSException{ std::move(what) }
{
}
- BadGetException::BadGetException(const std::string& what) :
+ RCSBadGetException::RCSBadGetException(const std::string& what) :
RCSException{ what }
{
}
- BadGetException::BadGetException(std::string&& what) :
+ RCSBadGetException::RCSBadGetException(std::string&& what) :
RCSException{ std::move(what) }
{
}
- InvalidKeyException::InvalidKeyException(const std::string& what) :
+ RCSInvalidKeyException::RCSInvalidKeyException(const std::string& what) :
RCSException{ what }
{
}
- InvalidKeyException::InvalidKeyException(std::string&& what) :
+ RCSInvalidKeyException::RCSInvalidKeyException(std::string&& what) :
RCSException{ std::move(what) }
{
}
-> result_type
{
// should not reach here.
- throw BadGetException("");
+ throw RCSBadGetException("");
}
auto RCSResourceAttributes::KeyValuePair::ConstValueVisitor::operator()(
}
catch (const std::out_of_range&)
{
- throw InvalidKeyException{ "No attribute named '" + key + "'" };
+ throw RCSInvalidKeyException{ "No attribute named '" + key + "'" };
}
}
}
catch (const std::out_of_range&)
{
- throw InvalidKeyException{ "No attribute named '" + key + "'" };
+ throw RCSInvalidKeyException{ "No attribute named '" + key + "'" };
}
}
static_cast< SubscribePresence1>(OC::OCPlatform::subscribePresence))
.Return(OC_STACK_ERROR);
- ASSERT_THROW(subscribePresence(handle, "", CONTYPE, SubscribeCallback()), PlatformException);
+ ASSERT_THROW(subscribePresence(handle, "", CONTYPE, SubscribeCallback()), RCSPlatformException);
}
TEST_F(PresenceSubscriberNonMemberTest, OCPlatformUnsubscribePresenceWillBeCalled)
{
mocks.ExpectCallFuncOverload(OC::OCPlatform::unsubscribePresence).Return(OC_STACK_ERROR);
- ASSERT_THROW(unsubscribePresence(handle), PlatformException);
+ ASSERT_THROW(unsubscribePresence(handle), RCSPlatformException);
}
class PresenceSubscriberTest: public TestWithMock
static_cast< SubscribePresence1 >(OC::OCPlatform::subscribePresence))
.Return(OC_STACK_ERROR);
- ASSERT_THROW(PresenceSubscriber(HOST, CONTYPE, SubscribeCallback()), PlatformException);
+ ASSERT_THROW(PresenceSubscriber(HOST, CONTYPE, SubscribeCallback()), RCSPlatformException);
}
TEST_F(PresenceSubscriberTest, IsSubscribingIfConstructedWithoutException)
{
mocks.OnCall(fakeResource, FakeOCResource::get).Return(OC_STACK_ERROR);
- ASSERT_THROW(resource->requestGet(PrimitiveResource::GetCallback()), PlatformException);
+ ASSERT_THROW(resource->requestGet(PrimitiveResource::GetCallback()), RCSPlatformException);
}
TEST_F(PrimitiveResourceTest, RequestSetInvokesOCResourcePut)
mocks.OnCall(fakeResource, FakeOCResource::put).Return(OC_STACK_ERROR);
ASSERT_THROW(resource->requestSet(RCSResourceAttributes{ }, PrimitiveResource::SetCallback()),
- PlatformException);
+ RCSPlatformException);
}
TEST_F(PrimitiveResourceTest, RequestSetPassResourceAttributesToOCResourcePut)
{
mocks.OnCall(fakeResource, FakeOCResource::observe).Return(OC_STACK_ERROR);
- ASSERT_THROW(resource->requestObserve(PrimitiveResource::ObserveCallback()), PlatformException);
+ ASSERT_THROW(resource->requestObserve(PrimitiveResource::ObserveCallback()), RCSPlatformException);
}
TEST_F(PrimitiveResourceTest, DelegteGettersToOCResource)
mocks.ExpectCallFuncOverload(static_cast<FindResource>(OC::OCPlatform::findResource)).
Return(OC_STACK_ERROR);
- EXPECT_THROW(discoverResource("", "", OCConnectivityType{ }, discovered), PlatformException);
+ EXPECT_THROW(discoverResource("", "", OCConnectivityType{ }, discovered), RCSPlatformException);
}
resourceAttributes[KEY] = 1;
auto& valueRef = resourceAttributes[KEY];
- ASSERT_THROW(valueRef.get< std::string >(), BadGetException);
+ ASSERT_THROW(valueRef.get< std::string >(), RCSBadGetException);
}
TEST_F(ResourceAttributesTest, GettingWithAtThrowsIfThereIsNoMatchedValue)
{
- ASSERT_THROW(resourceAttributes.at(KEY), InvalidKeyException);
+ ASSERT_THROW(resourceAttributes.at(KEY), RCSInvalidKeyException);
}
TEST_F(ResourceAttributesTest, CopyingValueDoesNotShareState)
resourceAttributes.erase(KEY);
- ASSERT_THROW(resourceAttributes.at(KEY), InvalidKeyException);
+ ASSERT_THROW(resourceAttributes.at(KEY), RCSInvalidKeyException);
}
TEST_F(ResourceAttributesTest, NoDataErasedIfKeyDoesNotMatch)
InvalidParameterException(std::string&& what)
: RCSException{ std::move(what) } {}
};
- class FailedSubscribePresenceException: public PlatformException
+ class FailedSubscribePresenceException: public RCSPlatformException
{
public:
FailedSubscribePresenceException(OCStackResult reason)
- : PlatformException{reason} {}
+ : RCSPlatformException{reason} {}
};
static ResourceBroker * getInstance();
OC_LOG_V(DEBUG, BROKER_TAG, "subscribe Presence");
presenceSubscriber
= PresenceSubscriber(address, BROKER_TRANSPORT, pSubscribeRequestCB);
- } catch(PlatformException &e)
+ } catch(RCSPlatformException &e)
{
OC_LOG_V(DEBUG, BROKER_TAG,
"exception in subscribe Presence %s", e.getReason().c_str());
OC_LOG_V(DEBUG, BROKER_TAG, "create the ResourcePresence.");
presenceItem.reset(new ResourcePresence());
presenceItem->initializeResourcePresence(pResource);
- }catch(PlatformException &e)
+ }catch(RCSPlatformException &e)
{
throw FailedSubscribePresenceException(e.getReasonCode());
}
MockingFunc();
mocks.OnCallFuncOverload(static_cast< subscribePresenceSig1 >(OC::OCPlatform::subscribePresence)).Return(OC_STACK_ERROR);
- ASSERT_THROW(instance->initializeDevicePresence(pResource),PlatformException);
+ ASSERT_THROW(instance->initializeDevicePresence(pResource),RCSPlatformException);
}
{
if (!cb)
{
- throw InvalidParameterException { "input Parameter(callback) is NULL" };
+ throw RCSInvalidParameterException { "input Parameter(callback) is NULL" };
}
DiscoverRequestInfo discoveryItem;
if (!cb)
{
- throw InvalidParameterException{ "startMonitoring : Callback is NULL" };
+ throw RCSInvalidParameterException{ "startMonitoring : Callback is NULL" };
}
if (isMonitoring())
{
OC_LOG(DEBUG, TAG, "startMonitoring : already started");
- throw BadRequestException{ "Monitoring already started." };
+ throw RCSBadRequestException{ "Monitoring already started." };
}
m_brokerId = ResourceBroker::getInstance()->hostResource(m_primitiveResource,
if (isCaching())
{
OC_LOG(DEBUG, TAG, "startCaching : already Started");
- throw BadRequestException{ "Caching already started." };
+ throw RCSBadRequestException{ "Caching already started." };
}
if (cb)
if (!isCaching())
{
- throw BadRequestException{ "Caching not started." };
+ throw RCSBadRequestException{ "Caching not started." };
}
if (!isCachedAvailable())
{
- throw BadRequestException{ "Cache data is not available." };
+ throw RCSBadRequestException{ "Cache data is not available." };
}
return ResourceCacheManager::getInstance()->getCachedData(m_primitiveResource);
if (!cb)
{
- throw InvalidParameterException{ "getRemoteAttributes : Callback is empty" };
+ throw RCSInvalidParameterException{ "getRemoteAttributes : Callback is empty" };
}
m_primitiveResource->requestGet(
if (!cb)
{
- throw InvalidParameterException{ "setRemoteAttributes : Callback is empty" };
+ throw RCSInvalidParameterException{ "setRemoteAttributes : Callback is empty" };
}
m_primitiveResource->requestSet(attribute,
discoveryTask = RCSDiscoveryManager::getInstance()->discoverResourceByType(
RCSAddress::multicast(), m_ResourceType, pDiscoveredCB);
}
- catch (InvalidParameterException &e)
+ catch (RCSInvalidParameterException &e)
{
// TODO Handle Exception
return;
{
updatedResource->getCachedAttribute(m_AttrubuteName);
}
- catch (InvalidKeyException &e)
+ catch (RCSInvalidKeyException &e)
{
// TODO Handle Exception
return;
retVector.push_back(value);
}
- catch (InvalidKeyException &e)
+ catch (RCSInvalidKeyException &e)
{
// TODO Handle Exception
}
{
autoNotify(!replaced.empty(), m_autoNotifyPolicy);
return sendResponse(*this, request, response);
- } catch (const PlatformException& e) {
+ } catch (const RCSPlatformException& e) {
OC_LOG_V(ERROR, LOG_TAG, "Error : %s ", e.what());
return OC_EH_ERROR;
}
TEST(ResourceObjectBuilderCreateTest, ThrowIfUriIsInvalid)
{
- ASSERT_THROW(RCSResourceObject::Builder("", "", "").build(), PlatformException);
+ ASSERT_THROW(RCSResourceObject::Builder("", "", "").build(), RCSPlatformException);
}
class ResourceObjectBuilderTest: public TestWithMock
TEST_F(RemoteResourceObjectTest, GetRemoteAttributesDoesNotAllowEmptyFunction)
{
- ASSERT_THROW(object->getRemoteAttributes({ }), InvalidParameterException);
+ ASSERT_THROW(object->getRemoteAttributes({ }), RCSInvalidParameterException);
}
TEST_F(RemoteResourceObjectTest, GetRemoteAttributesGetsAttributesOfServer)
TEST_F(RemoteResourceObjectTest, SetRemoteAttributesDoesNotAllowEmptyFunction)
{
- ASSERT_THROW(object->setRemoteAttributes({ }, { }), InvalidParameterException);
+ ASSERT_THROW(object->setRemoteAttributes({ }, { }), RCSInvalidParameterException);
}
TEST_F(RemoteResourceObjectTest, SetRemoteAttributesSetsAttributesOfServer)
TEST_F(RemoteResourceObjectTest, StartMonitoringThrowsIfFunctionIsEmpty)
{
- ASSERT_THROW(object->startMonitoring({ }), InvalidParameterException);
+ ASSERT_THROW(object->startMonitoring({ }), RCSInvalidParameterException);
}
TEST_F(RemoteResourceObjectTest, IsMonitoringReturnsTrueAfterStartMonitoring)
{
object->startMonitoring(resourceStateChanged);
- ASSERT_THROW(object->startMonitoring(resourceStateChanged), BadRequestException);
+ ASSERT_THROW(object->startMonitoring(resourceStateChanged), RCSBadRequestException);
}
TEST_F(RemoteResourceObjectTest, DefaultStateIsNone)
{
object->startCaching(cacheUpdatedCallback);
- ASSERT_THROW(object->startCaching(), BadRequestException);
+ ASSERT_THROW(object->startCaching(), RCSBadRequestException);
}
TEST_F(RemoteResourceObjectTest, DefaultCacheStateIsNone)
TEST_F(RemoteResourceObjectTest, GetCachedAttributesThrowsIfCachingIsNotStarted)
{
- ASSERT_THROW(object->getCachedAttributes(), BadRequestException);
+ ASSERT_THROW(object->getCachedAttributes(), RCSBadRequestException);
}
TEST_F(RemoteResourceObjectTest, CachedAttributesHasSameAttributesWithServer)
TEST_F(RemoteResourceObjectTest, GetCachedAttributeThrowsIfCachingIsNotStarted)
{
- ASSERT_THROW(object->getCachedAttribute(ATTR_KEY), BadRequestException);
+ ASSERT_THROW(object->getCachedAttribute(ATTR_KEY), RCSBadRequestException);
}
TEST_F(RemoteResourceObjectTest, GetCachedAttributeThrowsIfKeyIsInvalid)
object->startCaching(cacheUpdatedCallback);
Wait();
- ASSERT_THROW(object->getCachedAttribute(""), InvalidKeyException);
+ ASSERT_THROW(object->getCachedAttribute(""), RCSInvalidKeyException);
}
TEST_F(RemoteResourceObjectTest, HasSameUriWithServer)