ArrayList<Object> response = mRdManager.discoverResource(diList, rtList,
ifList);
+ if (response.size() == 0) {
+ return MessageBuilder.createResponse(request,
+ ResponseStatus.NOT_FOUND);
+ }
+
return MessageBuilder.createResponse(request, ResponseStatus.CONTENT,
ContentFormat.APPLICATION_CBOR,
mCbor.encodingPayloadToCbor(response));
RDServerTestUtils.DISCOVERY_REQ_URI,
"rt=core.light;di=" + RDServerTestUtils.DI);
mDiscoveryResource.onDefaultRequestReceived(mockDevice, request);
- // assertion: if the response status is "CONTENT"
- // assertion : if the payload is null
+ // assertion: if the response status is "NOT_FOUND"
assertTrue(mLatch.await(2L, SECONDS));
- assertTrue(methodCheck(mResponse, ResponseStatus.CONTENT));
- assertTrue(nullPayloadCheck(mResponse));
+ assertTrue(methodCheck(mResponse, ResponseStatus.NOT_FOUND));
}
@Test
void foundDevice(shared_ptr<OC::OCResource> resource)
{
+ cout << "Found device called!" << endl;
+
vector<string> rt = resource->getResourceTypes();
cout << "Device found: " << resource->uri() << endl;
}
}
+void errorFoundDevice(const std::string &uri, const int ecode)
+{
+ cout << "Found device error on " << uri << " code " << ecode << endl;
+ g_callbackLock.notify_all();
+}
+
void presenceDevice(OCStackResult , const unsigned int i, const string &str)
{
cout << "Presence received, i=" << i << " str=" << str << endl;
result = OCPlatform::findResource(g_host, "/oic/res?rt=oic.wk.d",
static_cast<OCConnectivityType>(CT_ADAPTER_TCP | CT_IP_USE_V4),
- &foundDevice);
+ &foundDevice, &errorFoundDevice);
cout << " result: " << result << endl;