use of com.hederahashgraph.api.proto.java.CurrentAndNextFeeSchedule in project hedera-services by hashgraph.
the class FeesJsonToProtoSerdeTest method preservesR4Behavior.
@Test
void preservesR4Behavior() throws Exception {
// given:
CurrentAndNextFeeSchedule expectedR4 = CurrentAndNextFeeSchedule.parseFrom(Files.toByteArray(new File(UNTYPED_FEE_SCHEDULE_REPR_PATH)));
// when:
CurrentAndNextFeeSchedule actual = loadFeeScheduleFromJson("sysfiles/R4FeeSchedule.json");
// then:
assertEquals(expectedR4, actual);
}
use of com.hederahashgraph.api.proto.java.CurrentAndNextFeeSchedule in project hedera-services by hashgraph.
the class FeesAndRatesProvider method downloadFeeSchedule.
private void downloadFeeSchedule() throws Throwable {
long queryFee = lookupDownloadFee(setup.feeScheduleId());
FileGetContentsResponse response = downloadWith(queryFee, false, setup.feeScheduleId());
byte[] bytes = response.getFileContents().getContents().toByteArray();
CurrentAndNextFeeSchedule wrapper = CurrentAndNextFeeSchedule.parseFrom(bytes);
feeSchedule = typePatching.withPatchedTypesIfNecessary(wrapper.getCurrentFeeSchedule());
log.info("The fee schedule covers " + feeSchedule.getTransactionFeeScheduleList().size() + " ops.");
}
use of com.hederahashgraph.api.proto.java.CurrentAndNextFeeSchedule in project hedera-services by hashgraph.
the class FeesAndRatesProvider method readFeeSchedule.
private void readFeeSchedule() throws Throwable {
File f = new File(setup.clientFeeSchedulePath());
byte[] bytes = Files.readAllBytes(f.toPath());
CurrentAndNextFeeSchedule wrapper = CurrentAndNextFeeSchedule.parseFrom(bytes);
feeSchedule = wrapper.getCurrentFeeSchedule();
log.info("The fee schedule from '" + f.getAbsolutePath() + "' covers " + feeSchedule.getTransactionFeeScheduleList().size() + " ops.");
}
use of com.hederahashgraph.api.proto.java.CurrentAndNextFeeSchedule in project hedera-services by hashgraph.
the class BasicFcfsUsagePricesTest method loadsGoodScheduleUneventfully.
@Test
void loadsGoodScheduleUneventfully() throws Exception {
// setup:
byte[] bytes = Files.toByteArray(new File(R4_FEE_SCHEDULE_REPR_PATH));
CurrentAndNextFeeSchedule expectedFeeSchedules = CurrentAndNextFeeSchedule.parseFrom(bytes);
given(hfs.exists(schedules)).willReturn(true);
given(hfs.cat(schedules)).willReturn(bytes);
// when:
subject.loadPriceSchedules();
// then:
assertEquals(expectedFeeSchedules, subject.feeSchedules);
}
Aggregations