Search in sources :

Example 1 with Synchroniser

use of org.jmock.lib.concurrent.Synchroniser in project geode by apache.

the class SerializableObjectHttpMessageConverterJUnitTest method setUp.

@Before
public void setUp() {
    mockContext = new Mockery();
    mockContext.setImposteriser(ClassImposteriser.INSTANCE);
    mockContext.setThreadingPolicy(new Synchroniser());
}
Also used : Synchroniser(org.jmock.lib.concurrent.Synchroniser) Mockery(org.jmock.Mockery) Before(org.junit.Before)

Example 2 with Synchroniser

use of org.jmock.lib.concurrent.Synchroniser in project geode by apache.

the class InitializerJUnitTest method setUp.

@Before
public void setUp() {
    mockContext = new Mockery();
    mockContext.setImposteriser(ClassImposteriser.INSTANCE);
    mockContext.setThreadingPolicy(new Synchroniser());
}
Also used : Synchroniser(org.jmock.lib.concurrent.Synchroniser) Mockery(org.jmock.Mockery) Before(org.junit.Before)

Example 3 with Synchroniser

use of org.jmock.lib.concurrent.Synchroniser in project geode by apache.

the class CompiledAggregateFunctionJUnitTest method setUp.

@Before
public void setUp() throws Exception {
    context = new Mockery() {

        {
            setImposteriser(ClassImposteriser.INSTANCE);
            setThreadingPolicy(new Synchroniser());
        }
    };
    cache = context.mock(InternalCache.class);
    bucketList = new ArrayList();
    bucketList.add(1);
}
Also used : ArrayList(java.util.ArrayList) InternalCache(org.apache.geode.internal.cache.InternalCache) Synchroniser(org.jmock.lib.concurrent.Synchroniser) Mockery(org.jmock.Mockery) Before(org.junit.Before)

Example 4 with Synchroniser

use of org.jmock.lib.concurrent.Synchroniser in project i2p.i2p-bote by i2p.

the class TestUtil method createConfiguration.

/**
 * Creates a mock {@link Configuration} whose getKeyDerivationParametersFile() and
 * getPasswordFile() methods must be called at least once each.<br/>
 * Creates a file named derivparams in <code>testDir</code>.<br/>
 * The <code>getPasswordCacheDuration</code> method returns 1 (one minute).
 * @param testDir
 */
public static Configuration createConfiguration(File testDir) {
    final Synchroniser synchroniser = new Synchroniser();
    Mockery mockery = new Mockery() {

        {
            setImposteriser(ClassImposteriser.INSTANCE);
            // otherwise we get errors on threads
            setThreadingPolicy(synchroniser);
        }
    };
    final Configuration configuration = mockery.mock(Configuration.class);
    final File derivParametersFile = new File(testDir, "derivparams");
    mockery.checking(new Expectations() {

        {
            atLeast(1).of(configuration).getKeyDerivationParametersFile();
            will(returnValue(derivParametersFile));
        }
    });
    final File passwordFile = new File(testDir, "password");
    mockery.checking(new Expectations() {

        {
            atLeast(1).of(configuration).getPasswordFile();
            will(returnValue(passwordFile));
        }
    });
    mockery.checking(new Expectations() {

        {
            allowing(configuration).getPasswordCacheDuration();
            will(returnValue(1));
        }
    });
    return configuration;
}
Also used : Expectations(org.jmock.Expectations) Synchroniser(org.jmock.lib.concurrent.Synchroniser) Mockery(org.jmock.Mockery) File(java.io.File)

Example 5 with Synchroniser

use of org.jmock.lib.concurrent.Synchroniser in project geode by apache.

the class PidFileJUnitTest method before.

@Before
public void before() {
    mockContext = new Mockery() {

        {
            setImposteriser(ClassImposteriser.INSTANCE);
            setThreadingPolicy(new Synchroniser());
        }
    };
    this.futures = Executors.newFixedThreadPool(2);
}
Also used : Synchroniser(org.jmock.lib.concurrent.Synchroniser) Mockery(org.jmock.Mockery) Before(org.junit.Before)

Aggregations

Mockery (org.jmock.Mockery)14 Synchroniser (org.jmock.lib.concurrent.Synchroniser)14 Before (org.junit.Before)12 File (java.io.File)2 Expectations (org.jmock.Expectations)2 EmailDestination (i2p.bote.email.EmailDestination)1 I2PSendQueue (i2p.bote.network.I2PSendQueue)1 IndexPacket (i2p.bote.packet.dht.IndexPacket)1 StoreRequest (i2p.bote.packet.dht.StoreRequest)1 RelayPeerManager (i2p.bote.service.RelayPeerManager)1 BufferedWriter (java.io.BufferedWriter)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 FileWriter (java.io.FileWriter)1 ArrayList (java.util.ArrayList)1 AtomicLong (java.util.concurrent.atomic.AtomicLong)1 I2PSession (net.i2p.client.I2PSession)1 Destination (net.i2p.data.Destination)1 AuditScheduler (org.apache.geode.cache.util.AutoBalancer.AuditScheduler)1 CacheOperationFacade (org.apache.geode.cache.util.AutoBalancer.CacheOperationFacade)1 OOBAuditor (org.apache.geode.cache.util.AutoBalancer.OOBAuditor)1