Using Scriptella for In-Memory Testing

I’ve started writing a small article on how-to populate/refresh a database with JUnit 4 and Spring.

In fact it’s very simple – just lookup and run a Runnable ETLExecutor registered in the application context.

Advertisements

Working with dates in JEXL expressions

I’ve just added a useful feature to the Scriptella 0.8 code base. It allows formatting/parsing dates in JEXL expressions. JEXL lacks a possibility to instantiate Java object or directly invoke static methods. The solution is to use a helper variable named etl which provides several utility classes.

etl.date is a date format/parse helper. Here is a simple ETL to script utilizing the new feature:

<!DOCTYPE etl SYSTEM "http://scriptella.javaforge.com/dtd/etl.dtd">
<etl>
    <connection driver="text" url="${etl.date.today('yyyyMMdd')}.log"/>
    <script>Current time is ${etl.date.today('yyyy-MM-dd HH:mm:ss.SSS')}</script>
</etl>
In future I can add a possibility to work files, numbers etc. using the same approach, e.g. ${etl.io.listFiles(...)}