Category Selected:

tutorials

Blog

Mocking a Super Class with MockBox

Luis Majano |  March 09, 2011

A few folks have asked how you can leverage MXUnit and MockBox to mock a super class class.  Here is a simple example to showcase this:

Class Parent A

<cfcomponent name="A"> 
<!--- send ---> 
<cffunction access="public" hint="" name="send" output="false" returntype="any"> 
<cfreturn parent="">
</cffunction> 
</cfcomponent> 

Class Parent B

							
							
								
Read More

Mocking a Super Class with MockBox

Luis Majano |  March 09, 2011

A few folks have asked how you can leverage MXUnit and MockBox to mock a super class class.  Here is a simple example to showcase this:

Class Parent A

<cfcomponent name="A"> 
<!--- send ---> 
<cffunction access="public" hint="" name="send" output="false" returntype="any"> 
<cfreturn parent="">
</cffunction> 
</cfcomponent> 

Class Parent B

							
							
								
Read More

Don't Forget persistent="false" When Autowiring Entities

Curt Gratz |  January 21, 2011

I ran into a strange error yesterday that I couldn't seem to find out what was happening.

I was getting coldfusion.runtime.TemplateProxy cannot be cast to java.lang.String when trying to save an entity using ColdFusion ORM.  

Google was turning up nothing, so I started systematically removing lines of code.  It started working when I removed the line that did an entityLoad on a different object.  What was weird was I was just using that object to get a bit of data and not even for the object I was saving that caused everything to go boom, and if I removed the save, everything worked fine.  Then I remembered that the Hibernate session is affected so I took a deeper look at the entity that a loaded.  Sure enough, I was autowiring a property and didn't have persistent="false" on that property, causing it to throw the "coldfusion.runtime.TemplateProxy cannot be cast to java.lang.String" error.

Changing it from something like this

property name="shippingOriginationZip" inject="coldbox:setting:shippingOriginationZip";

to this

property name="shippingOriginationZip" inject="coldbox:setting:shippingOriginationZip" persistent="false";

fixed it all up.  Of course, like all coding solutions happen, this was in the middle of the night when I was no longer working on the code that this came to me.

So remember folks, if you have a property in an persistent CFC that is not persistent, be sure to say so!

Read More

ColdBox at the OpenCF Summit

Curt Gratz |  January 19, 2011

ColdBox will be at OpenCF Summit. Don't know what the OpenCF Summit is? It is "a community gathering focused exclusively on advancing free and open source software in the CFML community."

I will be hosting a offical ColdBox Unconference. I am very excited to meet with other developers(ie YOU) and have a conversation about advancing ColdBox and sharing some of the different ways we can use the robust framework in our development. I am also excited about learning more about some of the different Open Source ColdFusion projects and ways we as a community can advance those projects. What a great concept for a conference.

If you are wondering why you should care open this "open source" stuff, Bob Silverberg recently posted Why Contribute to Open Source Projects?

If you are wondering why you should go to the OpenCF Summit, check out Jamie Krug's post Go To OpenCF Summit!

If you still aren't convinced to go, the great news is, the price was just dropped to $30. So for the price of a dinner you get

  • A 3 day professional conference
  • A great lineup of speakers
  • The chance to participate in a community "hackfest"
  • The opportunity to network within the greatest development community on the planet

If you have any ideas for things you would like to discuss at the ColdBox Unconference, leave me a comment and we will do our best to cover your idea in some fashion, or just come to the event with your creative juices flowing.

See you at the OpenCF Summit.

Read More

Using Custom Interception Points in ColdBox

Curt Gratz |  December 02, 2010

This is a brief tutorial on how to use custom interception points in ColdBox.  It shows what I think is a nice use case and hopefully will inspire you get your own creative juices flowing.

ColdBox Custom Interception Points - How To from Curt Gratz on Vimeo.

Again, think outside the box, be creative, and let your development flow.  I would love to hear other creative ways ColdBox users are using custom interception points, so if you use them and can share, leave a comment.

If you having trouble viewing the code on the embedded version, click the HD link and it will be much clearer.

Read More

Using Custom Interception Points in ColdBox

Curt Gratz |  December 02, 2010

This is a brief tutorial on how to use custom interception points in ColdBox.  It shows what I think is a nice use case and hopefully will inspire you get your own creative juices flowing.

ColdBox Custom Interception Points - How To from Curt Gratz on Vimeo.

Again, think outside the box, be creative, and let your development flow.  I would love to hear other creative ways ColdBox users are using custom interception points, so if you use them and can share, leave a comment.

If you having trouble viewing the code on the embedded version, click the HD link and it will be much clearer.

Read More

Using Custom Interception Points in ColdBox

Curt Gratz |  December 02, 2010

This is a brief tutorial on how to use custom interception points in ColdBox.  It shows what I think is a nice use case and hopefully will inspire you get your own creative juices flowing.

ColdBox Custom Interception Points - How To from Curt Gratz on Vimeo.

Again, think outside the box, be creative, and let your development flow.  I would love to hear other creative ways ColdBox users are using custom interception points, so if you use them and can share, leave a comment.

If you having trouble viewing the code on the embedded version, click the HD link and it will be much clearer.

Read More

Installing ColdBox Sample Applications from GitHub

Curt Gratz |  October 01, 2010

This is a brief tutorial on how to install the ColdBox Sample Applications downloading from GitHub

Installing ColdBox Sample Applications from GitHub from Curt Gratz on Vimeo.

Again, all of the sample applications have been updated to ColdBox 3.0.0 standards including using the complete cfc configurations which makes them more portable and installing them easy. Hope you enjoy.

Read More

Installing ColdBox Sample Applications from GitHub

Curt Gratz |  October 01, 2010

This is a brief tutorial on how to install the ColdBox Sample Applications downloading from GitHub

Installing ColdBox Sample Applications from GitHub from Curt Gratz on Vimeo.

Again, all of the sample applications have been updated to ColdBox 3.0.0 standards including using the complete cfc configurations which makes them more portable and installing them easy. Hope you enjoy.

Read More

Installing ColdBox Sample Applications from GitHub

Curt Gratz |  October 01, 2010

This is a brief tutorial on how to install the ColdBox Sample Applications downloading from GitHub

Installing ColdBox Sample Applications from GitHub from Curt Gratz on Vimeo.

Again, all of the sample applications have been updated to ColdBox 3.0.0 standards including using the complete cfc configurations which makes them more portable and installing them easy. Hope you enjoy.

Read More