PageRenderTime 58ms CodeModel.GetById 26ms RepoModel.GetById 0ms app.codeStats 0ms

/ri-clients/jbi-admin-cli/regress/regress_defs.ksh

https://bitbucket.org/openesb/openesb-core
Korn Shell | 323 lines | 171 code | 41 blank | 111 comment | 2 complexity | 28f2ba70bf18923383a3bf73538b80ff MD5 | raw file
  1. #
  2. # BEGIN_HEADER - DO NOT EDIT
  3. #
  4. # The contents of this file are subject to the terms
  5. # of the Common Development and Distribution License
  6. # (the "License"). You may not use this file except
  7. # in compliance with the License.
  8. #
  9. # You can obtain a copy of the license at
  10. # https://open-esb.dev.java.net/public/CDDLv1.0.html.
  11. # See the License for the specific language governing
  12. # permissions and limitations under the License.
  13. #
  14. # When distributing Covered Code, include this CDDL
  15. # HEADER in each file and include the License file at
  16. # https://open-esb.dev.java.net/public/CDDLv1.0.html.
  17. # If applicable add the following below this CDDL HEADER,
  18. # with the fields enclosed by brackets "[]" replaced with
  19. # your own identifying information: Portions Copyright
  20. # [year] [name of copyright owner]
  21. #
  22. #
  23. # @(#)regress_defs.ksh
  24. # Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
  25. #
  26. # END_HEADER - DO NOT EDIT
  27. #
  28. #common definitions for regression tests.
  29. #-------------------------------------------------------------------------
  30. # Use the Global regress setup.
  31. #-------------------------------------------------------------------------
  32. . $SRCROOT/antbld/regress/common_defs.ksh
  33. #-------------------------------------------------------------------------
  34. # Create pointer to the test directory (different for the two environments)
  35. #-------------------------------------------------------------------------
  36. export UI_REGRESS_DIST_DIR
  37. JV_SVC_TEST_CLASSES=$JV_SVC_BLD/regress
  38. if [ $OPENESB_BUILD -eq 1 ]; then
  39. UI_REGRESS_DIST_DIR=$JV_SVC_TEST_CLASSES/testdata
  40. else
  41. UI_REGRESS_DIST_DIR=$JV_SVC_TEST_CLASSES/dist
  42. fi
  43. #-------------------------------------------------------------------------
  44. # Create the pointer to the asadmin script file. We do this so we can override
  45. #-------------------------------------------------------------------------
  46. export TEST_ASADMIN
  47. TEST_ASADMIN=$AS8BASE/bin/asadmin
  48. if [ "$FORTE_PORT" = "cygwin" -o "$FORTE_PORT" = "nt" ]; then
  49. TEST_ASADMIN=${JV_SVC_BLD}/regress/test_asadmin.bat
  50. fi
  51. #-------------------------------------------------------------------------
  52. # Set the password file
  53. #-------------------------------------------------------------------------
  54. export PASSWORD_FILE
  55. PASSWORD_FILE=$AS8BASE/passwords
  56. #-------------------------------------------------------------------------
  57. # Set the port number
  58. #-------------------------------------------------------------------------
  59. export ADMIN_PORT
  60. ADMIN_PORT=$ASADMIN_PORT
  61. #-------------------------------------------------------------------------
  62. # Set the user
  63. #-------------------------------------------------------------------------
  64. export ADMIN_USER
  65. ADMIN_USER=$AS_ADMIN_USER
  66. #-------------------------------------------------------------------------
  67. # Will remove any service assemblies, components or libraries that may
  68. # be in the repository. Note the target needs to be specified
  69. #-------------------------------------------------------------------------
  70. cleanup()
  71. {
  72. $AS8BASE/bin/asadmin shut-down-jbi-service-assembly --target $1 --port $ADMIN_PORT --user $ADMIN_USER $ASADMIN_PW_OPTS cli_test_assembly_unit_1 >> $TEMP_OUTPUT_FILE 2>&1
  73. $AS8BASE/bin/asadmin shut-down-jbi-service-assembly --target $1 --port $ADMIN_PORT --user $ADMIN_USER $ASADMIN_PW_OPTS cli_test_sa4 >> $TEMP_OUTPUT_FILE 2>&1
  74. $AS8BASE/bin/asadmin shut-down-jbi-service-assembly --target $1 --port $ADMIN_PORT --user $ADMIN_USER $ASADMIN_PW_OPTS PingApp >> $TEMP_OUTPUT_FILE 2>&1
  75. $AS8BASE/bin/asadmin shut-down-jbi-service-assembly --target $1 --port $ADMIN_PORT --user $ADMIN_USER $ASADMIN_PW_OPTS SA1 >> $TEMP_OUTPUT_FILE 2>&1
  76. $AS8BASE/bin/asadmin shut-down-jbi-service-assembly --target $1 --port $ADMIN_PORT --user $ADMIN_USER $ASADMIN_PW_OPTS SA2 >> $TEMP_OUTPUT_FILE 2>&1
  77. $AS8BASE/bin/asadmin undeploy-jbi-service-assembly --target $1 --port $ADMIN_PORT --user $ADMIN_USER $ASADMIN_PW_OPTS --force cli_test_assembly_unit_1 >> $TEMP_OUTPUT_FILE 2>&1
  78. $AS8BASE/bin/asadmin undeploy-jbi-service-assembly --target $1 --port $ADMIN_PORT --user $ADMIN_USER $ASADMIN_PW_OPTS --force cli_test_sa4 >> $TEMP_OUTPUT_FILE 2>&1
  79. $AS8BASE/bin/asadmin undeploy-jbi-service-assembly --target $1 --port $ADMIN_PORT --user $ADMIN_USER $ASADMIN_PW_OPTS --force PingApp >> $TEMP_OUTPUT_FILE 2>&1
  80. $AS8BASE/bin/asadmin undeploy-jbi-service-assembly --target $1 --port $ADMIN_PORT --user $ADMIN_USER $ASADMIN_PW_OPTS --force SA1 >> $TEMP_OUTPUT_FILE 2>&1
  81. $AS8BASE/bin/asadmin undeploy-jbi-service-assembly --target $1 --port $ADMIN_PORT --user $ADMIN_USER $ASADMIN_PW_OPTS --force SA2 >> $TEMP_OUTPUT_FILE 2>&1
  82. $AS8BASE/bin/asadmin shut-down-jbi-component --target $1 --port $ADMIN_PORT --user $ADMIN_USER $ASADMIN_PW_OPTS --force cli_test_binding1 >> $TEMP_OUTPUT_FILE 2>&1
  83. $AS8BASE/bin/asadmin shut-down-jbi-component --target $1 --port $ADMIN_PORT --user $ADMIN_USER $ASADMIN_PW_OPTS --force cli_test_binding2 >> $TEMP_OUTPUT_FILE 2>&1
  84. $AS8BASE/bin/asadmin shut-down-jbi-component --target $1 --port $ADMIN_PORT --user $ADMIN_USER $ASADMIN_PW_OPTS --force cli_test_engine1 >> $TEMP_OUTPUT_FILE 2>&1
  85. $AS8BASE/bin/asadmin shut-down-jbi-component --target $1 --port $ADMIN_PORT --user $ADMIN_USER $ASADMIN_PW_OPTS --force cli_test_engine2 >> $TEMP_OUTPUT_FILE 2>&1
  86. $AS8BASE/bin/asadmin shut-down-jbi-component --target $1 --port $ADMIN_PORT --user $ADMIN_USER $ASADMIN_PW_OPTS --force cli_test_engine3 >> $TEMP_OUTPUT_FILE 2>&1
  87. $AS8BASE/bin/asadmin shut-down-jbi-component --target $1 --port $ADMIN_PORT --user $ADMIN_USER $ASADMIN_PW_OPTS --force cli_test_engine4 >> $TEMP_OUTPUT_FILE 2>&1
  88. $AS8BASE/bin/asadmin shut-down-jbi-component --target $1 --port $ADMIN_PORT --user $ADMIN_USER $ASADMIN_PW_OPTS --force cli-config-binding >> $TEMP_OUTPUT_FILE 2>&1
  89. $AS8BASE/bin/asadmin shut-down-jbi-component --target $1 --port $ADMIN_PORT --user $ADMIN_USER $ASADMIN_PW_OPTS --force test-component >> $TEMP_OUTPUT_FILE 2>&1
  90. $AS8BASE/bin/asadmin shut-down-jbi-component --target $1 --port $ADMIN_PORT --user $ADMIN_USER $ASADMIN_PW_OPTS --force test-component1 >> $TEMP_OUTPUT_FILE 2>&1
  91. $AS8BASE/bin/asadmin shut-down-jbi-component --target $1 --port $ADMIN_PORT --user $ADMIN_USER $ASADMIN_PW_OPTS --force SimpleTestEngine >> $TEMP_OUTPUT_FILE 2>&1
  92. $AS8BASE/bin/asadmin uninstall-jbi-component --target $1 --port $ADMIN_PORT --user $ADMIN_USER $ASADMIN_PW_OPTS --force cli_test_binding1 >> $TEMP_OUTPUT_FILE 2>&1
  93. $AS8BASE/bin/asadmin uninstall-jbi-component --target $1 --port $ADMIN_PORT --user $ADMIN_USER $ASADMIN_PW_OPTS --force cli_test_engine1 >> $TEMP_OUTPUT_FILE 2>&1
  94. $AS8BASE/bin/asadmin uninstall-jbi-component --target $1 --port $ADMIN_PORT --user $ADMIN_USER $ASADMIN_PW_OPTS --force cli_test_binding2 >> $TEMP_OUTPUT_FILE 2>&1
  95. $AS8BASE/bin/asadmin uninstall-jbi-component --target $1 --port $ADMIN_PORT --user $ADMIN_USER $ASADMIN_PW_OPTS --force cli_test_engine2 >> $TEMP_OUTPUT_FILE 2>&1
  96. $AS8BASE/bin/asadmin uninstall-jbi-component --target $1 --port $ADMIN_PORT --user $ADMIN_USER $ASADMIN_PW_OPTS --force cli_test_engine3 >> $TEMP_OUTPUT_FILE 2>&1
  97. $AS8BASE/bin/asadmin uninstall-jbi-component --target $1 --port $ADMIN_PORT --user $ADMIN_USER $ASADMIN_PW_OPTS --force cli_test_engine4 >> $TEMP_OUTPUT_FILE 2>&1
  98. $AS8BASE/bin/asadmin uninstall-jbi-component --target $1 --port $ADMIN_PORT --user $ADMIN_USER $ASADMIN_PW_OPTS --force cli-config-binding >> $TEMP_OUTPUT_FILE 2>&1
  99. $AS8BASE/bin/asadmin uninstall-jbi-component --target $1 --port $ADMIN_PORT --user $ADMIN_USER $ASADMIN_PW_OPTS --force test-component >> $TEMP_OUTPUT_FILE 2>&1
  100. $AS8BASE/bin/asadmin uninstall-jbi-component --target $1 --port $ADMIN_PORT --user $ADMIN_USER $ASADMIN_PW_OPTS --force test-component1 >> $TEMP_OUTPUT_FILE 2>&1
  101. $AS8BASE/bin/asadmin uninstall-jbi-component --target $1 --port $ADMIN_PORT --user $ADMIN_USER $ASADMIN_PW_OPTS --force SimpleTestEngine >> $TEMP_OUTPUT_FILE 2>&1
  102. $AS8BASE/bin/asadmin uninstall-jbi-shared-library --target $1 --port $ADMIN_PORT --user $ADMIN_USER $ASADMIN_PW_OPTS cli_test_sns1 >> $TEMP_OUTPUT_FILE 2>&1
  103. $AS8BASE/bin/asadmin uninstall-jbi-shared-library --target $1 --port $ADMIN_PORT --user $ADMIN_USER $ASADMIN_PW_OPTS cli_test_sns2 >> $TEMP_OUTPUT_FILE 2>&1
  104. }
  105. #-------------------------------------------------------------------------
  106. # Will start a component, redirecting the output to the TEMP file.
  107. #-------------------------------------------------------------------------
  108. start_component()
  109. {
  110. $AS8BASE/bin/asadmin start-jbi-component --target $1 --port $ADMIN_PORT --user $ADMIN_USER $ASADMIN_PW_OPTS $2 >> $TEMP_OUTPUT_FILE 2>&1
  111. }
  112. #-------------------------------------------------------------------------
  113. # Will shut down a component, redirecting the output to the TEMP file.
  114. #-------------------------------------------------------------------------
  115. shut_down_component()
  116. {
  117. $AS8BASE/bin/asadmin shut-down-jbi-component --target $1 --port $ADMIN_PORT --user $ADMIN_USER $ASADMIN_PW_OPTS $2 >> $TEMP_OUTPUT_FILE 2>&1
  118. }
  119. #-------------------------------------------------------------------------
  120. # Will install a component, redirecting the output to the TEMP file.
  121. #-------------------------------------------------------------------------
  122. install_component()
  123. {
  124. $AS8BASE/bin/asadmin install-jbi-component --target $1 --port $ADMIN_PORT --user $ADMIN_USER $ASADMIN_PW_OPTS $2 >> $TEMP_OUTPUT_FILE 2>&1
  125. }
  126. #-------------------------------------------------------------------------
  127. # Will install a shared library, redirecting the output to the TEMP file.
  128. #-------------------------------------------------------------------------
  129. install_shared_library()
  130. {
  131. $AS8BASE/bin/asadmin install-jbi-shared-library --target $1 --port $ADMIN_PORT --user $ADMIN_USER $ASADMIN_PW_OPTS $2 >> $TEMP_OUTPUT_FILE 2>&1
  132. }
  133. #-------------------------------------------------------------------------
  134. # Will start the service assembly, redirecting the output to the TEMP file.
  135. #-------------------------------------------------------------------------
  136. start_assembly()
  137. {
  138. $AS8BASE/bin/asadmin start-jbi-service-assembly --target $1 --port $ADMIN_PORT --user $ADMIN_USER $ASADMIN_PW_OPTS $2
  139. }
  140. #-------------------------------------------------------------------------
  141. # Will deploy the service assembly, redirecting the output to the TEMP file.
  142. #-------------------------------------------------------------------------
  143. deploy_assembly()
  144. {
  145. $AS8BASE/bin/asadmin deploy-jbi-service-assembly --target $1 --port $ADMIN_PORT --user $ADMIN_USER $ASADMIN_PW_OPTS $2
  146. }
  147. #-------------------------------------------------------------------------
  148. # Build the test artifacts (i.e. all the archive files used for testing)
  149. #-------------------------------------------------------------------------
  150. build_test_artifacts()
  151. {
  152. echo "-------------------------------------------------------------------"
  153. echo " Building the test artifacts"
  154. echo "-------------------------------------------------------------------"
  155. ant -emacs -q -f $JV_SVC_REGRESS/scripts/build-test-components.ant >> $TEMP_OUTPUT_FILE
  156. return 0
  157. }
  158. #-------------------------------------------------------------------------
  159. # Build the artifacts used for application configuration tests
  160. #-------------------------------------------------------------------------
  161. build_test_application_artifacts()
  162. {
  163. echo "-------------------------------------------------------------------"
  164. echo " Building and packaging the test component cli-config-binding"
  165. echo "-------------------------------------------------------------------"
  166. ant -q -emacs -propertyfile "$JV_JBI_DOMAIN_PROPS" -lib "$REGRESS_CLASSPATH" -f $JV_SVC_REGRESS/scripts/build-cli-config-binding.ant pkg.test.component >> $TEMP_OUTPUT_FILE 2>&1
  167. return 0
  168. }
  169. #-------------------------------------------------------------------------
  170. # Build the artifacts used for application configuration tests
  171. #-------------------------------------------------------------------------
  172. build_test_engine_with_endpoints_artifacts()
  173. {
  174. echo "-------------------------------------------------------------------"
  175. echo " Building and packaging the test simple test engine with endpoints"
  176. echo "-------------------------------------------------------------------"
  177. ant -q -emacs -propertyfile "$JV_JBI_DOMAIN_PROPS" -lib "$REGRESS_CLASSPATH" -f jbi-admin-cli00013.xml
  178. #ant -q -emacs -propertyfile "$JV_JBI_DOMAIN_PROPS" -lib "$REGRESS_CLASSPATH" -f $JV_SVC_REGRESS/scripts/build-test-engine-with-endpoints.ant >> $TEMP_OUTPUT_FILE 2>&1
  179. return 0
  180. }
  181. #----------------------------------------------------------------------------------
  182. # Will echo some verbage that explains what this regression test is doing
  183. #----------------------------------------------------------------------------------
  184. display_test_info()
  185. {
  186. echo ""
  187. echo "-------------------------------------------------------------------"
  188. echo " Start Test : $TEST_NAME"
  189. echo " Description: $TEST_DESCRIPTION"
  190. echo "-------------------------------------------------------------------"
  191. }
  192. #----------------------------------------------------------------------------------
  193. # Perform the test initialization, which consist of echoing the test description,
  194. # building the test artifacts and creating the temporary output file.
  195. #----------------------------------------------------------------------------------
  196. initilize_test()
  197. {
  198. create_temp_output_file
  199. display_test_info
  200. build_test_artifacts
  201. }
  202. #-------------------------------------------------------------------------
  203. # Create the tempory output file. This file will be used to redirect
  204. # the vairable output too. This is mostly used when setting up the
  205. # test environment before running the test.
  206. #-------------------------------------------------------------------------
  207. create_temp_output_file()
  208. {
  209. TEMP_OUTPUT_FILE="$JV_SVC_BLD/tmp/$TEST_NAME.out"
  210. mkdir -p $JV_SVC_BLD/tmp
  211. #echo "test_setup (logging to ..$TEMP_OUTPUT_FILE)"
  212. #echo "test_setup" > $TEMP_OUTPUT_FILE 2>&1
  213. }
  214. #-------------------------------------------------------------------------
  215. # Filter list on specified service assembly name. This is a safe way
  216. # to test the list.
  217. #-------------------------------------------------------------------------
  218. list_service_assembly()
  219. {
  220. echo ""
  221. echo "-------------------------------------------------------------------"
  222. echo " List the Service Assembly $1"
  223. echo "-------------------------------------------------------------------"
  224. echo "list-jbi-service-assemblies | grep $1"
  225. $AS8BASE/bin/asadmin list-jbi-service-assemblies --port $ADMIN_PORT --user $ADMIN_USER $ASADMIN_PW_OPTS | grep $1
  226. }
  227. #-------------------------------------------------------------------------
  228. # Filter list on specified shared library name. This is a safe way
  229. # to test the list.
  230. #-------------------------------------------------------------------------
  231. list_shared_libraries()
  232. {
  233. echo ""
  234. echo "-------------------------------------------------------------------"
  235. echo " List the Shared Library $1"
  236. echo "-------------------------------------------------------------------"
  237. echo "list-jbi-shared-library | grep $1"
  238. $AS8BASE/bin/asadmin list-jbi-shared-libraries --port $ADMIN_PORT --user $ADMIN_USER $ASADMIN_PW_OPTS | grep $1
  239. }
  240. #-------------------------------------------------------------------------
  241. # Filter list on specified binding component name. This is a safe way
  242. # to test the list.
  243. #-------------------------------------------------------------------------
  244. list_binding_components()
  245. {
  246. echo ""
  247. echo "-------------------------------------------------------------------"
  248. echo " List the Binding Component $1"
  249. echo "-------------------------------------------------------------------"
  250. echo "list-jbi-binding-component | grep $1"
  251. $AS8BASE/bin/asadmin list-jbi-binding-components --port $ADMIN_PORT --user $ADMIN_USER $ASADMIN_PW_OPTS | grep $1
  252. }
  253. #-------------------------------------------------------------------------
  254. # Filter list on specified service engine name. This is a safe way
  255. # to test the list.
  256. #-------------------------------------------------------------------------
  257. list_service_engines()
  258. {
  259. echo ""
  260. echo "-------------------------------------------------------------------"
  261. echo " List the Service Engine $1"
  262. echo "-------------------------------------------------------------------"
  263. echo "list-jbi-service-engines | grep $1"
  264. $AS8BASE/bin/asadmin list-jbi-service-engines --port $ADMIN_PORT --user $ADMIN_USER $ASADMIN_PW_OPTS | grep $1
  265. }
  266. #-------------------------------------------------------------------------
  267. # Perform a clean install --- Currently not used ---
  268. #-------------------------------------------------------------------------
  269. clean_jbi_install()
  270. {
  271. rm $JBI_DOMAIN_ROOT/logs/server.log
  272. rm $JBI_DOMAIN_ROOT/logs/.jbi_admin*
  273. rm -rf $JBI_DOMAIN_ROOT/jbi/engines
  274. rm -rf $JBI_DOMAIN_ROOT/jbi/bindings
  275. rm -rf $JBI_DOMAIN_ROOT/jbi/sharedlibraries
  276. rm -rf $JBI_DOMAIN_ROOT/jbi/repository
  277. rm -rf $JBI_DOMAIN_ROOT/jbi/schemaorg_apache_xmlbeans.system/deployment
  278. rm -rf $JBI_DOMAIN_ROOT/jbi/Trash
  279. mkdir $JBI_DOMAIN_ROOT/jbi/repository
  280. mkdir $JBI_DOMAIN_ROOT/jbi/schemaorg_apache_xmlbeans.system/deployment
  281. return 0;
  282. }