Search in sources :

Example 1 with CommandLog

use of org.voltdb.CommandLog in project voltdb by VoltDB.

the class TestSpSchedulerSpHandle method createObjs.

public void createObjs() throws JSONException {
    mbox = mock(Mailbox.class);
    when(mbox.getHSId()).thenReturn(dut_hsid);
    iv2masters = mock(MapCache.class);
    snapMonitor = mock(SnapshotCompletionMonitor.class);
    // make fake MapCache of iv2masters
    HashMap<String, JSONObject> fakecache = new HashMap<String, JSONObject>();
    fakecache.put("0", new JSONObject("{hsid:0}"));
    when(iv2masters.pointInTimeCache()).thenReturn(ImmutableMap.copyOf(fakecache));
    final CommandLog cl = mock(CommandLog.class);
    doReturn(CoreUtils.COMPLETED_FUTURE).when(cl).log(any(Iv2InitiateTaskMessage.class), anyLong(), any(int[].class), any(CommandLog.DurabilityListener.class), any(TransactionTask.class));
    dut = new SpScheduler(0, getSiteTaskerQueue(), snapMonitor);
    dut.setMailbox(mbox);
    dut.setCommandLog(cl);
    dut.setLock(mbox);
}
Also used : Mailbox(org.voltcore.messaging.Mailbox) SnapshotCompletionMonitor(org.voltdb.SnapshotCompletionMonitor) JSONObject(org.json_voltpatches.JSONObject) MapCache(org.voltcore.zk.MapCache) HashMap(java.util.HashMap) CommandLog(org.voltdb.CommandLog) Iv2InitiateTaskMessage(org.voltdb.messaging.Iv2InitiateTaskMessage)

Example 2 with CommandLog

use of org.voltdb.CommandLog in project voltdb by VoltDB.

the class TestSpSchedulerDedupe method createObjs.

public void createObjs() throws JSONException {
    mbox = mock(Mailbox.class);
    when(mbox.getHSId()).thenReturn(dut_hsid);
    iv2masters = mock(MapCache.class);
    snapMonitor = mock(SnapshotCompletionMonitor.class);
    // make fake MapCache of iv2masters
    HashMap<String, JSONObject> fakecache = new HashMap<String, JSONObject>();
    fakecache.put("0", new JSONObject("{hsid:0}"));
    when(iv2masters.pointInTimeCache()).thenReturn(ImmutableMap.copyOf(fakecache));
    final CommandLog cl = mock(CommandLog.class);
    doReturn(CoreUtils.COMPLETED_FUTURE).when(cl).log(any(Iv2InitiateTaskMessage.class), anyLong(), any(int[].class), any(CommandLog.DurabilityListener.class), any(TransactionTask.class));
    dut = new SpScheduler(0, getSiteTaskerQueue(), snapMonitor);
    dut.setMailbox(mbox);
    dut.setCommandLog(cl);
    dut.setLock(mbox);
    ((SpScheduler) dut).setConsistentReadLevelForTestOnly(m_readLevel);
}
Also used : Mailbox(org.voltcore.messaging.Mailbox) SnapshotCompletionMonitor(org.voltdb.SnapshotCompletionMonitor) JSONObject(org.json_voltpatches.JSONObject) MapCache(org.voltcore.zk.MapCache) HashMap(java.util.HashMap) CommandLog(org.voltdb.CommandLog) Iv2InitiateTaskMessage(org.voltdb.messaging.Iv2InitiateTaskMessage)

Aggregations

HashMap (java.util.HashMap)2 JSONObject (org.json_voltpatches.JSONObject)2 Mailbox (org.voltcore.messaging.Mailbox)2 MapCache (org.voltcore.zk.MapCache)2 CommandLog (org.voltdb.CommandLog)2 SnapshotCompletionMonitor (org.voltdb.SnapshotCompletionMonitor)2 Iv2InitiateTaskMessage (org.voltdb.messaging.Iv2InitiateTaskMessage)2