コード例 #1
0
 @Test
 public void testHostPathVolume() {
   IHostPathVolumeProperties volume = new HostPathVolumeProperties("/tmp/dir");
   pv.setPersistentVolumeProperties(volume);
   volume = (IHostPathVolumeProperties) pv.getPersistentVolumeProperties();
   assertEquals("/tmp/dir", volume.getPath());
 }
コード例 #2
0
 @Test(expected = ArithmeticException.class)
 public void testSetCapacityOverflow() {
   /*
    * 2^4 * 2 ^60 = 2^64, LONG_MAX is only 2^64-1
    */
   pv.setCapacity(16L, MemoryUnit.Ei);
   pv.getCapacity();
 }
コード例 #3
0
 @Test
 public void testNFSVolume() {
   INfsVolumeProperties volume = new NfsVolumeProperties("10.10.10.10", "/tmp/dir", true);
   pv.setPersistentVolumeProperties(volume);
   volume = (INfsVolumeProperties) pv.getPersistentVolumeProperties();
   assertEquals("/tmp/dir", volume.getPath());
   assertEquals("10.10.10.10", volume.getServer());
   assertEquals(true, volume.isReadOnly());
 }
コード例 #4
0
  @Test
  public void testGetCapacityUnit() {
    pv.setCapacity(1L, MemoryUnit.Ki);
    MemoryUnit unit = pv.getCapacityUnit();
    assertEquals(MemoryUnit.Ki, unit);

    pv.setCapacity(1L, MemoryUnit.Pi);
    unit = pv.getCapacityUnit();
    assertEquals(MemoryUnit.Pi, unit);
  }
コード例 #5
0
  @Test
  public void testSetCapacity() {
    pv.setCapacity(1L, MemoryUnit.Ki);
    long capacity = pv.getCapacity();
    assertEquals(1024L, capacity);

    pv.setCapacity(31L, MemoryUnit.Ti);
    capacity = pv.getCapacity(MemoryUnit.Ti);
    assertEquals(31L, capacity);
  }
コード例 #6
0
  @Test
  public void testGetCapacityString() {
    pv.setCapacity(13L, MemoryUnit.Pi);
    long capacity = pv.getCapacity("Ki");
    assertEquals(14293651161088L, capacity);

    capacity = pv.getCapacity("Ti");
    assertEquals(13312L, capacity);

    capacity = pv.getCapacity("Pi");
    assertEquals(13L, capacity);
  }
コード例 #7
0
  @Test
  public void testAccessModes() {
    pv.setAccessModes("ReadWriteOnce");
    Set<String> modes = pv.getAccessModes();
    assertTrue(modes.contains("ReadWriteOnce"));

    pv.setAccessModes("ReadWriteOnce", "ReadOnlyMany", "ReadWriteMany");
    modes = pv.getAccessModes();
    Set<String> expected = new HashSet<>();
    expected.addAll(Arrays.asList("ReadWriteOnce", "ReadOnlyMany", "ReadWriteMany"));
    assertTrue(modes.containsAll(expected));
  }
コード例 #8
0
 @Test
 public void testGetCapacity() {
   pv.setCapacity(13L, MemoryUnit.Pi);
   long capacity = pv.getCapacity();
   assertEquals(14636698788954112L, capacity);
 }
コード例 #9
0
 @Test
 public void testGetPersistentVolumeProperties() {
   pv.getPersistentVolumeProperties();
 }
コード例 #10
0
 @Test
 public void testReclaimPolicy() {
   pv.setReclaimPolicy("Recycle");
   String policy = pv.getReclaimPolicy();
   assertEquals(policy, "Recycle");
 }