@Test public void testNotify(@Capturing INotificationService notificationService) { new Expectations() { { notificationService.notify(anyString, (Map<String, MessageAttributeValue>) any); maxTimes = 1; } }; BackupVerificationResult backupVerificationResult = getBackupVerificationResult(); backupNotificationMgr.notify(backupVerificationResult); new Verifications() { { notificationService.notify(anyString, (Map<String, MessageAttributeValue>) any); maxTimes = 1; } }; }
public void notify(BackupVerificationResult backupVerificationResult) { JSONObject jsonObject = new JSONObject(); try { jsonObject.put("s3bucketname", this.config.getBackupPrefix()); jsonObject.put("s3clustername", config.getAppName()); jsonObject.put("s3namespace", backupVerificationResult.remotePath); jsonObject.put("region", instanceInfo.getRegion()); jsonObject.put("rack", instanceInfo.getRac()); jsonObject.put("token", instanceIdentity.getInstance().getToken()); jsonObject.put("backuptype", "SNAPSHOT_VERIFIED"); jsonObject.put("snapshotInstant", backupVerificationResult.snapshotInstant); Map<String, MessageAttributeValue> messageAttributes = getMessageAttributes(AbstractBackupPath.BackupFileType.SNAPSHOT_VERIFIED); this.notificationService.notify(jsonObject.toString(), messageAttributes); } catch (JSONException exception) { logger.error( "JSON exception during generation of notification for snapshot verification: {}. Msg: {}", backupVerificationResult, exception.getLocalizedMessage()); } }
BackupNotificationMgr implements EventObserver<BackupEvent> { public void notify(BackupVerificationResult backupVerificationResult) { JSONObject jsonObject = new JSONObject(); try { jsonObject.put("s3bucketname", this.config.getBackupPrefix()); jsonObject.put("s3clustername", config.getAppName()); jsonObject.put("s3namespace", backupVerificationResult.remotePath); jsonObject.put("region", instanceInfo.getRegion()); jsonObject.put("rack", instanceInfo.getRac()); jsonObject.put("token", instanceIdentity.getInstance().getToken()); jsonObject.put("backuptype", "SNAPSHOT_VERIFIED"); jsonObject.put("snapshotInstant", backupVerificationResult.snapshotInstant); Map<String, MessageAttributeValue> messageAttributes = getMessageAttributes(AbstractBackupPath.BackupFileType.SNAPSHOT_VERIFIED); this.notificationService.notify(jsonObject.toString(), messageAttributes); } catch (JSONException exception) { logger.error( "JSON exception during generation of notification for snapshot verification: {}. Msg: {}", backupVerificationResult, exception.getLocalizedMessage()); } } }
BackupNotificationMgr implements EventObserver<BackupEvent> { public void notify(BackupVerificationResult backupVerificationResult) { JSONObject jsonObject = new JSONObject(); try { jsonObject.put("s3bucketname", this.config.getBackupPrefix()); jsonObject.put("s3clustername", config.getAppName()); jsonObject.put("s3namespace", backupVerificationResult.remotePath); jsonObject.put("region", instanceInfo.getRegion()); jsonObject.put("rack", instanceInfo.getRac()); jsonObject.put("token", instanceIdentity.getInstance().getToken()); jsonObject.put("backuptype", "SNAPSHOT_VERIFIED"); jsonObject.put("snapshotInstant", backupVerificationResult.snapshotInstant); Map<String, MessageAttributeValue> messageAttributes = getMessageAttributes(AbstractBackupPath.BackupFileType.SNAPSHOT_VERIFIED); this.notificationService.notify(jsonObject.toString(), messageAttributes); } catch (JSONException exception) { logger.error( "JSON exception during generation of notification for snapshot verification: {}. Msg: {}", backupVerificationResult, exception.getLocalizedMessage()); } } @Inject  BackupNotificationMgr(
            IConfiguration config,
            IBackupRestoreConfig backupRestoreConfig,
            INotificationService notificationService,
            InstanceInfo instanceInfo,
            InstanceIdentity instanceIdentity); }
BackupNotificationMgr implements EventObserver<BackupEvent> { public void notify(BackupVerificationResult backupVerificationResult) { JSONObject jsonObject = new JSONObject(); try { jsonObject.put("s3bucketname", this.config.getBackupPrefix()); jsonObject.put("s3clustername", config.getAppName()); jsonObject.put("s3namespace", backupVerificationResult.remotePath); jsonObject.put("region", instanceInfo.getRegion()); jsonObject.put("rack", instanceInfo.getRac()); jsonObject.put("token", instanceIdentity.getInstance().getToken()); jsonObject.put("backuptype", "SNAPSHOT_VERIFIED"); jsonObject.put("snapshotInstant", backupVerificationResult.snapshotInstant); Map<String, MessageAttributeValue> messageAttributes = getMessageAttributes(AbstractBackupPath.BackupFileType.SNAPSHOT_VERIFIED); this.notificationService.notify(jsonObject.toString(), messageAttributes); } catch (JSONException exception) { logger.error( "JSON exception during generation of notification for snapshot verification: {}. Msg: {}", backupVerificationResult, exception.getLocalizedMessage()); } } @Inject  BackupNotificationMgr(
            IConfiguration config,
            IBackupRestoreConfig backupRestoreConfig,
            INotificationService notificationService,
            InstanceInfo instanceInfo,
            InstanceIdentity instanceIdentity); void notify(BackupVerificationResult backupVerificationResult); @Override void updateEventStart(BackupEvent event); @Override void updateEventFailure(BackupEvent event); @Override void updateEventSuccess(BackupEvent event); @Override void updateEventStop(BackupEvent event); }
BackupNotificationMgr implements EventObserver<BackupEvent> { public void notify(BackupVerificationResult backupVerificationResult) { JSONObject jsonObject = new JSONObject(); try { jsonObject.put("s3bucketname", this.config.getBackupPrefix()); jsonObject.put("s3clustername", config.getAppName()); jsonObject.put("s3namespace", backupVerificationResult.remotePath); jsonObject.put("region", instanceInfo.getRegion()); jsonObject.put("rack", instanceInfo.getRac()); jsonObject.put("token", instanceIdentity.getInstance().getToken()); jsonObject.put("backuptype", "SNAPSHOT_VERIFIED"); jsonObject.put("snapshotInstant", backupVerificationResult.snapshotInstant); Map<String, MessageAttributeValue> messageAttributes = getMessageAttributes(AbstractBackupPath.BackupFileType.SNAPSHOT_VERIFIED); this.notificationService.notify(jsonObject.toString(), messageAttributes); } catch (JSONException exception) { logger.error( "JSON exception during generation of notification for snapshot verification: {}. Msg: {}", backupVerificationResult, exception.getLocalizedMessage()); } } @Inject  BackupNotificationMgr(
            IConfiguration config,
            IBackupRestoreConfig backupRestoreConfig,
            INotificationService notificationService,
            InstanceInfo instanceInfo,
            InstanceIdentity instanceIdentity); void notify(BackupVerificationResult backupVerificationResult); @Override void updateEventStart(BackupEvent event); @Override void updateEventFailure(BackupEvent event); @Override void updateEventSuccess(BackupEvent event); @Override void updateEventStop(BackupEvent event); static final String SUCCESS_VAL; }