Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

Application.cfc 2.4 KB

You have to be logged in to leave a comment. Sign In
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
  1. /**
  2. * Copyright 2005-2007 ColdBox Framework by Luis Majano and Ortus Solutions, Corp
  3. * www.ortussolutions.com
  4. * ---
  5. */
  6. component {
  7. // APPLICATION CFC PROPERTIES
  8. this.name = "ColdBoxTestingSuite";
  9. this.sessionManagement = true;
  10. this.setClientCookies = true;
  11. this.sessionTimeout = createTimespan( 0, 0, 15, 0 );
  12. this.applicationTimeout = createTimespan( 0, 0, 15, 0 );
  13. this.whiteSpaceManagement = "smart";
  14. this.enableNullSupport = shouldEnableFullNullSupport();
  15. /**
  16. * --------------------------------------------------------------------------
  17. * Location Mappings
  18. * --------------------------------------------------------------------------
  19. * - cbApp : Quick reference to root application
  20. * - coldbox : Where ColdBox library is installed
  21. * - testbox : Where TestBox is installed
  22. */
  23. // Create testing mapping
  24. this.mappings[ "/tests" ] = getDirectoryFromPath( getCurrentTemplatePath() );
  25. // The root application mapping
  26. rootPath = reReplaceNoCase( this.mappings[ "/tests" ], "tests(\\|/)", "" );
  27. this.mappings[ "/root" ] = this.mappings[ "/cbapp" ] = rootPath;
  28. this.mappings[ "/coldbox" ] = rootPath & "coldbox";
  29. this.mappings[ "/testbox" ] = rootPath & "testbox";
  30. /**
  31. * Fires on every test request. It builds a Virtual ColdBox application for you
  32. *
  33. * @targetPage The requested page
  34. */
  35. public boolean function onRequestStart( targetPage ){
  36. // Set a high timeout for long running tests
  37. setting requestTimeout ="9999";
  38. // New ColdBox Virtual Application Starter
  39. request.coldBoxVirtualApp= new coldbox.system.testing.VirtualApp( appMapping = "/root" );
  40. // If hitting the runner or specs, prep our virtual app
  41. if ( getBaseTemplatePath().replace( expandPath( "/tests" ), "" ).reFindNoCase( "(runner|specs)" ) ) {
  42. request.coldBoxVirtualApp.startup();
  43. }
  44. // Reload for fresh results
  45. if ( structKeyExists( url, "fwreinit" ) ) {
  46. if ( structKeyExists( server, "lucee" ) ) {
  47. pagePoolClear();
  48. }
  49. // ormReload();
  50. request.coldBoxVirtualApp.restart();
  51. }
  52. return true;
  53. }
  54. /**
  55. * Fires when the testing requests end and the ColdBox application is shutdown
  56. */
  57. public void function onRequestEnd( required targetPage ){
  58. request.coldBoxVirtualApp.shutdown();
  59. }
  60. private boolean function shouldEnableFullNullSupport(){
  61. var system = createObject( "java", "java.lang.System" );
  62. var value = system.getEnv( "FULL_NULL" );
  63. return isNull( value ) ? false : !!value;
  64. }
  65. }
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...