final String resourceType2 = "unit.test.resource" + new Date().getTime();
final CountDownLatch signal = new CountDownLatch(2);
- final List<OcResource> resourceList = new LinkedList<OcResource>();
-
- OcPlatform.EntityHandler entityHandler = new OcPlatform.EntityHandler() {
- @Override
- public EntityHandlerResult handleEntity(OcResourceRequest ocResourceRequest) {
- return EntityHandlerResult.OK;
- }
- };
+ final List<OcResource> resourceList = new LinkedList<>();
OcPlatform.OnResourceFoundListener resourceFoundListener =
new OcPlatform.OnResourceFoundListener() {
@Override
- public void onResourceFound(OcResource resource) {
+ public synchronized void onResourceFound(OcResource resource) {
resourceList.add(resource);
Log.i(TAG, "Host: " + resource.getHost());
Log.i(TAG, "Uri: " + resource.getUri());
Log.i(TAG, "Observable: " + resource.isObservable());
+ assertFalse(resource.getResourceTypes().isEmpty());
for (String resourceType : resource.getResourceTypes()) {
Log.i(TAG, "Type: " + resourceType);
}
+ assertFalse(resource.getResourceTypes().isEmpty());
for (String resourceInterface : resource.getResourceInterfaces()) {
Log.i(TAG, "Interface: " + resourceInterface);
}
List<OcHeaderOption> headerOptionList = new LinkedList<OcHeaderOption>();
headerOptionList.add(new OcHeaderOption(2885, "OptionData1"));
headerOptionList.add(new OcHeaderOption(2886, "OptionData2"));
- resource.setHeaderOptions(headerOptionList);
resource.setHeaderOptions(headerOptionList);
resource.unsetHeaderOptions();
"/a/unittest1",
resourceType1,
OcPlatform.DEFAULT_INTERFACE,
- entityHandler,
+ null,
EnumSet.of(ResourceProperty.DISCOVERABLE)
);
"/a/unittest2",
resourceType2,
OcPlatform.DEFAULT_INTERFACE,
- entityHandler,
+ null,
EnumSet.of(ResourceProperty.DISCOVERABLE)
);
final String resourceType = "unit.test.resource" + new Date().getTime();
final CountDownLatch signal = new CountDownLatch(1);
- OcPlatform.EntityHandler entityHandler = new OcPlatform.EntityHandler() {
- @Override
- public EntityHandlerResult handleEntity(OcResourceRequest ocResourceRequest) {
- return EntityHandlerResult.OK;
- }
- };
-
OcPlatform.OnResourceFoundListener resourceFoundListener =
new OcPlatform.OnResourceFoundListener() {
@Override
"/a/unittest",
resourceType,
OcPlatform.DEFAULT_INTERFACE,
- entityHandler,
+ null,
EnumSet.of(ResourceProperty.DISCOVERABLE)
);
"/a/unittest",
resourceType,
OcPlatform.DEFAULT_INTERFACE,
- entityHandler,
+ null,
EnumSet.of(ResourceProperty.DISCOVERABLE)
);
* header options, they will be ignored. <br>
* Use unsetHeaderOptions API to clear the header information.
*/
- void setHeaderOptions(const HeaderOptions& headerOptions)
- {
- m_headerOptions = headerOptions;
- }
+ void setHeaderOptions(const HeaderOptions& headerOptions);
/**
* Function to unset header options.
*/
- void unsetHeaderOptions()
- {
- m_headerOptions.clear();
- }
+ void unsetHeaderOptions();
/**
* Function to get the host address of this resource
* Function to get the list of resource types
* @return vector of resource types
*/
- std::vector<std::string> getResourceTypes() const
- {
- return m_resourceTypes;
- }
+ std::vector<std::string> getResourceTypes() const;
/**
* Function to get the list of resource interfaces
* @return vector of resource interface
*/
- std::vector<std::string> getResourceInterfaces(void) const
- {
- return m_interfaces;
- }
+ std::vector<std::string> getResourceInterfaces(void) const;
// TODO-CA Revisit this since we are exposing two identifiers
/**
return result;
}
+void OCResource::setHeaderOptions(const HeaderOptions& headerOptions)
+{
+ m_headerOptions = headerOptions;
+}
+
+void OCResource::unsetHeaderOptions()
+{
+ m_headerOptions.clear();
+}
+
std::string OCResource::host() const
{
std::ostringstream ss;
return m_isObservable;
}
+std::vector<std::string> OCResource::getResourceTypes() const
+{
+ return m_resourceTypes;
+}
+
+std::vector<std::string> OCResource::getResourceInterfaces(void) const
+{
+ return m_interfaces;
+}
+
OCResourceIdentifier OCResource::uniqueIdentifier() const
{
return m_resourceId;