summaryrefslogtreecommitdiff
path: root/tests/TransportModuleLoader_test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'tests/TransportModuleLoader_test.cc')
-rw-r--r--tests/TransportModuleLoader_test.cc49
1 files changed, 49 insertions, 0 deletions
diff --git a/tests/TransportModuleLoader_test.cc b/tests/TransportModuleLoader_test.cc
new file mode 100644
index 0000000..57e69b1
--- /dev/null
+++ b/tests/TransportModuleLoader_test.cc
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd 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 "TransportModuleLoader.h"
+
+#include <AITT.h>
+#include <gtest/gtest.h>
+
+#include "AittTransport.h"
+#include "aitt_internal.h"
+
+class TransportModuleLoaderTest : public testing::Test {
+ public:
+ TransportModuleLoaderTest(void) : discovery("test"), loader("127.0.0.1")
+ {
+ loader.Init(discovery);
+ }
+
+ protected:
+ void SetUp() override {}
+ void TearDown() override {}
+
+ aitt::AittDiscovery discovery;
+ aitt::TransportModuleLoader loader;
+};
+
+TEST_F(TransportModuleLoaderTest, Positive_GetInstance_Anytime)
+{
+ std::shared_ptr<aitt::AittTransport> module = loader.GetInstance(AITT_TYPE_TCP);
+ ASSERT_NE(module, nullptr);
+}
+
+TEST_F(TransportModuleLoaderTest, Negative_GetInstance_Anytime)
+{
+ std::shared_ptr<aitt::AittTransport> module = loader.GetInstance(AITT_TYPE_MQTT);
+ ASSERT_EQ(module, nullptr);
+}