Package org.wildfly.clustering.ee.infinispan

Examples of org.wildfly.clustering.ee.infinispan.TransactionBatch


        ImmutableSession evictedSession = mock(ImmutableSession.class);
        ImmutableSession activeSession = mock(ImmutableSession.class);
        CommandDispatcherFactory dispatcherFactory = mock(CommandDispatcherFactory.class);
        CommandDispatcher<SessionEvictionContext> dispatcher = mock(CommandDispatcher.class);
        Batcher<TransactionBatch> batcher = mock(Batcher.class);
        TransactionBatch batch = mock(TransactionBatch.class);
        Evictor<String> evictor = mock(Evictor.class);
        ArgumentCaptor<Command> capturedCommand = ArgumentCaptor.forClass(Command.class);
        ArgumentCaptor<SessionEvictionContext> capturedContext = ArgumentCaptor.forClass(SessionEvictionContext.class);

        when(dispatcherFactory.createCommandDispatcher(same(name), capturedContext.capture())).thenReturn(dispatcher);
View Full Code Here


public class SessionExpirationSchedulerTestCase {
    @Test
    public void test() throws InterruptedException {
        Batcher<TransactionBatch> batcher = mock(Batcher.class);
        TransactionBatch batch = mock(TransactionBatch.class);
        Remover<String> remover = mock(Remover.class);
        ImmutableSession immortalSession = mock(ImmutableSession.class);
        ImmutableSession expiringSession = mock(ImmutableSession.class);
        ImmutableSession canceledSession = mock(ImmutableSession.class);
        SessionMetaData immortalMetaData = mock(SessionMetaData.class);
View Full Code Here

    @Test
    public void getCache() {
        AdvancedCache<Object, Object> defaultCache = mock(AdvancedCache.class);
        AdvancedCache<Object, Object> otherCache = mock(AdvancedCache.class);
        Batcher<TransactionBatch> batcher = mock(Batcher.class);
        TransactionBatch batch = mock(TransactionBatch.class);

        when(this.manager.<Object, Object>getCache("default", true)).thenReturn(defaultCache);
        when(this.manager.<Object, Object>getCache("other", true)).thenReturn(otherCache);
        when(defaultCache.getAdvancedCache()).thenReturn(defaultCache);
        when(otherCache.getAdvancedCache()).thenReturn(otherCache);
View Full Code Here

        this.id = id;
    }

    @Override
    public Void execute(SessionEvictionContext context) throws Exception {
        TransactionBatch batch = context.getBatcher().createBatch();
        boolean success = false;
        try {
            InfinispanWebLogger.ROOT_LOGGER.tracef("Passivating session %s", this.id);
            context.getEvictor().evict(this.id);
            success = true;
        } finally {
            if (success) {
                batch.close();
            } else {
                batch.discard();
            }
        }
        return null;
    }
View Full Code Here

    public void commit() throws Exception {
        Transaction tx = mock(Transaction.class);

        when(this.tm.getTransaction()).thenReturn(null, tx);

        TransactionBatch batch = this.batcher.createBatch();

        verify(this.tm).begin();

        assertSame(tx, batch.getTransaction());

        batch.close();

        verify(this.tm).commit();
    }
View Full Code Here

    public void rollback() throws Exception {
        Transaction tx = mock(Transaction.class);

        when(this.tm.getTransaction()).thenReturn(null, tx);

        TransactionBatch batch = this.batcher.createBatch();

        verify(this.tm).begin();

        assertSame(tx, batch.getTransaction());

        batch.discard();

        verify(this.tm).rollback();
    }
View Full Code Here

    public void existing() throws Exception {
        Transaction tx = mock(Transaction.class);

        when(this.tm.getTransaction()).thenReturn(tx);

        TransactionBatch batch = this.batcher.createBatch();

        verify(this.tm, never()).begin();

        assertSame(tx, batch.getTransaction());

        batch.close();

        verify(this.tm, never()).commit();

        batch.discard();

        verify(this.tm, never()).rollback();
    }
View Full Code Here

    public void activate() throws Exception {
        Transaction tx = mock(Transaction.class);

        when(this.tm.getTransaction()).thenReturn(tx);

        TransactionBatch batch = this.batcher.createBatch();

        assertSame(tx, batch.getTransaction());

        Transaction existing = mock(Transaction.class);

        when(this.tm.suspend()).thenReturn(existing);
View Full Code Here

        String evictedBeanId = "evicted";
        String activeBeanId = "active";
        CommandDispatcherFactory dispatcherFactory = mock(CommandDispatcherFactory.class);
        CommandDispatcher<BeanEvictionContext<String>> dispatcher = mock(CommandDispatcher.class);
        Batcher<TransactionBatch> batcher = mock(Batcher.class);
        TransactionBatch batch = mock(TransactionBatch.class);
        Evictor<String> evictor = mock(Evictor.class);
        PassivationConfiguration<Bean<Object, String, Object>> config = mock(PassivationConfiguration.class);
        BeanPassivationConfiguration passivationConfig = mock(BeanPassivationConfiguration.class);
        ArgumentCaptor<Command> capturedCommand = ArgumentCaptor.forClass(Command.class);
        ArgumentCaptor<BeanEvictionContext> capturedContext = ArgumentCaptor.forClass(BeanEvictionContext.class);
View Full Code Here

    }

    @Test
    public void testExpire() throws InterruptedException {
        Batcher<TransactionBatch> batcher = mock(Batcher.class);
        TransactionBatch batch = mock(TransactionBatch.class);
        BeanRemover<String, Object> remover = mock(BeanRemover.class);
        ExpirationConfiguration<Object> config = mock(ExpirationConfiguration.class);
        RemoveListener<Object> listener = mock(RemoveListener.class);
        String beanId = "expiring";
View Full Code Here

TOP

Related Classes of org.wildfly.clustering.ee.infinispan.TransactionBatch

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.