|
1 | 1 | /**
|
2 |
| -******************************************************************************** |
3 |
| -Copyright 2005-2007 ColdBox Framework by Luis Majano and Ortus Solutions, Corp |
4 |
| -www.ortussolutions.com |
5 |
| -******************************************************************************** |
| 2 | + * ******************************************************************************** |
| 3 | + * Copyright 2005-2007 ColdBox Framework by Luis Majano and Ortus Solutions, Corp |
| 4 | + * www.ortussolutions.com |
| 5 | + * ******************************************************************************** |
6 | 6 | */
|
7 | 7 | component {
|
8 | 8 |
|
| 9 | + // UPDATE THE NAME OF THE MODULE IN TESTING BELOW |
| 10 | + request.MODULE_NAME = "cbmailservices"; |
| 11 | + request.MODULE_PATH = "cbmailservices"; |
| 12 | + |
9 | 13 | // APPLICATION CFC PROPERTIES
|
10 |
| - this.name = "ColdBoxTestingSuite" & hash( getCurrentTemplatePath() ); |
| 14 | + this.name = "#request.MODULE_NAME# Testing Suite"; |
11 | 15 | this.sessionManagement = true;
|
12 | 16 | this.sessionTimeout = createTimespan( 0, 0, 15, 0 );
|
13 | 17 | this.applicationTimeout = createTimespan( 0, 0, 15, 0 );
|
14 | 18 | this.setClientCookies = true;
|
15 | 19 |
|
16 |
| - this.smtpServerSettings = { |
17 |
| - server : "localhost" |
18 |
| - }; |
19 |
| - |
20 | 20 | // Create testing mapping
|
21 | 21 | this.mappings[ "/tests" ] = getDirectoryFromPath( getCurrentTemplatePath() );
|
22 | 22 |
|
23 | 23 | // The application root
|
24 | 24 | rootPath = reReplaceNoCase( this.mappings[ "/tests" ], "tests(\\|/)", "" );
|
25 | 25 | this.mappings[ "/root" ] = rootPath;
|
26 | 26 |
|
27 |
| - // UPDATE THE NAME OF THE MODULE IN TESTING BELOW |
28 |
| - request.MODULE_NAME = "cbmailservices"; |
29 |
| - |
30 | 27 | // The module root path
|
31 | 28 | moduleRootPath = reReplaceNoCase( this.mappings[ "/root" ], "#request.module_name#(\\|/)test-harness(\\|/)", "" );
|
32 | 29 | this.mappings[ "/moduleroot" ] = moduleRootPath;
|
33 | 30 | this.mappings[ "/#request.MODULE_NAME#" ] = moduleRootPath & "#request.MODULE_NAME#";
|
34 | 31 |
|
35 |
| - this.datasource = "cbmailservices"; |
| 32 | + // Define the fake smtp server |
| 33 | + this.mail = { |
| 34 | + server = "localhost", |
| 35 | + port = 25, |
| 36 | + }; |
36 | 37 |
|
37 | 38 | // request start
|
38 | 39 | public boolean function onRequestStart( String targetPage ){
|
| 40 | + |
| 41 | + // Set a high timeout for long running tests |
| 42 | + setting requestTimeout="9999"; |
| 43 | + // New ColdBox Virtual Application Starter |
| 44 | + request.coldBoxVirtualApp = new coldbox.system.testing.VirtualApp( appMapping = "/root" ); |
| 45 | + |
| 46 | + // ORM Reload for fresh results |
| 47 | + if( structKeyExists( url, "fwreinit" ) ){ |
| 48 | + if( structKeyExists( server, "lucee" ) ){ |
| 49 | + pagePoolClear(); |
| 50 | + } |
| 51 | + request.coldBoxVirtualApp.shutdown(); |
| 52 | + } |
| 53 | + |
| 54 | + // If hitting the runner or specs, prep our virtual app |
| 55 | + if ( getBaseTemplatePath().replace( expandPath( "/tests" ), "" ).reFindNoCase( "(runner|specs)" ) ) { |
| 56 | + request.coldBoxVirtualApp.startup(); |
| 57 | + } |
| 58 | + |
39 | 59 | return true;
|
40 | 60 | }
|
41 | 61 |
|
42 | 62 | public function onRequestEnd(){
|
43 |
| - // CB 6 graceful shutdown |
44 |
| - if ( !isNull( application.cbController ) ) { |
45 |
| - application.cbController.getLoaderService().processShutdown(); |
46 |
| - } |
47 |
| - |
48 |
| - structDelete( application, "cbController" ); |
49 |
| - structDelete( application, "wirebox" ); |
| 63 | + request.coldBoxVirtualApp.shutdown(); |
50 | 64 | }
|
51 | 65 |
|
52 | 66 | }
|
0 commit comments