replace : iotivity -> iotivity-sec
[platform/upstream/iotivity.git] / resource / csdk / security / provisioning / unittest / secureresourceprovider.cpp
index fdb484a..91b8da1 100644 (file)
  *
  * *****************************************************************/
 #include "gtest/gtest.h"
+extern "C" {
 #include "secureresourceprovider.h"
+#include "psinterface.h"
+}
 
 static OicSecAcl_t acl;
 static OCProvisionDev_t pDev1;
@@ -196,6 +199,7 @@ class SRPTest : public ::testing::Test
 public:
     static void SetUpTestCase()
     {
+        InitPersistentStorageInterface();
         SetPersistentHandler(&ps);
         OCStackResult res = OCRegisterPersistentStorageHandler(&ps);
         ASSERT_TRUE(res == OC_STACK_OK);
@@ -263,9 +267,10 @@ TEST_F(SRPTest, SRPSaveTrustCertChainDER)
     int result;
     uint16_t credId;
 
+    //This test case cannot succeed. because doxm resource has not been initialized.
     result = SRPSaveTrustCertChain(certData, sizeof(certData), OIC_ENCODING_DER, &credId);
 
-    EXPECT_EQ(OC_STACK_OK, result);
+    EXPECT_EQ(OC_STACK_ERROR, result);
 }
 
 TEST_F(SRPTest, SRPSaveTrustCertChainPEM)
@@ -273,9 +278,10 @@ TEST_F(SRPTest, SRPSaveTrustCertChainPEM)
     int result;
     uint16_t credId;
 
+    //This test case cannot succeed. because doxm resource has not been initialized.
     result = SRPSaveTrustCertChain(certData, sizeof(certData), OIC_ENCODING_PEM, &credId);
 
-    EXPECT_EQ(OC_STACK_OK, result);
+    EXPECT_EQ(OC_STACK_ERROR, result);
 }
 
 TEST_F(SRPTest, SRPSaveTrustCertChainNullCertData)
@@ -302,7 +308,7 @@ TEST_F(SRPTest, SRPSaveOwnCertChainTest)
 {
     int result;
     uint16_t credId;
-    OicSecCert_t cert;
+    OicSecKey_t cert;
     OicSecKey_t key;
 
     cert.data = certData;
@@ -334,7 +340,7 @@ TEST_F(SRPTest, SRPSaveOwnCertChainTestNullCertData)
 {
     int result;
     uint16_t credId;
-    OicSecCert_t cert;
+    OicSecKey_t cert;
     OicSecKey_t key;
 
     cert.data = NULL;
@@ -351,7 +357,7 @@ TEST_F(SRPTest, SRPSaveOwnCertChainTestNullKey)
 {
     int result;
     uint16_t credId;
-    OicSecCert_t cert;
+    OicSecKey_t cert;
 
     cert.data = certData;
     cert.len = sizeof(certData);
@@ -365,7 +371,7 @@ TEST_F(SRPTest, SRPSaveOwnCertChainTestNullKeyData)
 {
     int result;
     uint16_t credId;
-    OicSecCert_t cert;
+    OicSecKey_t cert;
     OicSecKey_t key;
 
     cert.data = certData;
@@ -381,7 +387,7 @@ TEST_F(SRPTest, SRPSaveOwnCertChainTestNullKeyData)
 TEST_F(SRPTest, SRPSaveOwnCertChainTestNullCredId)
 {
     int result;
-    OicSecCert_t cert;
+    OicSecKey_t cert;
     OicSecKey_t key;
 
     cert.data = certData;