Skip to content

Commit

Permalink
Adjust apitest cases to TradeInfo .proto's price & volume type change
Browse files Browse the repository at this point in the history
  • Loading branch information
ghubstan committed Feb 19, 2022
1 parent e49ab16 commit 543c573
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,12 @@ public static void createXmrPaymentAccounts() {
XMR,
"44G4jWmSvTEfifSUZzTDnJVLPvYATmq9XhhtDqUof1BGCLceG82EQsVYG9Q9GN4bJcjbAJEc1JD1m5G7iK4UPZqACubV4Mq",
false);
log.debug("Alices XMR Account: {}", alicesXmrAcct);
log.trace("Alices XMR Account: {}", alicesXmrAcct);
bobsXmrAcct = bobClient.createCryptoCurrencyPaymentAccount("Bob's XMR Account",
XMR,
"4BDRhdSBKZqAXs3PuNTbMtaXBNqFj5idC2yMVnQj8Rm61AyKY8AxLTt9vGRJ8pwcG4EtpyD8YpGqdZWCZ2VZj6yVBN2RVKs",
false);
log.debug("Bob's XMR Account: {}", bobsXmrAcct);
log.trace("Bob's XMR Account: {}", bobsXmrAcct);
}

@AfterAll
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,15 @@ private void createBsqSwapOffer() {
1_000_000L,
1_000_000L,
"0.00005");
log.debug("BsqSwap Sell BSQ (Buy BTC) OFFER:\n{}", bsqSwapOffer);
log.debug("BsqSwap SELL BSQ (BUY BTC) Offer:\n{}", toOfferTable.apply(bsqSwapOffer));
var newOfferId = bsqSwapOffer.getId();
assertNotEquals("", newOfferId);
assertEquals(BUY.name(), bsqSwapOffer.getDirection());
assertEquals("0.00005000", bsqSwapOffer.getPrice());
assertEquals(1_000_000L, bsqSwapOffer.getAmount());
assertEquals(1_000_000L, bsqSwapOffer.getMinAmount());
assertEquals("200.00", bsqSwapOffer.getVolume());
assertEquals("200.00", bsqSwapOffer.getMinVolume());
assertEquals(BSQ, bsqSwapOffer.getBaseCurrencyCode());
assertEquals(BTC, bsqSwapOffer.getCounterCurrencyCode());

Expand All @@ -142,7 +144,7 @@ private void testGetMyBsqSwapOffer(OfferInfo bsqSwapOffer) {
if (numFetchAttempts >= 9)
fail(format("Alice giving up on fetching her (my) bsq swap offer after %d attempts.", numFetchAttempts), ex);

sleep(1000);
sleep(1500);
}
}
}
Expand All @@ -162,7 +164,7 @@ private void testGetBsqSwapOffer(OfferInfo bsqSwapOffer) {
if (numFetchAttempts > 9)
fail(format("Bob gave up on fetching available bsq swap offer after %d attempts.", numFetchAttempts), ex);

sleep(1000);
sleep(1500);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ private boolean isCalculatedPriceWithinErrorTolerance(double delta,
actualDiffPct,
mktPrice,
scaledOfferPrice);
log.warn(offer.toString());
log.trace(offer.toString());
}

