An adapter to use Hamcrest matchers as AssertJ conditions

Following on from yesterday’s post on AssertJ, here’s a tiny github repo that I put together with some utilities for AssertJ.

The first is the script mentioned yesterday, tidied up a little and renamed.

The second is a little adapter class that allows you to use Hamcrest Matchers as AssertJ Conditions.  So, if you have some really complex Hamcrest matcher stuff, you can migrate it easily:

    final String actual = "how now brown cow";
    assertThat(actual).is(matchedBy(Matchers.containsString("now brown")));

The adapter is provided by that “matchedBy” factory method.  But the github repo has a full README for details.

Converting from Hamcrest to AssertJ

Don’t quite know how I missed it all these years, but I only recently discovered AssertJ.  So I’ve started to use it in some of the Isis Addons example apps, for example the todoapp.

I had a look to see if there were any scripts to convert the Hamcrest assertThat assertions into corresponding AssertJ ones, but only turned up Joel’s script that works on vanilla JUnit assertEquals(…) assertions.  So I spent a bit of time updating it to support Hamcrest style assertions.  (I also refactored it so that it doesn’t rely on sed -i which seems to be pretty broken on Windows).

You’ll find a copy of my updated script in the todoapp’s repo.  I’ve left in (though commented out) the original assertions for assertEquals etc; should be easy enough to add in if you want.

Please feel free to pass around!

[ANN] Apache Isis version 1.8.0 released

We just pushed another release of Apache Isis, and it’s a big one! New features in this release include:

– a new theme-able look-n-feel for the Wicket viewer, using Twitter Bootstrap [1] and font awesome icons [2]
– a new simplified set of annotations (@Property, @DomainObject, @CollectionLayout etc) to make features more discoverable; see cheat-sheet [3]
– support to enable multi-tenancy (in particular in conjunction with Isis addons security module [4])
– new i18n support using gettext .po files, honouring user locale [5]
– sign-up/self-regisration support (so that end-users can create own user accounts) [6]
– EmailService for sending HTML emails, optionally with attachments [7]
– ability to validate individual parameters imperatively
– config property to flag use of deprecated annotations/method prefixes
– Maven plugin to validate domain object model with respect to Isis programming conventions
– improved support for Neo4J
– experimental support for more flexibility of generating Restful Objects representations [8]

Full release notes are available on the Isis website [9]

As of 1.8.0 we’re continuing to trim down and simplify.  To that end, the Wicket Viewer is bundled in with Core, while the ToDoApp archetype is no longer provided.  In its place the example todoapp is available from Isis addons (not ASF) to fork and adapt [10].

Also, I should point out that this release finally drops support for JDK 1.6, standardizes on JDK 1.7


Welcoming Martin Grigorov as a new committer on Apache Isis

I’m delighted to announce that Martin Grigorov has been voted in as a committer on Apache Isis, and also as a member of the Isis PMC. The first gives Martin the right to commit changes directly to Isis’ codebase, the second gives him the right to be involved in future votes.

Martin is already a key committer on the Apache Wicket project, as well as actively contributing to the companion Wicket-bootstrap project. But you also can’t failed to have noticed his involvement in Isis’ users and dev lists recently.

Initially Martin got involved because Jeroen and I brought him onto the Estatio project in order to “bootstrappify” the Wicket viewer. Even though that piece of work is substantially complete, Martin continues to be actively involved, providing patches and working on other tickets, and from speaking with him I know he’s keen to get involved with all aspects of Isis, not just the Wicket viewer. For recent contributions, check out these github statistics and his activity stream on JIRA.

I’m looking forward to working with Martin in the future; another great addition to Isis’ committers.

[ANN] Apache Isis version 1.7.0 Released

We just pushed out Isis 1.7.0, which consists of:
* Apache Isis Core version 1.7.0
* Wicket Viewer 1.7.0
* SimpleApp Archetype 1.7.0
* ToDoApp Archetype 1.7.0

This was mostly a bug fix release, including as it did some security fixes raised by the community (ISIS-883, ISIS-884, ISIS-895). It did have a couple of new features in it though, notably:

ISIS-809: @ViewModel annotation, no longer requiring explicit implementation of the IViewModel interface.
ISIS-916: ability to override framework-provided services, such as MementoService or BookmarkService.
ISIS-917: (beta): pluggable representations for the RO viewer

A lot of work was also done over in the Isis add-ons website, in particular the new isis-module-security add-on (see also this previous post).

