def synchronizeDynamicCfg(self): """ Synchronize the dynamic config (dbb) with the file settings (tas.ini) """ self.trace('Synchronize dynamic config') # cleanup the database config ret, rows = DbManager.instance().querySQL( query="""DELETE FROM `%s`""" % self.table_name) if not ret: raise Exception('unable to cleanup in db config') ret, rows = DbManager.instance().querySQL( query="""INSERT INTO `%s` (opt, value) VALUES ('%s', '%s')""" % (self.table_name, "paths-main", Settings.getDirExec())) if not ret: raise Exception("unable to insert main-path in db config") ret, rows = DbManager.instance().querySQL( query="""INSERT INTO `%s` (opt, value) VALUES ('%s', '%s')""" % (self.table_name, "server-version", Settings.getVersion())) if not ret: raise Exception("unable to insert version in db config") # parse the ini file and store key and value in the db for section in Settings.instance().sections(): for (name, value) in Settings.instance().items(section): ret, rows = DbManager.instance().querySQL( query= """INSERT INTO `%s` (opt, value) VALUES ('%s', '%s')""" % (self.table_name, "%s-%s" % (section.lower(), name.lower()), value)) if not ret: raise Exception( "unable to insert in db config: %s: %s %s" % (section, name, value)) self.trace('Dynamic config synchronized') self.loadDynamicCfg()
# # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, # MA 02110-1301 USA # ------------------------------------------------------------------- """ Module to construct the portable version with pyinstaller """ import os import sys import platform from Libs import Settings Settings.initialize() # settings = Settings.instance() os.rename( "%s/dist/ExtensiveTestingToolbox/" % Settings.getDirExec(), "%s/dist/%s_%s_%s_Portable" % (Settings.getDirExec(), Settings.get(section='Common', key='acronym'), Settings.getVersion(), platform.architecture()[0])) Settings.finalize()
helper = [] clsmembers = inspect.getmembers(module, inspect.isclass) for c, o in clsmembers: funcs = getYamlDecorators(cls=o, deco=deco) if len(funcs): helper.append( (c, funcs) ) return helper # params for public functions swagger = [] swagger_version = "2.0" swagger_email = Settings.get( 'Server', 'contact-email') swagger_licence = "LGPL 2.1" swagger_info = [ ( "description", "Control your test server with %s API" % Settings.get( 'Server', 'name') ), ( "version", Settings.getVersion(path="../") ), ( "title", "Swagger Tester - %s" % Settings.get( 'Server', 'name') ), ] swagger_schemes = [ "https" ] swagger_host = Settings.get( 'Bind', 'ip-ext') swagger_base_path = "/rest" swagger_paths = [ "paths:" ] swagger_tab = 2 # extract yaml python code in rest server interface py_tab = 4 py_decorators = findDecorators(module=TesterFunctions) for (c,fcs) in py_decorators:
base = None if sys.platform == "win32": base = "Win32GUI" if cx_Freeze.__version__.startswith("5."): buildOptions = dict(include_files=includeFiles) else: buildOptions = dict(include_files=includeFiles, optimize=2, compressed=True, create_shared_zip=False, append_script_to_exe=True, include_in_shared_zip=False) # Prepare the setup options setup(version=Settings.getVersion(), options=dict(build_exe=buildOptions), description=Settings.get(section='Common', key='name'), name=Settings.get(section='Common', key='name'), executables=[ Executable(script="../Systray.py", base=base, icon="../Resources/%s.ico" % Settings.get(section='Common', key='acronym').lower(), targetName="%s.exe" % Settings.get(section='Common', key='acronym')) ]) # Create folders sub_dirs = os.listdir("build/")[0] print("Makes dirs Tmp and Logs")
def __init__(self, controllerIp, controllerPort, toolName, toolDesc, defaultTool, supportProxy=False, proxyIp=None, proxyPort=None, sslSupport=True, toolType=NetLayerLib.TYPE_AGENT_AGENT, fromCmd=False, name=None): """ Constructor for tool @param version: @type version: string """ self.__LAST_ERROR = None self.defaultTool = defaultTool self.login = "******" self.password = "******" self.toolType = toolType self.fromCmd = fromCmd # init ssl self.sslSupportFinal = sslSupport if not Settings.getBool('Server', 'ssl-support'): self.sslSupportFinal = False # init websocket wsSupport = False if Settings.getBool('Server', 'websocket-support'): wsSupport = True NetLayerLib.ClientAgent.__init__( self, typeAgent=toolType, startAuto=True, keepAliveInterval=Settings.getInt('Network', 'keepalive-interval'), inactivityTimeout=Settings.getInt('Network', 'inactivity-timeout'), timeoutTcpConnect=Settings.getInt('Network', 'tcp-connect-timeout'), responseTimeout=Settings.getInt('Network', 'response-timeout'), selectTimeout=Settings.get('Network', 'select-timeout'), sslSupport=self.sslSupportFinal, wsSupport=wsSupport, pickleVer=Settings.getInt('Network', 'pickle-version'), tcpKeepAlive=Settings.getBool('Network', 'tcp-keepalive'), tcpKeepIdle=Settings.getInt('Network', 'tcp-keepidle'), tcpKeepCnt=Settings.getInt('Network', 'tcp-keepcnt'), tcpKeepIntvl=Settings.getInt('Network', 'tcp-keepintvl')) serverPort = Settings.getInt('Server', 'port') if controllerPort is not None: serverPort = int(controllerPort) self.setServerAddress(ip=controllerIp, port=serverPort) if supportProxy: self.setProxyAddress(ip=proxyIp, port=int(proxyPort)) self.setAgentName(name=toolName) toolMore = {'details': toolDesc, 'default': defaultTool} if name is not None: self.setDetails(name=name, desc=toolMore, ver=Settings.getVersion()) else: self.setDetails(name=self.__class__.__name__, desc=toolMore, ver=Settings.getVersion()) self.controllerIp = controllerIp self.controllerPort = serverPort self.pathTraces = Settings.get('Paths', 'tmp') self.toolName = toolName self.__mutex__ = threading.RLock() self.regThread = None self.__REGISTERED_BEFORE__ = False self.regRequest = None if sys.platform == "win32": self.__tmpPath__ = "%s\\%s\\[%s]_%s\\" % (Settings.getDirExec(), self.pathTraces, toolType, self.toolName) else: self.__tmpPath__ = "%s/%s/[%s]_%s/" % (Settings.getDirExec(), self.pathTraces, toolType, self.toolName) self.__callId__ = 0 self.__callIds__ = {} self.__args__ = [] # new in v6.2 self.testsContext = {}
def version(self): """ Get version of the server """ serverVersion = Settings.getVersion() sys.stdout.write("Server version: %s\n" % serverVersion)
# selenium2 for f in Selenium2_Files: Mydata_files.append(('Bin/Selenium2/', ['%s/%s' % (Selenium2_Path, f)])) # java 8 for f in Java8_Files: Mydata_files.append(('Bin/Java8/', ['%s/%s' % (Java8_Path, f)])) # sikuli for f in Sikuli_Files: Mydata_files.append(('Bin/Sikuli', ['%s/%s' % (Sikuli_Path, f)])) Main = Target( # We can extend or override the VersionInfo of the base class: version=Settings.getVersion(), company_name=Settings.get(section='Common', key='name'), copyright="Copyright %s © %s" % (Settings.get(section='Common', key='name'), buildYear), legal_copyright="Copyright %s © %s" % (Settings.get(section='Common', key='name'), buildYear), description=Settings.get(section='Common', key='name'), product_version=Settings.getVersion(), product_name=Settings.get(section='Common', key='name'), script="Systray.py", # path of the main script # Allows to specify the basename of the executable, if different from 'Main' dest_base=Settings.get(section='Common', key='acronym'), # Icon resources:[(resource_id, path to .ico file), ...] icon_resources=[
def getInformations(self, user=None, b64=False): """ Returns settings on the server for the client @return: server settings @rtype: list """ self.trace('construct servers information') ret = [] # platform try: ret.append({'version': Settings.getVersion()}) ret.append({'python': platform.python_version()}) ret.append({'start-at': "%s" % self.startedAt}) ret.append({'database': "%s" % self.mysqlVersion}) ret.append({'server-web': " %s" % self.apacheVersion}) ret.append({'php': " %s" % self.phpVersion}) if self.networkInterfaces is not None: ret.append({'network': self.networkInterfaces}) if self.networkRoutes is not None: ret.append({'routes': self.networkRoutes}) ret.append({'server-date': self.getServerDateTime()}) ret.append({ 'default-library': "%s" % RepoLibraries.instance().getDefault() }) # dynamic value ret.append( {'libraries': "%s" % RepoLibraries.instance().getInstalled()}) ret.append({ 'default-adapter': "%s" % RepoAdapters.instance().getDefault() }) # dynamic value ret.append( {'adapters': "%s" % RepoAdapters.instance().getInstalled()}) if user is not None: ret.append( {'test-environment': self.getTestEnvironment(user=user)}) if isinstance(user, UserContext): ret.append({'projects': user.getProjects()}) ret.append({'default-project': user.getDefault()}) else: ret.append({ 'projects': ProjectsManager.instance().getProjects(user=user) }) ret.append({ 'default-project': ProjectsManager.instance().getDefaultProjectForUser( user=user) }) for section in Settings.instance().sections(): for (name, value) in Settings.instance().items(section): ret.append( {"%s-%s" % (section.lower(), name.lower()): value}) except Exception as e: self.error('unable to construct servers settings: %s' % str(e)) return ret
def create(self): """ Create the inno file """ appName = Settings.get( section = 'Common', key='name' ) appAcronym = Settings.get( section = 'Common', key='acronym' ) appVersion = Settings.getVersion() appAuthor = Settings.get( section = 'Common', key='author' ) print("InnoSetup script: %s" % self.pathName) ofi = open(self.pathName, "w") d = [ r"[Setup]" ] d.append( r"AppName=%s" % appName ) d.append( r"AppVersion=%s" % appVersion ) d.append( r"AppVerName=%s %s" % ( appName, appVersion ) ) d.append( r"AppPublisher=%s" % appAuthor ) d.append( "AppPublisherURL=https://%s" % Settings.get( section = "Common", key="url" ) ) d.append( r"VersionInfoVersion=%s" % appVersion ) d.append( r"DefaultDirName={pf}\%s" % appName ) d.append( r"DefaultGroupName=\%s" % appName ) d.append( r"Compression=lzma" ) d.append( r"OutputDir=%s" % PACKAGE_DEST ) d.append( r"OutputBaseFilename=%s_%s_%s_Setup" % ( appAcronym, appVersion, platform.architecture()[0] ) ) d.append( r"WizardSmallImageFile=small_installer.bmp" ) d.append( r"UninstallDisplayIcon={app}\%s.ico" % appAcronym.lower() ) d.append( r"LicenseFile=LICENSE-LGPLv21" ) d.append( r"PrivilegesRequired=admin" ) if platform.architecture()[0] == "64bit": d.append( "ArchitecturesInstallIn64BitMode=x64" ) d.append( "" ) d.append( r"[Dirs]" ) d.append( r'Name: "{app}\imageformats\"; Permissions: users-modify' ) d.append( r'Name: "{app}\Bin"; Permissions: users-modify' ) d.append( r'Name: "{app}\Tmp"; Permissions: users-modify' ) d.append( r'Name: "{app}\Logs"; Permissions: users-modify' ) d.append( r'Name: "{app}\Plugins"; Permissions: users-modify' ) d.append( "" ) # components to install, update version on changes d.append( r"[Components]" ) d.append( r'Name: "main"; Description: "Engine"; Types: full compact custom; Flags: fixed;' ) d.append( r'Name: "java8"; Description: "Java %s"; Types: full ;' % VERSION_JAVA ) d.append( r'Name: "sikulix"; Description: "SikuliX %s"; Types: full;' % VERSION_SIKULIX ) d.append( r'Name: "selenium3"; Description: "Selenium %s"; Types: full;' % VERSION_SELENIUM3 ) d.append( r'Name: "selenium2"; Description: "Selenium %s"; Types: full;' % VERSION_SELENIUM2 ) d.append( r'Name: "adb"; Description: "Android Debug Bridge %s"; Types: full;' % VERSION_ADB ) d.append( r"[Files]" ) d.extend( self.listdir( self.path, "") ) # adding java 8 for f in os.listdir("%s/Bin/Java8" % self.path): if os.path.isfile( "%s/Bin/Java8/%s" % (self.path, f) ): Java8_Bin = f if Java8_Bin is None: raise Exception("no java8 binary") d.append( "" ) d.append( r"[Tasks]" ) d.append( r'Name: desktopicon; Description: "Create a &desktop icon"; GroupDescription: "Additional icons:"; Components: main' ) d.append( r'Name: startuplink; Description: "Create a &startup link"; GroupDescription: "Additional links:"; Components: main' ) d.append( r"[Icons]" ) d.append( r'Name: "{group}\%s"; Filename: "{app}\%s.exe"; WorkingDir: "{app}"; IconFilename: "{app}\%s.ico"' % \ ( appName, appAcronym, appAcronym.lower() ) ) d.append( r'Name: "{group}\Uninstall %s"; Filename: "{uninstallexe}"; IconFilename: "{app}\%s.ico"' % (appName,appAcronym.lower()) ) d.append( r'Name: "{commondesktop}\%s"; Filename: "{app}\%s.exe"; IconFilename: "{app}\%s.ico"; Components: main; Tasks: desktopicon' % \ ( appName, appAcronym, appAcronym.lower() ) ) d.append( r'Name: "{commonstartup}\%s"; Filename: "{app}\%s.exe"; IconFilename: "{app}\%s.ico"; Components: main; Tasks: startuplink' % \ ( appName, appAcronym, appAcronym.lower() ) ) d.append( r'Name: "{group}\Plugins"; Filename: "{app}\Plugins";' ) d.append( '' ) d.append( r"[Run]" ) d.append( r'Filename: {app}\Bin\Java8/%s; Parameters: "/s"; StatusMsg: "Installing Java 8..."; Components: java8;' % Java8_Bin ) d.append( r'Filename: {app}\releasenotes.txt; Description: View the release notes; Flags: postinstall shellexec skipifsilent; Components: main;' ) d.append( r'Filename: "{app}\%s.exe"; Description: "Launch %s"; Flags: nowait postinstall skipifsilent; Components: main;' % (appAcronym, appName) ) d.append( "" ) ofi.write( "\n".join(d) ) ofi.close()