use of com.hedera.services.ledger.SigImpactHistorian in project hedera-services by hashgraph.
the class FileSysUndelTransitionLogicTest method setup.
@BeforeEach
private void setup() throws Throwable {
wacl = TxnHandlingScenario.SIMPLE_NEW_WACL_KT.asJKey();
attr = new HFileMeta(false, wacl, currExpiry);
deletedAttr = new HFileMeta(true, wacl, currExpiry);
accessor = mock(PlatformTxnAccessor.class);
txnCtx = mock(TransactionContext.class);
oldExpiries = mock(Map.class);
sigImpactHistorian = mock(SigImpactHistorian.class);
hfs = mock(HederaFs.class);
given(hfs.exists(undeleted)).willReturn(true);
given(hfs.exists(deleted)).willReturn(true);
given(hfs.exists(missing)).willReturn(false);
given(hfs.getattr(undeleted)).willReturn(attr);
given(hfs.getattr(deleted)).willReturn(deletedAttr);
subject = new FileSysUndelTransitionLogic(hfs, sigImpactHistorian, oldExpiries, txnCtx);
}
use of com.hedera.services.ledger.SigImpactHistorian in project hedera-services by hashgraph.
the class FileUpdateTransitionLogicTest method happyPathFlows.
@Test
void happyPathFlows() {
// setup:
InOrder inOrder = inOrder(hfs, txnCtx, sigImpactHistorian);
givenTxnCtxUpdating(EnumSet.allOf(UpdateTarget.class));
// and:
given(hfs.overwrite(any(), any())).willReturn(new SimpleUpdateResult(false, true, SUCCESS));
given(hfs.setattr(any(), any())).willReturn(new SimpleUpdateResult(true, false, SUCCESS));
given(hfs.getattr(nonSysFileTarget)).willReturn(oldAttr);
// when:
subject.doStateTransition();
// then:
inOrder.verify(hfs).overwrite(argThat(nonSysFileTarget::equals), argThat(bytes -> Arrays.equals(newContents, bytes)));
inOrder.verify(hfs).setattr(argThat(nonSysFileTarget::equals), argThat(attr -> newAttr.toString().equals(attr.toString())));
inOrder.verify(txnCtx).setStatus(SUCCESS);
inOrder.verify(sigImpactHistorian).markEntityChanged(nonSysFileTarget.getFileNum());
}
Aggregations