Full release notes for the release are available on the Isis website, [1,2,3,4], as well as a migration guide [5].


Configuring Apache Isis command profiling and auditing module add-ons

When v1.6 of Apache Isis was released a month or two back we also announced the creation of a new “add-ons” website as a place to hold reusable module of code for any Apache Isis app.

Two of the modules that we’ve moved into the add-ons site are for auditing and for command profiling; the latter also enhances auditing capability as well as enabling Isis’ background command support.

The screencast below Read the rest of this entry

Configuring Apache Isis’ Security Module Add-on

When v1.6 of Apache Isis was released a month or two back we also announced the creation of a new “add-ons” website as a place to hold reusable module of code for any Apache Isis app.

Working with Jeroen I recently completed a new security module that handles both authentication and authorization for Isis apps.
Read the rest of this entry

How to restore a PostgreSQL backup

There would seem to be several ways, but if the backup file was created by pg_dump and is actually a series of DDL and INSERT statements (look in vi), then use:

psql -U postgres -d dbname < dbname.backup

‘Nuff said!

[ANN] Apache Isis version 1.6.0 Released

We just pushed out 1.6.0 of Isis, which now consists of:
  • Apache Isis Core version 1.6.0
  • Wicket Viewer 1.6.0
  • TodoApp Archetype 1.6.0
  • SimpleApp Archetype 1.6.0
If you compare this announcement to that of 1.5.0, you’ll see that we’re releasing a lot fewer components.  But that’s because:
  • Isis Core now incorporates the JDO Objectstore, Restful Objects Viewer and Shiro Security (all previously released as separate components).
  • TodoApp Archetype was previously the ‘Quickstart (Wicket/Restful/JDO) archetype’
  • SimpleApp Archetype was previously the ‘Simple (Wicket/Restful/JDO) archetype’
Full release notes are available on the Isis website, but there are some significant new features and reorganization worth calling out.
  • Extend (custom) EventBus vetoing logic so that can also encompass hide, disable, validate (ISIS-831)
  • @DomainService annotation to automatically discover and register domains (ISIS-493)
  • Wicket viewer: Add edit capability to view objects (ISIS-781)
  • Wicket viewer: Wizard-like form for Wicket viewer (ISIS-800, ISIS-810)
  • Move jdo, shiro and restful into core (ISIS-832)
  • Breaking out applib and JDO services into modules (ISIS-833)

The new EventBus stuff substantially helps decouple business logic in apps, while the @DomainService annotation reduces a lot of boring configuration.  But it’s the last two bullet points I want to talk a bit more about.

To expand on what these last two bullet points mean, as of 1.6.0 Isis now has a companion website, [10].  Similar to the way in which Apache Wicket has an additional “wicketstuff” website [9], the intention is for this site to house various third-party extensions to Isis, such that they can either be used “out-of-the-box”, or be forked and extended as need be.
Currently Isis add-ons fall into two categories:
  • modules… these provide business functionality to be incorporated directly into your domain object model, usually as domain services, occasionally with supporting entities.  Examples include mail merge, spreadsheets, tags/labels.
  • wicket extensions … these extend the capability of the Wicket viewer, eg maps, calendars, charts.

In the future we expect to add in “metamodel” category for customizations to Isis’ metamodel, eg an extension to leverage various Java 8 reflection features which we don’t want to roll into Isis core just yet.

The intention is for all modules in to follow a standard format, and include full unit and integration testing.  Thus, if you want to fork and extend any given module, then there is a solid base to start from.  Over time we hope that the “modules” in particular will provide a useful catalog to help bootstrap Isis development, and provide a way for the community to contribute back their own functionality as modules.

We are also considering moving some of Isis’ own modules (ie those recently factored out, such as for auditing, command, publishing etc) into  Doing so will reduce the size of Isis itself while making it possible for these components to be more easily extended/adapted by the user community as need be.  We will certainly take a *copy* of these modules in the first instance.

OK, that’s it.  Go check out some of those links…












[ANN] Apache Isis version 1.5.0 and related components Released

The Isis team is pleased to announce the release of:
– Apache Isis Core version 1.5.0
– Wicket Viewer 1.5.0
– Restful Objects Viewer 2.3.0
– JDO Object Store 1.5.0
– Shiro Security 1.5.0
– Simple Archetype 1.5.0
– Quickstart Archetype 1.5.0