return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,7 @@ public void testEditBsqSwapOfferShouldThrowException() {
1_250_000L,
750_000L,
"0.00005");
log.debug("BsqSwap Buy BSQ (Buy BTC) offer:\n{}", originalOffer);
log.debug("BsqSwap BUY BSQ (SELL BTC) Offer:\n{}", toOfferTable.apply(originalOffer));
var newOfferId = originalOffer.getId();
assertNotEquals("", newOfferId);
assertEquals(SELL.name(), originalOffer.getDirection());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ protected final void waitForSellerSeesPaymentInitiatedMessage(Logger log,

TradeInfo trade = grpcClient.getTrade(tradeId);
if (!isTradeInPaymentReceiptConfirmedStateAndPhase.test(trade)) {
fail(format("INVALID_PHASE for {}'s trade %s in STATE=%s PHASE=%s, cannot confirm payment received.",
fail(format("INVALID_PHASE for %s's trade %s in STATE=%s PHASE=%s, cannot confirm payment received.",
userName,
trade.getShortId(),
trade.getState(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
Expand All @@ -49,7 +48,7 @@
import bisq.apitest.method.offer.AbstractOfferTest;
import bisq.cli.GrpcClient;

@Disabled
// @Disabled
@Slf4j
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
public class BsqSwapBuyBtcTradeTest extends AbstractTradeTest {
Expand Down Expand Up @@ -85,7 +84,7 @@ public void testAliceCreateBsqSwapBuyBtcOffer() {
1_000_000L, // 0.01 BTC
1_000_000L,
"0.00005");
log.debug("Pending BsqSwap Sell BSQ (Buy BTC) OFFER:\n{}", toOfferTable.apply(mySwapOffer));
log.debug("Pending BsqSwap SELL BSQ (BUY BTC) Offer:\n{}", toOfferTable.apply(mySwapOffer));
var newOfferId = mySwapOffer.getId();
assertNotEquals("", newOfferId);
assertEquals(OfferDirection.BUY.name(), mySwapOffer.getDirection());
Expand All @@ -98,7 +97,7 @@ public void testAliceCreateBsqSwapBuyBtcOffer() {
genBtcBlocksThenWait(1, 2_500);

mySwapOffer = aliceClient.getOffer(newOfferId);
log.debug("My fetched BsqSwap Sell BSQ (Buy BTC) OFFER:\n{}", toOfferTable.apply(mySwapOffer));
log.debug("My fetched BsqSwap SELL BSQ (BUY BTC) Offer:\n{}", toOfferTable.apply(mySwapOffer));
assertNotEquals(0, mySwapOffer.getMakerFee());

runCliGetOffer(newOfferId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public void testAliceCreateBsqSwapSellBtcOffer() {
1_000_000L, // 0.01 BTC
1_000_000L,
"0.00005");
log.debug("Pending BsqSwap Buy BSQ (Sell BTC) OFFER:\n{}", toOfferTable.apply(mySwapOffer));
log.debug("Pending BsqSwap BUY BSQ (SELL BTC) Offer:\n{}", toOfferTable.apply(mySwapOffer));
var newOfferId = mySwapOffer.getId();
assertNotEquals("", newOfferId);
assertEquals(SELL.name(), mySwapOffer.getDirection());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public void testTakeAlicesSellBTCForXMROffer(final TestInfo testInfo) {
getDefaultBuyerSecurityDepositAsPercent(),
alicesXmrAcct.getId(),
TRADE_FEE_CURRENCY_CODE);
log.debug("Alice's Buy XMR (Sell BTC) offer:\n{}", new TableBuilder(OFFER_TBL, alicesOffer).build());
log.debug("Alice's BUY XMR (SELL BTC) Offer:\n{}", new TableBuilder(OFFER_TBL, alicesOffer).build());
genBtcBlocksThenWait(1, 5000);
var offerId = alicesOffer.getId();
assertFalse(alicesOffer.getIsCurrencyForMakerFeeBtc());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public void testTakeAlicesBuyBTCForXMROffer(final TestInfo testInfo) {
alicesXmrAcct.getId(),
TRADE_FEE_CURRENCY_CODE,
NO_TRIGGER_PRICE);
log.debug("Alice's SELL XMR (Buy BTC) offer:\n{}", new TableBuilder(OFFER_TBL, alicesOffer).build());
log.debug("Alice's SELL XMR (BUY BTC) Offer:\n{}", new TableBuilder(OFFER_TBL, alicesOffer).build());
genBtcBlocksThenWait(1, 4000);
var offerId = alicesOffer.getId();
assertTrue(alicesOffer.getIsCurrencyForMakerFeeBtc());
Expand Down

0 comments on commit 543c573

Please sign in to comment.