use of org.apache.nifi.remote.protocol.FlowFileTransaction in project nifi by apache.
the class TestHttpRemoteSiteListener method testNoneExistingTransaction.
@Test
public void testNoneExistingTransaction() {
HttpRemoteSiteListener transactionManager = HttpRemoteSiteListener.getInstance(NiFiProperties.createBasicNiFiProperties(null, null));
String transactionId = "does-not-exist-1";
assertFalse("Transaction should not be active.", transactionManager.isTransactionActive(transactionId));
ProcessSession processSession = Mockito.mock(ProcessSession.class);
FlowFileTransaction transaction = new FlowFileTransaction(processSession, null, null, 0, null, null);
try {
transactionManager.holdTransaction(transactionId, transaction, null);
} catch (IllegalStateException e) {
fail("Transaction can be held even if the transaction id is not valid anymore," + " in order to support large file or slow network.");
}
transactionId = "does-not-exist-2";
try {
transactionManager.finalizeTransaction(transactionId);
fail("But transaction should not be finalized if it isn't active.");
} catch (IllegalStateException e) {
}
}
Aggregations