usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From toddn...@apache.org
Subject [1/6] Pipeline tests and wiring complete
Date Thu, 05 Dec 2013 00:55:27 GMT
Updated Branches:
  refs/heads/two-dot-o cb9ec94e3 -> 44072d594


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/0e0c8ff7/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/impl/CreateTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/impl/CreateTest.java
b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/impl/CreateTest.java
new file mode 100644
index 0000000..0ce01c3
--- /dev/null
+++ b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/impl/CreateTest.java
@@ -0,0 +1,152 @@
+package org.apache.usergrid.persistence.collection.mvcc.stage.impl;
+
+
+import java.util.UUID;
+import java.util.concurrent.ExecutionException;
+
+import org.junit.Test;
+import org.mockito.ArgumentCaptor;
+
+import org.apache.usergrid.persistence.collection.mvcc.stage.WriteContext;
+import org.apache.usergrid.persistence.collection.service.TimeService;
+import org.apache.usergrid.persistence.collection.service.UUIDService;
+import org.apache.usergrid.persistence.model.entity.Entity;
+import org.apache.usergrid.persistence.model.util.UUIDGenerator;
+
+import com.netflix.astyanax.connectionpool.exceptions.ConnectionException;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+
+/** @author tnine */
+public class CreateTest {
+
+    /** Test the start stage for happy path */
+    @Test
+    public void testValidInput() throws ConnectionException, ExecutionException, InterruptedException
{
+
+        final WriteContext writeContext = mock( WriteContext.class );
+
+
+        //set up the mock to return the entity from the start phase
+        final Entity entity = new Entity();
+
+        when( writeContext.getMessage( Entity.class ) ).thenReturn( entity );
+
+
+        //mock returning the time
+        final TimeService timeService = mock( TimeService.class );
+
+        final long time = System.currentTimeMillis();
+
+        when( timeService.getTime() ).thenReturn( time );
+
+
+        //mock the uuid service
+        final UUIDService uuidService = mock( UUIDService.class );
+
+        final UUID newEntityId = UUIDGenerator.newTimeUUID();
+        final UUID newVersion = newEntityId;
+
+
+        //mock the uuid service
+        when( uuidService.newTimeUUID() ).thenReturn( newEntityId );
+
+
+        //perform the stage
+        final Create create = new Create( timeService, uuidService );
+
+        create.performStage( writeContext );
+
+
+        //now verify our output was correct
+        ArgumentCaptor<Entity> mvccEntity = ArgumentCaptor.forClass( Entity.class );
+
+
+        verify( writeContext ).setMessage( mvccEntity.capture() );
+
+        Entity created = mvccEntity.getValue();
+
+        //verify uuid and version in both the MvccEntity and the entity itself
+        assertEquals( "Entity re-set into context", entity, created );
+        assertEquals( "entity id did not match generator", newEntityId, created.getUuid()
);
+        assertEquals( "version did not not match entityId", newVersion, created.getVersion()
);
+
+        //check the time
+        assertEquals( "created time matches generator", time, created.getCreated() );
+        assertEquals( "updated time matches generator", time, created.getUpdated() );
+
+
+        //now verify the proceed was called
+        verify( writeContext ).proceed();
+    }
+
+
+    /** Test the start stage for happy path */
+    @Test(expected = NullPointerException.class)
+    public void testInvalidInput() throws ConnectionException, ExecutionException, InterruptedException
{
+
+        final WriteContext writeContext = mock( WriteContext.class );
+
+
+        when( writeContext.getMessage( Entity.class ) ).thenReturn( null );
+
+
+        //mock returning the time
+        final TimeService timeService = mock( TimeService.class );
+
+
+        //mock the uuid service
+        final UUIDService uuidService = mock( UUIDService.class );
+
+
+        //perform the stage
+        final Create create = new Create( timeService, uuidService );
+
+        //should throw an NPE
+        create.performStage( writeContext );
+
+
+    }
+
+
+    /** Test no time service */
+    @Test(expected = NullPointerException.class)
+    public void testNoTimeService() throws ConnectionException, ExecutionException, InterruptedException
{
+
+        final WriteContext writeContext = mock( WriteContext.class );
+
+
+        when( writeContext.getMessage( Entity.class ) ).thenReturn( null );
+
+
+        //mock the uuid service
+        final UUIDService uuidService = mock( UUIDService.class );
+
+
+        //perform the stage
+        new Create( null, uuidService );
+    }
+
+
+    /** Test no time service */
+    @Test(expected = NullPointerException.class)
+    public void testNoUUIDService() throws ConnectionException, ExecutionException, InterruptedException
{
+
+        final WriteContext writeContext = mock( WriteContext.class );
+
+
+        when( writeContext.getMessage( Entity.class ) ).thenReturn( null );
+
+
+        //mock returning the time
+        final TimeService timeService = mock( TimeService.class );
+
+
+        //throw NPE
+        new Create( timeService, null );
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/0e0c8ff7/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/impl/MvccEntityNewTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/impl/MvccEntityNewTest.java
b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/impl/MvccEntityNewTest.java
deleted file mode 100644
index 05e9460..0000000
--- a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/impl/MvccEntityNewTest.java
+++ /dev/null
@@ -1,136 +0,0 @@
-package org.apache.usergrid.persistence.collection.mvcc.stage.impl;
-
-
-import java.util.UUID;
-import java.util.concurrent.ExecutionException;
-
-import org.junit.Test;
-import org.mockito.ArgumentCaptor;
-
-import org.apache.usergrid.persistence.collection.CollectionContext;
-import org.apache.usergrid.persistence.collection.mvcc.entity.MvccEntity;
-import org.apache.usergrid.persistence.collection.mvcc.entity.MvccLogEntry;
-import org.apache.usergrid.persistence.collection.mvcc.entity.Stage;
-import org.apache.usergrid.persistence.collection.mvcc.stage.WriteContext;
-import org.apache.usergrid.persistence.collection.mvcc.stage.impl.MvccEntityNew;
-import org.apache.usergrid.persistence.collection.serialization.MvccLogEntrySerializationStrategy;
-import org.apache.usergrid.persistence.collection.service.TimeService;
-import org.apache.usergrid.persistence.collection.service.UUIDService;
-import org.apache.usergrid.persistence.model.entity.Entity;
-import org.apache.usergrid.persistence.model.util.UUIDGenerator;
-
-import com.google.common.util.concurrent.ListenableFuture;
-import com.netflix.astyanax.MutationBatch;
-import com.netflix.astyanax.connectionpool.OperationResult;
-import com.netflix.astyanax.connectionpool.exceptions.ConnectionException;
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.same;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-
-/** @author tnine */
-public class MvccEntityNewTest {
-
-    /**
-     * Test the start stage for happy path
-     * TODO throw junk at it
-     * TODO refactor a lot of this mock setup.  It's common across a lot of tests
-     */
-    @Test
-    public void testStartStage() throws ConnectionException, ExecutionException, InterruptedException
{
-
-        final MvccLogEntrySerializationStrategy logStrategy = mock( MvccLogEntrySerializationStrategy.class
);
-
-        final ArgumentCaptor<MvccLogEntry> logEntry = ArgumentCaptor.forClass( MvccLogEntry.class
);
-
-
-        final WriteContext writeContext = mock( WriteContext.class );
-        final CollectionContext context = mock( CollectionContext.class );
-
-
-        //mock returning the context
-        when( writeContext.getCollectionContext() ).thenReturn( context );
-
-
-        final MutationBatch mutation = mock( MutationBatch.class );
-
-
-        //mock returning a mock mutation when we do a log entry write
-        when( logStrategy.write( same( context ), logEntry.capture() ) ).thenReturn( mutation
);
-
-
-        //mock the listenable future
-        final ListenableFuture<OperationResult<Void>> future = mock( ListenableFuture.class);
-        final OperationResult<Void> result = mock(OperationResult.class);
-
-        when(mutation.executeAsync()).thenReturn( future );
-
-        //mock the "get" on the future
-        when(future.get()).thenReturn( result  );
-
-
-        //set up the mock to return the entity from the start phase
-        final Entity entity = new Entity();
-
-        when( writeContext.getMessage( Entity.class ) ).thenReturn( entity );
-
-
-        //mock returning the time
-        final TimeService timeService = mock( TimeService.class );
-
-        final long time = System.currentTimeMillis();
-
-        when( timeService.getTime() ).thenReturn( time );
-
-
-        //mock the uuid service
-        final UUIDService uuidService = mock( UUIDService.class );
-
-        final UUID newEntityId = UUIDGenerator.newTimeUUID();
-        final UUID newVersion = newEntityId;
-
-
-        //mock the uuid service
-        when( uuidService.newTimeUUID() ).thenReturn( newEntityId );
-
-
-        //run the stage
-        MvccEntityNew newStage = new MvccEntityNew( logStrategy, timeService, uuidService
);
-
-        newStage.performStage( writeContext );
-
-
-        //now verify our output was correct
-        ArgumentCaptor<MvccEntity> mvccEntity = ArgumentCaptor.forClass( MvccEntity.class
);
-
-
-        verify( writeContext).setMessage( mvccEntity.capture() );
-
-        MvccEntity created = mvccEntity.getValue();
-
-        //verify uuid and version in both the MvccEntity and the entity itself
-        assertEquals( "entity id did not match generator", newEntityId, created.getUuid()
);
-        assertEquals( "entity id did not match generator", newEntityId, created.getEntity().get().getUuid()
);
-        assertEquals( "version did not not match entityId", newVersion, created.getVersion()
);
-        assertEquals( "version did not not match entityId", newVersion, created.getEntity().get().getVersion()
);
-
-        //check the time
-        assertEquals( "created time matches generator", time, created.getEntity().get().getCreated()
);
-        assertEquals( "updated time matches generator", time, created.getEntity().get().getUpdated()
);
-
-        //now  verify we invoked the mvcc log operation correctly
-
-        MvccLogEntry entry = logEntry.getValue();
-
-        assertEquals("Log entry has correct uuid", newEntityId,  entry.getEntityId());
-        assertEquals("Log entry has correct version", newVersion,  entry.getEntityId());
-        assertEquals( "Stage was correct", Stage.ACTIVE, entry.getStage() );
-
-        //now verify the proceed was called
-        verify(writeContext).proceed();
-
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/0e0c8ff7/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/impl/StartTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/impl/StartTest.java
b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/impl/StartTest.java
new file mode 100644
index 0000000..a6786b1
--- /dev/null
+++ b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/impl/StartTest.java
@@ -0,0 +1,187 @@
+package org.apache.usergrid.persistence.collection.mvcc.stage.impl;
+
+
+import java.util.UUID;
+
+import org.junit.Test;
+import org.mockito.ArgumentCaptor;
+
+import org.apache.commons.lang3.reflect.FieldUtils;
+
+import org.apache.usergrid.persistence.collection.CollectionContext;
+import org.apache.usergrid.persistence.collection.mvcc.entity.MvccEntity;
+import org.apache.usergrid.persistence.collection.mvcc.entity.MvccLogEntry;
+import org.apache.usergrid.persistence.collection.mvcc.entity.Stage;
+import org.apache.usergrid.persistence.collection.mvcc.stage.WriteContext;
+import org.apache.usergrid.persistence.collection.serialization.MvccLogEntrySerializationStrategy;
+import org.apache.usergrid.persistence.model.entity.Entity;
+import org.apache.usergrid.persistence.model.util.UUIDGenerator;
+
+import com.netflix.astyanax.MutationBatch;
+
+import static junit.framework.TestCase.assertSame;
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.same;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+
+/** @author tnine */
+public class StartTest {
+
+    /** Standard flow */
+    @Test
+    public void testStartStage() throws Exception {
+
+
+        final WriteContext writeContext = mock( WriteContext.class );
+        final CollectionContext context = mock( CollectionContext.class );
+
+
+        //mock returning the context
+        when( writeContext.getCollectionContext() ).thenReturn( context );
+
+
+        //set up the mock to return the entity from the start phase
+        final Entity entity = generateEntity();
+
+        //mock returning the entity from the write context
+        when( writeContext.getMessage( Entity.class ) ).thenReturn( entity );
+
+
+        //mock returning a mock mutation when we do a log entry write
+        final MvccLogEntrySerializationStrategy logStrategy = mock( MvccLogEntrySerializationStrategy.class
);
+
+        final ArgumentCaptor<MvccLogEntry> logEntry = ArgumentCaptor.forClass( MvccLogEntry.class
);
+
+        final MutationBatch mutation = mock( MutationBatch.class );
+
+        when( logStrategy.write( same( context ), logEntry.capture() ) ).thenReturn( mutation
);
+
+
+        //run the stage
+        Start newStage = new Start( logStrategy );
+
+        newStage.performStage( writeContext );
+
+
+        //now verify our output was correct
+        ArgumentCaptor<MvccEntity> mvccEntity = ArgumentCaptor.forClass( MvccEntity.class
);
+
+
+        //verify the log entry is correct
+        MvccLogEntry entry = logEntry.getValue();
+
+        assertEquals( "entity id did not match ", entity.getUuid(), entry.getEntityId() );
+        assertEquals( "version did not not match entityId", entity.getVersion(), entry.getVersion()
);
+        assertEquals( "Stage is correct", Stage.ACTIVE, entry.getStage() );
+
+
+        //now verify we set the message into the write context
+        verify( writeContext ).setMessage( mvccEntity.capture() );
+
+        MvccEntity created = mvccEntity.getValue();
+
+        //verify uuid and version in both the MvccEntity and the entity itself
+        assertEquals( "entity id did not match generator", entity.getUuid(), created.getUuid()
);
+        assertEquals( "version did not not match entityId", entity.getVersion(), created.getVersion()
);
+        assertSame( "Entity correct", entity, created.getEntity().get() );
+
+
+        //now verify the proceed was called
+        verify( writeContext ).proceed();
+    }
+
+
+    /** Test no entity in the pipeline */
+    @Test( expected = NullPointerException.class )
+    public void testNoEntity() throws Exception {
+
+
+        final WriteContext writeContext = mock( WriteContext.class );
+
+
+        //mock returning the entity from the write context
+        when( writeContext.getMessage( Entity.class ) ).thenReturn( null );
+
+
+        //mock returning a mock mutation when we do a log entry write
+        final MvccLogEntrySerializationStrategy logStrategy = mock( MvccLogEntrySerializationStrategy.class
);
+
+        //run the stage
+        Start newStage = new Start( logStrategy );
+
+        newStage.performStage( writeContext );
+    }
+
+
+    /** Test no entity id on the entity */
+    @Test( expected = NullPointerException.class )
+    public void testNoEntityId() throws Exception {
+
+
+        final WriteContext writeContext = mock( WriteContext.class );
+
+
+        final Entity entity = new Entity();
+        final UUID version = UUIDGenerator.newTimeUUID();
+
+        entity.setVersion( version );
+
+        //mock returning the entity from the write context
+        when( writeContext.getMessage( Entity.class ) ).thenReturn( entity );
+
+
+        //mock returning a mock mutation when we do a log entry write
+        final MvccLogEntrySerializationStrategy logStrategy = mock( MvccLogEntrySerializationStrategy.class
);
+
+        //run the stage
+        Start newStage = new Start( logStrategy );
+
+        newStage.performStage( writeContext );
+    }
+
+
+    /** Test no entity id on the entity */
+    @Test( expected = NullPointerException.class )
+    public void testNoEntityVersion() throws Exception {
+
+
+        final WriteContext writeContext = mock( WriteContext.class );
+
+
+        final Entity entity = new Entity();
+        final UUID entityId = UUIDGenerator.newTimeUUID();
+
+
+        FieldUtils.writeDeclaredField( entity, "uuid", entityId, true );
+
+
+        //mock returning the entity from the write context
+        when( writeContext.getMessage( Entity.class ) ).thenReturn( entity );
+
+
+        //mock returning a mock mutation when we do a log entry write
+        final MvccLogEntrySerializationStrategy logStrategy = mock( MvccLogEntrySerializationStrategy.class
);
+
+        //run the stage
+        Start newStage = new Start( logStrategy );
+
+        newStage.performStage( writeContext );
+    }
+
+
+    private Entity generateEntity() throws IllegalAccessException {
+        final Entity entity = new Entity();
+        final UUID entityId = UUIDGenerator.newTimeUUID();
+        final UUID version = UUIDGenerator.newTimeUUID();
+
+        FieldUtils.writeDeclaredField( entity, "uuid", entityId, true );
+        entity.setVersion( version );
+
+        return entity;
+    }
+}
+
+

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/0e0c8ff7/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyImplTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyImplTest.java
b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyImplTest.java
index daa9edd..1c38963 100644
--- a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyImplTest.java
+++ b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyImplTest.java
@@ -12,7 +12,7 @@ import org.junit.Test;
 import org.apache.cassandra.db.marshal.UUIDType;
 
 import org.apache.usergrid.persistence.collection.CollectionContext;
-import org.apache.usergrid.persistence.collection.guice.TestCollectionModule;
+import org.apache.usergrid.persistence.collection.guice.CassandraTestCollectionModule;
 import org.apache.usergrid.persistence.collection.impl.CollectionContextImpl;
 import org.apache.usergrid.persistence.collection.mvcc.entity.MvccEntity;
 import org.apache.usergrid.persistence.collection.mvcc.entity.impl.MvccEntityImpl;
@@ -46,7 +46,7 @@ import static org.mockito.Mockito.mock;
 public class MvccEntitySerializationStrategyImplTest {
 
     @Rule
-    public final GuiceBerryRule guiceBerry = new GuiceBerryRule( TestCollectionModule.class
);
+    public final GuiceBerryRule guiceBerry = new GuiceBerryRule( CassandraTestCollectionModule.class
);
 
     @Rule
     public final CassandraRule rule = new CassandraRule();

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/0e0c8ff7/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccLogEntrySerializationStrategyImplTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccLogEntrySerializationStrategyImplTest.java
b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccLogEntrySerializationStrategyImplTest.java
index 9c47e08..3261c40 100644
--- a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccLogEntrySerializationStrategyImplTest.java
+++ b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccLogEntrySerializationStrategyImplTest.java
@@ -10,11 +10,11 @@ import org.junit.Rule;
 import org.junit.Test;
 
 import org.apache.usergrid.persistence.collection.CollectionContext;
+import org.apache.usergrid.persistence.collection.guice.CassandraTestCollectionModule;
 import org.apache.usergrid.persistence.collection.impl.CollectionContextImpl;
-import org.apache.usergrid.persistence.collection.guice.TestCollectionModule;
 import org.apache.usergrid.persistence.collection.mvcc.entity.MvccLogEntry;
-import org.apache.usergrid.persistence.collection.mvcc.entity.impl.MvccLogEntryImpl;
 import org.apache.usergrid.persistence.collection.mvcc.entity.Stage;
+import org.apache.usergrid.persistence.collection.mvcc.entity.impl.MvccLogEntryImpl;
 import org.apache.usergrid.persistence.collection.serialization.MvccLogEntrySerializationStrategy;
 import org.apache.usergrid.persistence.model.util.UUIDGenerator;
 import org.apache.usergrid.persistence.test.CassandraRule;
@@ -22,6 +22,7 @@ import org.apache.usergrid.persistence.test.CassandraRule;
 import com.google.guiceberry.GuiceBerryEnvSelector;
 import com.google.guiceberry.TestDescription;
 import com.google.guiceberry.junit4.GuiceBerryRule;
+import com.google.inject.AbstractModule;
 import com.google.inject.Inject;
 import com.google.inject.Module;
 import com.netflix.astyanax.connectionpool.exceptions.ConnectionException;
@@ -64,7 +65,7 @@ public class MvccLogEntrySerializationStrategyImplTest {
         final UUID version = UUIDGenerator.newTimeUUID();
 
         for ( Stage stage : Stage.values() ) {
-            MvccLogEntry saved = new MvccLogEntryImpl(  uuid, version, stage );
+            MvccLogEntry saved = new MvccLogEntryImpl( uuid, version, stage );
             logEntryStrategy.write( context, saved ).execute();
 
             //Read it back
@@ -121,7 +122,7 @@ public class MvccLogEntrySerializationStrategyImplTest {
             versions[i] = UUIDGenerator.newTimeUUID();
 
             entries[i] = new MvccLogEntryImpl( uuid, versions[i], COMPLETE );
-            logEntryStrategy.write( context,  entries[i] ).execute();
+            logEntryStrategy.write( context, entries[i] ).execute();
 
             //Read it back
 
@@ -172,7 +173,7 @@ public class MvccLogEntrySerializationStrategyImplTest {
         for ( Stage stage : Stage.values() ) {
 
             MvccLogEntry saved = new MvccLogEntryImpl( uuid, version, stage );
-            logEntryStrategy.write(context,  saved ).execute();
+            logEntryStrategy.write( context, saved ).execute();
 
             //Read it back after the timeout
 
@@ -196,13 +197,13 @@ public class MvccLogEntrySerializationStrategyImplTest {
 
     @Test(expected = NullPointerException.class)
     public void writeParamsNoContext() throws ConnectionException {
-        logEntryStrategy.write( null, mock(MvccLogEntry.class) );
+        logEntryStrategy.write( null, mock( MvccLogEntry.class ) );
     }
 
 
-    @Test(expected = NullPointerException.class)
+    @Test( expected = NullPointerException.class )
     public void writeParams() throws ConnectionException {
-        logEntryStrategy.write( mock(CollectionContext.class), null );
+        logEntryStrategy.write( mock( CollectionContext.class ), null );
     }
 
 
@@ -301,18 +302,22 @@ public class MvccLogEntrySerializationStrategyImplTest {
             }
 
             //by default, we wnat to run the TestCollectionModule
-            return TestCollectionModule.class;
+            return CassandraTestCollectionModule.class;
         }
     }
 
 
-    public static class TimeoutEnv extends TestCollectionModule {
+    public static class TimeoutEnv extends AbstractModule {
 
         @Override
-        public Map<String, String> getOverrides() {
+        protected void configure() {
+
+            //override the timeout property
             Map<String, String> timeout = new HashMap<String, String>();
             timeout.put( MvccLogEntrySerializationStrategyImpl.TIMEOUT_PROP, TIMEOUT + ""
);
-            return timeout;
+
+            //use the default module with cass
+            install( new CassandraTestCollectionModule( timeout ) );
         }
     }
 }


Mime
View raw message