Posts

Test Driven Development with Alfresco - Part 2 Inversion of Control

In my last post I briefly described the process of TDD.  In that discussion I stated that a unit test will test in isolation; meaning that you don't want to test a unit's dependencies only the unit itself.  In the real world our code doesn't run in isolation, in the real world our code has dependencies.  I also stated that in a future post I would talk about test doubles, however before I can talk about that we need to discuss how we isolate our class from the world around it.  Of course we can't isolate it completely, a completely isolated class is generally useless, but we can decrease the dependencies.  This dependency on other classes is referred to as coupling and coupling is generally considered bad. An excellent way to reduce coupling is called inversion of control, which is also referred to as dependency injection.  Many people when they think of inversion of control think of frameworks such as Spring, JUICE, or Java EE.  Although these frame...

Test Driven Development with Alfresco - Part 1 Introduction to TDD

This is the first in what I hope to be a series of blog posts on Test Driven Development (TDD) with Alfresco.  Before I can jump into the topic I want to make sure we are all on the same page with TDD.  I have heard a lot of definitions of TDD (primarily from interview candidates that haven't actually done TDD) and I know there is a lot of confusion as to what TDD is. Unit Testing Before I dive into TDD I want to talk a little bit about unit testing.  There are different types of testing, unit testing, integration testing, and system testing (there are others but all of them are out of scope of this blog except unit testing anyway :)).  Unit testing is the testing of a unit in isolation.  A unit of code in Java is generally a class.  The idea is that you are only testing the unit not the unit's dependencies (we will explore test doubles in a future post, for now just know there are ways to isolate your unit from its dependencies). With unit testing the...

Emailing to Custom Folders Types in Alfresco

I recently had an issue come across my virtual desk that turned out a little more complex than I originally thought.  Before I begin this was done in Alfresco Enterprise 4.1.2 but I would expect it would work with any version above 4.0 (probably anything above 3.2). I have a client which is sending emails directly into Alfresco.  Originally the plan was to send the emails into a specific folder within a site and then move the emails to the correct location.  I was asked if they could just email the documents into the correct location. Didn't seem like an issue to me so I just updated the view for my custom folder types to show the DB ID of the node and viola everything should be kosher.  It didn't work out that way; the first email that was sent in almost immediately returned with an error message like the following: 5.3.0 - Other mail system problem 554-"Email message handler was not found for node type 'eha:myCustomFolderType'." (delivery attempts: 0) ...