...
Servoy allows you to export workspace solutions into .servoy files or .war files as well as to run jsunit tests on these using command line.
If you are looking for how to write end-to-end/UI tests for your solution see UI Testing. If you are looking for an example on how these tools were used for unit testing see Servoy Software Factory Example using Jenkins.
NGClient, WebClient and Smart Client ".war" export
This exporter will export NGClient, WebClient and SmartClient solutions as .war files. There is also an exporter specific for mobile typed solutions that also generates a .war file but that one is separate is is detailed later.
To see the help message do the following:
- Change the current directory to <servoy_install>\developer\exporter
- execute (.bat/.sh depends on your OS): war_export.bat -help
This will output the help for the Command Line War Export Application. To do a war export a command similar to the following should be executed:
Code Block |
---|
|
war_export.bat -s <solution_name> -o <out_dir> -data <workspace_location> -defaultAdminUser <admin username> -defaultAdminPassword <admin password> [optional_args] |
Output of "war_export.bat -help" is:
Expand |
---|
title | see .war exporter arguments |
---|
|
Code Block |
---|
| WAR exporter. Exports workspace solutions into .war files.
USAGE:
-help or -? or /? or no arguments ... shows current help message.
OR
-s <solution_name> -o <out_dir> -data <workspace_location>
Note: <solution_name> can also contain multiple solution names separated by comma. In
that case, one .war file will be generated for each solution in that list. Some of
the options below (for example -warFileName) do not make sense when multiple .war
files are to be created. There is a note on each such option.
-defaultAdminUser <user name for admin page when no admin user exists>
-defaultAdminPassword <password for defaultAdminUser> [optional_args]
Optional arguments:
-verbose ... prints more info to console
-p <properties_file> ... path and name of properties file used to start exporter.
Default: the 'servoy.properties' file from 'application_server' will be used.
-as <app_server_dir> ... specifies where to find the 'application_server' directory.
Default: '../../application_server'.
-pl alternate project locations; solution, resources and other needed projects will
be searched for in subfolders (deep) of the given 'workspace_location' as well.
For example: if the
workspace needs to contain projects from different git repositories, those can
be checked out in '<workspace_loc>', '<workspace_loc>/a', '<workspace_loc>/b/c'
and so on.
-ie ignore build errors. CAUTION! the use of this flag is discouraged; it can cause
invalid solutions to be exported.
-sb skip build. No build markers will be generated. This can greatly decrease
export time. CAUTION! the use of this flag is discouraged;
it can cause invalid solutions to be exported (added in 2019.12).
-dbi ... export based on dbi files (even if database servers are available)
-active <true/false> ... export given solution (and its modules) as part of .war.
That means the (current if more) solution from -s parameter and its modules.
If false, it will create a war with no solution included. If false, you will
have to import solutions using the admin page. It does not make sense to use
false if multiple solutions were given at -s.
Default: true
-pfw <properties_file> ... path & name of properties file to be included in the war.
Default: the 'servoy.properties' file from 'application_server' will be used.
-b <bean_names> ... the space separated list of (smart / web client) beans to export
Default: all beans from application_server/beans are exported.
You can use '-b <none>' to avoid exporting beans.
-excludeBeans <bean_names> ... the list of beans to excluded from the export e.g.:
-excludeBeans bean1.jar bean2.zip
Default: none is excluded.
-l <lafs_names> ... the space separated list of look-and-feels (smart cl.) to export
Default: all lafs from application_server/lafs are exported.
You can use '-l <none>' to avoid exporting lafs.
-excludeLafs <lafs_names> ... the list of lafs to be excluded from the export e.g:
-excludeLafs laf1.jar laf2.zip
Default: none is excluded.
-d <jdbc_drivers> ... the space separated list of jdbc (database) drivers to export
Default: all drivers from application_server/drivers are exported.
You can use '-d <none>' to avoid exporting drivers.
-excludeDrivers <jdbc_drivers> ... the list of drivers to exclude from the export
e.g.: -excludeDrivers driver1.jar driver2.zip
Default: none is excluded.
-pi <plugin_names> ... the list of plugins to export e.g -pi plugin1.jar plugin2.zip
Default: all plugins from application_server/plugins are exported.
You can use '-pi <none>' to avoid exporting plugins.
-excludePlugins <plugin_names> ... the list of plugins to exclude from the export
e.g.: -excludePlugins plugin1.jar plugin2.zip
Default: none is excluded.
-nas ... space separated list of solutions that must be exported but are not in the
current solution's modules (for example solutions for batch processors).
If active is false no solution will be exported in war. It might be wrong to
use this flag if you also specify multiple solutions in -s.
Default: only active solution and its modules are exported.
-pluginLocations <ABSOLUTE paths to developer 'plugins' folder> ... needed in case
you don't run the exporter from [servoy_install]/developer/exporter
Default: '../plugins'.
-crefs ... exports only the components used by the (current if -s has more) solution
Default:
all components are exported.
-crefs <additional_component_names> ... can be 'all' (without the ') or a list of
components separated by spaces; exports the components used by the solution
(current if -s has more) and the components in this additional components list.
Default: only the allused components are exported.
-excludeComponentPkgs ... space separated list of excluded component packages (from
Default:all noneavailable iscomponent excludedpackages).
Default: none is excluded.
-srefs ... exports only the services used by the (current if -s has more) solution
Default: all services are exported.
-srefs <additional_service_names> ... can be 'all' (no ') or a list of services
separated by spaces; exports the services used by the (current if -s has more)
solution and the services in this additional services list.
Default: only allthe used services are exported.
-excludeServicePkgs ... space separated list of excluded service packages (from all
available service packages).
Default: none is excluded.
-md ... export metadata tables (tables marked as metadata); uses the metadata stored
in workspace files for each metadata table.
-checkmd ... check that metadata for metadata tables is the same for each table both
in the according workspace file and in the actual table in the database before
exporting; this only makes sense if -md was specified
Default: false
-sd ... exports sample data. IMPORTANT all needed DB servers must already be started
-sdcount <count> ... number of rows to export per table. Only makes sense when -sd
is also present. Can be 'all' (without the ') in which case it will still be
limited but to a very high number: 49999999
Default: 5000
-i18n ... exports i18n data
-users ... exports users
-tables ... export all table information about tables from referenced servers.
IMPORTANT: all needed DB servers must already be started
-warFileName ... the name of the war file; do *NOT* use this if multiple solutions
were given in -s argument (it does not make sense then as multiple wars will be
generated).
Default: the (current if -s has more) solution name
-overwriteGroups ... overwrites Groups
-allowSQLKeywords ... allows SQLKeywords
-stopOnDataModelChanges ... stops import if data model changes.
This option is ignored if allowDataModelChanges is present.
-allowDataModelChanges ... (optionally) a space separated list of server names that
allow data model changes. If the list is missing, then data model changes are
allowed on all servers.
-skipDatabaseViewsUpdate... skips database views update
-overrideSequenceTypes ... overrides Sequence Types
-overrideDefaultValues ... overrides Default Values
-insertNewI18NKeysOnly ... inserts NewI18NKeysOnly
-importUserPolicy ... 0/1/2 where:
don't = 0
create users & update groups = 1 (default)
overwrite completely = 2
-addUsersToAdminGroup ... adds Users To Admin Group
-updateSequences ... updates Sequences
-upgradeRepository ... automatically upgrade repository if needed
-createTomcatContextXMLcontextFileName ... createa path to a tomcat META-INF/context.xml that file;should be included
please see into the https://tomcat.apache.org/tomcat-8.0-doc/configWAR/META-INF/context.html#Standard_Implementxml
-useAsRealAdminUser ... the default ationadmin foruser morelogin information. given via -defaultAdminUser
-antiResourceLocking ... add antiResourceLocking="true" to Context element; may only above will be available as a normal admin user bein usedsolutions withas createTomcatContextXMLwell.
-clearReferencesStatic ... add clearReferencesStatic="true" to Context element; maylicense.company_name OR license.<i>.company_name,
The name of the company that has onlythe belicense, used withwhere createTomcatContextXML.<i> is used when there are
-clearReferencesStopThreads ... add clearReferencesStopThreads="true" to Context multiple licenses:
element; may only be used with createTomcatContextXML. -license.1.company_name name1 -license.2.company_name name2
-clearReferencesStopTimerThreads ... add clearReferencesStopTimerThreads="true" to-license.code OR license.<i>.code,
The license code, where <i> is used when there are Contextmultiple element;licenses:
may only be used with createTomcatContextXML. -license.1.code XXXX-useAsRealAdminUserXXXX-XXXX -license.2..code the default admin user loginXXXX-XXXX-XXXX
given via -defaultAdminUserlicense.licenses OR license.<i>.licenses,
above will beThe availablenumber asof alicenses, normalwhere admin<i> useris inused solutionswhen asthere well.are multiple licenses:
-minimize ... minimize JS and CSS files
-license.company_name OR license.<i>.company_name,
The name of the company that has the license, where <i> is used when there are
multiple licenses:
-license.1.company_name name1 -license.2.company_name name21.licenses SERVER -license.2.licenses 1000
-license.code OR license.<i>.code,
The license code, where <i> is used when there are multiple licenses:
-license.1.code XXXX-XXXX-XXXX -license.2.code XXXX-XXXX-XXXXuserHomeDirectory <user_home_directory> ... this must be a writable directory where
Servoy -license.licensesapplication OR license.<i>.licenses,
related files will be stored; if not set, then the system
The number of licenses, where <i> is used when there are multiple licenses:user home directory will be used.
-licensedoNotOverwriteDBServerProperties ..1.licenses SERVER -license.2.licenses 1000. SKIP overwrite of old DBserver properties - if
they were -userHomeDirectory <user_home_directory> ... this must be stored separately by a writablepreviously directorydeployed wherewar (due to changes to
Servoy application related files willproperties bevia stored;admin page) if- notwith set,ones thenfrom the systemwar export's servoy.properties.
user home directoryIf will-overwriteAllProperties bebelow used.is set then this flag has no effect. -doNotOverwriteDBServerProperties ... SKIP overwrite of old DBserver properties - ifPrior to
Servoy 2019.09, '-overwriteDBServerProperties' was used instead theybut wereit is storednow
separately by a previously deployed war (due to changes to removed in order to have the same default value as in UI export propertieswizard.
via admin page) - with ones from the war export's servoy.properties-overwriteAllProperties ... overwrite all (potentially changed via admin If -overwriteAllPropertiespage)
below is set then this flag has no effect. Prior to properties of a previously deployed war application with the Servoy 2019.09, '-overwriteDBServerProperties' was used instead but it is nowvalues from the
servoy.properties of this war export.
removed in order to have the same default value as in UI export wizard.
-overwriteAllProperties ... overwrite all (potentially changed via admin page)
-log4jConfigurationFile ... a path to a log4j configuration file that should be
included nstead of the default one.
-webXmlFileName ... propertiesa path ofto a previouslyweb.xml deployed warthat should applicationbe included withinstead the valuesof fromdefault
the one; servoy.propertiesit ofshould thisbe wara exportweb.xml file previously generated via a Servoy -log4jConfigurationFile ... aWAR export.
path to a log4j configuration file-ng2 true that/ false should/ besourcemaps ... export Titanium NG2 binaries. If 'sourcemaps' is
included nstead of the default one. given, sourcemaps will be generated -webXmlFileNamefor ...ts afiles path- touseful afor webdebugging.xml
that should be included instead of default Default: true
one; it should be a web.xml file previously generated via a Servoy WAR export-ng1 ... export NG1 client resources; not exported by default.
EXIT codes: 0 - normal, 1 - export stopped by user, 2 - export failed, 3 - invalid arguments
Export DONE.
|
|
Exporting to ".servoy" or to mobile solution ".war" files
You can see a list of available command line arguments in a console window by executing {servoyInstall}/developer/exporter/export.bat -help
and {servoyInstall}/developer/exporter/mobile_export.bat -help
;
...
Expand |
---|
title | see mobile ".war" solution exporter arguments |
---|
|
Code Block |
---|
| Workspace exporter for mobile solutions. Exports mobile workspace solutions in .war format.
USAGE:
-help or -? or /? or no arguments ... shows current help message.
OR
-s <solutions_separated_by_comma> -o <out_dir> -data <workspace_location> [optional_args]
Optional arguments:
-verbose ... prints more info to console
-p <properties_file> ... path and name of properties file used to start exporter.
Default: the 'servoy.properties' file from 'application_server' will be used.
-as <app_server_dir> ... specifies where to find the 'application_server' directory.
Default: '../../application_server'.
-pl alternate project locations; solution, resources and other needed projects will
be searched for in subfolders (deep) of the given 'workspace_location' as well.
For example: if the
workspace needs to contain projects from different git repositories, those can
be checked out in '<workspace_loc>', '<workspace_loc>/a', '<workspace_loc>/b/c'
and so on.
-ie ignore build errors. CAUTION! the use of this flag is discouraged; it can cause
invalid solutions to be exported.
-sb skip build. No build markers will be generated. This can greatly decrease
export time. CAUTION! the use of this flag is discouraged;
it can cause invalid solutions to be exported.
-production ... export normal mobile client. Default: false (exports unit test war).
-server_url <url> ... application server URL. Used to find mobile service solution.
Default: http://localhost:[detectedInstallationPortNumber]
-service_solution ... name of the service solution (default will be
mySolutionName_service).
-sync_timeout <seconds> ... client sync call timeout. Default: 30 sec.
-long_test_names ... only if '-production' is not set; it will generate 'long' test
method names that include solution and form/scope name; this can
help with dumb junit tools that ignore junit test suite nesting
when showing test results - thus loosing that information.
(starting with 2020.09)
EXIT codes: 0 - normal, 1 - export stopped by user, 2 - export failed, 3 - invalid arguments
Export DONE.
|
|
(Import) Test suite runner
Arguments are shown below. This is a JUnit suite that actually will import a .servoy file and run the JSUnit tests on them. It's not an actual command line tool but it can be used directly from command line, or from several build tools. See Servoy Software Factory Example using Jenkins as an example.
...
Expand |
---|
title | see jsunit (import) test client arguments |
---|
|
Code Block |
---|
| This is the smart import-test-client test-suite runner HELP message.
This suite is able to import one or more .servoy solutions and run jsunit tests on them. If you did
not expect to see this message but still got it, then something is probably misconfigured...
The working directory is assumed to be [path_to_your_servoy_install]/application_server. If this is
not the case please define system property 'servoy.application_server.dir'.
You can give parameters to this test suite using system properties. Configurable system properties:
servoy.test.help
Prints this help message to the console when the value is 'true'.
servoy.test.property-file
Key for the system property pointing to the servoy.properties file that should be used
(either absolute or relative to the working dir). If not specified, the properties will be
loaded from '<working dir>/<default properties file name obtained through usual means>'.
servoy.test.target-exports
Key for the system property that points to the solutions that should be tested. It must
point to a folder containing exported solutions or to an exported solution file. The name of
the export files must be the same as the solution it contains that must be tested. If this
is not specified, the default value is '<working dir>/../../exportedSolutions/'.
servoy.test.solution-load.timeout
Key for the system property that specifies the maximum number of seconds in which a solution
should load and be ready for testing. Solutions with long running onOpen handlers might want
to set this. If a solution doesn't load in this time frame, the tests will fail. Default
value: 300 sec. Minimum: 5 sec.
servoy.test.import-config-file
Key for the system property that points to the import configuration properties file. That is
a standard .properties file from which import options will be read. If this is not specified
then a set of default import options will be used - which will try to overwrite and import
as much as possible. Put a 'key=value' pair on each line in the file; here is a list of
properties that can be used in the file (defaults, marked with '*', are used for unspecified
properties):
overwriteStyles [*true/false] Overwrite repository styles with import version
overwriteUserGroups [*true/false] Overwrite repository group security settings with
import version
cleanSolutionName [newName] A clean import will be performed using the new
solution name. Only specify this if you want a clean
import. Default: do not use clean import
overrideSequenceTypes [*true/false] Override existing sequence type definitions (in
repository) with the sequence types contained in the
import file
updateSequences [*true/false] Update sequences for all tables on all servers used
by the imported solution and modules
overrideDefaultValues [*true/false] Override existing default values (in repository)
with the default values contained in the import file
allowSQLKeywords [*true/false] Allow reserved SQL keywords as table or column names
(will fail unless supported by the backend database)
allowDataModelChanges [*true/false/serverNames] Allow data model (database) changes
skipDatabaseViewsUpdate
[true/*false] Skip database view create/update (table info will be
imported)
showDataModelChanges [*true/false] Display data model (database) changes
importMetaData [*true/false] Import solution meta data
importSampleData [*true/false] Import solution sample data
importI18NKeys [*true/false] Import internationalization (i18n) data (inserts and
updates)
insertNewI18NKeysOnly [true/*false] Insert new internationalization (i18n) keys only
(inserts only, no updates)
importUserPolicy [skip/create_new_users_update_groups/*overwrite_all]
Where:
[skip] Do not import users contained in import
[create_new_users_update_groups] Create non-existing
users and add existing users to groups
specified in import
[overwrite_all] Overwrite existing users completely
(USE WITH CARE)
addUsersToAdminGroup [*true/false] Allow users to be added to the Administrators group.
solutionPassword_name [password] Only use this if the export is password protected.
'name' is the protected solution's name. One such
property can be set for each protected solution
importHookUserName [userName] Any import hooks will run using this user's
credentials. Null by default.
servoy.test.long-test-method-names
Key for the boolean system property that, when 'true', will generate long test method names
that contain solution name and form/scope names in them; this can help with dumb junit tools
that ignore junit test suite nesting when showing test results - and loose that information.
(starting with 2020.09) |
|
Mobile test suite runner
Arguments are shown below. This is a JUnit suite that will run the JSUnit tests on an exported and deployed mobile solution (and it's mobile service solution that is already running or can be imported from .servoy and made available). It's not an actual command line tool but it can be used directly from command line, or from several build tools. See Servoy Software Factory Example using Jenkins as an example.
...