use of com.treasuredata.client.TDClientHttpConflictException in project fluency by komamitsu.
the class TreasureDataSenderTest method sendWithLackOfPermissionOnDatabase.
@Test
public void sendWithLackOfPermissionOnDatabase() throws IOException {
doThrow(new TDClientHttpNotFoundException("Not Found!!!!")).when(client).importFile(anyString(), anyString(), any(File.class), anyString());
doThrow(new TDClientHttpNotFoundException("Not Found!!!!")).when(client).createTable(anyString(), anyString());
doThrow(new TDClientHttpConflictException("Conflict!!!!")).when(client).createDatabase(anyString());
doReturn(false).when(client).existsDatabase(anyString());
try {
sender.send(DB_AND_TABLE, ByteBuffer.wrap(DATA));
fail();
} catch (NonRetryableException e) {
assertTrue(true);
}
ArgumentCaptor<String> uniqueIdArgumentCaptor = ArgumentCaptor.forClass(String.class);
verify(client, times(1)).importFile(eq(DB), eq(TABLE), any(File.class), uniqueIdArgumentCaptor.capture());
verify(client, times(4)).createDatabase(eq(DB));
verify(client, times(4)).existsDatabase(eq(DB));
verify(client, times(1)).createTable(eq(DB), eq(TABLE));
UUID.fromString(uniqueIdArgumentCaptor.getValue());
}
Aggregations