.withService( SerializationProvider.class, countingServiceInstance );
@Test
public void testPropertiesIndexing() {
SearchFactoryImplementor searchFactory = factoryHolder.getSearchFactory();
IndexManager indexManager = searchFactory.getIndexManagerHolder().getIndexManager( "books" );
Assert.assertNotNull( indexManager );
Assert.assertEquals( 0, countingServiceInstance.serializerGetCount.get() );
Assert.assertEquals( 0, countingServiceInstance.deserializerGetCount.get() );
//Serialize some work:
indexManager.getSerializer().toSerializedModel( makeSomeWork() );
Assert.assertEquals( 1, countingServiceInstance.serializerGetCount.get() );
Assert.assertEquals( 0, countingServiceInstance.deserializerGetCount.get() );
//Serialize again, note the point of the test is to request all references again:
indexManager.getSerializer().toSerializedModel( makeSomeWork() );
Assert.assertEquals( 2, countingServiceInstance.serializerGetCount.get() );
Assert.assertEquals( 0, countingServiceInstance.deserializerGetCount.get() );
//Now Deserialize:
indexManager.getSerializer().toLuceneWorks( makeSomeSerializedWork() );
Assert.assertEquals( 2, countingServiceInstance.serializerGetCount.get() );
Assert.assertEquals( 1, countingServiceInstance.deserializerGetCount.get() );
//Now Deserialize again:
indexManager.getSerializer().toLuceneWorks( makeSomeSerializedWork() );
Assert.assertEquals( 2, countingServiceInstance.serializerGetCount.get() );
Assert.assertEquals( 2, countingServiceInstance.deserializerGetCount.get() );
}