September 29, 2005

Embedded Firebird and the new Spring testing classes

I have moved all of my Spring Dao tests from a roll your own test framework to one that is based on spring's
AbstractTransactionalDataSourceSpringContextTests
(a classname that is just too damn long and I will never remember). These tests (and some others) are in the spring-mocks package. Really nice except for a few issues I am learning to deal with (mostly the fact that transactions are never committed unless you force the issue). No problem with the sanity tests, so I decided to try the authorizationDao from some classes that are getting major refactoring).

This dao needs a lot of data to be in the database (this is the project that is going to use ruby on rails to fill the database). I (like most people) have used dbunit to put this data in. Part of setup. Well, setup and onSetup are final for this test - so I moved the dbunit setup (which had been in a static initializer) to onSetUpBeforeTransaction. All of a sudden my tests were not failing - they were going into some weird state and I had to kill eclipse in order to close the database. But, as soon as I moved the database to local (from embedded) everything went just fine.

I think that we had deadlock on the embedded firebird. My cure for this now (other than giving up on the spring class and rolling my own which would happily use dbunit) is to stop using embedded firebird and call through local. I still might roll my own, but it depends a lot on what else has to be done in the next two weeks.

Posted by liz at 01:36 PM | Comments (0) | TrackBack

September 23, 2005

Firebird and spring jdbc

If you want to do anything real with firebird and spring jdbc you need to know your id. There are incrementer classes in the spring framework for a few databases, but none for firebird.

Here is one for firebird. Thanks to Roman who seems to be in charge of firebird-java for giving me the sql.


import javax.sql.DataSource;
import org.springframework.jdbc.support.incrementer.OracleSequenceMaxValueIncrementer;

public class FirebirdSequenceMaxValueIncrementer extends
OracleSequenceMaxValueIncrementer
{
/**
*
*/
public FirebirdSequenceMaxValueIncrementer()
{
super();

}

/**
* Convenience constructor.
* @param ds the DataSource to use
* @param incrementerName the name of the sequence to use
*/
public FirebirdSequenceMaxValueIncrementer(DataSource ds, String incrementerName) {
super(ds,incrementerName);
}

public FirebirdSequenceMaxValueIncrementer(String incrementerName)
{
super();
setIncrementerName(incrementerName);
}

protected String getSequenceQuery()
{
return "SELECT gen_id(" + getIncrementerName() + ",1) FROM rdb$database";
}

}

Posted by liz at 09:13 AM | Comments (0) | TrackBack

September 09, 2005

driver problem sort of solved

A new snapshot was released last night of jaybird. This time there is a true 1.4 compile. I dropped it in and was finally able to use dbexplorer (in my eclipse). I was also able to run my ant script. At least sort of run it.

While running to a successful conclusion I get 50 lines of stack on the console. I will live with that for now, but I find it difficult to believe that they don't test their drivers against ant. How do they write them without either ant or maven?

I thought EVERYBODY used ant (except certain sections of the government and consulting companies). Some people use maven INSTEAD of ant or in addition to ant. But, please, people, use something other than your ide.

Posted by liz at 09:45 AM | Comments (0) | TrackBack

September 08, 2005

Firebird infinitum

Ok, maybe I am just picky. But, really, I would like it if jaybird actually worked with the sql task in ant. I have code that has worked with 3 other databases (all it does is build tables). I get a null pointer exception when I use firebird.

This means (of course) that I now have to do all sorts of configuration (string replacements and such) and run isql through exec in order to create the tables, views, etc in my firebird code. I don't know about you - but I think this is the shits.

If anybody wants the code, I will be happy to supply it. Or am I the only idiot that is trying to do things like this?

I work in a big company full of consultants. Worse, these consultants never spend any time with each other - because they are too busy consulting. I am trying to write push button scripts that we can demand the consultants use - if we can't force them to unit test (they seem to think that unit tests are for use cases) we can at least build their environment in order to give them the opportunity to unit test.

So, this is why I am spending my time trying to write idiot proof scripts and processes. At least one lead has drunk the koolaid - and is beginning to follow my process and configuration. Now, I have to spread it through the rest of the company.

I was the tech interviewer 2 days ago for a person who wanted a tech lead job. 15 years in the business. She had never heard of Ant, Hibernate or Spring. I am not sure if she knew the difference between an EJB and a javabean. This is a woman with a masters in computer science. She also thought that unit tests are for use cases. Where are people getting this idea?

I am not real big on design patterns - but I do think people should be able to at least identify the MVC pattern. Come on, we can do better than this.

We aren't hiring her. At least, I hope we aren't.

Posted by liz at 12:39 PM | Comments (0) | TrackBack