MongoDBPersistentSubscriptionManager extends AbstractPersistentSubscriptionManager { void clean() { _mongoCollection.drop(); } MongoDBPersistentSubscriptionManager(StandardLiveDataServer server, MongoConnector mongoConnector); @Override void saveToStorage(Set<PersistentSubscription> newState);  }
@Test(enabled=false) public void persistentSubscriptionManagement() { ExternalScheme idScheme = ExternalScheme.of("TestDomain"); MockLiveDataServer server = new MockLiveDataServer(idScheme, _cacheManager); server.connect(); MongoConnector connector = MongoTestUtils.makeTestConnector(MongoDBPersistentSubscriptionManagerTest.class.getSimpleName(), true); MongoDBPersistentSubscriptionManager manager = new MongoDBPersistentSubscriptionManager(server, connector); manager.clean(); assertTrue(manager.getPersistentSubscriptions().isEmpty()); manager.refresh(); assertTrue(manager.getPersistentSubscriptions().isEmpty()); manager.save(); server.subscribe("testsub1", true); server.subscribe("testsub2", true); server.subscribe("testsub3", false); server.subscribe("testsub4", false); server.subscribe("testsub5", false); manager.save(); assertEquals(2, manager.getPersistentSubscriptions().size()); assertTrue(server.getMarketDataDistributor("testsub1").isPersistent()); manager.refresh(); assertEquals(2, manager.getPersistentSubscriptions().size()); assertTrue(server.getMarketDataDistributor("testsub1").isPersistent()); boolean removed = manager.removePersistentSubscription("testsub1"); assertTrue(removed); assertEquals(1, manager.getPersistentSubscriptions().size()); assertFalse(server.getMarketDataDistributor("testsub1").isPersistent()); assertFalse(manager.removePersistentSubscription("nonexistentsub")); manager.addPersistentSubscription("testsub6"); assertEquals(2, manager.getPersistentSubscriptions().size()); assertTrue(server.getMarketDataDistributor("testsub6").isPersistent()); }