}
}
@Test
public void testBatchFailed() throws TDHSException {
BatchStatement batchStatement = client.createBatchStatement();
batchStatement.insert().use(db).from(table)
.value("id", "1")
.value("name", "a")
.value("level", "1").insert();
batchStatement.insert().use(db).from(table)
.value("id", "2")
.value("name", "b")
.value("level", "2").insert();
batchStatement.insert().use(db).from(table)
.value("id", "1")
.value("name", "c")
.value("level", "1").insert();
TDHSResponse[] responses = batchStatement.commit();
Assert.assertEquals(3, responses.length);
Assert.assertEquals(responses[0].getStatus(), TDHSResponseEnum.ClientStatus.SERVER_ERROR);
Assert.assertEquals(responses[0].getErrorCode(), TDHSResponseEnum.ErrorCode.CLIENT_ERROR_CODE_FAILED_TO_COMMIT);
Assert.assertEquals(responses[1].getStatus(), TDHSResponseEnum.ClientStatus.SERVER_ERROR);
Assert.assertEquals(responses[1].getErrorCode(), TDHSResponseEnum.ErrorCode.CLIENT_ERROR_CODE_FAILED_TO_COMMIT);