@Test public void createAlert() throws Exception { String name = "name"; long dateTime = LONG_ID; String cronExpr = "0 15 10 * * ? *"; AlertObject alertObject = ImmutableAlertObject.builder().name(name).createdDate(dateTime).cronEntry(cronExpr).build(); Response<AlertObject>response = Response.success(alertObject); @SuppressWarnings("unchecked") Call<AlertObject>responseCall = mock(Call.class); doReturn(response).when(responseCall).execute(); doReturn(request).when(responseCall).request(); doReturn(responseCall).when(svc).createAlert(any(), any()); AlertObject alert = argus.createAlert(alertObject); assertThat(alert.name(), is(name)); assertThat(alert.createdDate(), is(dateTime)); assertThat(alert.cronEntry(), is(cronExpr)); }
public AlertObject createAlert(AlertObject alert) throws UnauthorizedException { Preconditions.checkNotNull(alert, "Alert should not be null"); return executeAndRetrieveBody(svc().createAlert(authorizationHeader(), alert), null); }
ArgusClient extends AbstractRemoteClient<ArgusService> { public AlertObject createAlert(AlertObject alert) throws UnauthorizedException { Preconditions.checkNotNull(alert, "Alert should not be null"); return executeAndRetrieveBody(svc().createAlert(authorizationHeader(), alert), null); } }
ArgusClient extends AbstractRemoteClient<ArgusService> { public AlertObject createAlert(AlertObject alert) throws UnauthorizedException { Preconditions.checkNotNull(alert, "Alert should not be null"); return executeAndRetrieveBody(svc().createAlert(authorizationHeader(), alert), null); } ArgusClient(EndpointConnector connector); }
ArgusClient extends AbstractRemoteClient<ArgusService> { public AlertObject createAlert(AlertObject alert) throws UnauthorizedException { Preconditions.checkNotNull(alert, "Alert should not be null"); return executeAndRetrieveBody(svc().createAlert(authorizationHeader(), alert), null); } ArgusClient(EndpointConnector connector); @Override boolean isAuthenticated(); List<MetricResponse> getMetrics(List<String> expressions); AlertObject createAlert(AlertObject alert); AlertObject updateAlert(AlertObject alert); AlertObject loadAlert(long id); List<AlertObject> loadAllAlerts(); List<AlertObject> loadAlertsByOwner(String ownerName); List<AlertObject> loadAlertsMetadataByOwner(String ownerName); void deleteAlert(long alertId); List<TriggerObject> loadTriggersForAlert(long alertId); List<TriggerObject> createTrigger(long alertId, TriggerObject trigger); TriggerObject updateTrigger(long alertId, TriggerObject trigger); void deleteTrigger(long alertId, long triggerId); NotificationObject getNotification(long alertId, long notificationId); List<NotificationObject> getNotificationsForAlert(long alertId); List<NotificationObject> createNotification(long alertId, NotificationObject notification); NotificationObject updateNotification(long alertId, long notificationId, NotificationObject notification); void deleteNotification(long alertId, long notificationId); TriggerObject attachTriggerToNotification(long alertId, long notificationId, long triggerId); void removeTriggerFromNotification(long alertId, long notificationId, long triggerId); List<DashboardObject> getAllDashboards(); DashboardObject getDashboardByName(String owner, String dashboardName); DashboardObject createDashboard(DashboardObject dashboard); DashboardObject updateDashboard(long dashboardId, DashboardObject dashboard); void deleteDashboard(long dashboardId); DashboardObject getDashboardById(long dashboardId); }
ArgusClient extends AbstractRemoteClient<ArgusService> { public AlertObject createAlert(AlertObject alert) throws UnauthorizedException { Preconditions.checkNotNull(alert, "Alert should not be null"); return executeAndRetrieveBody(svc().createAlert(authorizationHeader(), alert), null); } ArgusClient(EndpointConnector connector); @Override boolean isAuthenticated(); List<MetricResponse> getMetrics(List<String> expressions); AlertObject createAlert(AlertObject alert); AlertObject updateAlert(AlertObject alert); AlertObject loadAlert(long id); List<AlertObject> loadAllAlerts(); List<AlertObject> loadAlertsByOwner(String ownerName); List<AlertObject> loadAlertsMetadataByOwner(String ownerName); void deleteAlert(long alertId); List<TriggerObject> loadTriggersForAlert(long alertId); List<TriggerObject> createTrigger(long alertId, TriggerObject trigger); TriggerObject updateTrigger(long alertId, TriggerObject trigger); void deleteTrigger(long alertId, long triggerId); NotificationObject getNotification(long alertId, long notificationId); List<NotificationObject> getNotificationsForAlert(long alertId); List<NotificationObject> createNotification(long alertId, NotificationObject notification); NotificationObject updateNotification(long alertId, long notificationId, NotificationObject notification); void deleteNotification(long alertId, long notificationId); TriggerObject attachTriggerToNotification(long alertId, long notificationId, long triggerId); void removeTriggerFromNotification(long alertId, long notificationId, long triggerId); List<DashboardObject> getAllDashboards(); DashboardObject getDashboardByName(String owner, String dashboardName); DashboardObject createDashboard(DashboardObject dashboard); DashboardObject updateDashboard(long dashboardId, DashboardObject dashboard); void deleteDashboard(long dashboardId); DashboardObject getDashboardById(long dashboardId);  }