@Test public void testGetRegionalIds() { // setup KoalaIdFactory koalaIdFactory = new KoalaIdFactory(0, 0); koalaIdFactory.setKoalaPiEntityFactory(koalaPiEntityFactory); koalaGCPastImpl.setKoalaIdFactory(koalaIdFactory); PId testId = koalaGCPastImpl.getKoalaIdFactory().buildPId("R. Lopez"); // act Set<String> ids = koalaGCPastImpl.generateBackupIds(4, NodeScope.REGION, testId); assertEquals(4, ids.size()); assertSetEndsWithBackupIdentifier(ids); assertSetContains(ids, testId.getIdAsHex().substring(4, testId.getIdAsHex().length() - 1)); }
@Test public void testGetGlobalIds() { // setup KoalaIdFactory koalaIdFactory = new KoalaIdFactory(0, 0); koalaIdFactory.setKoalaPiEntityFactory(koalaPiEntityFactory); koalaGCPastImpl.setKoalaIdFactory(koalaIdFactory); PId testId = koalaGCPastImpl.getKoalaIdFactory().buildPId("R. Lopez"); // act Set<String> globalIds = koalaGCPastImpl.generateBackupIds(4, NodeScope.GLOBAL, testId); // asssert assertEquals(4, globalIds.size()); assertSetEndsWithBackupIdentifier(globalIds); }
@Test public void testGetAvailabilityZoneIds() { // setup KoalaIdFactory koalaIdFactory = new KoalaIdFactory(0, 0); koalaIdFactory.setKoalaPiEntityFactory(koalaPiEntityFactory); koalaGCPastImpl.setKoalaIdFactory(koalaIdFactory); PId testId = koalaGCPastImpl.getKoalaIdFactory().buildPId("YEAHBOB"); // act Set<String> ids = koalaGCPastImpl.generateBackupIds(4, NodeScope.AVAILABILITY_ZONE, testId); // assert assertEquals(4, ids.size()); assertSetEndsWithBackupIdentifier(ids); assertSetContains(ids, testId.getIdAsHex().substring(5, testId.getIdAsHex().length() - 1)); }
@Test public void testGetGlobalBackupIDs() { // setup koalaGCPastImpl.setKoalaIdFactory(new KoalaIdFactory(0, 0)); realTestId = (PId) koalaGCPastImpl .getKoalaIdFactory() .buildPIdFromHexString("1234567890123456789012345678901234567892"); // act Set<String> ids = koalaGCPastImpl.generateBackupIds(4, NodeScope.GLOBAL, realTestId); // assert assertSetEndsWithBackupIdentifier(ids); assertSetContains(ids, "34567890123456789012345678901234560013"); }