New features and improvements in this release include:
– Additional EventBus service events, ability to programmatically trigger events, vetoing subscribers (ISIS-550, ISIS-786)
– Integration testing improvements, most notably the new FixtureScript API and auto-injection of services into integration tests (ISIS-776, ISIS-782, ISIS-783)
– Better handling of multiple realms in Shiro security (ISIS-746)
– Better default column sizes for applib services (command, auditing, pubsub) (ISIS-744, ISIS-750)
– Precommit phase to flush pending updates for applib services (ISIS-769)
– Preparatory work for move to Java 7 (ISIS-569, ISIS-770, ISIS-772)
– Improved support for JRebel in Maven and various IDEs (ISIS-756)

Notable bug fixes include:
– Fixed blob/clob mapping in JDO Objectstore (ISIS-714)
– Fixed handling of mandatory boolean parameters in Wicket viewer (ISIS-431)
– RO not threadsafe when buiding metamodel (ISIS-777)

Full release notes are available at [1,2,3,4,5,6,7] on the Isis website (links below).

You can access this release directly from the Maven central repo [8],
or download the release and build it from source [9].


-The Isis team


Deleting git tags on a remote

For some reason our git repo for Apache Isis (mirrored on github) acquired a bunch of tags in the form:

  • upstream/isis-1.4.0
  • upstream/upstream/isis-1.4.0
  • upstream/upstream/upstream/isis-1.4.0
  • upstream/upstream/upstream/upstream/isis-1.4.0

Clearly something or someone has been accidentally pushing bad tags.

To remove these tags locally, I used:

for a in `git tag -l upstream*`; do echo $a; git tag -d $a ; done

To remove these tags from origin, I chose to do it in two steps. First locate the tags to be deleted:

git ls-remote –tags origin | awk ‘{print $2}’ | \
grep ^refs/tags/ | cut -c11- | \
grep upstream | grep -v "\^{}" \
> /tmp/y

then delete ’em:

for a in `cat /tmp/y`; do echo $a; git push –delete origin $a ; done

Observable and Iterator design pattern are the same thing – who knew?

I’ve just watched this excellent talk on Reactive Extensions – how they do Async Javascript at NetFlix.  A genuinely new idea for me (though I feel a bit dumb for only learning about RX now). Worth spending the 30 mins to watch.

Also really cool that there are versions of RX not only for Javascript but also .NET and Java.


Still a place for books…

Like everyone else, if I need to know how use some little API, I google for the answer and then follow the links to stackoverflow.  Yesterday my searches that took me there included an error regarding a missing Windows Identity Foundation DLL, how to do try/catch/finally in Powershell (just as you would’ve thought, by the way), and how to change the name of a Windows service (somewhat more obscure).  In fact my google history for yesterday shows I visited SO 15 times that day with different queries.

Even so, there’s still a time for books.  I’m going to be starting on the next-gen viewer for Apache Isis soon, and because it’s going to be written in AngularJS, I really think there’s no substitute for immersing oneself in a book to really get into the “mindset” of that technology.

The publishers that first cornered the market in technology-specific books (at least so far as my reading was concerned) was OReilly, and then a little later I became aware of Manning.  Most recently though I’ve got into reading Packt Publishing, also doing an excellent job of delivering quality titles on specific technologies.  When it comes to AngularJS, for example, I see that they have 4 books currently; enough to be getting on with!   That compares to just one book on the topic from either O’Reilly or Manning.

Now I must admit that Packt do seem pretty strong on marketing, which leaves me torn.  If I were being cynical, I tend to worry that strong marketing might cover up for a weakness in material.  But as an author myself, I think I’d be appreciative that my publishing company was working hard to flog my wares!  Whatever; Packt’s own surveys show almost 90% of readers are “very satisfied” with their books; that’s a pretty impressive statistic.

So why this puff piece about Packt?  Well, they’ve just released their 2,000 book, and they’ve currently got a discount code which is basically a buy-one-get-one-free offer.  So if you were after a book on technology X, definitely worth checking out.

Full disclosure: Oh, and yeah, I told you about their marketing department? So, apparently this post earns me an ebook or two for myself.  Well, there’s a couple more of those AngularJS books I need to read, so if they help me write Isis’ next-gen viewer, then it’s for the greater good!

Isis 1.4.0 released

