From f41e9a577750c40b14d195c065f26552707cbcac Mon Sep 17 00:00:00 2001 From: dovholuknf <46322585+dovholuknf@users.noreply.github.com> Date: Sun, 1 Oct 2023 00:20:10 -0400 Subject: [PATCH] continue tweaks. test works --- OpenZiti.NET/src/OpenZiti/Native/nAPI.cs | 6 ++++++ TestProject/Program.cs | 10 ++++------ TestProject/Properties/launchSettings.json.back | 17 +++++++++++++++++ 3 files changed, 27 insertions(+), 6 deletions(-) create mode 100644 TestProject/Properties/launchSettings.json.back diff --git a/OpenZiti.NET/src/OpenZiti/Native/nAPI.cs b/OpenZiti.NET/src/OpenZiti/Native/nAPI.cs index 1dd2cf4..2b653f5 100644 --- a/OpenZiti.NET/src/OpenZiti/Native/nAPI.cs +++ b/OpenZiti.NET/src/OpenZiti/Native/nAPI.cs @@ -16,14 +16,20 @@ limitations under the License. using System; using System.Net.Sockets; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +[assembly: InternalsVisibleTo("UnitTests")] namespace OpenZiti.Native { public class API { public const CallingConvention CALL_CONVENTION = CallingConvention.Cdecl; public const string Z4D_DLL_PATH = @"ziti4dotnet"; + public static string GetZitiPath() { + return Z4D_DLL_PATH; + } + #region //ziti.h - functions exported from the ziti-sdk-c project from ziti.h //these functions should be declared in the same order as they appear in ziti.h to make diffing easier! diff --git a/TestProject/Program.cs b/TestProject/Program.cs index 5538cbf..60c3045 100644 --- a/TestProject/Program.cs +++ b/TestProject/Program.cs @@ -93,10 +93,8 @@ public static async Task Main(string[] args) { //create the service policies var serviceRoles = new Roles() { $"#{testServices}" }; - var dialRoles = new Roles() { $"#{svcName}.binders" }; - var bindRoles = new Roles() { $"#{svcName}.dialers" }; - //var dialRoles = new Roles() { $"#{svcName}.dialers" }; - //var bindRoles = new Roles() { $"#{svcName}.binders" }; + var dialRoles = new Roles() { $"#{svcName}.dialers" }; + var bindRoles = new Roles() { $"#{svcName}.binders" }; await h.DeleteServicePolicyByNameAsync($"{svcName}.sp.dial"); var createServicePolicy = new ServicePolicyCreate { @@ -157,8 +155,8 @@ public static async Task Main(string[] args) { string tempFilePath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); System.IO.File.WriteAllBytes(tempFilePath, Encoding.UTF8.GetBytes(zitiId)); - //Console.WriteLine("Waiting 10 seconds for router to receive the service"); - //await Task.Delay(10000); + Console.WriteLine("Waiting 10 seconds for router to receive the service"); + await Task.Delay(10000); var c = new ZitiContext(tempFilePath); var zitiSocketHandler = c.NewZitiSocketHandler(svcName); diff --git a/TestProject/Properties/launchSettings.json.back b/TestProject/Properties/launchSettings.json.back new file mode 100644 index 0000000..5543ab5 --- /dev/null +++ b/TestProject/Properties/launchSettings.json.back @@ -0,0 +1,17 @@ +{ + "profiles": { + "TestProject": { + "commandName": "Project", + "commandLineArgs": "args0 test weather c:\\git\\github\\openziti\\ziti-sdk-csharp\\Samples\\setup-scripts\\enroll.demo.json", + "environmentVariables": { + "ZITI_USERNAME": "admin", + "ZITI_PASSWORD": "cdaws8086" + }, + "nativeDebugging": true + }, + "WSL": { + "commandName": "WSL2", + "distributionName": "" + } + } +} \ No newline at end of file