use of com.hedera.services.ledger.SigImpactHistorian in project hedera-services by hashgraph.
the class FileCreateTransitionLogicTest method setup.
@BeforeEach
private void setup() throws Throwable {
hederaWacl = waclSkeleton.asJKey();
attr = new HFileMeta(false, hederaWacl, expiry);
accessor = mock(PlatformTxnAccessor.class);
txnCtx = mock(TransactionContext.class);
hfs = mock(HederaFs.class);
sigImpactHistorian = mock(SigImpactHistorian.class);
validator = mock(OptionValidator.class);
given(validator.isValidAutoRenewPeriod(expectedDuration)).willReturn(true);
given(validator.hasGoodEncoding(wacl)).willReturn(true);
given(validator.memoCheck(any())).willReturn(OK);
subject = new FileCreateTransitionLogic(hfs, validator, sigImpactHistorian, txnCtx);
}
use of com.hedera.services.ledger.SigImpactHistorian in project hedera-services by hashgraph.
the class FileUpdateTransitionLogicTest method setup.
@BeforeEach
private void setup() throws Throwable {
oldWacl = TxnHandlingScenario.SIMPLE_NEW_WACL_KT.asJKey();
oldAttr = new HFileMeta(false, oldWacl, oldExpiry, oldMemo);
deletedAttr = new HFileMeta(true, oldWacl, oldExpiry);
immutableAttr = new HFileMeta(false, StateView.EMPTY_WACL, oldExpiry);
actionableNewWacl = TxnHandlingScenario.MISC_FILE_WACL_KT.asJKey();
newAttr = new HFileMeta(false, actionableNewWacl, newExpiry, newMemo);
accessor = mock(PlatformTxnAccessor.class);
txnCtx = mock(TransactionContext.class);
given(txnCtx.activePayer()).willReturn(nonSysAdmin);
networkCtx = mock(MerkleNetworkContext.class);
hfs = mock(HederaFs.class);
given(hfs.exists(nonSysFileTarget)).willReturn(true);
given(hfs.getattr(nonSysFileTarget)).willReturn(oldAttr);
validator = mock(OptionValidator.class);
given(validator.isValidAutoRenewPeriod(expectedDuration)).willReturn(false);
given(validator.hasGoodEncoding(newWacl)).willReturn(true);
given(validator.memoCheck(newMemo)).willReturn(OK);
sigImpactHistorian = mock(SigImpactHistorian.class);
subject = new FileUpdateTransitionLogic(hfs, number, validator, sigImpactHistorian, txnCtx, () -> networkCtx);
}
use of com.hedera.services.ledger.SigImpactHistorian in project hedera-services by hashgraph.
the class ExpiryManagerTest method expiresSchedulesAsExpected.
@Test
void expiresSchedulesAsExpected() {
subject = new ExpiryManager(mockScheduleStore, nums, sigImpactHistorian, mockTxnHistories, () -> mockAccounts, () -> mockSchedules);
// given:
subject.trackExpirationEvent(Pair.of(aKey.longValue(), entityId -> mockScheduleStore.expire(entityId)), firstThen);
subject.trackExpirationEvent(Pair.of(bKey.longValue(), entityId -> mockScheduleStore.expire(entityId)), secondThen);
subject.purge(now);
// then:
verify(mockScheduleStore).expire(new EntityId(0, 0, aKey.longValue()));
verify(sigImpactHistorian).markEntityChanged(aKey.longValue());
assertEquals(1, subject.getShortLivedEntityExpiries().getAllExpiries().size());
}
use of com.hedera.services.ledger.SigImpactHistorian in project hedera-services by hashgraph.
the class FileCreateTransitionLogicTest method happyPathFlows.
@Test
void happyPathFlows() {
// setup:
InOrder inOrder = inOrder(hfs, txnCtx, sigImpactHistorian);
givenTxnCtxCreating(EnumSet.allOf(ValidProperty.class));
// and:
given(hfs.create(any(), any(), any())).willReturn(created);
// when:
subject.doStateTransition();
// then:
inOrder.verify(txnCtx).activePayer();
inOrder.verify(hfs).create(argThat(bytes -> Arrays.equals(contents, bytes)), argThat(info -> info.getWacl().toString().equals(hederaWacl.toString()) && info.getExpiry() == expiry && memo.equals(info.getMemo())), argThat(genesis::equals));
inOrder.verify(txnCtx).setCreated(created);
inOrder.verify(txnCtx).setStatus(SUCCESS);
inOrder.verify(sigImpactHistorian).markEntityChanged(created.getFileNum());
}
use of com.hedera.services.ledger.SigImpactHistorian in project hedera-services by hashgraph.
the class FileSysDelTransitionLogicTest method setup.
@BeforeEach
private void setup() throws Throwable {
wacl = TxnHandlingScenario.SIMPLE_NEW_WACL_KT.asJKey();
attr = new HFileMeta(false, wacl, oldExpiry);
deletedAttr = new HFileMeta(true, wacl, oldExpiry);
accessor = mock(PlatformTxnAccessor.class);
txnCtx = mock(TransactionContext.class);
sigImpactHistorian = mock(SigImpactHistorian.class);
oldExpiries = mock(Map.class);
hfs = mock(HederaFs.class);
given(hfs.exists(tbd)).willReturn(true);
given(hfs.exists(deleted)).willReturn(true);
given(hfs.exists(missing)).willReturn(false);
given(hfs.getattr(tbd)).willReturn(attr);
given(hfs.getattr(deleted)).willReturn(deletedAttr);
subject = new FileSysDelTransitionLogic(hfs, sigImpactHistorian, oldExpiries, txnCtx);
}
Aggregations