You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sn...@apache.org on 2014/10/30 15:48:59 UTC

git commit: Cleanup EntityVersionCreated to remove unnecessary fields, add missing ASL header, and beginning of StaleIndexCleanupTest.testCleanupOnUpdate() method (which is currently failing).

Repository: incubator-usergrid
Updated Branches:
  refs/heads/two-dot-o-events ac03027c0 -> 7dec37b61


Cleanup EntityVersionCreated to remove unnecessary fields, add missing ASL header, and beginning of StaleIndexCleanupTest.testCleanupOnUpdate() method (which is currently failing).


Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/7dec37b6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/7dec37b6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/7dec37b6

Branch: refs/heads/two-dot-o-events
Commit: 7dec37b61df069752ae82efe808978997c40186c
Parents: ac03027
Author: Dave Johnson <dm...@apigee.com>
Authored: Thu Oct 30 10:48:44 2014 -0400
Committer: Dave Johnson <dm...@apigee.com>
Committed: Thu Oct 30 10:48:44 2014 -0400

----------------------------------------------------------------------
 .../corepersistence/StaleIndexCleanupTest.java  |  74 +++++++-
 .../collection/event/EntityVersionCreated.java  |  14 +-
 .../collection/event/EntityVersionDeleted.java  |   9 +-
 .../impl/EntityVersionCreatedTask.java          | 120 +++++-------
 .../impl/EntityVersionCreatedTaskTest.java      | 187 +++----------------
 5 files changed, 153 insertions(+), 251 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/7dec37b6/stack/core/src/test/java/org/apache/usergrid/corepersistence/StaleIndexCleanupTest.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/corepersistence/StaleIndexCleanupTest.java b/stack/core/src/test/java/org/apache/usergrid/corepersistence/StaleIndexCleanupTest.java
