[CB 4.0][CBORM 1.0.3][testbox2.1.0] "The coldbox main controller has not been initialized"

Hi all,
I’ve just started playing with Coldbox and am thrilled at the depth and breadth of the tool.
I’ve managed to fight my way thru several little stumbles up the learning curve but find myself at a loss at the moment. I’m hoping someone will be able to point me in the right direction.

All seemed to be working. I had the ormSettings incorrectly configured and was getting postgresql error "cross-database references are not implemented"
I fixed the ormSettings such that the query would hit ‘test2.public’ and now get "ColdBox Controller Not Found"

Googling this I find Google Groups but I can’t seem to make heads or tails of what that is about.

------------------------------ My testbox ‘application.cfc’ ------------------------------------

<cfset this.name = “ColdBoxTestingSuite” & hash(getCurrentTemplatePath())>


<cfset this.mappings[ “/tests” ] = getDirectoryFromPath( getCurrentTemplatePath() )>
<cfset this.mappings[ “/coldbox” ] = “/var/www/coldbox”>
<cfset this.mappings[ “/models” ] = “/var/www/curator/models”>
<cfset this.mappings[ “/testbox” ] = “/var/www/coldbox/testbox”>
<cfset this.mappings[ “/cborm” ] = “/var/www/coldbox/modules/cborm”>

<cfset rootPath = REReplaceNoCase( this.mappings[ “/tests” ], “tests(\|/)”, “” )>
<cfset this.mappings[ “/root” ] = rootPath>

this.javaSettings = { loadPaths = [ “lib” ], reloadOnChange = false };
this.datasource = “curator”;
this.ormenabled = true;
this.ormSettings = {
datasource = “curator”,
cfclocation = this.mappings[ “/models” ],
catalog = “test2”,
schema = “public”,
dbcreate = “none”,
dialect = “PostgreSQL”,
logSQL = true,
// Enable event handling
eventHandler = “cborm.models.EventHandler”
// Set the event handler to use, which will be inside our application.
};

--------------------------- My ‘articleTest.cfc’ --------------------------------

component extends=“testbox.system.BaseSpec”{
/*********************************** LIFE CYCLE Methods ***********************************/

// executes before all suites+specs in the run() method

function beforeAll(){
aService = createObject(‘component’, ‘models.article.articleService’).init();
mockArticle = getMockBox().createMock(“models.article.article”).init(aService);
mockArticle.$property(propertyName=“ArticleID”,mock=“123456”);
mockArticle.$property(propertyName=“Headline”,mock=“A Sample Headline”);
}

// executes after all suites+specs in the run() method
function afterAll(){
}

/*********************************** BDD SUITES ***********************************/
function run( testResults, testBox ){

// all your suites go here.
describe( “An article”, function(){
it(“should be an object”, function(){
expect(mockArticle).toBeComponent();
});
it(“should be able to be created”, function(){
oA = aService.get(0);
expect(oA).toBeComponent();
});

});
}

}

---------------------- My articleService.cfc ----------------------------------------------

/**

  • Article service
    /
    component extends=“cborm.models.VirtualEntityService” singleton{
    /
    *

  • Constructor
    */
    function init(){
    // init super class
    super.init(entityName=“article”);
    // Use Query Caching
    setUseQueryCaching( false );
    // Query Cache Region
    setQueryCacheRegion( ‘query.article’ );
    // EventHandling
    setEventHandling( true );

return this;

}
}

At this point I’m guessing I need to bootstrap coldbox in my testbox application.cfc. Does that sound like the right direction?

Are you having errors in your integration tests?

Luis Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com
P/F: 1-888-557-8057
Direct: (909) 248-3408

ColdBox Platform: http://www.coldbox.org

ContentBox Platform: http://www.gocontentbox.org
Linked In: http://www.linkedin.com/pub/3/731/483

Social: twitter.com/ortussolutions | twitter.com/coldbox | twitter.com/lmajano | twitter.com/gocontentbox

Can you post your testss

Luis Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com
P/F: 1-888-557-8057
Direct: (909) 248-3408

ColdBox Platform: http://www.coldbox.org

ContentBox Platform: http://www.gocontentbox.org
Linked In: http://www.linkedin.com/pub/3/731/483

Social: twitter.com/ortussolutions | twitter.com/coldbox | twitter.com/lmajano | twitter.com/gocontentbox

Oops. I just saw them.

Yes the problem is you are doing A integration test to load the orm extensions. Therefore instead of extending from base spec exten from the ColdBox base testing class
ColdBox.system.testing.BaseTestCase

This way you can load the virtual application into memory.

Luis Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com
P/F: 1-888-557-8057
Direct: (909) 248-3408

ColdBox Platform: http://www.coldbox.org

ContentBox Platform: http://www.gocontentbox.org
Linked In: http://www.linkedin.com/pub/3/731/483

Social: twitter.com/ortussolutions | twitter.com/coldbox | twitter.com/lmajano | twitter.com/gocontentbox

Hi Luis -
Not sure what you are asking . . .
I’m just running the /tests/runner.cfm from the browser.

I have the sample tests in the /tests/specs/integration folder and they are not giving me errors but both the “MainTest” and the MainBDDTest" are each giving me one failure in the ‘doSomething’ (some kind of ‘relocation test’?).

The error I see is in my own test in the /tests/specs/unit/articleTest.cfc (code above).

The specific error message is
ColdBox Controller Not Found
and he detail is
The coldbox main controller has not been initialized

I guess one would call it an ‘integration test’ because it is integrating my code with the database system.

The test code is posted in the original message. Would you like me to post some other way?

heh - finally reading your whole post. Thanks for the ideas - off to play with them - I’ll report back.
B.

Seems to make a lot of sense but - unfortunately - no joy.
My message is just the same . . .
“The coldbox main controller has not been initialized”

my only change was the ‘extends’ attribute . . . here’s the new code.

You need a call to Boostrap the framework in your before all method. Do a call to setup(); in there before any code

Luis Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com
P/F: 1-888-557-8057
Direct: (909) 248-3408

ColdBox Platform: http://www.coldbox.org

ContentBox Platform: http://www.gocontentbox.org
Linked In: http://www.linkedin.com/pub/3/731/483

Social: twitter.com/ortussolutions | twitter.com/coldbox | twitter.com/lmajano | twitter.com/gocontentbox