After 4 months development, we (that is, the Apache Isis team) have just released Isis 1.4.0, and supporting components.
This is a pretty cool release, because it’s the one that Estatio (the first major application to run on Isis) has been deployed against.
Some of the features in this release include:
  •  further support in layout.json files for additional facets/UI hints
  • better reporting of metamodel validation errors (including a new page in Wicket viewer)
  • improved support for bulk update
  • @javax.enterprise.context.RequestScoped for request-scoped services
  • QueryResultsCache request-scoped domain service (for performance tuning)
  • new MementoService to support view models
  • new request-scoped @Bulk.InteractionontextService for standardized co-ordination between bulk action invocations
  • Scratchpad request-scoped domain service (for adhoc coordination between actions, eg bulk action invocations)
  • Command, CommandContext, BackgroundCommandService, for profiling and background task support
  • improvements to JDO implementations of auditing and publishing services, to integrate closely with the new Command/backgroundCommand services
  • improved support for running arbitrary Isis jobs via a scheduler
  • supporting methods (disableXxx, validateXxx) for contributed actions/associations now supported
  • services autowired prior to @PostConstruct, and Isis session present for service initialization
  • JRebel support (JRebel plugni itself is third-party, see Isis website for details)

In the Wicket viewer, major changes/improvements include:

  • show action dialogs in a modal dialog, rather than new page
  • limit number of bookmarks, make less easier to accidentally trip, show/hide with keyboard shortcut
  • improved IE9 support, bundle CSS files
  • simplify URLs in Wicket viewer
  • actions returning URL open new browser window
  • UI sorting/ordering hints, pop-up to copy to clipboard
  • breadcrumb drop-down to easily revisit previous page
  • upper/lower case now switchable
  • standalone tables now rendered according to runtime type, not compile-time type
  • better tooltips over icon/titles
Full release notes are available at [1,2,3,4,5,6,7,8,9,10,11] on the Isis website.

Isis integration with JRebel

You probably know about JRebel already – it’s a commercial product that dynamically reloads Java classes without having to redeploy your webapp. Not necessarily the cheapest of products, but if you’re a full-time dev working on the JVM, then it can easily pay for itself. Oh, and it’s free for use on any hobby/open source projects.

JRebel itself is pluggable, and so for a while now I’ve been meaning to work on an integration with Apache Isis. Actually, invalidating Isis’ metadata caches is pretty easy, the difficulty really arises in Isis’ JDO/DataNucleus objectstore.

But, with a bit of experimentation, I’ve got what I think is a workable integration going, full details up on github.

And if you just want to see what this means, take a look at this screencast (also available on the the Isis website):

Instant Mockito – a review

Instant Mockito is just a little book covering, but that’s not a bad objective in itself. Mockito, after all, is one of the most commonly used Java mocking libraries. (I happen to prefer other mocking libraries better, but that’s another story).

The book organized around a single coherent example which – if contrived – is easy enough to grok and helps unify the content. Through that example this book does a pretty reasonable job of explaining how to use Mockito’s capabilities.

As with many technical books, the layout/indentation of the code examples left something to be desired; I don’t think the author was done any favours by his editor. And I did struggle a bit with little with the omission of import statements in the examples; it wasn’t clear which class the static mock() method had been imported from, for example. The first mention of Matchers was also confusing; both Mockito and the widely used Hamcrest library define a class of this name.

I did also find myself wondering why Mockito’s @Mock annotation hadn’t been used; only later was that explained. I would rather the author had shown the use of @Mock first, and then only later (as a mechanism that involves much more boilerplate), covered the use of mock().

Overall, this book doesn’t cover very much more than what’s covered in Mockito’s own Javadoc API. So is it worth buying? Well, yes, probably… the content is solid enough, you’ll read it quickly, and will end up with a pretty understanding of what Mockito is and how to use it. Which I am sure is what the author set out to do.

Disclaimer: I was asked to review this book – and provided a free eBook for my trouble – by Packt Publishing.

Oredev 2013 – RRRADDD!

In my last post I talked a little bit about attending Oredev 2013, and promised I’d talk a bit about my own talk.

The session title was called RRRADDD! – ridiculously rapid application development with Apache Isis – so I decided that I would do exactly that, and build up a three domain class in a session lasting just 50 minutes. What started off as a bunch of notes and code fragments in notepad eventually morphed into a github project with a README, and (count them!) 22 tags acting as checkpoints as the app is built up piece by piece.