index d828733..ff740af 100644
--- a/stack/core/src/test/java/org/apache/usergrid/corepersistence/StaleIndexCleanupTest.java
+++ b/stack/core/src/test/java/org/apache/usergrid/corepersistence/StaleIndexCleanupTest.java
@@ -103,7 +103,7 @@ public class StaleIndexCleanupTest extends AbstractCoreIT {
     @Test
     public void testCleanupOnRead() throws Exception {
 
-        logger.info("Started testStaleIndexCleanup()");
+        logger.info("Started testCleanupOnRead()");
 
         // TODO: turn off post processing stuff that cleans up stale entities 
 
@@ -274,7 +274,77 @@ public class StaleIndexCleanupTest extends AbstractCoreIT {
         do {
             Thread.sleep(100);
             crs = queryCollectionCp("things", "select *");
-        } while ( crs.size() > 0 || count++ > 14 );
+        } while ( crs.size() > 0 || count++ < 14 );
+
+        Assert.assertEquals( "Expect no candidates", 0, crs.size() );
+    }
+
+    
+    /**
+     * Test that the EntityDeleteImpl cleans up stale indexes on update. Ensures that when an 
+     * entity is updated its old indexes are cleared from ElasticSearch.
+     */
+    @Test
+    public void testCleanupOnUpdate() throws Exception {
+
+        logger.info("Started testCleanupOnUpdate()");
+
+        // TODO: turn off index cleanup on read
+
+        final EntityManager em = app.getEntityManager();
+
+        final int numEntities = 10;
+        final int numUpdates = 3;
+
+        // create lots of entities
+        final List<Entity> things = new ArrayList<Entity>(numEntities);
+        for ( int i=0; i<numEntities; i++) {
+            final String thingName = "thing" + i;
+            things.add( em.create("thing", new HashMap<String, Object>() {{
+                put("name", thingName);
+            }}));
+            Thread.sleep( writeDelayMs );
+        }
+        em.refreshIndex();
+
+        CandidateResults crs = queryCollectionCp( "things", "select *");
+        Assert.assertEquals( "Expect no stale candidates yet", numEntities, crs.size() );
+
+        // update each one a bunch of times
+        int count = 0;
+
+        List<Entity> maxVersions = new ArrayList<>(numEntities);
+
+        for ( Entity thing : things ) {
+            Entity toUpdate = null;
+
+            for ( int j=0; j<numUpdates; j++) {
+                toUpdate = em.get( thing.getUuid() );
+                toUpdate.setProperty( "property"  + j, RandomStringUtils.randomAlphanumeric(10));
+
+                em.update(toUpdate);
+
+                Thread.sleep( writeDelayMs );
+                count++;
+                if ( count % 100 == 0 ) {
+                    logger.info("Updated {} of {} times", count, numEntities * numUpdates);
+                }
+            }
+
+            maxVersions.add( toUpdate );
+        }
+        em.refreshIndex();
+
+        // query Core Persistence directly for total number of result candidates
+        crs = queryCollectionCp("things", "select *");
+        Assert.assertEquals( "Expect stale candidates", numEntities * (numUpdates + 1), crs.size());
+
+        // wait for indexes to be cleared for the deleted entities
+        count = 0;
+        do {
+            Thread.sleep(100);
+            crs = queryCollectionCp("things", "select *");
+        } while ( crs.size() > 0 || count++ < 14 );
 
         Assert.assertEquals( "Expect no candidates", 0, crs.size() );
     }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/7dec37b6/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/event/EntityVersionCreated.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/event/EntityVersionCreated.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/event/EntityVersionCreated.java
index 2b9c023..4412b0c 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/event/EntityVersionCreated.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/event/EntityVersionCreated.java
@@ -17,26 +17,22 @@
  */
 package org.apache.usergrid.persistence.collection.event;
 
-
 import org.apache.usergrid.persistence.collection.CollectionScope;
 import org.apache.usergrid.persistence.model.entity.Entity;
 
 
 /**
- *
- * Invoked after a new version of an entity has been created.  The entity should be a complete
- * view of the entity.
- *
+ * Invoked after a new version of an entity has been created.
+ * The entity should be a complete view of the entity.
  */
 public interface EntityVersionCreated {
 
-
     /**
-     * The new version of the entity.  Note that this should be a fully merged view of the entity.
-     * In the case of partial updates, the passed entity should be fully merged with it's previous entries
+     * The new version of the entity. Note that this should be a fully merged view of the entity.
+     * In the case of partial updates, the passed entity should be fully merged with it's previous 
+     * entries.
      * @param scope The scope of the entity
      * @param entity The fully loaded and merged entity
      */
     public void versionCreated( final CollectionScope scope, final Entity entity );
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/7dec37b6/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/event/EntityVersionDeleted.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/event/EntityVersionDeleted.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/event/EntityVersionDeleted.java
index c4b4408..65a34e0 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/event/EntityVersionDeleted.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/event/EntityVersionDeleted.java
@@ -19,8 +19,6 @@ package org.apache.usergrid.persistence.collection.event;
 
 
 import java.util.List;
-import java.util.UUID;
-
 import org.apache.usergrid.persistence.collection.CollectionScope;
 import org.apache.usergrid.persistence.collection.MvccEntity;
 import org.apache.usergrid.persistence.model.entity.Id;
@@ -28,8 +26,8 @@ import org.apache.usergrid.persistence.model.entity.Id;
 
 /**
  *
- * Invoked when an entity version is removed.  Note that this is not a deletion of the entity itself,
- * only the version itself.
+ * Invoked when an entity version is removed.  Note that this is not a deletion of the entity 
+ * itself, only the version itself.
  *
  */
 public interface EntityVersionDeleted {
@@ -42,6 +40,7 @@ public interface EntityVersionDeleted {
      * @param entityId The entity Id that was removed
      * @param entityVersions The versions that are to be removed
      */
-    public void versionDeleted(final CollectionScope scope, final Id entityId, final List<MvccEntity> entityVersions);
+    public void versionDeleted(final CollectionScope scope, final Id entityId, 
+            final List<MvccEntity> entityVersions);
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/7dec37b6/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityVersionCreatedTask.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityVersionCreatedTask.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityVersionCreatedTask.java
index 256e65f..5846c89 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityVersionCreatedTask.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityVersionCreatedTask.java
@@ -1,38 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  The ASF licenses this file to You
+ * under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.  For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
 package org.apache.usergrid.persistence.collection.impl;
 
-
-import java.util.Iterator;
-import java.util.List;
 import java.util.Set;
-import java.util.UUID;
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-
 import org.apache.usergrid.persistence.collection.CollectionScope;
-import org.apache.usergrid.persistence.collection.EntityVersionCreatedFactory;
-import org.apache.usergrid.persistence.collection.MvccEntity;
-import org.apache.usergrid.persistence.collection.event.EntityDeleted;
 import org.apache.usergrid.persistence.collection.event.EntityVersionCreated;
-import org.apache.usergrid.persistence.collection.event.EntityVersionDeleted;
-import org.apache.usergrid.persistence.collection.mvcc.MvccEntitySerializationStrategy;
-import org.apache.usergrid.persistence.collection.mvcc.MvccLogEntrySerializationStrategy;
-import org.apache.usergrid.persistence.collection.serialization.SerializationFig;
-import org.apache.usergrid.persistence.collection.serialization.UniqueValue;
-import org.apache.usergrid.persistence.collection.serialization.UniqueValueSerializationStrategy;
-import org.apache.usergrid.persistence.collection.serialization.impl.UniqueValueImpl;
-import org.apache.usergrid.persistence.core.rx.ObservableIterator;
 import org.apache.usergrid.persistence.core.task.Task;
 import org.apache.usergrid.persistence.model.entity.Entity;
-import org.apache.usergrid.persistence.model.entity.Id;
-import org.apache.usergrid.persistence.model.field.Field;
-
 import com.google.inject.Inject;
 import com.google.inject.assistedinject.Assisted;
-import com.netflix.astyanax.Keyspace;
-import com.netflix.astyanax.MutationBatch;
-import com.netflix.astyanax.connectionpool.exceptions.ConnectionException;
-
 import rx.Observable;
 import rx.functions.Action1;
 import rx.functions.Func1;
@@ -40,63 +33,39 @@ import rx.schedulers.Schedulers;
 
 
 /**
- * Created by ApigeeCorporation on 10/24/14.
+ * Fires events so that all EntityVersionCreated handlers area called.
  */
 public class EntityVersionCreatedTask implements Task<Void> {
-    private static final Logger LOG = LoggerFactory.getLogger( EntityVersionCleanupTask.class );
-
+    private static final Logger logger = LoggerFactory.getLogger( EntityVersionCleanupTask.class );
 
     private final Set<EntityVersionCreated> listeners;
-
-    private final MvccLogEntrySerializationStrategy logEntrySerializationStrategy;
-    private final MvccEntitySerializationStrategy entitySerializationStrategy;
-    private UniqueValueSerializationStrategy uniqueValueSerializationStrategy;
-    private final Keyspace keyspace;
-
-    private final SerializationFig serializationFig;
-
     private final CollectionScope collectionScope;
     private final Entity entity;
 
-    private EntityVersionCreatedFactory entityVersionCreatedFactory;
-
-
 
     @Inject
-    public EntityVersionCreatedTask( EntityVersionCreatedFactory entityVersionCreatedFactory,
-                                     final SerializationFig serializationFig,
-                                     final MvccLogEntrySerializationStrategy logEntrySerializationStrategy,
-                                     final MvccEntitySerializationStrategy entitySerializationStrategy,
-                                     final UniqueValueSerializationStrategy uniqueValueSerializationStrategy,
-                                     final Keyspace keyspace,
-                                     @Assisted final CollectionScope collectionScope,
+    public EntityVersionCreatedTask( @Assisted final CollectionScope collectionScope,
                                      final Set<EntityVersionCreated> listeners,
                                      @Assisted final Entity entity ) {
 
-        this.entityVersionCreatedFactory = entityVersionCreatedFactory;
-        this.serializationFig = serializationFig;
-        this.logEntrySerializationStrategy = logEntrySerializationStrategy;
-        this.entitySerializationStrategy = entitySerializationStrategy;
-        this.uniqueValueSerializationStrategy = uniqueValueSerializationStrategy;
-        this.keyspace = keyspace;
         this.listeners = listeners;
         this.collectionScope = collectionScope;
         this.entity = entity;
-
     }
 
 
     @Override
     public void exceptionThrown( final Throwable throwable ) {
-        LOG.error( "Unable to run update task for collection {} with entity {} and version {}",
+        logger.error( "Unable to run update task for collection {} with entity {} and version {}",
                 new Object[] { collectionScope, entity}, throwable );
     }
 
 
     @Override
     public Void rejected() {
-        //Our task was rejected meaning our queue was full.  We need this operation to run,
-        // so we'll run it in our current thread
+
+        // Our task was rejected meaning our queue was full.  
+        // We need this operation to run, so we'll run it in our current thread
         try {
             call();
         }
@@ -107,6 +76,7 @@ public class EntityVersionCreatedTask implements Task<Void> {
         return null;
     }
 
+    
     @Override
     public Void call() throws Exception {
 
@@ -114,7 +84,9 @@ public class EntityVersionCreatedTask implements Task<Void> {
         return null;
     }
 
+
     private void fireEvents() {
+
         final int listenerSize = listeners.size();
 
         if ( listenerSize == 0 ) {
@@ -126,25 +98,25 @@ public class EntityVersionCreatedTask implements Task<Void> {
             return;
         }
 
-        LOG.debug( "Started firing {} listeners", listenerSize );
+        logger.debug( "Started firing {} listeners", listenerSize );
+
         //if we have more than 1, run them on the rx scheduler for a max of 8 operations at a time
-        Observable.from(listeners)
-                  .parallel( new Func1<Observable<EntityVersionCreated
-                          >, Observable<EntityVersionCreated>>() {
-
-                      @Override
-                      public Observable<EntityVersionCreated> call(
-                              final Observable<EntityVersionCreated> entityVersionCreatedObservable ) {
-
-                          return entityVersionCreatedObservable.doOnNext( new Action1<EntityVersionCreated>() {
-                              @Override
-                              public void call( final EntityVersionCreated listener ) {
-                                  listener.versionCreated(collectionScope,entity);
-                              }
-                          } );
-                      }
-                  }, Schedulers.io() ).toBlocking().last();
-
-        LOG.debug( "Finished firing {} listeners", listenerSize );
+        Observable.from(listeners).parallel( 
+            new Func1<Observable<EntityVersionCreated>, Observable<EntityVersionCreated>>() {
+
+                @Override
+                public Observable<EntityVersionCreated> call(
+                    final Observable<EntityVersionCreated> entityVersionCreatedObservable ) {
+
+                    return entityVersionCreatedObservable.doOnNext( new Action1<EntityVersionCreated>() {
+                        @Override
+                        public void call( final EntityVersionCreated listener ) {
+                            listener.versionCreated(collectionScope,entity);
+                        }
+                    } );
+                }
+            }, Schedulers.io() ).toBlocking().last();
+
+        logger.debug( "Finished firing {} listeners", listenerSize );
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/7dec37b6/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/impl/EntityVersionCreatedTaskTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/impl/EntityVersionCreatedTaskTest.java b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/impl/EntityVersionCreatedTaskTest.java
index 21895ba..3526fe9 100644
--- a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/impl/EntityVersionCreatedTaskTest.java
+++ b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/impl/EntityVersionCreatedTaskTest.java
@@ -1,45 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  The ASF licenses this file to You
+ * under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.  For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
 package org.apache.usergrid.persistence.collection.impl;
 
-
-import java.util.ArrayList;
-import java.util.HashSet;
+import com.google.common.util.concurrent.ListenableFuture;
+import com.netflix.astyanax.connectionpool.exceptions.ConnectionException;
 import java.util.Iterator;
-import java.util.List;
 import java.util.Set;
-import java.util.UUID;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Semaphore;
-
-import org.junit.AfterClass;
-import org.junit.Test;
-
 import org.apache.usergrid.persistence.collection.CollectionScope;
-import org.apache.usergrid.persistence.collection.EntityVersionCreatedFactory;
-import org.apache.usergrid.persistence.collection.MvccEntity;
 import org.apache.usergrid.persistence.collection.event.EntityVersionCreated;
-import org.apache.usergrid.persistence.collection.event.EntityVersionDeleted;
-import org.apache.usergrid.persistence.collection.mvcc.MvccEntitySerializationStrategy;
-import org.apache.usergrid.persistence.collection.mvcc.MvccLogEntrySerializationStrategy;
-import org.apache.usergrid.persistence.collection.mvcc.entity.impl.MvccEntityImpl;
-import org.apache.usergrid.persistence.collection.serialization.SerializationFig;
-import org.apache.usergrid.persistence.collection.serialization.UniqueValueSerializationStrategy;
-import org.apache.usergrid.persistence.collection.util.LogEntryMock;
 import org.apache.usergrid.persistence.core.task.NamedTaskExecutorImpl;
 import org.apache.usergrid.persistence.core.task.TaskExecutor;
 import org.apache.usergrid.persistence.model.entity.Entity;
 import org.apache.usergrid.persistence.model.entity.Id;
 import org.apache.usergrid.persistence.model.entity.SimpleId;
-import org.apache.usergrid.persistence.model.util.UUIDGenerator;
-
-import com.google.common.base.Optional;
-import com.google.common.util.concurrent.ListenableFuture;
-import com.netflix.astyanax.Keyspace;
-import com.netflix.astyanax.MutationBatch;
-import com.netflix.astyanax.connectionpool.exceptions.ConnectionException;
-
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.same;
+import org.junit.AfterClass;
+import org.junit.Test;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
@@ -57,125 +49,22 @@ public class EntityVersionCreatedTaskTest {
         taskExecutor.shutdown();
     }
 
-    @Test(timeout=10000)
-    public void noListener()//why does it matter if it has a version or not without a listener
-            throws ExecutionException, InterruptedException, ConnectionException {
-
-
-        final SerializationFig serializationFig = mock( SerializationFig.class );
-
-        when( serializationFig.getBufferSize() ).thenReturn( 10 );
-
-        final MvccEntitySerializationStrategy ess =
-                mock( MvccEntitySerializationStrategy.class );
-
-        final MvccLogEntrySerializationStrategy less =
-                mock( MvccLogEntrySerializationStrategy.class );
-
-        final Keyspace keyspace = mock( Keyspace.class );
-
-        final MutationBatch entityBatch = mock( MutationBatch.class );
-
-        final MutationBatch logBatch = mock( MutationBatch.class );
-
-        final EntityVersionCreatedFactory entityVersionCreatedFactory = mock(EntityVersionCreatedFactory.class);
-
-        when( keyspace.prepareMutationBatch() )
-                .thenReturn( mock( MutationBatch.class ) ) // don't care what happens to this one
-                .thenReturn( entityBatch )
-                .thenReturn( logBatch );
-
-        // intentionally no events
-        final Set<EntityVersionCreated> listeners = mock( Set.class );//new HashSet<EntityVersionCreated>();
-
-        when ( listeners.size()).thenReturn( 0 );
-
-        final Id applicationId = new SimpleId( "application" );
-
-        final CollectionScope appScope = new CollectionScopeImpl(
-                applicationId, applicationId, "users" );
-
-        final Id entityId = new SimpleId( "user" );
-
-        final Entity entity = new Entity( entityId );
-
-        final MvccEntity mvccEntity = new MvccEntityImpl( entityId, UUIDGenerator.newTimeUUID(),
-                MvccEntity.Status.COMPLETE,entity );
-
-
-        // mock up a single log entry for our first test
-        final LogEntryMock logEntryMock =
-                LogEntryMock.createLogEntryMock(less, appScope, entityId, 2 );
-
-        final UUID version = logEntryMock.getEntries().iterator().next().getVersion();
-
-        final UniqueValueSerializationStrategy uvss =
-                mock( UniqueValueSerializationStrategy.class );
-
-        EntityVersionCreatedTask entityVersionCreatedTask =
-                new EntityVersionCreatedTask(entityVersionCreatedFactory,
-                serializationFig,
-                        less,
-                        ess,
-                        uvss,
-                        keyspace,
-                        appScope,
-                        listeners,
-                        entity);
-
-        // start the task
-        ListenableFuture<Void> future = taskExecutor.submit( entityVersionCreatedTask );
-
-        // wait for the task
-        future.get();
-
-        //mocked listener makes sure that the task is called
-        verify( listeners ).size();
-
-    }
 
     @Test(timeout=10000)
     public void oneListener()
             throws ExecutionException, InterruptedException, ConnectionException {
 
+        // create a latch for the event listener, and add it to the list of events
 
-        final SerializationFig serializationFig = mock( SerializationFig.class );
-
-        when( serializationFig.getBufferSize() ).thenReturn( 10 );
-
-        final MvccEntitySerializationStrategy ess =
-                mock( MvccEntitySerializationStrategy.class );
-
-        final MvccLogEntrySerializationStrategy less =
-                mock( MvccLogEntrySerializationStrategy.class );
-
-        final Keyspace keyspace = mock( Keyspace.class );
-
-        final MutationBatch entityBatch = mock( MutationBatch.class );
-
-        final MutationBatch logBatch = mock( MutationBatch.class );
-
-        final EntityVersionCreatedFactory entityVersionCreatedFactory = mock(EntityVersionCreatedFactory.class);
-
-        when( keyspace.prepareMutationBatch() )
-                .thenReturn( mock( MutationBatch.class ) ) // don't care what happens to this one
-                .thenReturn( entityBatch )
-                .thenReturn( logBatch );
-
-        // intentionally no events
-
-        //create a latch for the event listener, and add it to the list of events
         final int sizeToReturn = 1;
 
         final CountDownLatch latch = new CountDownLatch( sizeToReturn );
 
         final EntityVersionCreatedTest eventListener = new EntityVersionCreatedTest(latch);
 
-        final Set<EntityVersionCreated> listeners = mock( Set.class );//new HashSet<EntityVersionCreated>();
-
+        final Set<EntityVersionCreated> listeners = mock( Set.class );
         final Iterator<EntityVersionCreated> helper = mock(Iterator.class);
 
-
         when ( listeners.size()).thenReturn( 1 );
         when ( listeners.iterator()).thenReturn( helper );
         when ( helper.next() ).thenReturn( eventListener );
@@ -186,37 +75,13 @@ public class EntityVersionCreatedTaskTest {
                 applicationId, applicationId, "users" );
 
         final Id entityId = new SimpleId( "user" );
-
         final Entity entity = new Entity( entityId );
 
-        final MvccEntity mvccEntity = new MvccEntityImpl( entityId, UUIDGenerator.newTimeUUID(),
-                MvccEntity.Status.COMPLETE,entity );
-
-
-        // mock up a single log entry for our first test
-        final LogEntryMock logEntryMock =
-                LogEntryMock.createLogEntryMock(less, appScope, entityId, 2 );
-
-        final UUID version = logEntryMock.getEntries().iterator().next().getVersion();
-
-        final UniqueValueSerializationStrategy uvss =
-                mock( UniqueValueSerializationStrategy.class );
-
-        //when ( listeners.iterator().next().versionCreated(appScope,entity));
-
+        // start the task
 
-                EntityVersionCreatedTask entityVersionCreatedTask =
-                new EntityVersionCreatedTask(entityVersionCreatedFactory,
-                        serializationFig,
-                        less,
-                        ess,
-                        uvss,
-                        keyspace,
-                        appScope,
-                        listeners,
-                        entity);
+        EntityVersionCreatedTask entityVersionCreatedTask =
+            new EntityVersionCreatedTask( appScope, listeners, entity);
 
-        // start the task
         ListenableFuture<Void> future = taskExecutor.submit( entityVersionCreatedTask );
 
         // wait for the task