Search in sources :

Example 1 with DataTableType

use of io.cucumber.java.DataTableType in project bluezone by jmgarridopaz.

the class PermitStepDefs method permitRequestEntry.

// @When("I do the following issue permit request at {string}:")
// public void iDoTheFollowingIssuePermitRequestAt ( String aString, PermitRequest permitRequest ) {
// ForParkingCars forParkingCars = this.scenarioContext.systemUnderTest();
// LocalDateTime currentDateTime = LocalDateTime.parse ( aString, DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm") );
// Clock clockWithCurrentDateTime = Clock.fixed ( currentDateTime.toInstant(ZoneOffset.UTC), ZoneOffset.UTC );
// PermitTicket permitTicket = forParkingCars.issuePermit ( clockWithCurrentDateTime, permitRequest );
// this.scenarioContext.setIssuedPermitTicket(permitTicket);
// }
// 
// 
// @Then("I should get the following issue permit response:")
// public void iShouldGetTheFollowingIssuePermitResponse ( PermitTicket expectedPermitTicket) {
// assertThat ( this.scenarioContext.getIssuedPermitTicket(), is(expectedPermitTicket) );
// }
@DataTableType
public ParkingRequest permitRequestEntry(Map<String, String> dataTableEntry) {
    LocalDateTime currentDateTime = LocalDateTime.parse(dataTableEntry.get("current date time"), DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss"));
    Clock clockWithCurrentDateTime = Clock.fixed(currentDateTime.toInstant(ZoneOffset.UTC), ZoneOffset.UTC);
    LocalDateTime endingDateTime = LocalDateTime.parse(dataTableEntry.get("ending date time"), DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm"));
    ParkingRequest permitRequest = new ParkingRequest();
    permitRequest.setClock(clockWithCurrentDateTime);
    permitRequest.setCarPlate(dataTableEntry.get("car plate"));
    permitRequest.setRateName(dataTableEntry.get("rate name"));
    permitRequest.setEndingDateTime(endingDateTime);
    permitRequest.setPaymentCardNumber(dataTableEntry.get("payment card number"));
    return permitRequest;
}
Also used : LocalDateTime(java.time.LocalDateTime) ParkingRequest(io.github.jmgarridopaz.bluezone.hexagon.ParkingRequest) Clock(java.time.Clock) DataTableType(io.cucumber.java.DataTableType)

Example 2 with DataTableType

use of io.cucumber.java.DataTableType in project bluezone by jmgarridopaz.

the class PermitStepDefs method permitTicketEntry.

@DataTableType
public PermitTicket permitTicketEntry(Map<String, String> dataTableEntry) {
    LocalDateTime startingDateTime = LocalDateTime.parse(dataTableEntry.get("starting date time"), DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm"));
    LocalDateTime endingDateTime = LocalDateTime.parse(dataTableEntry.get("ending date time"), DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm"));
    PermitTicket permitTicket = new PermitTicket();
    permitTicket.setCode(dataTableEntry.get("code"));
    permitTicket.setCarPlate(dataTableEntry.get("car plate"));
    permitTicket.setStartingDateTime(startingDateTime);
    permitTicket.setEndingDateTime(endingDateTime);
    permitTicket.setRateName(dataTableEntry.get("rate name"));
    permitTicket.setPrice(new BigDecimal(dataTableEntry.get("price")));
    return permitTicket;
}
Also used : LocalDateTime(java.time.LocalDateTime) PermitTicket(io.github.jmgarridopaz.bluezone.hexagon.PermitTicket) BigDecimal(java.math.BigDecimal) DataTableType(io.cucumber.java.DataTableType)

Example 3 with DataTableType

use of io.cucumber.java.DataTableType in project hedera-mirror-node by hashgraph.

the class CustomFeesConverter method customFee.

@DataTableType
public CustomFee customFee(Map<String, String> entry) {
    String amount = entry.get("amount");
    AccountId collector = tokenFeature.getRecipientAccountId(Integer.parseInt(entry.get("collector")));
    if (Strings.isNotEmpty(amount)) {
        // fixed fee
        CustomFixedFee fixedFee = new CustomFixedFee();
        fixedFee.setAmount(Long.parseLong(amount));
        fixedFee.setFeeCollectorAccountId(collector);
        fixedFee.setDenominatingTokenId(getTokenId(entry.get("token")));
        return fixedFee;
    } else {
        CustomFractionalFee fractionalFee = new CustomFractionalFee();
        fractionalFee.setNumerator(Long.parseLong(entry.get("numerator")));
        fractionalFee.setDenominator(Long.parseLong(entry.get("denominator")));
        fractionalFee.setFeeCollectorAccountId(collector);
        fractionalFee.setMax(getValueOrDefault(entry.get("maximum")));
        fractionalFee.setMin(getValueOrDefault(entry.get("minimum")));
        return fractionalFee;
    }
}
Also used : CustomFractionalFee(com.hedera.hashgraph.sdk.CustomFractionalFee) AccountId(com.hedera.hashgraph.sdk.AccountId) CustomFixedFee(com.hedera.hashgraph.sdk.CustomFixedFee) DataTableType(io.cucumber.java.DataTableType)

Example 4 with DataTableType

use of io.cucumber.java.DataTableType in project hedera-mirror-node by hashgraph.

the class CustomFeesConverter method mirrorAssessedCustomFee.

@DataTableType
public MirrorAssessedCustomFee mirrorAssessedCustomFee(Map<String, String> entry) {
    MirrorAssessedCustomFee assessedCustomFee = new MirrorAssessedCustomFee();
    assessedCustomFee.setAmount(Long.parseLong(entry.get("amount")));
    assessedCustomFee.setCollectorAccountId(tokenFeature.getRecipientAccountId(Integer.parseInt(entry.get("collector"))).toString());
    assessedCustomFee.setTokenId(getToken(entry.get("token")));
    return assessedCustomFee;
}
Also used : MirrorAssessedCustomFee(com.hedera.mirror.test.e2e.acceptance.props.MirrorAssessedCustomFee) DataTableType(io.cucumber.java.DataTableType)

Example 5 with DataTableType

use of io.cucumber.java.DataTableType in project bluezone by jmgarridopaz.

the class RateStepDefs method rateEntry.

@DataTableType
public RateData rateEntry(Map<String, String> entry) {
    RateData rate = new RateData();
    rate.setName(entry.get("name"));
    rate.setAmountPerHour(new BigDecimal(entry.get("amount per hour")));
    rate.setMinMinutesAllowed(Integer.parseInt(entry.get("min minutes allowed")));
    rate.setMaxMinutesAllowed(Integer.parseInt(entry.get("max minutes allowed")));
    return rate;
}
Also used : RateData(io.github.jmgarridopaz.bluezone.hexagon.RateData) BigDecimal(java.math.BigDecimal) DataTableType(io.cucumber.java.DataTableType)

Aggregations

DataTableType (io.cucumber.java.DataTableType)5 BigDecimal (java.math.BigDecimal)2 LocalDateTime (java.time.LocalDateTime)2 AccountId (com.hedera.hashgraph.sdk.AccountId)1 CustomFixedFee (com.hedera.hashgraph.sdk.CustomFixedFee)1 CustomFractionalFee (com.hedera.hashgraph.sdk.CustomFractionalFee)1 MirrorAssessedCustomFee (com.hedera.mirror.test.e2e.acceptance.props.MirrorAssessedCustomFee)1 ParkingRequest (io.github.jmgarridopaz.bluezone.hexagon.ParkingRequest)1 PermitTicket (io.github.jmgarridopaz.bluezone.hexagon.PermitTicket)1 RateData (io.github.jmgarridopaz.bluezone.hexagon.RateData)1 Clock (java.time.Clock)1