I have to say having done the talk I’m not that sure how well it worked from the point of view of the attendee; perhaps too repetitive and not enough jokes.  In other sessions I attended at Oredev the live coding portion only did a very small amount of stuff (too little, I thought); but maybe I should have followed suit.   Anyway, you can judge for yourself… the talk has been uploaded to Vimeo.

Whatever, plus side is that the github project is now a useful additional asset for those coming to Isis and who want to experiment a bit; I’ve linked to it from the Isis website.

Post script:
Every Oredev session is voted by attendees as they leave.  How well this one went over I’ll never know… the Oredev conference organizers got in touch and said that unfortunately due to a glitch they lost the votes for my session.  Maybe I hit it out of the park.  Then again, maybe not.

Oredev 2013

Last week I attended Oredev conference for the first time. First time in Malmo, first time in Sweden in fact.

Have to say I really enjoyed the venue, a good size. the catering also good, not to mention the free beer at the end of the day. Indeed, I was going to get some Swedish Krona from the cash machine when I was there, but completed the whole trip without any need to; just a couple of train tickets to/from Copenhagen airport, paid for on Visa. Criticisms: perhaps a bit short on power supplies for laptop, and the wifi (as is always the case at tech conferences) was a bit hit-and-miss.

Hotel too was good – and literally next door to the conference venue. Most of the speakers were staying there, so possible to have a conversation in the lounge area after the conference venue closed up at 10:30pm. And the conference organisers were very helpful, both before the event (eg providing clear instructions on logistics) and at it.

There were some good keynotes too (and some less good ones). Everyone, I think, enjoyed Randall Monroe’s xkcd talk, some great anecodotes, as was the talk on the “World of Minecraft”; now I understand what the game is about, I can see how people get immersed in it. Great examples of what could be done, some very funny stuff also. Back home we enjoyed watching up some of those same examples on youtube. Matthew McCullough’s talk was also good value; he always does a good and professional job. (The less said about the opening keynote on Wed am, though, the better).

As to the sessions, each were 50 minutes, and over a good variety of topics. I liked there was some techie stuff (Java, .NET, HTML5/JS) and some agile/process-y stuff, probably a 60:40 split. There were over 6 concurrent tracks, but each also was recorded and have already been uploaded to Vimeo. As for my own session, I’ll blog about that separately.

To sum up, overall, if you are thinking of attending Oredev – either as an attendee or as a speaker – then I can definitely recommend it.

Isis 1.3.0 – crammed full of goodies!

Over on Apache Isis, we’ve just released a new version, 1.3.0, of the framework (core plus supporting components).

There are some major new features in this release; indeed this is probably the most significant release of Isis as a TLP.  Just to highlight some of the main features…

In core, the new features include:

  • contributed collections and properties
  • view model support (across both Wicket and RO viewers)
  • UI layouts defined in JSON files
  • better integration and BDD testing support, including Cucumber-JVM integration
  • domain services for handling application and user settings service
  • domain service providing various developer utilities (eg downloading metamodel)
  • domain service incorporating Guava’s EventBus service);
  • context-specific autoComplete
  • conditional choices
  • new annotations: @SortedBy; @CssClass; @PostsPropertyChangedEvent
  • helpers for writing contract unit tests and for writing comparable entities
  • optimistic locking improvements

In the Wicket viewer, new features include:

  • default dashboard
  • more sophisticated layouts, with multiple columns
  • dynamic reloading of layouts
  • sortable table columns
  • BlobPanel displaying images
  • bookmarkable actions
  • upgrade to wicket 6.11.0

In JDO objectstore, new features include:

  • better integration/validation between Isis and JDO metamodels
  • upgrade to DataNucleus 3.2.7
  • better Google App Engine compatibility
  • expose JDO PersistenceManager via domain service for more sophisticated use cases

The Restful Objects viewer also had several bug fixes vis-a-vis the RO spec v1.0 (thanks to our GSOC students for highlighting these).

In addition to all that, there is a new “simple” archetype, making it easier to get started.

The full release notes etc are available at [1,2,3,4,5,6,7] on the Isis website.

You can access this release directly from the Maven central repo [8], or download the release and build it from source [9].

As ever, feedback welcome


Google Summer of Code Veteran Orgs: Apache Software Foundation

The Google open source blog has just posted the write-up that ASF provided on some of its students for GSOC 2013. I contributed a couple of paragraphs on how Apache Isis‘ two students, Dimuthu Upeksha and Bhargav Golla, got on.

Here’s what I said:

Read the rest of this entry


Get every new post delivered to your Inbox.

Join 298 other followers