-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathConfigTest.cs
53 lines (48 loc) · 2.08 KB
/
ConfigTest.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
using System;
using Senzing;
namespace Test
{
class ConfigTest
{
static int Main(string[] args)
{
string engineConfig = Environment.GetEnvironmentVariable("SENZING_ENGINE_CONFIGURATION_JSON");
if (engineConfig == null)
{
Console.WriteLine("SENZING_ENGINE_CONFIGURATION_JSON must be defined");
return -1;
}
G2ConfigMgr.init("ConfigTest",engineConfig,1);
G2Config.init("ConfigTest",engineConfig,1);
IntPtr handle = G2Config.create();
string newConfig = G2Config.save(handle);
G2Config.close(handle);
long newConfigID = G2ConfigMgr.addConfig(newConfig);
G2ConfigMgr.setDefaultConfigID(newConfigID);
Console.WriteLine("Default Config ID: " + G2ConfigMgr.getDefaultConfigID());
//Console.WriteLine("Default Config: " + G2ConfigMgr.getConfig(G2ConfigMgr.getDefaultConfigID()));
Console.WriteLine("Config List: " + G2ConfigMgr.getConfigList());
long configID = G2ConfigMgr.getDefaultConfigID();
string config = G2ConfigMgr.getConfig(configID);
handle = G2Config.load(config);
Console.WriteLine("G2Config.load success");
Console.WriteLine("listDataSources: " + G2Config.listDataSources(handle));
G2Config.addDataSource(handle, "MY_DATASOurce ");
Console.WriteLine("addDataSource: success");
Console.WriteLine("listDataSources: " + G2Config.listDataSources(handle));
newConfig = G2Config.save(handle);
//Console.WriteLine("New Config: " + newConfig);
G2Config.close(handle);
Console.WriteLine("G2Config.close: success");
newConfigID = G2ConfigMgr.addConfig(newConfig);
Console.WriteLine("addConfig: " + newConfigID);
G2ConfigMgr.setDefaultConfigID(newConfigID);
Console.WriteLine("setDefaultConfigID: success");
Console.WriteLine("Default Config ID: " + G2ConfigMgr.getDefaultConfigID());
Console.WriteLine("Config List: " + G2ConfigMgr.getConfigList());
G2Config.destroy();
G2ConfigMgr.destroy();
return 0;
}
}
}