use of org.apache.curator.framework.api.DeleteBuilder in project metron by apache.
the class SensorIndexingConfigServiceImplTest method deleteShouldReturnTrueWhenClientSuccessfullyCallsDelete.
@Test
public void deleteShouldReturnTrueWhenClientSuccessfullyCallsDelete() throws Exception {
DeleteBuilder builder = mock(DeleteBuilder.class);
when(curatorFramework.delete()).thenReturn(builder);
when(builder.forPath(ConfigurationType.INDEXING.getZookeeperRoot() + "/bro")).thenReturn(null);
assertTrue(sensorIndexingConfigService.delete("bro"));
verify(curatorFramework).delete();
}
use of org.apache.curator.framework.api.DeleteBuilder in project metron by apache.
the class SensorIndexingConfigServiceImplTest method deleteShouldProperlyCatchNoNodeExceptionAndReturnFalse.
@Test
public void deleteShouldProperlyCatchNoNodeExceptionAndReturnFalse() throws Exception {
DeleteBuilder builder = mock(DeleteBuilder.class);
when(curatorFramework.delete()).thenReturn(builder);
when(builder.forPath(ConfigurationType.INDEXING.getZookeeperRoot() + "/bro")).thenThrow(KeeperException.NoNodeException.class);
assertFalse(sensorIndexingConfigService.delete("bro"));
}
use of org.apache.curator.framework.api.DeleteBuilder in project metron by apache.
the class SensorParserConfigServiceImplTest method deleteShouldProperlyCatchNoNodeExceptionAndReturnFalse.
@Test
public void deleteShouldProperlyCatchNoNodeExceptionAndReturnFalse() throws Exception {
DeleteBuilder builder = mock(DeleteBuilder.class);
when(curatorFramework.delete()).thenReturn(builder);
when(builder.forPath(ConfigurationType.PARSER.getZookeeperRoot() + "/bro")).thenThrow(KeeperException.NoNodeException.class);
assertFalse(sensorParserConfigService.delete("bro"));
}
use of org.apache.curator.framework.api.DeleteBuilder in project metron by apache.
the class SensorParserConfigServiceImplTest method deleteShouldProperlyCatchNonNoNodeExceptionAndThrowRestException.
@Test
public void deleteShouldProperlyCatchNonNoNodeExceptionAndThrowRestException() throws Exception {
exception.expect(RestException.class);
DeleteBuilder builder = mock(DeleteBuilder.class);
when(curatorFramework.delete()).thenReturn(builder);
when(builder.forPath(ConfigurationType.PARSER.getZookeeperRoot() + "/bro")).thenThrow(Exception.class);
assertFalse(sensorParserConfigService.delete("bro"));
}
use of org.apache.curator.framework.api.DeleteBuilder in project metron by apache.
the class SensorParserConfigServiceImplTest method deleteShouldReturnTrueWhenClientSuccessfullyCallsDelete.
@Test
public void deleteShouldReturnTrueWhenClientSuccessfullyCallsDelete() throws Exception {
DeleteBuilder builder = mock(DeleteBuilder.class);
when(curatorFramework.delete()).thenReturn(builder);
when(builder.forPath(ConfigurationType.PARSER.getZookeeperRoot() + "/bro")).thenReturn(null);
assertTrue(sensorParserConfigService.delete("bro"));
verify(curatorFramework).delete();
}
Aggregations