[GitHub] [metron] nickwallen commented on a change in pull request #1457: METRON-2176 Upgrade REST for HBase 2.0.2

2019-07-03 Thread GitBox
nickwallen commented on a change in pull request #1457: METRON-2176 Upgrade 
REST for HBase 2.0.2
URL: https://github.com/apache/metron/pull/1457#discussion_r300126779
 
 

 ##
 File path: 
metron-interface/metron-rest/src/test/java/org/apache/metron/rest/service/impl/AlertsUIServiceImplTest.java
 ##
 @@ -126,63 +127,63 @@ public void escalateAlertShouldSendMessageToKafka() 
throws Exception {
   }
 
   @Test
-  public void getShouldProperlyReturnActiveProfile() throws Exception {
-when(userSettingsClient.findOne(user1, 
AlertsUIServiceImpl.ALERT_USER_SETTING_TYPE)).thenReturn(Optional.of(user1AlertUserSettings));
-
-AlertsUIUserSettings expectedAlertsUIUserSettings = new 
AlertsUIUserSettings();
-
expectedAlertsUIUserSettings.setTableColumns(Collections.singletonList("user1_field"));
-assertEquals(expectedAlertsUIUserSettings, 
alertsUIService.getAlertsUIUserSettings().get());
-verify(userSettingsClient, times(1)).findOne(user1, 
AlertsUIServiceImpl.ALERT_USER_SETTING_TYPE);
-verifyNoMoreInteractions(userSettingsClient);
+  public void shouldGetActiveProfile() throws Exception {
+AlertsUIUserSettings expected = new AlertsUIUserSettings();
+expected.setTableColumns(Collections.singletonList("user1_field"));
+
+// save a profile for current user
+userSettingsClient.save(user1, ALERT_USER_SETTING_TYPE, toJSON(expected));
 
 Review comment:
   Being able to use a real `HBaseSettingsClient` instead of a mock made these 
tests much easier to grok and maintain in my opinion.  Previously we had to use 
a lot of mockito-magic to test this. 


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [metron] nickwallen commented on a change in pull request #1457: METRON-2176 Upgrade REST for HBase 2.0.2

2019-07-03 Thread GitBox
nickwallen commented on a change in pull request #1457: METRON-2176 Upgrade 
REST for HBase 2.0.2
URL: https://github.com/apache/metron/pull/1457#discussion_r300125125
 
 

 ##
 File path: 
metron-interface/metron-rest/src/main/java/org/apache/metron/rest/service/impl/AlertsUIServiceImpl.java
 ##
 @@ -136,12 +136,15 @@ public void 
saveAlertsUIUserSettings(AlertsUIUserSettings alertsUIUserSettings)
   }
 
   @Override
-  public boolean deleteAlertsUIUserSettings(String user) {
-boolean success = true;
+  public boolean deleteAlertsUIUserSettings(String user) throws RestException {
+boolean success = false;
 try {
-  userSettingsClient.delete(user, ALERT_USER_SETTING_TYPE);
+  if(userSettingsClient.findOne(user, 
ALERT_USER_SETTING_TYPE).isPresent()) {
 
 Review comment:
   This was needed to maintain the behavior of returning false if you attempt 
to delete settings that don't exist.  When issuing the delete you don't get any 
indication of whether something was deleted or not.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services