use of com.hederahashgraph.api.proto.java.FileID in project hedera-services by hashgraph.
the class BaseHederaLedgerTestHelper method commonSetup.
protected void commonSetup() {
sideEffectsTracker = mock(SideEffectsTracker.class);
creator = mock(ExpiringCreations.class);
historian = mock(AccountRecordsHistorian.class);
ids = new EntityIdSource() {
long nextId = NEXT_ID;
@Override
public TopicID newTopicId(final AccountID sponsor) {
return TopicID.newBuilder().setTopicNum(nextId++).build();
}
@Override
public AccountID newAccountId(AccountID newAccountSponsor) {
return AccountID.newBuilder().setAccountNum(nextId++).build();
}
@Override
public ContractID newContractId(AccountID newContractSponsor) {
return ContractID.newBuilder().setContractNum(nextId++).build();
}
@Override
public FileID newFileId(AccountID newFileSponsor) {
return FileID.newBuilder().setFileNum(nextId++).build();
}
@Override
public TokenID newTokenId(AccountID sponsor) {
return TokenID.newBuilder().setTokenNum(nextId++).build();
}
@Override
public ScheduleID newScheduleId(AccountID sponsor) {
return ScheduleID.newBuilder().setScheduleNum(nextId++).build();
}
@Override
public void reclaimLastId() {
nextId--;
}
@Override
public void reclaimProvisionalIds() {
}
@Override
public void resetProvisionalIds() {
}
};
}
use of com.hederahashgraph.api.proto.java.FileID in project hedera-services by hashgraph.
the class SeqNoEntityIdSourceTest method returnsExpectedFileId.
@Test
void returnsExpectedFileId() {
given(seqNo.getAndIncrement()).willReturn(555L);
// when:
FileID newId = subject.newFileId(sponsor);
// then:
assertEquals(asFile("1.2.555"), newId);
}
use of com.hederahashgraph.api.proto.java.FileID in project hedera-services by hashgraph.
the class StateViewTest method getsSpecialFileContents.
@Test
void getsSpecialFileContents() {
FileID file150 = asFile("0.0.150");
given(specialFiles.get(file150)).willReturn(data);
given(specialFiles.contains(file150)).willReturn(true);
final var stuff = subject.contentsOf(file150);
assertTrue(Arrays.equals(data, stuff.get()));
}
use of com.hederahashgraph.api.proto.java.FileID in project hedera-mirror-node by hashgraph.
the class EntityRecordItemListenerFileTest method fileCreatePersistSystemPositive.
@Test
void fileCreatePersistSystemPositive() {
entityProperties.getPersist().setFiles(false);
Transaction transaction = fileCreateTransaction();
TransactionBody transactionBody = getTransactionBody(transaction);
FileID fileID = FileID.newBuilder().setShardNum(0).setRealmNum(0).setFileNum(10).build();
TransactionRecord record = transactionRecord(transactionBody, fileID);
parseRecordItemAndCommit(new RecordItem(transaction, record));
assertAll(() -> assertRowCountOnSuccess(fileID), () -> assertTransactionAndRecord(transactionBody, record), () -> assertFileEntityAndData(transactionBody.getFileCreate(), record.getConsensusTimestamp()));
}
use of com.hederahashgraph.api.proto.java.FileID in project hedera-mirror-node by hashgraph.
the class EntityRecordItemListenerFileTest method fileUpdateAllToNewSystem.
@Test
void fileUpdateAllToNewSystem() {
FileID fileID = FileID.newBuilder().setShardNum(0).setRealmNum(0).setFileNum(10).build();
Transaction transaction = fileUpdateAllTransaction(fileID, FILE_CONTENTS);
TransactionBody transactionBody = getTransactionBody(transaction);
FileUpdateTransactionBody fileUpdateTransactionBody = transactionBody.getFileUpdate();
TransactionRecord record = transactionRecord(transactionBody, fileID);
entityProperties.getPersist().setFiles(true);
entityProperties.getPersist().setSystemFiles(true);
parseRecordItemAndCommit(new RecordItem(transaction, record));
assertAll(() -> assertRowCountOnSuccess(fileID), () -> assertTransactionAndRecord(transactionBody, record), () -> assertFileEntityAndData(fileUpdateTransactionBody, record.getConsensusTimestamp()));
}
Aggregations