use of com.hedera.services.files.interceptors.MockFileNumbers in project hedera-services by hashgraph.
the class HfsSystemFilesManagerTest method setup.
@BeforeEach
@SuppressWarnings("unchecked")
void setup() throws DecoderException {
masterKey = TxnHandlingScenario.COMPLEX_KEY_ACCOUNT_KT.asJKey();
expectedInfo = new HFileMeta(false, JKey.mapKey(Key.newBuilder().setKeyList(KeyList.newBuilder().addKeys(TxnHandlingScenario.COMPLEX_KEY_ACCOUNT_KT.asKey())).build()), expiry);
final var keyA = mock(PublicKey.class);
given(keyA.getEncoded()).willReturn(aKeyEncoding);
final var addressA = mock(Address.class);
final var aIpv4 = new byte[] { (byte) 1, (byte) 2, (byte) 3, (byte) 4 };
final var memoA = "A new memo that is not the node account ID.";
given(addressA.getId()).willReturn(111L);
given(addressA.getMemo()).willReturn(memoA);
given(addressA.getAddressExternalIpv4()).willReturn(aIpv4);
given(addressA.getSigPublicKey()).willReturn(keyA);
final var keyB = mock(PublicKey.class);
given(keyB.getEncoded()).willReturn(bKeyEncoding);
final var addressB = mock(Address.class);
final var bIpv4 = new byte[] { (byte) 2, (byte) 3, (byte) 4, (byte) 5 };
final var memoB = "0.0.3";
given(addressB.getId()).willReturn(222L);
given(addressB.getMemo()).willReturn(memoB);
given(addressB.getAddressExternalIpv4()).willReturn(bIpv4);
given(addressB.getSigPublicKey()).willReturn(keyB);
currentBook = mock(AddressBook.class);
given(currentBook.getAddress(0L)).willReturn(addressA);
given(currentBook.getAddress(1L)).willReturn(addressB);
given(currentBook.getSize()).willReturn(2);
data = mock(Map.class);
metadata = mock(Map.class);
hfs = mock(TieredHederaFs.class);
specialFiles = mock(MerkleSpecialFiles.class);
given(hfs.getData()).willReturn(data);
given(hfs.getMetadata()).willReturn(metadata);
given(hfs.specialFiles()).willReturn(specialFiles);
fileNumbers = new MockFileNumbers();
fileNumbers.setShard(0L);
fileNumbers.setRealm(0L);
given(specialFiles.contains(fileNumbers.toFid(111))).willReturn(false);
properties = mock(PropertySource.class);
given(properties.getStringProperty("bootstrap.hapiPermissions.path")).willReturn(bootstrapJutilPermsLoc);
given(properties.getStringProperty("bootstrap.networkProperties.path")).willReturn(bootstrapJutilPropsLoc);
given(properties.getLongProperty("bootstrap.system.entityExpiry")).willReturn(expiry);
given(properties.getIntProperty("bootstrap.rates.currentHbarEquiv")).willReturn(curHbarEquiv);
given(properties.getIntProperty("bootstrap.rates.currentCentEquiv")).willReturn(curCentEquiv);
given(properties.getLongProperty("bootstrap.rates.currentExpiry")).willReturn(expiry);
given(properties.getIntProperty("bootstrap.rates.nextHbarEquiv")).willReturn(nxtHbarEquiv);
given(properties.getIntProperty("bootstrap.rates.nextCentEquiv")).willReturn(nxtCentEquiv);
given(properties.getLongProperty("bootstrap.rates.nextExpiry")).willReturn(nextExpiry);
given(properties.getStringProperty("bootstrap.feeSchedulesJson.resource")).willReturn("R4FeeSchedule.json");
given(properties.getStringProperty("bootstrap.throttleDefsJson.resource")).willReturn("bootstrap/throttles.json");
ratesCb = mock(Consumer.class);
schedulesCb = mock(Consumer.class);
propertiesCb = mock(Consumer.class);
permissionsCb = mock(Consumer.class);
throttlesCb = mock(Consumer.class);
callbacks = mock(SysFileCallbacks.class);
subject = new HfsSystemFilesManager(() -> currentBook, fileNumbers, properties, hfs, () -> masterKey, callbacks);
}
Aggregations