Skip to content
Snippets Groups Projects
Commit f76cdded authored by alexey.stratulat's avatar alexey.stratulat
Browse files

[*] Added import from libdapConnector module correctly. Now no need for every...

[*] Added import from libdapConnector module correctly. Now no need for every call from libdapConnector no need to add module name
parent 4275aec4
No related branches found
No related tags found
1 merge request!26Support 3689
import libdapConnector from libdapConnector import *
import os import os
import sys import sys
def output_info(string):
libdapConnector.logIt(libdapConnector.LogLevel.L_INFO, string)
def output_info_failed(string):
libdapConnector.logIt(libdapConnector.LogLevel.L_CRITICAL, string)
def create_config_file(app_name): def create_config_file(app_name):
f = open(app_name+".cfg", "w") f = open(app_name+".cfg", "w")
f.write("[server]\nlisten_address=0.0.0.0\n") f.write("[server]\nlisten_address=0.0.0.0\n")
f.close() f.close()
output_info("Start main test") logIt(LogLevel.L_INFO,"Start main test")
app_name = "TestAPP" app_name = "TestAPP"
output_info("Create config file") logIt(LogLevel.L_INFO, "Create config file")
create_config_file(app_name) create_config_file(app_name)
...@@ -21,26 +17,26 @@ json_string = """{ ...@@ -21,26 +17,26 @@ json_string = """{
"modules": "libdap", "modules": "libdap",
"dap": { "dap": {
"config_dir": \""""+os.getcwd()+"""\", "config_dir": \""""+os.getcwd()+"""\",
"log_level": \""""+libdapConnector.LogLevel.L_DEBUG.name+"""\", "log_level": \""""+LogLevel.L_DEBUG.name+"""\",
"application_name": \""""+app_name+"""\" "application_name": \""""+app_name+"""\"
} }
}""" }"""
libdapConnector.init(json_string) init(json_string)
output_info("Initialization of the DAP done") logIt(LogLevel.L_INFO, "Initialization of the DAP done")
libdapConnector.setLogLevel(libdapConnector.LogLevel.L_DEBUG) setLogLevel(LogLevel.L_DEBUG)
output_info("Level logging ""DEBUG"" done") logIt(LogLevel.L_INFO,"Level logging ""DEBUG"" done")
libdapConnector.logIt(libdapConnector.LogLevel.L_DEBUG, "Test. Outputting a string using the log_it function in the libdap library") logIt(LogLevel.L_DEBUG, "Test. Outputting a string using the log_it function in the libdap library")
output_info("Outputting a string using the log_it function done") logIt(LogLevel.L_INFO,"Outputting a string using the log_it function done")
res1 = libdapConnector.configGetItem("server", "listen_address") res1 = configGetItem("server", "listen_address")
output_info("Output [server] 'listen_address' = "+res1+"\n") logIt(LogLevel.L_INFO, "Output [server] 'listen_address' = "+res1+"\n")
res2 = libdapConnector.configGetItemDefault("server1", "listen_address", "8.8.8.8") res2 = configGetItemDefault("server1", "listen_address", "8.8.8.8")
output_info("Output default value '8.8.8.8' [server1] 'listen_address' = "+res2+"\n") logIt(LogLevel.L_INFO, "Output default value '8.8.8.8' [server1] 'listen_address' = "+res2+"\n")
output_info("TEST. Get default config done") logIt(LogLevel.L_INFO, "TEST. Get default config done")
libdapConnector.deInit() deInit()
output_info("Deinitialization done") logIt(LogLevel.L_INFO, "Deinitialization done")
os.remove(app_name+".cfg") os.remove(app_name+".cfg")
output_info("Dellete config file") logIt(LogLevel.L_INFO, "Dellete config file")
output_info("Main test done"); logIt(LogLevel.L_INFO, "Main test done");
sys.exit(0) sys.exit(0)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment