use of com.hedera.mirror.common.domain.entity.AbstractEntity in project hedera-mirror-node by hashgraph.
the class AbstractTransactionHandlerTest method getExpectedUpdatedEntity.
protected AbstractEntity getExpectedUpdatedEntity() {
AbstractEntity entity = getExpectedEntityWithTimestamp();
TransactionBody defaultBody = getDefaultTransactionBody().build();
Message innerBody = getInnerBody(defaultBody);
List<String> fieldNames = innerBody.getDescriptorForType().getFields().stream().map(FieldDescriptor::getName).collect(Collectors.toList());
for (String fieldName : fieldNames) {
switch(fieldName) {
case "adminKey":
entity.setKey(DEFAULT_KEY.toByteArray());
break;
case "autoRenewPeriod":
entity.setAutoRenewPeriod(DEFAULT_AUTO_RENEW_PERIOD.getSeconds());
break;
case "expiry":
case "expirationTime":
entity.setExpirationTimestamp(DomainUtils.timestampInNanosMax(DEFAULT_EXPIRATION_TIME));
break;
case "keys":
entity.setKey(DEFAULT_KEY_LIST.toByteArray());
break;
case "receiverSigRequired":
if (entity instanceof Entity) {
((Entity) entity).setReceiverSigRequired(DEFAULT_RECEIVER_SIG_REQUIRED);
}
break;
case "submitKey":
if (entity instanceof Entity) {
((Entity) entity).setSubmitKey(DEFAULT_SUBMIT_KEY.toByteArray());
}
break;
default:
break;
}
}
return entity;
}
use of com.hedera.mirror.common.domain.entity.AbstractEntity in project hedera-mirror-node by hashgraph.
the class AbstractEntityRecordItemListenerTest method assertEntity.
protected void assertEntity(AbstractEntity expected) {
AbstractEntity actual = getEntity(expected.toEntityId());
assertThat(actual).isEqualTo(expected);
}
use of com.hedera.mirror.common.domain.entity.AbstractEntity in project hedera-mirror-node by hashgraph.
the class ContractCreateTransactionHandlerTest method getUpdateEntityTestSpecsForCreateTransaction.
@Override
protected List<UpdateEntityTestSpec> getUpdateEntityTestSpecsForCreateTransaction(Descriptors.FieldDescriptor memoField) {
List<UpdateEntityTestSpec> testSpecs = super.getUpdateEntityTestSpecsForCreateTransaction(memoField);
TransactionBody body = getTransactionBodyForUpdateEntityWithoutMemo();
Message innerBody = getInnerBody(body);
body = getTransactionBody(body, innerBody);
byte[] evmAddress = TestUtils.generateRandomByteArray(20);
var contractCreateResult = ContractFunctionResult.newBuilder().setEvmAddress(BytesValue.of(ByteString.copyFrom(evmAddress)));
var recordBuilder = getDefaultTransactionRecord().setContractCreateResult(contractCreateResult);
AbstractEntity expected = getExpectedUpdatedEntity();
((Contract) expected).setEvmAddress(evmAddress);
expected.setMemo("");
testSpecs.add(UpdateEntityTestSpec.builder().description("create contract entity with evm address in record").expected(expected).recordItem(getRecordItem(body, recordBuilder.build())).build());
return testSpecs;
}
use of com.hedera.mirror.common.domain.entity.AbstractEntity in project hedera-mirror-node by hashgraph.
the class CryptoCreateTransactionHandlerTest method getExpectedUpdatedEntity.
@Override
protected AbstractEntity getExpectedUpdatedEntity() {
AbstractEntity entity = super.getExpectedUpdatedEntity();
entity.setMaxAutomaticTokenAssociations(0);
return entity;
}
Aggregations