diff --git a/apitest/src/test/java/bisq/apitest/method/offer/BsqSwapOfferTest.java b/apitest/src/test/java/bisq/apitest/method/offer/BsqSwapOfferTest.java index c46da2ea5d..227613b984 100644 --- a/apitest/src/test/java/bisq/apitest/method/offer/BsqSwapOfferTest.java +++ b/apitest/src/test/java/bisq/apitest/method/offer/BsqSwapOfferTest.java @@ -23,6 +23,7 @@ import lombok.extern.slf4j.Slf4j; 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; @@ -37,7 +38,7 @@ import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.junit.jupiter.api.Assertions.fail; import static protobuf.OfferDirection.BUY; -// @Disabled +@Disabled @Slf4j @TestMethodOrder(MethodOrderer.OrderAnnotation.class) public class BsqSwapOfferTest extends AbstractOfferTest { diff --git a/apitest/src/test/java/bisq/apitest/method/trade/BsqSwapTradeTest.java b/apitest/src/test/java/bisq/apitest/method/trade/BsqSwapTradeTest.java index f9463c6111..8c72275658 100644 --- a/apitest/src/test/java/bisq/apitest/method/trade/BsqSwapTradeTest.java +++ b/apitest/src/test/java/bisq/apitest/method/trade/BsqSwapTradeTest.java @@ -29,6 +29,7 @@ import lombok.extern.slf4j.Slf4j; 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; @@ -47,7 +48,7 @@ import static protobuf.OfferDirection.BUY; import bisq.apitest.method.offer.AbstractOfferTest; -// @Disabled +@Disabled @Slf4j @TestMethodOrder(MethodOrderer.OrderAnnotation.class) public class BsqSwapTradeTest extends AbstractOfferTest { diff --git a/apitest/src/test/java/bisq/apitest/scenario/OfferTest.java b/apitest/src/test/java/bisq/apitest/scenario/OfferTest.java index 41ac197f1b..e52916bad8 100644 --- a/apitest/src/test/java/bisq/apitest/scenario/OfferTest.java +++ b/apitest/src/test/java/bisq/apitest/scenario/OfferTest.java @@ -28,6 +28,7 @@ import org.junit.jupiter.api.TestMethodOrder; import bisq.apitest.method.offer.AbstractOfferTest; +import bisq.apitest.method.offer.BsqSwapOfferTest; import bisq.apitest.method.offer.CancelOfferTest; import bisq.apitest.method.offer.CreateBSQOffersTest; import bisq.apitest.method.offer.CreateOfferUsingFixedPriceTest; @@ -90,6 +91,19 @@ public class OfferTest extends AbstractOfferTest { @Test @Order(6) + public void testCreateBSQSwapOffers() { + BsqSwapOfferTest test = new BsqSwapOfferTest(); + BsqSwapOfferTest.createBsqSwapBsqPaymentAccounts(); + test.testAliceCreateBsqSwapBuyOffer1(); + test.testAliceCreateBsqSwapBuyOffer2(); + test.testAliceCreateBsqSwapBuyOffer3(); + test.testAliceCreateBsqSwapBuyOffer4(); + test.testGetMyBsqSwapOffers(); + test.testGetAvailableBsqSwapOffers(); + } + + @Test + @Order(7) public void testEditOffer() { EditOfferTest test = new EditOfferTest(); // Edit fiat offer tests diff --git a/apitest/src/test/java/bisq/apitest/scenario/TradeTest.java b/apitest/src/test/java/bisq/apitest/scenario/TradeTest.java index 1cd4054d61..becb62f918 100644 --- a/apitest/src/test/java/bisq/apitest/scenario/TradeTest.java +++ b/apitest/src/test/java/bisq/apitest/scenario/TradeTest.java @@ -29,6 +29,7 @@ import org.junit.jupiter.api.TestMethodOrder; import bisq.apitest.method.trade.AbstractTradeTest; +import bisq.apitest.method.trade.BsqSwapTradeTest; import bisq.apitest.method.trade.TakeBuyBSQOfferTest; import bisq.apitest.method.trade.TakeBuyBTCOfferTest; import bisq.apitest.method.trade.TakeBuyBTCOfferWithNationalBankAcctTest; @@ -97,4 +98,13 @@ public class TradeTest extends AbstractTradeTest { test.testBobsConfirmPaymentReceived(testInfo); test.testAlicesBtcWithdrawalToExternalAddress(testInfo); } + + @Test + @Order(6) + public void testBsqSwapTradeTest(final TestInfo testInfo) { + BsqSwapTradeTest test = new BsqSwapTradeTest(); + test.createBsqSwapBsqPaymentAccounts(); + test.testAliceCreateBsqSwapBuyOffer(); + test.testBobTakesBsqSwapOffer(); + } } diff --git a/core/src/main/java/bisq/core/api/CoreApi.java b/core/src/main/java/bisq/core/api/CoreApi.java index 53a43806a8..380fd670ca 100644 --- a/core/src/main/java/bisq/core/api/CoreApi.java +++ b/core/src/main/java/bisq/core/api/CoreApi.java @@ -135,8 +135,8 @@ public class CoreApi { return coreOffersService.getMyBsqSwapOffer(id); } - public List getBsqSwapOffers(String direction, String currencyCode) { - return coreOffersService.getBsqSwapOffers(direction, currencyCode); + public List getBsqSwapOffers(String direction) { + return coreOffersService.getBsqSwapOffers(direction); } public List getOffers(String direction, String currencyCode) { @@ -147,8 +147,8 @@ public class CoreApi { return coreOffersService.getMyOffers(direction, currencyCode); } - public List getMyBsqSwapOffers(String direction, String currencyCode) { - return coreOffersService.getMyBsqSwapOffers(direction, currencyCode); + public List getMyBsqSwapOffers(String direction) { + return coreOffersService.getMyBsqSwapOffers(direction); } public OpenOffer getMyOpenBsqSwapOffer(String id) { diff --git a/core/src/main/java/bisq/core/api/CoreOffersService.java b/core/src/main/java/bisq/core/api/CoreOffersService.java index 99fc1871a2..adbcee01dd 100644 --- a/core/src/main/java/bisq/core/api/CoreOffersService.java +++ b/core/src/main/java/bisq/core/api/CoreOffersService.java @@ -155,10 +155,10 @@ class CoreOffersService { } - List getBsqSwapOffers(String direction, String currencyCode) { + List getBsqSwapOffers(String direction) { var offers = offerBookService.getOffers().stream() .filter(o -> !o.isMyOffer(keyRing)) - .filter(o -> offerMatchesDirectionAndCurrency(o, direction, currencyCode)) + .filter(o -> o.getDirection().name().equalsIgnoreCase(direction)) .filter(o -> o.isBsqSwapOffer()) .sorted(priceComparator(direction)) .collect(Collectors.toList()); @@ -182,10 +182,10 @@ class CoreOffersService { .collect(Collectors.toList()); } - List getMyBsqSwapOffers(String direction, String currencyCode) { + List getMyBsqSwapOffers(String direction) { var offers = offerBookService.getOffers().stream() .filter(o -> o.isMyOffer(keyRing)) - .filter(o -> offerMatchesDirectionAndCurrency(o, direction, currencyCode)) + .filter(o -> o.getDirection().name().equalsIgnoreCase(direction)) .filter(Offer::isBsqSwapOffer) .sorted(priceComparator(direction)) .collect(Collectors.toList()); diff --git a/daemon/src/main/java/bisq/daemon/grpc/GrpcOffersService.java b/daemon/src/main/java/bisq/daemon/grpc/GrpcOffersService.java index 3aa453c202..bafd4c17d0 100644 --- a/daemon/src/main/java/bisq/daemon/grpc/GrpcOffersService.java +++ b/daemon/src/main/java/bisq/daemon/grpc/GrpcOffersService.java @@ -145,7 +145,7 @@ class GrpcOffersService extends OffersImplBase { public void getBsqSwapOffers(GetOffersRequest req, StreamObserver responseObserver) { try { - List result = coreApi.getBsqSwapOffers(req.getDirection(), req.getCurrencyCode()) + List result = coreApi.getBsqSwapOffers(req.getDirection()) .stream().map(BsqSwapOfferInfo::toBsqSwapOfferInfo) .collect(Collectors.toList()); var reply = GetBsqSwapOffersReply.newBuilder() @@ -183,7 +183,7 @@ class GrpcOffersService extends OffersImplBase { public void getMyBsqSwapOffers(GetMyOffersRequest req, StreamObserver responseObserver) { try { - List result = coreApi.getMyBsqSwapOffers(req.getDirection(), req.getCurrencyCode()) + List result = coreApi.getMyBsqSwapOffers(req.getDirection()) .stream().map(BsqSwapOfferInfo::toBsqSwapOfferInfo) .collect(Collectors.toList()); var reply = GetMyBsqSwapOffersReply.newBuilder()