Search in sources :

Example 6 with DeleteBuilder

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();
}
Also used : DeleteBuilder(org.apache.curator.framework.api.DeleteBuilder) Test(org.junit.Test)

Example 7 with DeleteBuilder

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"));
}
Also used : DeleteBuilder(org.apache.curator.framework.api.DeleteBuilder) KeeperException(org.apache.zookeeper.KeeperException) Test(org.junit.Test)

Example 8 with DeleteBuilder

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"));
}
Also used : DeleteBuilder(org.apache.curator.framework.api.DeleteBuilder) KeeperException(org.apache.zookeeper.KeeperException) Test(org.junit.Test)

Example 9 with DeleteBuilder

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"));
}
Also used : DeleteBuilder(org.apache.curator.framework.api.DeleteBuilder) Test(org.junit.Test)

Example 10 with DeleteBuilder

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();
}
Also used : DeleteBuilder(org.apache.curator.framework.api.DeleteBuilder) Test(org.junit.Test)

Aggregations

DeleteBuilder (org.apache.curator.framework.api.DeleteBuilder)17 Test (org.junit.Test)13 KeeperException (org.apache.zookeeper.KeeperException)6 IOException (java.io.IOException)1 LinkedHashSet (java.util.LinkedHashSet)1 ExecutionException (java.util.concurrent.ExecutionException)1 TimeUnit (java.util.concurrent.TimeUnit)1 SetupStep (org.apache.atlas.setup.SetupStep)1 CuratorFramework (org.apache.curator.framework.CuratorFramework)1 BackgroundPathable (org.apache.curator.framework.api.BackgroundPathable)1 CreateBuilder (org.apache.curator.framework.api.CreateBuilder)1 ExistsBuilder (org.apache.curator.framework.api.ExistsBuilder)1 InterProcessMutex (org.apache.curator.framework.recipes.locks.InterProcessMutex)1 FileAlreadyExistsException (org.apache.hadoop.fs.FileAlreadyExistsException)1 PathIsNotEmptyDirectoryException (org.apache.hadoop.fs.PathIsNotEmptyDirectoryException)1 PathNotFoundException (org.apache.hadoop.fs.PathNotFoundException)1 AuthenticationFailedException (org.apache.hadoop.registry.client.exceptions.AuthenticationFailedException)1 NoChildrenForEphemeralsException (org.apache.hadoop.registry.client.exceptions.NoChildrenForEphemeralsException)1 NoPathPermissionsException (org.apache.hadoop.registry.client.exceptions.NoPathPermissionsException)1 RegistryIOException (org.apache.hadoop.registry.client.exceptions.RegistryIOException)1