Skip to content

Commit

Permalink
Activation Type: Launch
Browse files Browse the repository at this point in the history
  • Loading branch information
zafields committed Apr 14, 2017
1 parent 24353a7 commit ac4df18
Show file tree
Hide file tree
Showing 57 changed files with 3,073 additions and 1,196 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ typings/**
.cmake/**
*build/**
build_nodejs/**
build_libuv/**

# ignore Atom Editor files
.atom-build.json
Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ option(run_as_a_service "Flags that we have the goal of running gateway as a ser
option(enable_dotnet_binding "set enable_dotnet_binding to ON to build dotnet binding host binaries (default is OFF)" OFF)
option(enable_dotnet_core_binding "set enable_dotnet_core_binding to ON to build dotnet core binding host binaries (default is OFF)" OFF)
option(enable_ble_module "set enable_ble_module to OFF to remove ble module from gateway build (default is ON)" ON)
option(enable_native_remote_modules "Build the infrastructure required to support native remote modules" ON)
option(enable_java_remote_modules "Build the infrastructure required to support java remote modules" OFF)
option(enable_native_remote_modules "Build the infrastructure required to support native remote modules (default is ON)" ON)
option(enable_java_remote_modules "Build the infrastructure required to support java remote modules (default is OFF)" OFF)
option(use_amqp "set use_amqp to ON if amqp is to be used, set to OFF to not use amqp" ON)
option(use_http "set use_http to ON if http is to be used, set to OFF to not use http" ON)
option(use_mqtt "set use_mqtt to ON if mqtt is to be used, set to OFF to not use mqtt" ON)
Expand Down
12 changes: 6 additions & 6 deletions bindings/dotnetcore/src/adapters/dotnetcore_utils_linux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ void AddFilesFromDirectoryToTpaList(const std::string& directory, std::string& t

// Walk the directory for each extension separately so that we first get files with .ni.dll extension,
// then files with .dll extension, etc.
for (int extIndex = 0; extIndex < sizeof(tpaExtensions) / sizeof(tpaExtensions[0]); extIndex++)
for (size_t extIndex = 0; extIndex < sizeof(tpaExtensions) / sizeof(tpaExtensions[0]); extIndex++)
{
const char* ext = tpaExtensions[extIndex];
int extLength = strlen(ext);
Expand Down Expand Up @@ -100,11 +100,11 @@ void AddFilesFromDirectoryToTpaList(const std::string& directory, std::string& t
tpaList.append(":");
}
}

// Rewind the directory stream to be able to iterate over it for the next extension
rewinddir(dir);
}

closedir(dir);
}

Expand All @@ -115,9 +115,9 @@ bool initializeDotNetCoreCLR(coreclr_initialize_ptr coreclrInitialize_ptr, const

char executableFullPath[PATH_MAX] = {0};
char the_p_path[PATH_MAX];

//Ignoring failures of these calls. coreclrInitialize_ptr will fail if folder is not right.
ssize_t size = readlink("/proc/self/exe", executableFullPath, sizeof(executableFullPath));
(void)readlink("/proc/self/exe", executableFullPath, sizeof(executableFullPath));
getcwd(the_p_path, 255);
strcat(the_p_path, "/");

Expand Down Expand Up @@ -168,4 +168,4 @@ bool initializeDotNetCoreCLR(coreclr_initialize_ptr coreclrInitialize_ptr, const
}

return returnResult;
}
}
1 change: 1 addition & 0 deletions bindings/dotnetcore/src/dotnetcore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ static void* DotNetCore_ParseConfigurationFromJson(const char* configuration)

void DotNetCore_FreeConfiguration(void* configuration)
{
(void)configuration;
//Nothing to be freed here.
}

Expand Down
44 changes: 29 additions & 15 deletions bindings/dotnetcore/tests/dotnetcore_e2e/dotnetcore_e2e.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,27 @@ static bool messageReplyReceived = false;

static void* E2EModule_ParseConfigurationFromJson(const char* configuration)
{
return (void*)0x4242;
(void)configuration;
return (void*)0x4242;
}

static void E2EModule_FreeConfiguration(void* configuration)
{
return;
(void)configuration;
return;
}

static MODULE_HANDLE E2EModule_Create(BROKER_HANDLE broker, const void* configuration)
{
(void)broker;
(void)configuration;
return (MODULE_HANDLE)0x4242;
}

static void E2EModule_Receive(MODULE_HANDLE moduleHandle, MESSAGE_HANDLE messageHandle)
{
(void)moduleHandle;
(void)messageHandle;
if (messageHandle != NULL)
{
CONSTMAP_HANDLE properties = Message_GetProperties(messageHandle);
Expand All @@ -66,16 +72,17 @@ static void E2EModule_Receive(MODULE_HANDLE moduleHandle, MESSAGE_HANDLE message
ConstMap_Destroy(properties);
}
}

static void E2EModule_Destroy(MODULE_HANDLE module)
{

(void)module;
}

static const MODULE_API_1 E2E_APIS_all =
{
{MODULE_API_VERSION_1},

E2EModule_ParseConfigurationFromJson,
E2EModule_FreeConfiguration,
E2EModule_ParseConfigurationFromJson,
E2EModule_FreeConfiguration,
E2EModule_Create,
E2EModule_Destroy,
E2EModule_Receive,
Expand All @@ -84,21 +91,30 @@ static const MODULE_API_1 E2E_APIS_all =

MODULE_EXPORT const MODULE_API* Module_GetApi(const struct MODULE_LOADER_TAG* loader, MODULE_API_VERSION gateway_api_version)
{
(void)loader;
(void)gateway_api_version;
return reinterpret_cast<const MODULE_API *>(&E2E_APIS_all);
}

MODULE_LIBRARY_HANDLE E2E_Loader_Load(const struct MODULE_LOADER_TAG* loader, const void * config)
{
(void)loader;
(void)config;
return (MODULE_LIBRARY_HANDLE)&E2E_APIS_all;
}

void E2E_Loader_Unload(const struct MODULE_LOADER_TAG* loader, MODULE_LIBRARY_HANDLE handle)
{
(void)loader;
(void)handle;
return;
}

const MODULE_API* E2E_Loader_GetApi(const struct MODULE_LOADER_TAG* loader, MODULE_LIBRARY_HANDLE handle)
{
(void)loader;
(void)handle;

const MODULE_API* result;
if (handle != NULL)
{
Expand All @@ -113,12 +129,16 @@ const MODULE_API* E2E_Loader_GetApi(const struct MODULE_LOADER_TAG* loader, MODU

void* E2E_Loader_BuildModuleConfiguration(const struct MODULE_LOADER_TAG* loader, const void* entrypoint, const void* module_configuration)
{
return NULL;
(void)loader;
(void)entrypoint;
(void)module_configuration;
return NULL;
}

void E2E_Loader_FreeModuleConfiguration(const struct MODULE_LOADER_TAG* loader, const void* module_configuration)
{

(void)loader;
(void)module_configuration;
}

// E2E static module loader does not need any JSON parsing.
Expand Down Expand Up @@ -223,12 +243,6 @@ TEST_FUNCTION(GW_dotnetcore_binding_e2e_Managed2Managed)
&receiverEndpoint
};

const DOTNET_CORE_HOST_CONFIG receiverConfig{
"E2ETestModule",
"E2ETestModule.DotNetE2ETestModule",
"Receiver"
};

modulesEntryArray[1] = {
nameModuleReceiver,
loaders[1],
Expand Down Expand Up @@ -271,7 +285,7 @@ TEST_FUNCTION(GW_dotnetcore_binding_e2e_Managed2Managed)
nameProbeModule
};

///act
///act
GATEWAY_PROPERTIES properties;
properties.gateway_modules = VECTOR_create(sizeof(GATEWAY_MODULES_ENTRY));
properties.gateway_links = VECTOR_create(sizeof(GATEWAY_LINK_ENTRY));
Expand Down
32 changes: 26 additions & 6 deletions bindings/dotnetcore/tests/dotnetcore_ut/dotnetcore_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,25 +73,39 @@ static bool calledReceiveMethod = false;
static bool calledDestroyMethod = false;
static bool calledStartMethod = false;

int DOTNET_CORE_CALLING_CONVENTION fakeGatewayCreateMethod(intptr_t broker, intptr_t module, const char* assemblyName, const char* entryType, const char* gatewayConfiguration)
int DOTNET_CORE_CALLING_CONVENTION fakeGatewayCreateMethod(intptr_t broker, intptr_t module, const char* assemblyName, const char* entryType, const char* gatewayConfiguration)
{
(void)broker;
(void)module;
(void)assemblyName;
(void)entryType;
(void)gatewayConfiguration;

calledCreateMethod = true;

return __LINE__;
};

void DOTNET_CORE_CALLING_CONVENTION fakeGatewayReceiveMethod(unsigned char* buffer, int32_t bufferSize, unsigned int moduleIdManaged)
{
(void)buffer;
(void)bufferSize;
(void)moduleIdManaged;

calledReceiveMethod = true;
};

void DOTNET_CORE_CALLING_CONVENTION fakeGatewayDestroyMethod(unsigned int moduleIdManaged)
{
(void)moduleIdManaged;

calledDestroyMethod = true;
};

void DOTNET_CORE_CALLING_CONVENTION fakeGatewayStartMethod(unsigned int moduleIdManaged)
{
(void)moduleIdManaged;

calledStartMethod = true;
}

Expand All @@ -103,6 +117,11 @@ int DOTNET_CORE_CALLING_CONVENTION fake_create_delegate(void* hostHandle,
const char* entryPointMethodName,
void** delegate)
{
(void)hostHandle;
(void)domainId;
(void)entryPointAssemblyName;
(void)entryPointTypeName;

int returnStatus;

//assign delegates.
Expand All @@ -124,7 +143,7 @@ int DOTNET_CORE_CALLING_CONVENTION fake_create_delegate(void* hostHandle,
}


//Define return status.
//Define return status.
if (failCreateDelegate == true && strcmp(entryPointMethodName, "Create") == 0)
{
returnStatus = -1;
Expand All @@ -148,9 +167,11 @@ int DOTNET_CORE_CALLING_CONVENTION fake_create_delegate(void* hostHandle,


int DOTNET_CORE_CALLING_CONVENTION fake_shutdownclr(
void* hostHandle,
void * hostHandle,
unsigned int domainId)
{
(void)hostHandle;
(void)domainId;
return 0;
};

Expand Down Expand Up @@ -243,7 +264,6 @@ TYPED_MOCK_CLASS(CDOTNETCOREMocks, CGlobalMock)
MOCK_STATIC_METHOD_3(, int32_t, Message_ToByteArray, MESSAGE_HANDLE, messageHandle, unsigned char*, buf, int32_t , size)
MOCK_METHOD_END( int32_t, (int32_t)11);


MOCK_STATIC_METHOD_2(, MESSAGE_HANDLE, Message_CreateFromByteArray, const unsigned char*, source, int32_t, size)
MOCK_METHOD_END(MESSAGE_HANDLE, (MESSAGE_HANDLE)0x42);

Expand Down Expand Up @@ -302,7 +322,7 @@ TYPED_MOCK_CLASS(CDOTNETCOREMocks, CGlobalMock)

MOCK_STATIC_METHOD_2(, JSON_Object*, json_array_get_object, const JSON_Array*, arr, size_t, index)
JSON_Object* object = NULL;
if (arr != NULL && index >= 0)
if (arr != NULL)
{
object = (JSON_Object*)0x42;
}
Expand Down Expand Up @@ -1391,4 +1411,4 @@ BEGIN_TEST_SUITE(dotnetcore_ut)
}


END_TEST_SUITE(dotnetcore_ut)
END_TEST_SUITE(dotnetcore_ut)
4 changes: 3 additions & 1 deletion bindings/java/tests/host_manager_ut/host_manager_ut.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@
//Globals
//=============================================================================

#ifdef WIN32
static TEST_MUTEX_HANDLE g_dllByDll;
#endif
static TEST_MUTEX_HANDLE g_testByTest;
static TEST_MUTEX_HANDLE g_dllByDll;

static bool malloc_will_fail = false;

Expand Down
4 changes: 3 additions & 1 deletion bindings/java/tests/host_ut/host_ut.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,10 @@ typedef signed char jbyte;
//Globals
//=============================================================================

#ifdef WIN32
static TEST_MUTEX_HANDLE g_dllByDll;
#endif
static TEST_MUTEX_HANDLE g_testByTest;
static TEST_MUTEX_HANDLE g_dllByDll;

static bool malloc_will_fail = false;

Expand Down
Loading

0 comments on commit ac4df18

Please sign in to comment.