Search in sources :

Example 66 with Namespace

use of org.apache.distributedlog.api.namespace.Namespace in project heron by twitter.

the class DlogUploaderTest method testUndoFailure.

@Test
public void testUndoFailure() throws Exception {
    Namespace ns = mock(Namespace.class);
    when(nsBuilder.build()).thenReturn(ns);
    Mockito.doThrow(new IOException("test")).when(ns).deleteLog(anyString());
    uploader.initialize(config);
    assertFalse(uploader.undo());
    verify(ns, times(1)).deleteLog(eq(uploader.getPackageName()));
}
Also used : IOException(java.io.IOException) Namespace(org.apache.distributedlog.api.namespace.Namespace) Test(org.junit.Test)

Aggregations

Namespace (org.apache.distributedlog.api.namespace.Namespace)66 Test (org.junit.Test)43 URI (java.net.URI)30 DistributedLogManager (org.apache.distributedlog.api.DistributedLogManager)29 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)18 InputStream (java.io.InputStream)16 IOException (java.io.IOException)12 Response (javax.ws.rs.core.Response)8 Matchers.anyString (org.mockito.Matchers.anyString)8 Test (org.testng.annotations.Test)8 OutputStream (java.io.OutputStream)6 FunctionMetaData (org.apache.pulsar.functions.proto.Function.FunctionMetaData)6 RequestResult (org.apache.pulsar.functions.worker.request.RequestResult)6 DistributedLogConfiguration (org.apache.distributedlog.DistributedLogConfiguration)5 AsyncLogReader (org.apache.distributedlog.api.AsyncLogReader)5 AsyncLogWriter (org.apache.distributedlog.api.AsyncLogWriter)5 LogReader (org.apache.distributedlog.api.LogReader)5 LogWriter (org.apache.distributedlog.api.LogWriter)5 ErrorData (org.apache.pulsar.common.policies.data.ErrorData)5 File (java.io.File)4