Ejemplo n.º 1
0
  @Test
  public void testGetAllocatedSize1() throws Exception {
    DeviceAllocationsTracker tracker = new DeviceAllocationsTracker(configuration);

    tracker.addToAllocation(1L, 0, 100L);

    assertEquals(100, tracker.getAllocatedSize(0));

    tracker.subFromAllocation(1L, 0, 100L);

    assertEquals(0, tracker.getAllocatedSize(0));
  }
  @Test
  public void testGetAllocatedSize4() throws Exception {
    DeviceAllocationsTracker tracker = new DeviceAllocationsTracker(environment, configuration);

    tracker.addToAllocation(1L, 0, 100L);
    tracker.addToAllocation(2L, 0, 150L);

    assertEquals(250, tracker.getAllocatedSize(0));

    assertEquals(100, tracker.getAllocatedSize(1L, 0));
    assertEquals(150, tracker.getAllocatedSize(2L, 0));

    tracker.subFromAllocation(1L, 0, 100L);

    assertEquals(150, tracker.getAllocatedSize(0));
  }