Hi there everyone,
I've got a very simple scenario here and I'm not sure why it's not
working.
When I run the following test the testDummyData passes, but the
validateCredentialsShouldReturnBoolean function errors out with:
"The ENTITYNAME parameter to the new function is required but was not
passed in."
*Stack trace at the end of this post
I assume it's because the @model is not creating a true version of the
Service.. but I think I want it to as I'm trying to test (non-VES)
functions
Any help appreciated,
Cheers
Steve
PartyServiceTest -------------------------------------------------
component extends="coldbox.system.testing.BaseModelTest"
model="model.services.users.PartyService"
{
void function setup(){
//Call the super setup method to setup the app.
super.setup();
// Your own setup here if needed
}
function validateCredentialsShouldReturnBoolean()
{
party = model.new();
party.setUsername("username");
party.setPassword("password");
model.save(party);
var partyValid = model.validatePartyCredentials(party);
}
function testDummyData()
{
data = model.getDummyData();
expected = {
1 = 1,
a = "a",
now = now()
};
assertEquals(expected, data, "Dummy data returns the wrong data");
}
}
end -------------------------------------------------
PartyService ------------------------------------
component extends="coldbox.system.orm.hibernate.VirtualEntityService"
singleton{
public PartyService function init(){
// init super class
super.init(entityName="Party");
// Use Query Caching
setUseQueryCaching( false );
// Query Cache Region
setQueryCacheRegion( 'ORMService.defaultCache' );
// EventHandling
setEventHandling( true );
return this;
}
public boolean function validatePartyCredentials(Party party)
{
return true;
}
public struct function getDummyData()
{
return
{
1 = 1,
a = "a",
now = now()
};
}
}
end -------------------------------------------
stacktrace ---------------------------------
coldfusion.runtime.MissingArgumentException: The ENTITYNAME parameter
to the new function is required but was not passed in. at
coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:523) at
coldfusion.runtime.CfJspPage._invokeUDF(CfJspPage.java:2547) at
coldfusion.runtime.SuperScope.invoke(SuperScope.java:18) at
coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:2301) at
cfVirtualEntityService2ecfc1199061123$funcNEW.runFunction(C:\inetpub
\wwwroot\coldbox\system\orm\hibernate\VirtualEntityService.cfc:93) at
coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472) at
coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:
405) at coldfusion.runtime.UDFMethod
$ArgumentCollectionFilter.invoke(UDFMethod.java:368) at
coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:
55) at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:220) at
coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:490) at
coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:336) at
coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:2360) at
cfPartyServiceTest2ecfc713101611$funcVALIDATECREDENTIALSSHOULDRETURNBOOLEAN.runFunction(C:
\Users\scowling\workspace\hmri_core2\test\unit\users
\PartyServiceTest.cfc:14) ... snip
end stacktrace --------------------------