PrepareBackupRequest extends CliLegacyMessage { @Override protected AdminResponse createResponse(DistributionManager dm) { HashSet<PersistentID> persistentIds; try { persistentIds = prepareBackupFactory .createPrepareBackup(dm.getDistributionManagerId(), dm.getCache(), properties).run(); } catch (IOException | InterruptedException e) { logger.error(String.format("Error processing request %s.", getClass()), e); return AdminFailureResponse.create(getSender(), e); } return prepareBackupFactory.createBackupResponse(getSender(), persistentIds); } PrepareBackupRequest();   PrepareBackupRequest(InternalDistributedMember sender, Set<InternalDistributedMember> recipients,
      int msgId, PrepareBackupFactory prepareBackupFactory, Properties properties); @Override int getDSFID(); @Override void fromData(DataInput in,
      DeserializationContext context); @Override void toData(DataOutput out,
      SerializationContext context);  }
@Test public void usesFactoryToCreatePrepareBackup() throws Exception { prepareBackupRequest.createResponse(dm); verify(prepareBackupFactory, times(1)).createPrepareBackup(eq(sender), eq(cache), eq(backupProperties)); }
@Test public void usesFactoryToCreateBackupResponse() throws Exception { prepareBackupRequest.createResponse(dm); verify(prepareBackupFactory, times(1)).createBackupResponse(eq(sender), eq(persistentIds)); }
@Test public void returnsBackupResponse() throws Exception { assertThat(prepareBackupRequest.createResponse(dm)).isInstanceOf(BackupResponse.class); }
@Test public void returnsAdminFailureResponseWhenPrepareBackupThrowsIOException() throws Exception { when(prepareBackup.run()).thenThrow(new IOException()); assertThat(prepareBackupRequest.createResponse(dm)).isInstanceOf(AdminFailureResponse.class); }