@Test public void testCommitAndRebuildCache() throws Exception { ICacheableDAO mockCacheableDAO = mock(ICacheableDAO.class); IDataSourceConnector.Transaction mockTransaction = mock(IDataSourceConnector.Transaction.class); when(connector.createTransaction()).thenReturn(mockTransaction); when(serializer.serialize(anyObject(), anyBoolean())).thenReturn(ANY_SERIALIZED_DATA); when(daoFactory.getRegisteredCacheableDAO(any(EntityType.class))).thenReturn(mockCacheableDAO); ITransactionalDAO.ITransaction transaction = testee.beginTransaction(); transaction.save(new IfExpression(), EntityType.RULE, ANY_SERVICE, ANY_ID); transaction.save(new Server(), EntityType.SERVER, ANY_SERVICE, ANY_ID); transaction.save(new Whitelisted(), EntityType.WHITELIST, ANY_SERVICE); transaction.operationByActionType(new IfExpression(), EntityType.URL_RULE, ANY_SERVICE, ANY_ID, ActionType.DELETE); transaction.incVersion(EntityType.MODEL_CHANGED, ANY_SERVICE); transaction.commit(); verify(mockTransaction, times(1)).commit(); }
@Override public ITransaction beginTransaction() { return new Transaction(); }
TransactionalDAO implements ITransactionalDAO { @Override public ITransaction beginTransaction() { return new Transaction(); } }
TransactionalDAO implements ITransactionalDAO { @Override public ITransaction beginTransaction() { return new Transaction(); } TransactionalDAO(IDataSourceConnector connector, Serializer serializer, IRegisteringDAOFactory daoFactory); }
TransactionalDAO implements ITransactionalDAO { @Override public ITransaction beginTransaction() { return new Transaction(); } TransactionalDAO(IDataSourceConnector connector, Serializer serializer, IRegisteringDAOFactory daoFactory); @Override ITransaction beginTransaction(); }
TransactionalDAO implements ITransactionalDAO { @Override public ITransaction beginTransaction() { return new Transaction(); } TransactionalDAO(IDataSourceConnector connector, Serializer serializer, IRegisteringDAOFactory daoFactory); @Override ITransaction beginTransaction();  }