use of org.apache.samza.system.SystemProducerException in project samza by apache.
the class TestAzureBlobSystemProducer method testFlushWhenWriterCloseFails.
@Test
public void testFlushWhenWriterCloseFails() throws Exception {
doThrow(new SystemProducerException("failed")).when(mockAzureWriter).close();
systemProducer.register(SOURCE);
systemProducer.start();
systemProducer.send(SOURCE, ome);
try {
systemProducer.flush(SOURCE);
Assert.fail("Expected exception not thrown.");
} catch (SystemProducerException e) {
}
verify(mockErrorCounter).inc();
}
use of org.apache.samza.system.SystemProducerException in project samza by apache.
the class TestAzureBlobSystemProducer method testSendWhenWriterFails.
@Test
public void testSendWhenWriterFails() throws Exception {
doThrow(new SystemProducerException("failed")).when(mockAzureWriter).write(ome);
systemProducer.register(SOURCE);
systemProducer.start();
try {
systemProducer.send(SOURCE, ome);
Assert.fail("Expected exception not thrown.");
} catch (SystemProducerException e) {
}
verify(mockErrorCounter).inc();
}
use of org.apache.samza.system.SystemProducerException in project samza by apache.
the class TestAzureBlobSystemProducer method testSendWhenWriterCreateFails.
@Test
public void testSendWhenWriterCreateFails() throws Exception {
AzureBlobConfig azureBlobConfig = new AzureBlobConfig(getBasicConfigs());
AzureBlobSystemProducer systemProducer = spy(new AzureBlobSystemProducer(SYSTEM_NAME, azureBlobConfig, mockMetricsRegistry));
PowerMockito.whenNew(AzureBlobAvroWriter.class).withAnyArguments().thenThrow(new SystemProducerException("Failed"));
// bypass Azure connection setup
doNothing().when(systemProducer).setupAzureContainer();
systemProducer.register(SOURCE);
systemProducer.start();
try {
systemProducer.send(SOURCE, ome);
Assert.fail("Expected exception not thrown.");
} catch (SystemProducerException e) {
}
verify(mockErrorCounter).inc();
}
Aggregations