#include "ocprovisioningmanager.h"
#include "oxmjustworks.h"
#include "oxmrandompin.h"
+#include "oxmmanufacturercert.h"
#include "securevirtualresourcetypes.h"
#include "provisioningdatabasemanager.h"
-#ifdef _ENABLE_MULTIPLE_OWNER_
+#ifdef MULTIPLE_OWNER
#include "multipleownershiptransfermanager.h"
-#endif //_ENABLE_MULTIPLE_OWNER_
+#endif //MULTIPLE_OWNER
#include "srmutility.h"
#include "doxmresource.h"
#include "pmtypes.h"
EXPECT_TRUE(OC_STACK_INVALID_PARAM == res);
}
+TEST(ManufacturerCertOxMTest, NullParam)
+{
+ OTMContext_t* otmCtx = NULL;
+ OCStackResult res = OC_STACK_ERROR;
+ uint8_t *payloadRes = NULL;
+ size_t size = 0;
+
+ res = PrepareMCertificateCallback(otmCtx);
+ EXPECT_TRUE(OC_STACK_INVALID_PARAM == res);
+
+ res = CreateSecureSessionMCertificateCallback(otmCtx);
+ EXPECT_TRUE(OC_STACK_INVALID_PARAM == res);
+
+ res = CreateMCertificateBasedSelectOxmPayload(otmCtx, &payloadRes, &size);
+ EXPECT_TRUE(OC_STACK_INVALID_PARAM == res);
+
+ res = CreateMCertificateBasedOwnerTransferPayload(otmCtx, &payloadRes, &size);
+ EXPECT_TRUE(OC_STACK_INVALID_PARAM == res);
+
+ OTMContext_t otmCtx2;
+ otmCtx2.selectedDeviceInfo = NULL;
+
+ res = InputPinCodeCallback(&otmCtx2);
+ EXPECT_TRUE(OC_STACK_INVALID_PARAM == res);
+
+ res = CreateSecureSessionMCertificateCallback(&otmCtx2);
+ EXPECT_TRUE(OC_STACK_INVALID_PARAM == res);
+
+ res = CreateMCertificateBasedSelectOxmPayload(&otmCtx2, &payloadRes, &size);
+ EXPECT_TRUE(OC_STACK_INVALID_PARAM == res);
+
+ res = CreateMCertificateBasedOwnerTransferPayload(&otmCtx2, &payloadRes, &size);
+ EXPECT_TRUE(OC_STACK_INVALID_PARAM == res);
+}
/****************************************
* Test the OTM modules with sample server
static const char* g_otmCtx = "Test User Context";
static OCProvisionDev_t* g_unownedDevices = NULL;
static OCProvisionDev_t* g_ownedDevices = NULL;
-#ifdef _ENABLE_MULTIPLE_OWNER_
+#ifdef MULTIPLE_OWNER
static OCProvisionDev_t* g_motEnabledDevices = NULL;
static OCProvisionDev_t* g_multiplOwnedDevices = NULL;
-#endif //_ENABLE_MULTIPLE_OWNER_
+#endif //MULTIPLE_OWNER
static void GetCurrentWorkingDirectory(char* buf, size_t bufsize)
{
g_doneCB = true;
}
-#ifdef _ENABLE_MULTIPLE_OWNER_
+#ifdef MULTIPLE_OWNER
static void updateDoxmForMOTCB(void* ctx, int nOfRes, OCProvisionResult_t* arr, bool hasError)
{
if(!hasError)
g_callbackResult = !hasError;
g_doneCB = true;
}
-#endif //_ENABLE_MULTIPLE_OWNER_
+#endif //MULTIPLE_OWNER
// callback function(s) for provisioning client using C-level provisioning API
static void removeDeviceCB(void* ctx, int UNUSED1, OCProvisionResult_t* UNUSED2, bool hasError)
EXPECT_EQ(OC_STACK_OK, result);
}
-#ifdef _ENABLE_MULTIPLE_OWNER_
+#ifdef MULTIPLE_OWNER
TEST(RegisterPreconfiguredPIN, NullParam)
{
OCStackResult result = SetPreconfigPin("12341234", strlen("12341234"));
EXPECT_NE((OCProvisionDev_t*)NULL, g_ownedDevices);
g_doneCB = false;
- result = MOTChangeMode(NULL, g_ownedDevices, OIC_MULTIPLE_OWNER_ENABLE, updateDoxmForMOTCB);
+ result = OCChangeMOTMode(NULL, g_ownedDevices, OIC_MULTIPLE_OWNER_ENABLE, updateDoxmForMOTCB);
EXPECT_EQ(OC_STACK_OK, result);
if(waitCallbackRet()) // input |g_doneCB| flag implicitly
{
OCStackResult result = OC_STACK_OK;
g_doneCB = false;
- result = OCProvisionPreconfPin(NULL, g_motEnabledDevices, "12341234", strlen("12341234"), provisionPreconfiguredPinCB);
+ result = OCProvisionPreconfigPin(NULL, g_motEnabledDevices, "12341234", strlen("12341234"), provisionPreconfiguredPinCB);
EXPECT_EQ(OC_STACK_OK, result);
if(waitCallbackRet()) // input |g_doneCB| flag implicitly
{
- OIC_LOG(ERROR, TAG, "OCProvisionPreconfPin callback error");
+ OIC_LOG(ERROR, TAG, "OCProvisionPreconfigPin callback error");
return;
}
OCStackResult result = OC_STACK_OK;
g_doneCB = false;
- result = MOTSelectMOTMethod(NULL, g_motEnabledDevices, OIC_PRECONFIG_PIN, updateDoxmForMOTCB);
+ result = OCSelectMOTMethod(NULL, g_motEnabledDevices, OIC_PRECONFIG_PIN, updateDoxmForMOTCB);
EXPECT_EQ(OC_STACK_OK, result);
if(waitCallbackRet()) // input |g_doneCB| flag implicitly
{
EXPECT_TRUE(NULL != g_multiplOwnedDevices);
}*/
-#endif //_ENABLE_MULTIPLE_OWNER_
+#endif //MULTIPLE_OWNER
TEST(PerformRemoveDevice, NullParam)
{