polygene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Niclas Hedhman <nic...@hedhman.org>
Subject Interesting pattern...
Date Sat, 04 Feb 2017 10:35:31 GMT
I have been working on a Cassandra store. It doesn't use the
MapEntityStore, but text, timestamp and map data types in Cassandra. Only
serialized ValueComposite typed properties use JSON serialization.

Now to the subject of this mail... Once the test is done, I want to execute
a clean up on the cassandra cluster that is used for the testing, and doing
so without compromising the service with a "removeAll" or exposing the
cluster/session in the service interface.

So, first of all, move all Cluster/Session handling of the EntityStore into
a CassandraCluster "private" interface with a Mixin that has operations
against the store. But still no "removeAll".

I then created a CanRemoveAll interface in
org.polygene.core.testsupport.entity. And in the test directory in
cassandra-es I have the EmptyCassandraTableMixin for that.

Finally a

module.services( CassandraEntityStoreService.class ).withTypes(
CanRemoveAll.class ).withMixins( EmptyCassandraTableMixin.class );

So what is so nice about this;

1. The test is adding mixins to the service, to make it more controllable
from the test executor.
2. The test support is leveraging private Mixins to keep the public APIs
3. Any amount of test support could be 'attached' to Composites in this
fashion and reach into its internals by the use of Private Mixins.

Anyway, just wanted to share this...

Next; get the test to use Docker. I think I can figure it out.
Paul, will it kick in automatically, or do I need to invoke some task?

Niclas Hedhman, Software Developer
http://polygene.apache.org <http://zest.apache.org> - New Energy for Java

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message