Exemplo n.º 1
0
 /**
  * Test the getOplogId returns what has been set
  *
  * @throws Exception
  */
 public void testGetSetOplogId() throws Exception {
   DiskId did = getDiskId();
   did.setOplogId(-1);
   assertEquals(-1, did.getOplogId());
   did.setOplogId(0);
   assertEquals(0, did.getOplogId());
   did.setOplogId(1024);
   assertEquals(1024, did.getOplogId());
   did.setOplogId(-1024);
   assertEquals(-1024, did.getOplogId());
 }
Exemplo n.º 2
0
 /**
  * Test the whether setting of one set of values does not affect another set of values
  *
  * @throws Exception
  */
 public void testAllOperationsValidatingResult1() {
   DiskId did = getDiskId();
   for (int i = -16777215; i < 16777215; i++) {
     boolean boolValuePerIteration = false;
     did.setOplogId(i);
     // set true for even, set false for odd
     switch ((i % 3)) {
       case 0:
         boolValuePerIteration = true;
         break;
       case 1:
       case 2:
         boolValuePerIteration = false;
         break;
     }
     byte userbits = 0;
     switch (i % 4) {
       case 0:
         break;
       case 1:
         did.setUserBits(EntryBits.setSerialized(userbits, boolValuePerIteration));
         break;
       case 2:
         did.setUserBits(EntryBits.setInvalid(userbits, boolValuePerIteration));
         break;
       case 3:
         did.setUserBits(EntryBits.setLocalInvalid(userbits, boolValuePerIteration));
         break;
     }
     assertEquals(did.getOplogId(), i);
     byte userBits2 = did.getUserBits();
     switch (i % 4) {
       case 0:
         break;
       case 1:
         assertEquals(EntryBits.isSerialized(userBits2), boolValuePerIteration);
         break;
       case 2:
         assertEquals(EntryBits.isInvalid(userBits2), boolValuePerIteration);
         break;
       case 3:
         assertEquals(EntryBits.isLocalInvalid(userBits2), boolValuePerIteration);
         break;
     }
   }
 }