build:
python %s <targetbuild>
Allowed values for <target_build>: all, linux_unsecured, linux_secured, linux_unsecured_with_ra, linux_secured_with_ra, linux_unsecured_with_rd, linux_secured_with_rd, android, arduino, tizen, simulator, darwin, windows, msys
- Note: \"linux\" will build \"linux_unsecured\", \"linux_secured\", \"linux_unsecured_with_ra\", \"linux_secured_with_ra\", \"linux_secured_with_rd\" & \"linux_unsecured_with_rd\".
+ Note: \"linux\" will build \"linux_unsecured\", \"linux_secured\", \"linux_unsecured_with_ra\", \"linux_secured_with_ra\", \"linux_secured_with_rd\", \"linux_unsecured_with_mq\" & \"linux_unsecured_with_rd\".
Any selection will build both debug and release versions of all available targets in the scope you've selected.
To choose any specific command, please use the SCons commandline directly. Please refer to [IOTIVITY_REPO]/Readme.scons.txt.
clean:
build_linux_unsecured_with_rm(flag, extra_option_str)
build_linux_unsecured_with_rd(flag, extra_option_str)
build_linux_secured_with_rd(flag, extra_option_str)
+ build_linux_unsecured_with_mq(flag, extra_option_str)
build_simulator(flag, extra_option_str)
build_android(flag, extra_option_str)
}
call_scons(build_options, extra_option_str)
+def build_linux_unsecured_with_mq(flag, extra_option_str):
+ print ("*********** Build for linux With Message Queue ************")
+ build_options = {
+ 'RELEASE':flag,
+ 'WITH_MQ':'PUB,SUB,BROKER',
+ }
+ call_scons(build_options, extra_option_str)
+
def build_android(flag, extra_option_str):
# Note: for android, as oic-resource uses C++11 feature stoi and to_string,
# it requires gcc-4.9, currently only android-ndk-r10(for linux)
build_linux_secured_with_rd("true", "")
build_linux_secured_with_rd("false", "")
+ elif str(sys.argv[1]) == "linux_unsecured_with_mq":
+ build_linux_unsecured_with_mq("true", "")
+ build_linux_unsecured_with_mq("false", "")
+
elif str(sys.argv[1]) == "android":
build_android("true", "")
build_android("false", "")
--- /dev/null
+/* ****************************************************************
+ *
+ * Copyright 2016 Samsung Electronics All Rights Reserved.
+ *
+ *
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************/
+
+
+#include <OCPlatform.h>
+#include <OCApi.h>
+#include <gtest/gtest.h>
+#include <string>
+#include <map>
+
+namespace OCMQResourceTest
+{
+ using namespace OC;
+
+#ifdef MQ_SUBSCRIBER
+ void onObserve(const HeaderOptions, const OCRepresentation&, const int&, const int&)
+ {
+ }
+#endif
+
+#ifdef MQ_PUBLISHER
+ void onGetPut(const HeaderOptions&, const OCRepresentation& , const int eCode)
+ {
+ }
+#endif
+
+ void foundResource(std::shared_ptr<OCResource>)
+ {
+ }
+
+ void createdTopic(const HeaderOptions &, const OCRepresentation &, const int,
+ std::shared_ptr<OCResource>)
+ {
+ }
+
+ //Helper method
+ OCResource::Ptr ConstructResourceObject(std::string host, std::string uri)
+ {
+ OCConnectivityType connectivityType = CT_DEFAULT;
+ std::vector<std::string> types = {"tkss.wk"};
+ std::vector<std::string> ifaces = {DEFAULT_INTERFACE};
+
+ auto ret = OCPlatform::constructResourceObject(host, uri,
+ connectivityType, false, types, ifaces);
+
+ if (!ret)
+ {
+ ADD_FAILURE() << "ConstructResourceObject result was null";
+ return nullptr;
+ }
+
+ return ret;
+ }
+
+ // Message Queue Test
+ TEST(MessageQueueTest, DiscoveryMQTopicsValid)
+ {
+ OCResource::Ptr resource = ConstructResourceObject("coap://192.168.1.2:5000", "/resource");
+ EXPECT_TRUE(resource != NULL);
+ QueryParamsMap query = {};
+ EXPECT_EQ(OC_STACK_OK, resource->discoveryMQTopics(query, &foundResource));
+ }
+
+ TEST(MessageQueueTest, CreateMQTopicValid)
+ {
+ OCResource::Ptr resource = ConstructResourceObject("coap://192.168.1.2:5000", "/resource");
+ EXPECT_TRUE(resource != NULL);
+ OCRepresentation rep;
+ QueryParamsMap query = {};
+ EXPECT_EQ(OC_STACK_OK, resource->createMQTopic(rep, "/ps/nweTopic", query, &createdTopic));
+ }
+
+#ifdef MQ_PUBLISHER
+ TEST(MessageQueueTest, PublishMQTopicValid)
+ {
+ OCResource::Ptr resource = ConstructResourceObject("coap://192.168.1.2:5000", "/resource");
+ EXPECT_TRUE(resource != NULL);
+ OCRepresentation rep;
+ QueryParamsMap query = {};
+ EXPECT_EQ(OC_STACK_OK, resource->publishMQTopic(rep, query, &onGetPut));
+ }
+#endif
+
+#ifdef MQ_SUBSCRIBER
+ TEST(MessageQueueTest, SubscribeMQTopicValid)
+ {
+ OCResource::Ptr resource = ConstructResourceObject("coap://192.168.1.2:5000", "/resource");
+ EXPECT_TRUE(resource != NULL);
+ QueryParamsMap query = {};
+ EXPECT_EQ(OC_STACK_OK, resource->subscribeMQTopic(ObserveType::Observe, query, &onObserve));
+ }
+
+ TEST(MessageQueueTest, RequestMQPublishValid)
+ {
+ OCResource::Ptr resource = ConstructResourceObject("coap://192.168.1.2:5000", "/resource");
+ EXPECT_TRUE(resource != NULL);
+ QueryParamsMap query = {};
+ EXPECT_EQ(OC_STACK_OK, resource->requestMQPublish(query, &onGetPut));
+ }
+#endif
+}
+