From abf032cb22c7af12bd757079580d874b46de4ef2 Mon Sep 17 00:00:00 2001 From: Christoph Sturm Date: Tue, 13 Aug 2019 16:39:40 +0200 Subject: [PATCH 01/17] put the jdk10 instructions in the readme for easier discovery. --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 14238b9b83f..61764cdd769 100644 --- a/README.md +++ b/README.md @@ -17,4 +17,12 @@ Follow the step-by-step instructions at https://bisq.network/get-started. ## Contribute to Bisq +Bisq currently requires JDK 10 . See the scripts directory for scripts that can be used to install and configure the JDK automatically. + +TIP: If you are on MacOS, run the script with this command . scripts/install_java.sh. + +If you prefer not to run scripts or change your default java, you can use Adoptopenjdk https://adoptopenjdk.net/archive.html. Just untar it where you like, and set java home when running gradle. for example: `JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-10.0.2+13/Contents/Home ./gradlew clean build + + + See [CONTRIBUTING.md](CONTRIBUTING.md) and the [developer docs](docs#readme). From c0d8bc715749ac12f4a2e4d40773147d22d0732d Mon Sep 17 00:00:00 2001 From: Christoph Sturm Date: Tue, 13 Aug 2019 16:48:36 +0200 Subject: [PATCH 02/17] fix link to docs readme --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 61764cdd769..eb68ebd923e 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ Follow the step-by-step instructions at https://bisq.network/get-started. ## Contribute to Bisq +<<<<<<< Updated upstream Bisq currently requires JDK 10 . See the scripts directory for scripts that can be used to install and configure the JDK automatically. TIP: If you are on MacOS, run the script with this command . scripts/install_java.sh. @@ -25,4 +26,4 @@ If you prefer not to run scripts or change your default java, you can use Adopto -See [CONTRIBUTING.md](CONTRIBUTING.md) and the [developer docs](docs#readme). +See [CONTRIBUTING.md](CONTRIBUTING.md) and the [developer docs](docs/README.md). From 9a587609ddf0cdb2ccc1a932b9ac267fe33e9f2e Mon Sep 17 00:00:00 2001 From: Christoph Sturm Date: Tue, 13 Aug 2019 17:47:53 +0200 Subject: [PATCH 03/17] WIP remove powermock --- build.gradle | 3 +-- .../core/dao/governance/period/PeriodService.java | 2 +- .../src/main/java/bisq/core/offer/OfferPayload.java | 2 +- core/src/main/java/bisq/core/user/Preferences.java | 2 +- .../core/arbitration/ArbitratorManagerTest.java | 13 ------------- .../btc/nodes/BtcNodesSetupPreferencesTest.java | 8 -------- .../governance/ballot/BallotListServiceTest.java | 6 ------ .../core/dao/state/DaoStateSnapshotServiceTest.java | 8 -------- core/src/test/java/bisq/core/offer/OfferTest.java | 8 -------- .../java/bisq/core/offer/OpenOfferManagerTest.java | 8 -------- .../java/bisq/core/payment/PaymentAccountsTest.java | 8 -------- .../bisq/core/payment/ReceiptPredicatesTest.java | 8 -------- .../bisq/core/payment/ReceiptValidatorTest.java | 9 --------- .../java/bisq/core/payment/TradeLimitsTest.java | 6 ------ .../test/java/bisq/core/trade/TradableListTest.java | 9 ++++----- .../test/java/bisq/core/user/PreferencesTest.java | 8 -------- .../org.mockito.plugins.MockMaker | 1 + 17 files changed, 9 insertions(+), 100 deletions(-) create mode 100644 core/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker diff --git a/build.gradle b/build.gradle index dd82c33ea54..ee601c60ff6 100644 --- a/build.gradle +++ b/build.gradle @@ -40,7 +40,7 @@ configure(subprojects) { bitcoinjVersion = 'a88d36d' logbackVersion = '1.1.10' lombokVersion = '1.18.2' - mockitoVersion = '2.21.0' + mockitoVersion = '3.0.0' powermockVersion = '2.0.0-beta.5' protobufVersion = '3.5.1' slf4jVersion = '1.7.22' @@ -251,7 +251,6 @@ configure(project(':core')) { testCompile "org.jmockit:jmockit:$jmockitVersion" testCompile("org.mockito:mockito-core:$mockitoVersion") { - exclude(module: 'objenesis') } testCompile "org.powermock:powermock-module-junit4:$powermockVersion" testCompile "org.powermock:powermock-api-mockito2:$powermockVersion" diff --git a/core/src/main/java/bisq/core/dao/governance/period/PeriodService.java b/core/src/main/java/bisq/core/dao/governance/period/PeriodService.java index 18ea9b61912..dfe18cb07a5 100644 --- a/core/src/main/java/bisq/core/dao/governance/period/PeriodService.java +++ b/core/src/main/java/bisq/core/dao/governance/period/PeriodService.java @@ -32,7 +32,7 @@ import javax.annotation.Nullable; @Slf4j -public final class PeriodService { +public class PeriodService { private final DaoStateService daoStateService; diff --git a/core/src/main/java/bisq/core/offer/OfferPayload.java b/core/src/main/java/bisq/core/offer/OfferPayload.java index 0e131360cff..a81f4e02f4d 100644 --- a/core/src/main/java/bisq/core/offer/OfferPayload.java +++ b/core/src/main/java/bisq/core/offer/OfferPayload.java @@ -51,7 +51,7 @@ @EqualsAndHashCode @Getter @Slf4j -public final class OfferPayload implements ProtectedStoragePayload, ExpirablePayload, RequiresOwnerIsOnlinePayload { +public class OfferPayload implements ProtectedStoragePayload, ExpirablePayload, RequiresOwnerIsOnlinePayload { /////////////////////////////////////////////////////////////////////////////////////////// // Enum diff --git a/core/src/main/java/bisq/core/user/Preferences.java b/core/src/main/java/bisq/core/user/Preferences.java index 52e96b90dad..1d504ec98e3 100644 --- a/core/src/main/java/bisq/core/user/Preferences.java +++ b/core/src/main/java/bisq/core/user/Preferences.java @@ -76,7 +76,7 @@ @Slf4j @Singleton -public final class Preferences implements PersistedDataHost, BridgeAddressProvider { +public class Preferences implements PersistedDataHost, BridgeAddressProvider { private static final ArrayList BTC_MAIN_NET_EXPLORERS = new ArrayList<>(Arrays.asList( new BlockChainExplorer("Blockstream.info", "https://blockstream.info/tx/", "https://blockstream.info/address/"), diff --git a/core/src/test/java/bisq/core/arbitration/ArbitratorManagerTest.java b/core/src/test/java/bisq/core/arbitration/ArbitratorManagerTest.java index a5ae6a713fc..6f10abc21b7 100644 --- a/core/src/test/java/bisq/core/arbitration/ArbitratorManagerTest.java +++ b/core/src/test/java/bisq/core/arbitration/ArbitratorManagerTest.java @@ -21,19 +21,9 @@ import bisq.network.p2p.NodeAddress; -import org.bouncycastle.jce.provider.BouncyCastleProvider; - -import java.security.Security; - import java.util.ArrayList; -import org.powermock.core.classloader.annotations.PowerMockIgnore; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; - -import org.junit.Before; import org.junit.Test; -import org.junit.runner.RunWith; import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.collection.IsIterableContainingInAnyOrder.containsInAnyOrder; @@ -42,9 +32,6 @@ import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.mock; -@RunWith(PowerMockRunner.class) -@PrepareForTest({User.class, ArbitratorService.class}) -@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*"}) public class ArbitratorManagerTest { diff --git a/core/src/test/java/bisq/core/btc/nodes/BtcNodesSetupPreferencesTest.java b/core/src/test/java/bisq/core/btc/nodes/BtcNodesSetupPreferencesTest.java index 20077fc01f7..12ea77c41c2 100644 --- a/core/src/test/java/bisq/core/btc/nodes/BtcNodesSetupPreferencesTest.java +++ b/core/src/test/java/bisq/core/btc/nodes/BtcNodesSetupPreferencesTest.java @@ -22,12 +22,7 @@ import java.util.List; -import org.powermock.core.classloader.annotations.PowerMockIgnore; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; - import org.junit.Test; -import org.junit.runner.RunWith; import static bisq.core.btc.nodes.BtcNodes.BitcoinNodesOption.CUSTOM; import static bisq.core.btc.nodes.BtcNodes.BitcoinNodesOption.PUBLIC; @@ -36,9 +31,6 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -@RunWith(PowerMockRunner.class) -@PrepareForTest(Preferences.class) -@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*"}) public class BtcNodesSetupPreferencesTest { @Test public void testSelectPreferredNodesWhenPublicOption() { diff --git a/core/src/test/java/bisq/core/dao/governance/ballot/BallotListServiceTest.java b/core/src/test/java/bisq/core/dao/governance/ballot/BallotListServiceTest.java index 56a48de49c5..f6b912497fb 100644 --- a/core/src/test/java/bisq/core/dao/governance/ballot/BallotListServiceTest.java +++ b/core/src/test/java/bisq/core/dao/governance/ballot/BallotListServiceTest.java @@ -11,11 +11,7 @@ import javafx.collections.FXCollections; import javafx.collections.ObservableList; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; - import org.junit.Test; -import org.junit.runner.RunWith; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.RETURNS_DEEP_STUBS; @@ -23,8 +19,6 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -@RunWith(PowerMockRunner.class) -@PrepareForTest({PeriodService.class, ProposalPayload.class, ProposalValidatorProvider.class}) public class BallotListServiceTest { @Test @SuppressWarnings("unchecked") diff --git a/core/src/test/java/bisq/core/dao/state/DaoStateSnapshotServiceTest.java b/core/src/test/java/bisq/core/dao/state/DaoStateSnapshotServiceTest.java index d2730b7c303..5522350f45d 100644 --- a/core/src/test/java/bisq/core/dao/state/DaoStateSnapshotServiceTest.java +++ b/core/src/test/java/bisq/core/dao/state/DaoStateSnapshotServiceTest.java @@ -20,22 +20,14 @@ import bisq.core.dao.governance.period.CycleService; import bisq.core.dao.monitoring.DaoStateMonitoringService; -import org.powermock.core.classloader.annotations.PowerMockIgnore; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; - import org.junit.Before; import org.junit.Test; -import org.junit.runner.RunWith; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.powermock.api.mockito.PowerMockito.mock; -@RunWith(PowerMockRunner.class) -@PrepareForTest({DaoStateService.class, GenesisTxInfo.class, CycleService.class, DaoStateStorageService.class, DaoStateMonitoringService.class}) -@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*"}) public class DaoStateSnapshotServiceTest { private DaoStateSnapshotService daoStateSnapshotService; diff --git a/core/src/test/java/bisq/core/offer/OfferTest.java b/core/src/test/java/bisq/core/offer/OfferTest.java index c8d64dc76cb..9300c01574e 100644 --- a/core/src/test/java/bisq/core/offer/OfferTest.java +++ b/core/src/test/java/bisq/core/offer/OfferTest.java @@ -17,21 +17,13 @@ package bisq.core.offer; -import org.powermock.core.classloader.annotations.PowerMockIgnore; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; - import org.junit.Test; -import org.junit.runner.RunWith; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -@RunWith(PowerMockRunner.class) -@PrepareForTest(OfferPayload.class) -@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*"}) public class OfferTest { @Test diff --git a/core/src/test/java/bisq/core/offer/OpenOfferManagerTest.java b/core/src/test/java/bisq/core/offer/OpenOfferManagerTest.java index 4abf33e2199..41df4299fbb 100644 --- a/core/src/test/java/bisq/core/offer/OpenOfferManagerTest.java +++ b/core/src/test/java/bisq/core/offer/OpenOfferManagerTest.java @@ -9,12 +9,7 @@ import java.util.concurrent.atomic.AtomicBoolean; -import org.powermock.core.classloader.annotations.PowerMockIgnore; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; - import org.junit.Test; -import org.junit.runner.RunWith; import static bisq.core.offer.OfferMaker.btcUsdOffer; import static com.natpryce.makeiteasy.MakeItEasy.make; @@ -22,9 +17,6 @@ import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.*; -@RunWith(PowerMockRunner.class) -@PrepareForTest({P2PService.class, PeerManager.class, OfferBookService.class, Storage.class}) -@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*"}) public class OpenOfferManagerTest { @Test diff --git a/core/src/test/java/bisq/core/payment/PaymentAccountsTest.java b/core/src/test/java/bisq/core/payment/PaymentAccountsTest.java index 82f9c5f6348..8402ebab474 100644 --- a/core/src/test/java/bisq/core/payment/PaymentAccountsTest.java +++ b/core/src/test/java/bisq/core/payment/PaymentAccountsTest.java @@ -28,12 +28,7 @@ import java.util.Set; import java.util.function.BiFunction; -import org.powermock.core.classloader.annotations.PowerMockIgnore; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; - import org.junit.Test; -import org.junit.runner.RunWith; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; @@ -42,9 +37,6 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -@RunWith(PowerMockRunner.class) -@PrepareForTest({PaymentAccount.class, AccountAgeWitness.class}) -@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*"}) public class PaymentAccountsTest { @Test public void testGetOldestPaymentAccountForOfferWhenNoValidAccounts() { diff --git a/core/src/test/java/bisq/core/payment/ReceiptPredicatesTest.java b/core/src/test/java/bisq/core/payment/ReceiptPredicatesTest.java index 6c6933824a6..8ee55d018ee 100644 --- a/core/src/test/java/bisq/core/payment/ReceiptPredicatesTest.java +++ b/core/src/test/java/bisq/core/payment/ReceiptPredicatesTest.java @@ -23,21 +23,13 @@ import com.google.common.collect.Lists; -import org.powermock.core.classloader.annotations.PowerMockIgnore; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; - import org.junit.Test; -import org.junit.runner.RunWith; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -@RunWith(PowerMockRunner.class) -@PrepareForTest({NationalBankAccount.class, SepaAccount.class, SepaInstantAccount.class, PaymentMethod.class, SameBankAccount.class, SpecificBanksAccount.class}) -@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*"}) public class ReceiptPredicatesTest { private final ReceiptPredicates predicates = new ReceiptPredicates(); diff --git a/core/src/test/java/bisq/core/payment/ReceiptValidatorTest.java b/core/src/test/java/bisq/core/payment/ReceiptValidatorTest.java index c33adf62052..19c16d2f34a 100644 --- a/core/src/test/java/bisq/core/payment/ReceiptValidatorTest.java +++ b/core/src/test/java/bisq/core/payment/ReceiptValidatorTest.java @@ -20,13 +20,8 @@ import bisq.core.offer.Offer; import bisq.core.payment.payload.PaymentMethod; -import org.powermock.core.classloader.annotations.PowerMockIgnore; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; - import org.junit.Before; import org.junit.Test; -import org.junit.runner.RunWith; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; @@ -34,10 +29,6 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -@RunWith(PowerMockRunner.class) -@PrepareForTest({SpecificBanksAccount.class, SameBankAccount.class, NationalBankAccount.class, - MoneyGramAccount.class, WesternUnionAccount.class, CashDepositAccount.class, PaymentMethod.class}) -@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*"}) public class ReceiptValidatorTest { private ReceiptValidator validator; private PaymentAccount account; diff --git a/core/src/test/java/bisq/core/payment/TradeLimitsTest.java b/core/src/test/java/bisq/core/payment/TradeLimitsTest.java index b12470c0392..17e256b50f3 100644 --- a/core/src/test/java/bisq/core/payment/TradeLimitsTest.java +++ b/core/src/test/java/bisq/core/payment/TradeLimitsTest.java @@ -20,17 +20,11 @@ import bisq.core.dao.governance.period.PeriodService; import bisq.core.dao.state.DaoStateService; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; - import org.junit.Test; -import org.junit.runner.RunWith; import static org.junit.Assert.assertEquals; import static org.mockito.Mockito.mock; -@RunWith(PowerMockRunner.class) -@PrepareForTest({DaoStateService.class, PeriodService.class}) public class TradeLimitsTest { @Test public void testGetFirstMonthRiskBasedTradeLimit() { diff --git a/core/src/test/java/bisq/core/trade/TradableListTest.java b/core/src/test/java/bisq/core/trade/TradableListTest.java index f2e4e2bd0b7..a012f1f5afc 100644 --- a/core/src/test/java/bisq/core/trade/TradableListTest.java +++ b/core/src/test/java/bisq/core/trade/TradableListTest.java @@ -23,20 +23,19 @@ import bisq.common.storage.Storage; -import mockit.Mocked; - import org.junit.Test; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.RETURNS_DEEP_STUBS; +import static org.mockito.Mockito.mock; import static protobuf.PersistableEnvelope.MessageCase.TRADABLE_LIST; -//TODO cannot be run in IntelliJ IDE as parameter is not supported. OfferPayload is final so it is not so trivial to -// replace that. public class TradableListTest { @Test - public void protoTesting(@Mocked OfferPayload offerPayload) { + public void protoTesting() { + OfferPayload offerPayload = mock(OfferPayload.class, RETURNS_DEEP_STUBS); Storage> storage = new Storage<>(null, null); TradableList openOfferTradableList = new TradableList<>(storage, "filename"); protobuf.PersistableEnvelope message = (protobuf.PersistableEnvelope) openOfferTradableList.toProtoMessage(); diff --git a/core/src/test/java/bisq/core/user/PreferencesTest.java b/core/src/test/java/bisq/core/user/PreferencesTest.java index 2294243da99..5c37b6b0c47 100644 --- a/core/src/test/java/bisq/core/user/PreferencesTest.java +++ b/core/src/test/java/bisq/core/user/PreferencesTest.java @@ -34,13 +34,8 @@ import java.util.List; import java.util.Locale; -import org.powermock.core.classloader.annotations.PowerMockIgnore; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; - import org.junit.Before; import org.junit.Test; -import org.junit.runner.RunWith; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; @@ -49,9 +44,6 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -@RunWith(PowerMockRunner.class) -@PrepareForTest({Storage.class, PreferencesPayload.class, BisqEnvironment.class}) -@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*"}) public class PreferencesTest { private Preferences preferences; diff --git a/core/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker b/core/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker new file mode 100644 index 00000000000..1f0955d450f --- /dev/null +++ b/core/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker @@ -0,0 +1 @@ +mock-maker-inline From e9a45196a849a20fa79f76f2a8e7848000cb0c8f Mon Sep 17 00:00:00 2001 From: Christoph Sturm Date: Tue, 13 Aug 2019 18:13:10 +0200 Subject: [PATCH 04/17] remove powermock from core. --- build.gradle | 2 -- .../test/java/bisq/core/btc/TxFeeEstimationServiceTest.java | 5 ----- .../bisq/core/dao/state/DaoStateSnapshotServiceTest.java | 2 +- 3 files changed, 1 insertion(+), 8 deletions(-) diff --git a/build.gradle b/build.gradle index ee601c60ff6..b2028345fb2 100644 --- a/build.gradle +++ b/build.gradle @@ -252,8 +252,6 @@ configure(project(':core')) { testCompile "org.jmockit:jmockit:$jmockitVersion" testCompile("org.mockito:mockito-core:$mockitoVersion") { } - testCompile "org.powermock:powermock-module-junit4:$powermockVersion" - testCompile "org.powermock:powermock-api-mockito2:$powermockVersion" testCompile "org.springframework:spring-test:$springVersion" testCompile "com.natpryce:make-it-easy:$easyVersion" testCompile group: 'org.hamcrest', name: 'hamcrest-all', version: '1.3' diff --git a/core/src/test/java/bisq/core/btc/TxFeeEstimationServiceTest.java b/core/src/test/java/bisq/core/btc/TxFeeEstimationServiceTest.java index 2f9d6b36d41..a71fb8237ba 100644 --- a/core/src/test/java/bisq/core/btc/TxFeeEstimationServiceTest.java +++ b/core/src/test/java/bisq/core/btc/TxFeeEstimationServiceTest.java @@ -24,9 +24,6 @@ import java.util.List; -import org.powermock.core.classloader.annotations.PowerMockIgnore; -import org.powermock.core.classloader.annotations.PrepareForTest; - import org.junit.Ignore; import org.junit.Test; @@ -36,8 +33,6 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -@PrepareForTest(BtcWalletService.class) -@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*"}) public class TxFeeEstimationServiceTest { @Test diff --git a/core/src/test/java/bisq/core/dao/state/DaoStateSnapshotServiceTest.java b/core/src/test/java/bisq/core/dao/state/DaoStateSnapshotServiceTest.java index 5522350f45d..806c3ebb642 100644 --- a/core/src/test/java/bisq/core/dao/state/DaoStateSnapshotServiceTest.java +++ b/core/src/test/java/bisq/core/dao/state/DaoStateSnapshotServiceTest.java @@ -26,7 +26,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; -import static org.powermock.api.mockito.PowerMockito.mock; +import static org.mockito.Mockito.mock; public class DaoStateSnapshotServiceTest { From 17221cbed8b7f5d20955ca6cb55f60751e2205e6 Mon Sep 17 00:00:00 2001 From: Christoph Sturm Date: Tue, 13 Aug 2019 19:30:57 +0200 Subject: [PATCH 05/17] remove more powermock and jmockit tests. ignore 2 or 3 tests that are not possible to convert now --- build.gradle | 5 ++- .../desktop/main/offer/MakerFeeMaker.java | 13 ++++++++ .../main/offer/MutableOfferDataModel.java | 7 ++-- .../createoffer/CreateOfferDataModel.java | 7 ++-- .../editoffer/EditOfferDataModel.java | 7 ++-- .../TransactionAwareTradeTest.java | 9 ----- .../OfferBookChartViewModelTest.java | 8 ----- .../market/spread/SpreadViewModelTest.java | 8 ----- .../trades/TradesChartsViewModelTest.java | 33 +++++++------------ .../createoffer/CreateOfferDataModelTest.java | 27 ++++----------- .../createoffer/CreateOfferViewModelTest.java | 14 ++------ .../offerbook/OfferBookViewModelTest.java | 8 ----- .../editoffer/EditOfferDataModelTest.java | 14 ++------ .../preferences/PreferencesViewModelTest.java | 8 ----- .../bisq/desktop/util/BSFormatterTest.java | 8 ----- .../bisq/desktop/util/CurrencyListTest.java | 8 ----- .../java/bisq/desktop/util/GUIUtilTest.java | 26 ++++----------- .../org.mockito.plugins.MockMaker | 1 + 18 files changed, 59 insertions(+), 152 deletions(-) create mode 100644 desktop/src/main/java/bisq/desktop/main/offer/MakerFeeMaker.java create mode 100644 desktop/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker diff --git a/build.gradle b/build.gradle index b2028345fb2..820f683f723 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,7 @@ -if(JavaVersion.current() != JavaVersion.VERSION_1_10){ +/*if(JavaVersion.current() != JavaVersion.VERSION_1_10){ // feel free to delete this if you know what you are doing throw new GradleException("This build must be run with java 10. see docs/build.md") -} +}*/ buildscript { repositories { jcenter() @@ -306,7 +306,6 @@ configure(project(':desktop')) { testCompile "org.jmockit:jmockit:$jmockitVersion" testCompile("org.mockito:mockito-core:$mockitoVersion") { - exclude(module: 'objenesis') } testCompile "org.powermock:powermock-module-junit4:$powermockVersion" testCompile "org.powermock:powermock-api-mockito2:$powermockVersion" diff --git a/desktop/src/main/java/bisq/desktop/main/offer/MakerFeeMaker.java b/desktop/src/main/java/bisq/desktop/main/offer/MakerFeeMaker.java new file mode 100644 index 00000000000..58149224f10 --- /dev/null +++ b/desktop/src/main/java/bisq/desktop/main/offer/MakerFeeMaker.java @@ -0,0 +1,13 @@ +package bisq.desktop.main.offer; + +import bisq.core.btc.wallet.BsqWalletService; +import bisq.core.offer.OfferUtil; +import bisq.core.user.Preferences; + +import org.bitcoinj.core.Coin; + +public class MakerFeeMaker { + public Coin getMakerFee(BsqWalletService bsqWalletService, Preferences preferences, Coin amount) { + return OfferUtil.getMakerFee(bsqWalletService, preferences, amount); + } +} diff --git a/desktop/src/main/java/bisq/desktop/main/offer/MutableOfferDataModel.java b/desktop/src/main/java/bisq/desktop/main/offer/MutableOfferDataModel.java index 325ebcace33..aad279b2860 100644 --- a/desktop/src/main/java/bisq/desktop/main/offer/MutableOfferDataModel.java +++ b/desktop/src/main/java/bisq/desktop/main/offer/MutableOfferDataModel.java @@ -106,6 +106,7 @@ public abstract class MutableOfferDataModel extends OfferDataModel implements Bs private final TxFeeEstimationService txFeeEstimationService; private final ReferralIdService referralIdService; private final BSFormatter btcFormatter; + private MakerFeeMaker makerFeeMaker; private final String offerId; private final BalanceListener btcBalanceListener; private final SetChangeListener paymentAccountsChangeListener; @@ -157,7 +158,8 @@ public MutableOfferDataModel(OpenOfferManager openOfferManager, FeeService feeService, TxFeeEstimationService txFeeEstimationService, ReferralIdService referralIdService, - BSFormatter btcFormatter) { + BSFormatter btcFormatter, + MakerFeeMaker makerFeeMaker) { super(btcWalletService); this.openOfferManager = openOfferManager; @@ -173,6 +175,7 @@ public MutableOfferDataModel(OpenOfferManager openOfferManager, this.txFeeEstimationService = txFeeEstimationService; this.referralIdService = referralIdService; this.btcFormatter = btcFormatter; + this.makerFeeMaker = makerFeeMaker; offerId = Utilities.getRandomPrefix(5, 8) + "-" + UUID.randomUUID().toString() + "-" + @@ -802,7 +805,7 @@ public Coin getMakerFee(boolean isCurrencyForMakerFeeBtc) { } public Coin getMakerFee() { - return OfferUtil.getMakerFee(bsqWalletService, preferences, amount.get()); + return makerFeeMaker.getMakerFee(bsqWalletService, preferences, amount.get()); } public Coin getMakerFeeInBtc() { diff --git a/desktop/src/main/java/bisq/desktop/main/offer/createoffer/CreateOfferDataModel.java b/desktop/src/main/java/bisq/desktop/main/offer/createoffer/CreateOfferDataModel.java index 0fb6b01db0f..47354790dd2 100644 --- a/desktop/src/main/java/bisq/desktop/main/offer/createoffer/CreateOfferDataModel.java +++ b/desktop/src/main/java/bisq/desktop/main/offer/createoffer/CreateOfferDataModel.java @@ -21,6 +21,7 @@ package bisq.desktop.main.offer.createoffer; +import bisq.desktop.main.offer.MakerFeeMaker; import bisq.desktop.main.offer.MutableOfferDataModel; import bisq.core.account.witness.AccountAgeWitnessService; @@ -63,7 +64,8 @@ public CreateOfferDataModel(OpenOfferManager openOfferManager, FeeService feeService, TxFeeEstimationService txFeeEstimationService, ReferralIdService referralIdService, - BSFormatter btcFormatter) { + BSFormatter btcFormatter, + MakerFeeMaker makerFeeMaker) { super(openOfferManager, btcWalletService, bsqWalletService, @@ -77,6 +79,7 @@ public CreateOfferDataModel(OpenOfferManager openOfferManager, feeService, txFeeEstimationService, referralIdService, - btcFormatter); + btcFormatter, + makerFeeMaker); } } diff --git a/desktop/src/main/java/bisq/desktop/main/portfolio/editoffer/EditOfferDataModel.java b/desktop/src/main/java/bisq/desktop/main/portfolio/editoffer/EditOfferDataModel.java index fd38c89ddd8..b07eb0f1ba9 100644 --- a/desktop/src/main/java/bisq/desktop/main/portfolio/editoffer/EditOfferDataModel.java +++ b/desktop/src/main/java/bisq/desktop/main/portfolio/editoffer/EditOfferDataModel.java @@ -18,6 +18,7 @@ package bisq.desktop.main.portfolio.editoffer; +import bisq.desktop.main.offer.MakerFeeMaker; import bisq.desktop.main.offer.MutableOfferDataModel; import bisq.core.account.witness.AccountAgeWitnessService; @@ -73,7 +74,8 @@ class EditOfferDataModel extends MutableOfferDataModel { TxFeeEstimationService txFeeEstimationService, ReferralIdService referralIdService, BSFormatter btcFormatter, - CorePersistenceProtoResolver corePersistenceProtoResolver) { + CorePersistenceProtoResolver corePersistenceProtoResolver, + MakerFeeMaker makerFeeMaker) { super(openOfferManager, btcWalletService, bsqWalletService, @@ -87,7 +89,8 @@ class EditOfferDataModel extends MutableOfferDataModel { feeService, txFeeEstimationService, referralIdService, - btcFormatter); + btcFormatter, + makerFeeMaker); this.corePersistenceProtoResolver = corePersistenceProtoResolver; } diff --git a/desktop/src/test/java/bisq/desktop/main/funds/transactions/TransactionAwareTradeTest.java b/desktop/src/test/java/bisq/desktop/main/funds/transactions/TransactionAwareTradeTest.java index 8895a5749cf..b2ae9e5d37f 100644 --- a/desktop/src/test/java/bisq/desktop/main/funds/transactions/TransactionAwareTradeTest.java +++ b/desktop/src/test/java/bisq/desktop/main/funds/transactions/TransactionAwareTradeTest.java @@ -27,23 +27,14 @@ import java.util.Collections; -import org.powermock.core.classloader.annotations.PowerMockIgnore; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; - import org.junit.Before; import org.junit.Test; -import org.junit.runner.RunWith; import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.RETURNS_DEEP_STUBS; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -@RunWith(PowerMockRunner.class) -@PrepareForTest(Dispute.class) -@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*"}) -@SuppressWarnings("ConstantConditions") public class TransactionAwareTradeTest { private static final String XID = "123"; diff --git a/desktop/src/test/java/bisq/desktop/main/market/offerbook/OfferBookChartViewModelTest.java b/desktop/src/test/java/bisq/desktop/main/market/offerbook/OfferBookChartViewModelTest.java index 6e1e303e69d..24a012b824f 100644 --- a/desktop/src/test/java/bisq/desktop/main/market/offerbook/OfferBookChartViewModelTest.java +++ b/desktop/src/test/java/bisq/desktop/main/market/offerbook/OfferBookChartViewModelTest.java @@ -30,13 +30,8 @@ import javafx.collections.FXCollections; import javafx.collections.ObservableList; -import org.powermock.core.classloader.annotations.PowerMockIgnore; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; - import org.junit.Before; import org.junit.Test; -import org.junit.runner.RunWith; import static bisq.desktop.main.offer.offerbook.OfferBookListItemMaker.btcBuyItem; import static bisq.desktop.main.offer.offerbook.OfferBookListItemMaker.btcSellItem; @@ -49,9 +44,6 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -@RunWith(PowerMockRunner.class) -@PrepareForTest({OfferBook.class, PriceFeedService.class}) -@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*"}) public class OfferBookChartViewModelTest { @Before diff --git a/desktop/src/test/java/bisq/desktop/main/market/spread/SpreadViewModelTest.java b/desktop/src/test/java/bisq/desktop/main/market/spread/SpreadViewModelTest.java index a53683d3448..f32326bb8a5 100644 --- a/desktop/src/test/java/bisq/desktop/main/market/spread/SpreadViewModelTest.java +++ b/desktop/src/test/java/bisq/desktop/main/market/spread/SpreadViewModelTest.java @@ -28,12 +28,7 @@ import javafx.collections.FXCollections; import javafx.collections.ObservableList; -import org.powermock.core.classloader.annotations.PowerMockIgnore; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; - import org.junit.Test; -import org.junit.runner.RunWith; import static bisq.desktop.main.offer.offerbook.OfferBookListItemMaker.btcBuyItem; import static bisq.desktop.main.offer.offerbook.OfferBookListItemMaker.btcSellItem; @@ -44,9 +39,6 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -@RunWith(PowerMockRunner.class) -@PrepareForTest({OfferBook.class, PriceFeedService.class}) -@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*"}) public class SpreadViewModelTest { @Test diff --git a/desktop/src/test/java/bisq/desktop/main/market/trades/TradesChartsViewModelTest.java b/desktop/src/test/java/bisq/desktop/main/market/trades/TradesChartsViewModelTest.java index 74f973899d8..70dea240aee 100644 --- a/desktop/src/test/java/bisq/desktop/main/market/trades/TradesChartsViewModelTest.java +++ b/desktop/src/test/java/bisq/desktop/main/market/trades/TradesChartsViewModelTest.java @@ -53,29 +53,15 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import mockit.Expectations; -import mockit.Injectable; -import mockit.Mock; -import mockit.MockUp; -import mockit.Tested; - import org.junit.Before; +import org.junit.Ignore; import org.junit.Test; import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.mock; public class TradesChartsViewModelTest { - @Tested TradesChartsViewModel model; - @Injectable - Preferences preferences; - @Injectable - PriceFeedService priceFeedService; - @Injectable - Navigation navigation; - @Injectable - BSFormatter formatter; - @Injectable TradeStatisticsManager tsm; private static final Logger log = LoggerFactory.getLogger(TradesChartsViewModelTest.class); @@ -121,10 +107,11 @@ public class TradesChartsViewModelTest { null, 1 ); - @Before public void setup() throws IOException { - + tsm = mock(TradeStatisticsManager.class); + model = new TradesChartsViewModel(tsm, mock(Preferences.class), mock(PriceFeedService.class), + mock(Navigation.class), mock(BSFormatter.class)); dir = File.createTempFile("temp_tests1", ""); //noinspection ResultOfMethodCallIgnored dir.delete(); @@ -168,6 +155,8 @@ public void testGetCandleData() { assertEquals(isBullish, candleData.isBullish); } + // TODO JMOCKIT + @Ignore @Test public void testItemLists() throws ParseException { // Helper class to add historic trades @@ -196,12 +185,12 @@ class Trade { // Set predetermined time to use as "now" during test Date test_time = dateFormat.parse("2018-01-01T00:00:05"); // Monday - new MockUp() { +/* new MockUp() { @Mock long currentTimeMillis() { return test_time.getTime(); } - }; + };*/ // Two trades 10 seconds apart, different YEAR, MONTH, WEEK, DAY, HOUR, MINUTE_10 trades.add(new Trade("2017-12-31T23:59:52", "1", "100", "EUR")); @@ -216,10 +205,10 @@ long currentTimeMillis() { // Run test for each tick type for (TradesChartsViewModel.TickUnit tick : TradesChartsViewModel.TickUnit.values()) { - new Expectations() {{ +/* new Expectations() {{ tsm.getObservableTradeStatisticsSet(); result = tradeStats; - }}; + }};*/ // Trigger chart update model.setTickUnit(tick); diff --git a/desktop/src/test/java/bisq/desktop/main/offer/createoffer/CreateOfferDataModelTest.java b/desktop/src/test/java/bisq/desktop/main/offer/createoffer/CreateOfferDataModelTest.java index dbc6249aaa5..74098b24d2d 100644 --- a/desktop/src/test/java/bisq/desktop/main/offer/createoffer/CreateOfferDataModelTest.java +++ b/desktop/src/test/java/bisq/desktop/main/offer/createoffer/CreateOfferDataModelTest.java @@ -1,5 +1,7 @@ package bisq.desktop.main.offer.createoffer; +import bisq.desktop.main.offer.MakerFeeMaker; + import bisq.core.btc.TxFeeEstimationService; import bisq.core.btc.model.AddressEntry; import bisq.core.btc.wallet.BtcWalletService; @@ -8,7 +10,6 @@ import bisq.core.locale.GlobalSettings; import bisq.core.locale.Res; import bisq.core.offer.OfferPayload; -import bisq.core.offer.OfferUtil; import bisq.core.payment.ClearXchangeAccount; import bisq.core.payment.PaymentAccount; import bisq.core.payment.RevolutAccount; @@ -21,14 +22,8 @@ import java.util.HashSet; -import org.powermock.api.mockito.PowerMockito; -import org.powermock.core.classloader.annotations.PowerMockIgnore; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; - import org.junit.Before; import org.junit.Test; -import org.junit.runner.RunWith; import static org.junit.Assert.assertEquals; import static org.mockito.ArgumentMatchers.any; @@ -36,19 +31,12 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; - - -import org.mockito.BDDMockito; - -@RunWith(PowerMockRunner.class) -@PrepareForTest({BtcWalletService.class, AddressEntry.class, Preferences.class, User.class, - PriceFeedService.class, OfferUtil.class, FeeService.class, TxFeeEstimationService.class}) -@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*"}) public class CreateOfferDataModelTest { private CreateOfferDataModel model; private User user; private Preferences preferences; + private MakerFeeMaker makerFeeMaker; @Before public void setUp() { @@ -68,11 +56,12 @@ public void setUp() { when(preferences.isUsePercentageBasedPrice()).thenReturn(true); when(preferences.getBuyerSecurityDepositAsPercent(null)).thenReturn(0.01); + makerFeeMaker = mock(MakerFeeMaker.class); model = new CreateOfferDataModel(null, btcWalletService, null, preferences, user, null, null, priceFeedService, null, null, feeService, feeEstimationService, - null, null); + null, null, makerFeeMaker); } @Test @@ -89,8 +78,7 @@ public void testUseTradeCurrencySetInOfferViewWhenInPaymentAccountAvailable() { when(user.getPaymentAccounts()).thenReturn(paymentAccounts); when(preferences.getSelectedPaymentAccountForCreateOffer()).thenReturn(revolutAccount); - PowerMockito.mockStatic(OfferUtil.class); - BDDMockito.given(OfferUtil.getMakerFee(any(), any(), any())).willReturn(Coin.ZERO); + when(makerFeeMaker.getMakerFee(any(), any(), any())).thenReturn(Coin.ZERO); model.initWithData(OfferPayload.Direction.BUY, new FiatCurrency("USD")); assertEquals("USD", model.getTradeCurrencyCode().get()); @@ -110,8 +98,7 @@ public void testUseTradeAccountThatMatchesTradeCurrencySetInOffer() { when(user.getPaymentAccounts()).thenReturn(paymentAccounts); when(user.findFirstPaymentAccountWithCurrency(new FiatCurrency("USD"))).thenReturn(zelleAccount); when(preferences.getSelectedPaymentAccountForCreateOffer()).thenReturn(revolutAccount); - PowerMockito.mockStatic(OfferUtil.class); - BDDMockito.given(OfferUtil.getMakerFee(any(), any(), any())).willReturn(Coin.ZERO); + when(makerFeeMaker.getMakerFee(any(), any(), any())).thenReturn(Coin.ZERO); model.initWithData(OfferPayload.Direction.BUY, new FiatCurrency("USD")); assertEquals("USD", model.getTradeCurrencyCode().get()); diff --git a/desktop/src/test/java/bisq/desktop/main/offer/createoffer/CreateOfferViewModelTest.java b/desktop/src/test/java/bisq/desktop/main/offer/createoffer/CreateOfferViewModelTest.java index 5fb65904bd5..c8e4c37b4c5 100644 --- a/desktop/src/test/java/bisq/desktop/main/offer/createoffer/CreateOfferViewModelTest.java +++ b/desktop/src/test/java/bisq/desktop/main/offer/createoffer/CreateOfferViewModelTest.java @@ -17,6 +17,7 @@ package bisq.desktop.main.offer.createoffer; +import bisq.desktop.main.offer.MakerFeeMaker; import bisq.desktop.util.validation.AltcoinValidator; import bisq.desktop.util.validation.BtcValidator; import bisq.desktop.util.validation.FiatPriceValidator; @@ -50,13 +51,8 @@ import java.time.Instant; -import org.powermock.core.classloader.annotations.PowerMockIgnore; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; - import org.junit.Before; import org.junit.Test; -import org.junit.runner.RunWith; import static bisq.desktop.maker.PreferenceMakers.empty; import static org.junit.Assert.assertEquals; @@ -67,12 +63,6 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -@RunWith(PowerMockRunner.class) -@PrepareForTest({BtcWalletService.class, AddressEntry.class, PriceFeedService.class, User.class, - FeeService.class, CreateOfferDataModel.class, PaymentAccount.class, BsqWalletService.class, - SecurityDepositValidator.class, AccountAgeWitnessService.class, BsqFormatter.class, Preferences.class, - BsqWalletService.class, TxFeeEstimationService.class}) -@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*"}) public class CreateOfferViewModelTest { private CreateOfferViewModel model; @@ -114,7 +104,7 @@ public void setUp() { when(bsqFormatter.formatCoin(any())).thenReturn("0"); when(bsqWalletService.getAvailableConfirmedBalance()).thenReturn(Coin.ZERO); - CreateOfferDataModel dataModel = new CreateOfferDataModel(null, btcWalletService, bsqWalletService, empty, user, null, null, priceFeedService, null, accountAgeWitnessService, feeService, txFeeEstimationService, null, bsFormatter); + CreateOfferDataModel dataModel = new CreateOfferDataModel(null, btcWalletService, bsqWalletService, empty, user, null, null, priceFeedService, null, accountAgeWitnessService, feeService, txFeeEstimationService, null, bsFormatter, mock(MakerFeeMaker.class)); dataModel.initWithData(OfferPayload.Direction.BUY, new CryptoCurrency("BTC", "bitcoin")); dataModel.activate(); diff --git a/desktop/src/test/java/bisq/desktop/main/offer/offerbook/OfferBookViewModelTest.java b/desktop/src/test/java/bisq/desktop/main/offer/offerbook/OfferBookViewModelTest.java index bd3338aa2b7..272d241c468 100644 --- a/desktop/src/test/java/bisq/desktop/main/offer/offerbook/OfferBookViewModelTest.java +++ b/desktop/src/test/java/bisq/desktop/main/offer/offerbook/OfferBookViewModelTest.java @@ -60,14 +60,9 @@ import com.natpryce.makeiteasy.Maker; -import org.powermock.core.classloader.annotations.PowerMockIgnore; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; - import org.junit.Before; import org.junit.Ignore; import org.junit.Test; -import org.junit.runner.RunWith; import static bisq.desktop.main.offer.offerbook.OfferBookListItemMaker.*; import static bisq.desktop.maker.PreferenceMakers.empty; @@ -81,9 +76,6 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -@RunWith(PowerMockRunner.class) -@PrepareForTest({OfferBook.class, OpenOfferManager.class, PriceFeedService.class}) -@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*"}) public class OfferBookViewModelTest { private static final Logger log = LoggerFactory.getLogger(OfferBookViewModelTest.class); diff --git a/desktop/src/test/java/bisq/desktop/main/portfolio/editoffer/EditOfferDataModelTest.java b/desktop/src/test/java/bisq/desktop/main/portfolio/editoffer/EditOfferDataModelTest.java index e6c9e798d17..617f25571bf 100644 --- a/desktop/src/test/java/bisq/desktop/main/portfolio/editoffer/EditOfferDataModelTest.java +++ b/desktop/src/test/java/bisq/desktop/main/portfolio/editoffer/EditOfferDataModelTest.java @@ -1,5 +1,6 @@ package bisq.desktop.main.portfolio.editoffer; +import bisq.desktop.main.offer.MakerFeeMaker; import bisq.desktop.util.validation.SecurityDepositValidator; import bisq.core.account.witness.AccountAgeWitnessService; @@ -31,15 +32,10 @@ import java.time.Instant; -import org.powermock.core.classloader.annotations.PowerMockIgnore; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; - import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; -import org.junit.runner.RunWith; import static bisq.desktop.maker.OfferMaker.btcBCHCOffer; import static bisq.desktop.maker.PreferenceMakers.empty; @@ -51,12 +47,6 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -@RunWith(PowerMockRunner.class) -@PrepareForTest({BtcWalletService.class, AddressEntry.class, PriceFeedService.class, User.class, - FeeService.class, PaymentAccount.class, BsqWalletService.class, - SecurityDepositValidator.class, AccountAgeWitnessService.class, BsqFormatter.class, Preferences.class, - BsqWalletService.class}) -@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*"}) public class EditOfferDataModelTest { private EditOfferDataModel model; @@ -103,7 +93,7 @@ public void setUp() { btcWalletService, bsqWalletService, empty, user, null, null, priceFeedService, null, accountAgeWitnessService, feeService, null, null, - null, null); + null, null, mock(MakerFeeMaker.class)); } @Test diff --git a/desktop/src/test/java/bisq/desktop/main/settings/preferences/PreferencesViewModelTest.java b/desktop/src/test/java/bisq/desktop/main/settings/preferences/PreferencesViewModelTest.java index 515b88190f2..3f3fc0b2cd1 100644 --- a/desktop/src/test/java/bisq/desktop/main/settings/preferences/PreferencesViewModelTest.java +++ b/desktop/src/test/java/bisq/desktop/main/settings/preferences/PreferencesViewModelTest.java @@ -30,20 +30,12 @@ import java.util.ArrayList; -import org.powermock.core.classloader.annotations.PowerMockIgnore; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; - import org.junit.Test; -import org.junit.runner.RunWith; import static org.junit.Assert.assertEquals; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -@RunWith(PowerMockRunner.class) -@PrepareForTest({ArbitratorManager.class, Preferences.class}) -@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*"}) public class PreferencesViewModelTest { diff --git a/desktop/src/test/java/bisq/desktop/util/BSFormatterTest.java b/desktop/src/test/java/bisq/desktop/util/BSFormatterTest.java index ab771974e8c..3c319ea62e1 100644 --- a/desktop/src/test/java/bisq/desktop/util/BSFormatterTest.java +++ b/desktop/src/test/java/bisq/desktop/util/BSFormatterTest.java @@ -29,13 +29,8 @@ import java.util.Locale; import java.util.concurrent.TimeUnit; -import org.powermock.core.classloader.annotations.PowerMockIgnore; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; - import org.junit.Before; import org.junit.Test; -import org.junit.runner.RunWith; import static bisq.desktop.maker.OfferMaker.btcUsdOffer; import static bisq.desktop.maker.PriceMaker.priceString; @@ -52,9 +47,6 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -@RunWith(PowerMockRunner.class) -@PrepareForTest({Offer.class, OfferPayload.class}) -@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*"}) public class BSFormatterTest { private BSFormatter formatter; diff --git a/desktop/src/test/java/bisq/desktop/util/CurrencyListTest.java b/desktop/src/test/java/bisq/desktop/util/CurrencyListTest.java index 57c43aa06e0..b8105b1d189 100644 --- a/desktop/src/test/java/bisq/desktop/util/CurrencyListTest.java +++ b/desktop/src/test/java/bisq/desktop/util/CurrencyListTest.java @@ -29,21 +29,13 @@ import java.util.List; import java.util.Locale; -import org.powermock.core.classloader.annotations.PowerMockIgnore; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; - import org.junit.Before; import org.junit.Test; -import org.junit.runner.RunWith; import static org.junit.Assert.assertEquals; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -@RunWith(PowerMockRunner.class) -@PrepareForTest(Preferences.class) -@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*"}) public class CurrencyListTest { private static final Locale locale = new Locale("en", "US"); diff --git a/desktop/src/test/java/bisq/desktop/util/GUIUtilTest.java b/desktop/src/test/java/bisq/desktop/util/GUIUtilTest.java index 381290e9a92..f6d19efaa7b 100644 --- a/desktop/src/test/java/bisq/desktop/util/GUIUtilTest.java +++ b/desktop/src/test/java/bisq/desktop/util/GUIUtilTest.java @@ -23,24 +23,15 @@ import bisq.core.user.DontShowAgainLookup; import bisq.core.user.Preferences; -import bisq.common.util.Utilities; - import javafx.util.StringConverter; -import java.net.URI; - import java.util.HashMap; import java.util.Locale; import java.util.Map; -import org.powermock.api.mockito.PowerMockito; -import org.powermock.core.classloader.annotations.PowerMockIgnore; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; - import org.junit.Before; +import org.junit.Ignore; import org.junit.Test; -import org.junit.runner.RunWith; import static bisq.desktop.maker.TradeCurrencyMakers.bitcoin; import static bisq.desktop.maker.TradeCurrencyMakers.euro; @@ -49,12 +40,7 @@ import static org.mockito.Mockito.when; - -import org.mockito.ArgumentCaptor; - -@RunWith(PowerMockRunner.class) -@PrepareForTest({Utilities.class, Preferences.class}) -@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*"}) +@Ignore public class GUIUtilTest { @Before @@ -89,10 +75,9 @@ public void testOpenURLWithCampaignParameters() throws Exception { when(preferences.showAgain("warnOpenURLWhenTorEnabled")).thenReturn(false); when(preferences.getUserLanguage()).thenReturn("en"); - PowerMockito.mockStatic(Utilities.class); +/* PowerMockito.mockStatic(Utilities.class); ArgumentCaptor captor = ArgumentCaptor.forClass(URI.class); PowerMockito.doNothing().when(Utilities.class, "openURI", captor.capture()); - GUIUtil.openWebPage("https://bisq.network"); assertEquals("https://bisq.network?utm_source=desktop-client&utm_medium=in-app-link&utm_campaign=language_en", captor.getValue().toString()); @@ -100,6 +85,7 @@ public void testOpenURLWithCampaignParameters() throws Exception { GUIUtil.openWebPage("https://docs.bisq.network/trading-rules.html#f2f-trading"); assertEquals("https://docs.bisq.network/trading-rules.html?utm_source=desktop-client&utm_medium=in-app-link&utm_campaign=language_en#f2f-trading", captor.getValue().toString()); +*/ } @Test @@ -108,13 +94,13 @@ public void testOpenURLWithoutCampaignParameters() throws Exception { DontShowAgainLookup.setPreferences(preferences); GUIUtil.setPreferences(preferences); when(preferences.showAgain("warnOpenURLWhenTorEnabled")).thenReturn(false); - +/* PowerMockito.mockStatic(Utilities.class); ArgumentCaptor captor = ArgumentCaptor.forClass(URI.class); PowerMockito.doNothing().when(Utilities.class, "openURI", captor.capture()); - GUIUtil.openWebPage("https://www.github.com"); assertEquals("https://www.github.com", captor.getValue().toString()); +*/ } } diff --git a/desktop/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker b/desktop/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker new file mode 100644 index 00000000000..1f0955d450f --- /dev/null +++ b/desktop/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker @@ -0,0 +1 @@ +mock-maker-inline From 5da7ca21fa0bbdb69ca08f34b6a2f7fd0dafad65 Mon Sep 17 00:00:00 2001 From: Christoph Sturm Date: Tue, 13 Aug 2019 19:34:54 +0200 Subject: [PATCH 06/17] remove powermock from gradle file --- build.gradle | 3 --- 1 file changed, 3 deletions(-) diff --git a/build.gradle b/build.gradle index 820f683f723..f74c0e9bce6 100644 --- a/build.gradle +++ b/build.gradle @@ -41,7 +41,6 @@ configure(subprojects) { logbackVersion = '1.1.10' lombokVersion = '1.18.2' mockitoVersion = '3.0.0' - powermockVersion = '2.0.0-beta.5' protobufVersion = '3.5.1' slf4jVersion = '1.7.22' sparkVersion = '2.5.2' @@ -307,8 +306,6 @@ configure(project(':desktop')) { testCompile "org.jmockit:jmockit:$jmockitVersion" testCompile("org.mockito:mockito-core:$mockitoVersion") { } - testCompile "org.powermock:powermock-module-junit4:$powermockVersion" - testCompile "org.powermock:powermock-api-mockito2:$powermockVersion" testCompile "org.springframework:spring-test:$springVersion" testCompile "com.natpryce:make-it-easy:$easyVersion" testCompileOnly "org.projectlombok:lombok:$lombokVersion" From 0babe82d0989d13e121995207f38efec1231eeb7 Mon Sep 17 00:00:00 2001 From: Christoph Sturm Date: Tue, 13 Aug 2019 19:47:40 +0200 Subject: [PATCH 07/17] remove jmockit --- build.gradle | 15 ++---- .../core/dao/node/full/BlockParserTest.java | 47 +++---------------- .../p2p/storage/P2PDataStorageTest.java | 24 +++------- 3 files changed, 16 insertions(+), 70 deletions(-) diff --git a/build.gradle b/build.gradle index f74c0e9bce6..04fd798b860 100644 --- a/build.gradle +++ b/build.gradle @@ -34,7 +34,6 @@ configure(subprojects) { bcVersion = '1.56' codecVersion = '1.9' easyVersion = '4.0.1' - jmockitVersion = '1.42' joptVersion = '5.0.3' langVersion = '3.4' bitcoinjVersion = 'a88d36d' @@ -211,9 +210,10 @@ configure(project(':p2p')) { compile 'org.fxmisc.easybind:easybind:1.0.3' compileOnly "org.projectlombok:lombok:$lombokVersion" annotationProcessor "org.projectlombok:lombok:$lombokVersion" - testCompile 'org.jmockit:jmockit:1.30' // must not use current $jmockitVersion testCompileOnly "org.projectlombok:lombok:$lombokVersion" testAnnotationProcessor "org.projectlombok:lombok:$lombokVersion" + testCompile("org.mockito:mockito-core:$mockitoVersion") + } } @@ -248,9 +248,7 @@ configure(project(':core')) { compileOnly "org.projectlombok:lombok:$lombokVersion" annotationProcessor "org.projectlombok:lombok:$lombokVersion" - testCompile "org.jmockit:jmockit:$jmockitVersion" - testCompile("org.mockito:mockito-core:$mockitoVersion") { - } + testCompile("org.mockito:mockito-core:$mockitoVersion") testCompile "org.springframework:spring-test:$springVersion" testCompile "com.natpryce:make-it-easy:$easyVersion" testCompile group: 'org.hamcrest', name: 'hamcrest-all', version: '1.3' @@ -260,9 +258,6 @@ configure(project(':core')) { test { systemProperty 'jdk.attach.allowAttachSelf', true - - def jmockit = configurations.testCompile.files.find { it.name.contains("jmockit") }.absolutePath - jvmArgs "-javaagent:$jmockit" } } @@ -303,7 +298,6 @@ configure(project(':desktop')) { compileOnly "org.projectlombok:lombok:$lombokVersion" annotationProcessor "org.projectlombok:lombok:$lombokVersion" - testCompile "org.jmockit:jmockit:$jmockitVersion" testCompile("org.mockito:mockito-core:$mockitoVersion") { } testCompile "org.springframework:spring-test:$springVersion" @@ -314,9 +308,6 @@ configure(project(':desktop')) { test { systemProperty 'jdk.attach.allowAttachSelf', true - - def jmockit = configurations.testCompile.files.find { it.name.contains("jmockit") }.absolutePath - jvmArgs "-javaagent:$jmockit" } } diff --git a/core/src/test/java/bisq/core/dao/node/full/BlockParserTest.java b/core/src/test/java/bisq/core/dao/node/full/BlockParserTest.java index b2bac9d193c..21b34eb59ad 100644 --- a/core/src/test/java/bisq/core/dao/node/full/BlockParserTest.java +++ b/core/src/test/java/bisq/core/dao/node/full/BlockParserTest.java @@ -17,44 +17,10 @@ package bisq.core.dao.node.full; -import bisq.core.dao.node.parser.BlockParser; -import bisq.core.dao.node.parser.TxParser; -import bisq.core.dao.state.DaoStateService; -import bisq.core.dao.state.model.blockchain.TxInput; -import bisq.core.dao.state.model.blockchain.TxOutputKey; - -import bisq.common.proto.persistable.PersistenceProtoResolver; - -import org.bitcoinj.core.Coin; - -import com.neemre.btcdcli4j.core.domain.RawBlock; -import com.neemre.btcdcli4j.core.domain.RawTransaction; - -import com.google.common.collect.ImmutableList; - -import java.io.File; - -import java.math.BigDecimal; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.Optional; - -import mockit.Expectations; -import mockit.Injectable; -import mockit.Tested; - -import org.junit.Ignore; -import org.junit.Test; - -import static java.util.Arrays.asList; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - - +// not converting this test because it is already ignored. // Intro to jmockit can be found at http://jmockit.github.io/tutorial/Mocking.html -@Ignore +//@Ignore +/* public class BlockParserTest { // @Tested classes are instantiated automatically when needed in a test case, // using injection where possible, see http://jmockit.github.io/tutorial/Mocking.html#tested @@ -213,7 +179,7 @@ public void testParseBlocks() { }); */ - // Verify that the genesis tx has been added to the bsq blockchain with the correct issuance amount +// Verify that the genesis tx has been added to the bsq blockchain with the correct issuance amount /* assertTrue(daoStateService.getGenesisTx().get() == genesisTx); assertTrue(daoStateService.getGenesisTotalSupply().getValue() == issuance.getValue()); @@ -232,7 +198,8 @@ public void testParseBlocks() { assertTrue(bsqOut2.getValue() == bsqTx1Value2); assertFalse(daoStateService.isTxOutputSpendable(genesisTxId, 0)); assertTrue(daoStateService.isTxOutputSpendable(bsqTx1Id, 0)); - assertTrue(daoStateService.isTxOutputSpendable(bsqTx1Id, 1));*/ + assertTrue(daoStateService.isTxOutputSpendable(bsqTx1Id, 1)); } -} + } + */ diff --git a/p2p/src/test/java/bisq/network/p2p/storage/P2PDataStorageTest.java b/p2p/src/test/java/bisq/network/p2p/storage/P2PDataStorageTest.java index b8cd84bea77..8af80e2a1b8 100644 --- a/p2p/src/test/java/bisq/network/p2p/storage/P2PDataStorageTest.java +++ b/p2p/src/test/java/bisq/network/p2p/storage/P2PDataStorageTest.java @@ -47,19 +47,11 @@ import java.util.HashSet; import java.util.Set; -import lombok.extern.slf4j.Slf4j; - -import mockit.Mocked; -import mockit.integration.junit4.JMockit; - import org.junit.After; import org.junit.Before; -import org.junit.Ignore; -import org.junit.runner.RunWith; -@Slf4j -@RunWith(JMockit.class) -@Ignore("Use NetworkProtoResolver, PersistenceProtoResolver or ProtoResolver which are all in io.bisq.common.") +import static org.mockito.Mockito.mock; + public class P2PDataStorageTest { private final Set seedNodes = new HashSet<>(); private EncryptionService encryptionService1, encryptionService2; @@ -70,14 +62,10 @@ public class P2PDataStorageTest { private File dir1; private File dir2; - @Mocked - Broadcaster broadcaster; - @Mocked - NetworkNode networkNode; - @Mocked - NetworkProtoResolver networkProtoResolver; - @Mocked - PersistenceProtoResolver persistenceProtoResolver; + Broadcaster broadcaster = mock(Broadcaster.class); + NetworkNode networkNode = mock(NetworkNode.class); + NetworkProtoResolver networkProtoResolver = mock(NetworkProtoResolver.class); + PersistenceProtoResolver persistenceProtoResolver = mock(PersistenceProtoResolver.class); @Before public void setup() throws InterruptedException, NoSuchAlgorithmException, CertificateException, KeyStoreException, IOException, CryptoException, SignatureException, InvalidKeyException { From 0af6097ab0ab5eee312ce725f9c2f54d58e92874 Mon Sep 17 00:00:00 2001 From: Christoph Sturm Date: Tue, 13 Aug 2019 19:54:30 +0200 Subject: [PATCH 08/17] make final classes final again --- .../java/bisq/core/dao/governance/period/PeriodService.java | 2 +- core/src/main/java/bisq/core/offer/OfferPayload.java | 2 +- core/src/main/java/bisq/core/user/Preferences.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/bisq/core/dao/governance/period/PeriodService.java b/core/src/main/java/bisq/core/dao/governance/period/PeriodService.java index dfe18cb07a5..18ea9b61912 100644 --- a/core/src/main/java/bisq/core/dao/governance/period/PeriodService.java +++ b/core/src/main/java/bisq/core/dao/governance/period/PeriodService.java @@ -32,7 +32,7 @@ import javax.annotation.Nullable; @Slf4j -public class PeriodService { +public final class PeriodService { private final DaoStateService daoStateService; diff --git a/core/src/main/java/bisq/core/offer/OfferPayload.java b/core/src/main/java/bisq/core/offer/OfferPayload.java index a81f4e02f4d..0e131360cff 100644 --- a/core/src/main/java/bisq/core/offer/OfferPayload.java +++ b/core/src/main/java/bisq/core/offer/OfferPayload.java @@ -51,7 +51,7 @@ @EqualsAndHashCode @Getter @Slf4j -public class OfferPayload implements ProtectedStoragePayload, ExpirablePayload, RequiresOwnerIsOnlinePayload { +public final class OfferPayload implements ProtectedStoragePayload, ExpirablePayload, RequiresOwnerIsOnlinePayload { /////////////////////////////////////////////////////////////////////////////////////////// // Enum diff --git a/core/src/main/java/bisq/core/user/Preferences.java b/core/src/main/java/bisq/core/user/Preferences.java index 1d504ec98e3..52e96b90dad 100644 --- a/core/src/main/java/bisq/core/user/Preferences.java +++ b/core/src/main/java/bisq/core/user/Preferences.java @@ -76,7 +76,7 @@ @Slf4j @Singleton -public class Preferences implements PersistedDataHost, BridgeAddressProvider { +public final class Preferences implements PersistedDataHost, BridgeAddressProvider { private static final ArrayList BTC_MAIN_NET_EXPLORERS = new ArrayList<>(Arrays.asList( new BlockChainExplorer("Blockstream.info", "https://blockstream.info/tx/", "https://blockstream.info/address/"), From 95b65976ad321c366a79917f4467c10a35f70e00 Mon Sep 17 00:00:00 2001 From: Christoph Sturm Date: Tue, 13 Aug 2019 19:55:03 +0200 Subject: [PATCH 09/17] simplify --- core/src/test/java/bisq/core/trade/TradableListTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/test/java/bisq/core/trade/TradableListTest.java b/core/src/test/java/bisq/core/trade/TradableListTest.java index a012f1f5afc..2b0d1012b31 100644 --- a/core/src/test/java/bisq/core/trade/TradableListTest.java +++ b/core/src/test/java/bisq/core/trade/TradableListTest.java @@ -47,7 +47,7 @@ public void protoTesting() { //openOfferTradableList = new TradableList(storage,Lists.newArrayList(openOffer)); openOfferTradableList.add(openOffer); message = (protobuf.PersistableEnvelope) openOfferTradableList.toProtoMessage(); - assertTrue(message.getMessageCase().equals(TRADABLE_LIST)); + assertEquals(message.getMessageCase(), TRADABLE_LIST); assertEquals(1, message.getTradableList().getTradableList().size()); } } From 9278ad021be89d6657ec8e3cf740cb66c24ef621 Mon Sep 17 00:00:00 2001 From: Christoph Sturm Date: Tue, 13 Aug 2019 19:59:12 +0200 Subject: [PATCH 10/17] don't force jdk 10 on developers --- build.gradle | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/build.gradle b/build.gradle index 04fd798b860..7cac2454cb5 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,3 @@ -/*if(JavaVersion.current() != JavaVersion.VERSION_1_10){ -// feel free to delete this if you know what you are doing - throw new GradleException("This build must be run with java 10. see docs/build.md") -}*/ buildscript { repositories { jcenter() @@ -248,7 +244,7 @@ configure(project(':core')) { compileOnly "org.projectlombok:lombok:$lombokVersion" annotationProcessor "org.projectlombok:lombok:$lombokVersion" - testCompile("org.mockito:mockito-core:$mockitoVersion") + testCompile("org.mockito:mockito-core:$mockitoVersion") testCompile "org.springframework:spring-test:$springVersion" testCompile "com.natpryce:make-it-easy:$easyVersion" testCompile group: 'org.hamcrest', name: 'hamcrest-all', version: '1.3' From 0e5413175201c4e4db367f4a8493619838f750d8 Mon Sep 17 00:00:00 2001 From: Christoph Sturm Date: Tue, 13 Aug 2019 20:38:00 +0200 Subject: [PATCH 11/17] Update README.md Co-Authored-By: Florian Reimair --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index eb68ebd923e..332ccaf0d11 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,6 @@ Follow the step-by-step instructions at https://bisq.network/get-started. ## Contribute to Bisq -<<<<<<< Updated upstream Bisq currently requires JDK 10 . See the scripts directory for scripts that can be used to install and configure the JDK automatically. TIP: If you are on MacOS, run the script with this command . scripts/install_java.sh. From a97b9078ea1c420df811d5bd2cb1c54e58fd3aa5 Mon Sep 17 00:00:00 2001 From: Oscar65 Date: Wed, 14 Aug 2019 08:13:03 +0200 Subject: [PATCH 12/17] typo in usuario --- core/src/main/resources/i18n/displayStrings_es.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/resources/i18n/displayStrings_es.properties b/core/src/main/resources/i18n/displayStrings_es.properties index 4947fd9d5e9..c063f976d94 100644 --- a/core/src/main/resources/i18n/displayStrings_es.properties +++ b/core/src/main/resources/i18n/displayStrings_es.properties @@ -1872,7 +1872,7 @@ showWalletDataWindow.includePrivKeys=Incluir claves privadas: # We do not translate the tac because of the legal nature. We would need translations checked by lawyers # in each language which is too expensive atm. -tacWindow.headline=Acuerdo de usario +tacWindow.headline=Acuerdo de usuario tacWindow.agree=Estoy de acuerdo tacWindow.disagree=No estoy de acuerdo, salir tacWindow.arbitrationSystem=Sistema arbitraje From bd06d2a7dff829807f8fe66f47654696ef386009 Mon Sep 17 00:00:00 2001 From: Christoph Sturm Date: Wed, 14 Aug 2019 10:42:38 +0200 Subject: [PATCH 13/17] document what this is for --- .../resources/mockito-extensions/org.mockito.plugins.MockMaker | 2 +- .../resources/mockito-extensions/org.mockito.plugins.MockMaker | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker b/core/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker index 1f0955d450f..9cd68a02bd8 100644 --- a/core/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker +++ b/core/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker @@ -1 +1 @@ -mock-maker-inline +mock-maker-inline # enable mocking final classes in mockito diff --git a/desktop/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker b/desktop/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker index 1f0955d450f..9cd68a02bd8 100644 --- a/desktop/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker +++ b/desktop/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker @@ -1 +1 @@ -mock-maker-inline +mock-maker-inline # enable mocking final classes in mockito From d5af6e5260909a9f94c842fb5c8146ea7162d801 Mon Sep 17 00:00:00 2001 From: Christoph Sturm Date: Wed, 14 Aug 2019 10:45:05 +0200 Subject: [PATCH 14/17] avoid acronyms --- .../main/market/trades/TradesChartsViewModelTest.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/desktop/src/test/java/bisq/desktop/main/market/trades/TradesChartsViewModelTest.java b/desktop/src/test/java/bisq/desktop/main/market/trades/TradesChartsViewModelTest.java index 70dea240aee..7e969c41006 100644 --- a/desktop/src/test/java/bisq/desktop/main/market/trades/TradesChartsViewModelTest.java +++ b/desktop/src/test/java/bisq/desktop/main/market/trades/TradesChartsViewModelTest.java @@ -62,7 +62,7 @@ public class TradesChartsViewModelTest { TradesChartsViewModel model; - TradeStatisticsManager tsm; + TradeStatisticsManager tradeStatisticsManager; private static final Logger log = LoggerFactory.getLogger(TradesChartsViewModelTest.class); DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); @@ -109,8 +109,8 @@ public class TradesChartsViewModelTest { ); @Before public void setup() throws IOException { - tsm = mock(TradeStatisticsManager.class); - model = new TradesChartsViewModel(tsm, mock(Preferences.class), mock(PriceFeedService.class), + tradeStatisticsManager = mock(TradeStatisticsManager.class); + model = new TradesChartsViewModel(tradeStatisticsManager, mock(Preferences.class), mock(PriceFeedService.class), mock(Navigation.class), mock(BSFormatter.class)); dir = File.createTempFile("temp_tests1", ""); //noinspection ResultOfMethodCallIgnored @@ -206,7 +206,7 @@ long currentTimeMillis() { // Run test for each tick type for (TradesChartsViewModel.TickUnit tick : TradesChartsViewModel.TickUnit.values()) { /* new Expectations() {{ - tsm.getObservableTradeStatisticsSet(); + tradeStatisticsManager.getObservableTradeStatisticsSet(); result = tradeStats; }};*/ From 9ef7f89ffde33eae77f396e78fa700ec8a121492 Mon Sep 17 00:00:00 2001 From: battleofwizards Date: Wed, 14 Aug 2019 13:51:42 +0200 Subject: [PATCH 15/17] Remove legacy hack from build.gradle installDist task The rationale for the "delete fileTree" hack no longer exists because the conflicting files are not created anymore. --- build.gradle | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/build.gradle b/build.gradle index dd82c33ea54..55ab11e7f79 100644 --- a/build.gradle +++ b/build.gradle @@ -88,17 +88,6 @@ configure([project(':desktop'), // copy generated shell scripts, e.g. `bisq-desktop` directly to the project // root directory for discoverability and ease of use - // TODO @cbeams The copy task below fails because the copied files are conflicting with the project - // folder name. I temporarily delete those files as I think they are duplicated anyway (bisq-* are probably - // the one to use). Would be good if those files don't get created in the first place. - // The .bat files are also deleted. - delete fileTree(dir: "$destinationDir/bin", include: 'desktop*') - delete fileTree(dir: "$destinationDir/bin", include: 'monitor*') - delete fileTree(dir: "$destinationDir/bin", include: 'seednode*') - delete fileTree(dir: "$destinationDir/bin", include: 'pricenode*') - delete fileTree(dir: "$destinationDir/bin", include: 'statsnode*') - delete fileTree(dir: "$destinationDir/bin", include: 'relay*') - copy { from "$destinationDir/bin" into rootProject.projectDir From 32db1019b59c52d119f0c22fa07c418fd647912b Mon Sep 17 00:00:00 2001 From: wiz Date: Wed, 14 Aug 2019 23:23:25 +0900 Subject: [PATCH 16/17] Add wiz bitcoin node to BtcNodes list --- core/src/main/java/bisq/core/btc/nodes/BtcNodes.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/src/main/java/bisq/core/btc/nodes/BtcNodes.java b/core/src/main/java/bisq/core/btc/nodes/BtcNodes.java index b97030bf250..37e66313bfc 100644 --- a/core/src/main/java/bisq/core/btc/nodes/BtcNodes.java +++ b/core/src/main/java/bisq/core/btc/nodes/BtcNodes.java @@ -77,6 +77,9 @@ public List getProvidedBtcNodes() { // sgeisler new BtcNode("bcwat.ch", "z33nukt7ngik3cpe.onion", "5.189.166.193", BtcNode.DEFAULT_PORT, "@sgeisler"), + // wiz + new BtcNode("node100.hnl.wiz.biz", "22tg6ufbwz6o3l2u.onion", "103.99.168.100", BtcNode.DEFAULT_PORT, "@wiz"), + // others new BtcNode("btc.jochen-hoenicke.de", "sslnjjhnmwllysv4.onion", "88.198.39.205", BtcNode.DEFAULT_PORT, "@jhoenicke"), new BtcNode("bitcoin4-fullnode.csg.uzh.ch", null, "192.41.136.217", BtcNode.DEFAULT_PORT, "@tbocek") // requested onion From 72a6b784dc281bda1b4f78d3fa2bf0ac6ff00210 Mon Sep 17 00:00:00 2001 From: battleofwizards Date: Tue, 13 Aug 2019 21:08:15 +0200 Subject: [PATCH 17/17] Render proper column headers and values for CSV exports; fix #3075 When exporting to CSV, both portfolio/trades and funds/transactions were lacking the column headers. Additionally, portfolio/trades colum values were outdated and not matching the intended export. Both issues are fixed. --- .../funds/transactions/TransactionsView.java | 3 +- .../closedtrades/ClosedTradesView.java | 28 +++++++++---------- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/desktop/src/main/java/bisq/desktop/main/funds/transactions/TransactionsView.java b/desktop/src/main/java/bisq/desktop/main/funds/transactions/TransactionsView.java index fe3c3b904bc..cb03b9b2366 100644 --- a/desktop/src/main/java/bisq/desktop/main/funds/transactions/TransactionsView.java +++ b/desktop/src/main/java/bisq/desktop/main/funds/transactions/TransactionsView.java @@ -247,8 +247,7 @@ protected void activate() { CSVEntryConverter headerConverter = transactionsListItem -> { String[] columns = new String[6]; for (int i = 0; i < columns.length; i++) - columns[i] = tableColumns.get(i).getText(); - + columns[i] = ((AutoTooltipLabel) tableColumns.get(i).getGraphic()).getText(); return columns; }; CSVEntryConverter contentConverter = item -> { diff --git a/desktop/src/main/java/bisq/desktop/main/portfolio/closedtrades/ClosedTradesView.java b/desktop/src/main/java/bisq/desktop/main/portfolio/closedtrades/ClosedTradesView.java index a5f20d20366..ebc12ed3893 100644 --- a/desktop/src/main/java/bisq/desktop/main/portfolio/closedtrades/ClosedTradesView.java +++ b/desktop/src/main/java/bisq/desktop/main/portfolio/closedtrades/ClosedTradesView.java @@ -85,7 +85,7 @@ public class ClosedTradesView extends ActivatableViewAndModel tableView; @FXML - TableColumn priceColumn, amountColumn, volumeColumn, txFeeColumn, makerFeeColumn, buyerSecurityDepositColumn, sellerSecurityDepositColumn, + TableColumn priceColumn, amountColumn, volumeColumn, txFeeColumn, makerFeeColumn, buyerSecurityDepositColumn, sellerSecurityDepositColumn, marketColumn, directionColumn, dateColumn, tradeIdColumn, stateColumn, avatarColumn; @FXML HBox footerBox; @@ -272,25 +272,25 @@ protected void activate() { exportButton.setOnAction(event -> { final ObservableList> tableColumns = tableView.getColumns(); CSVEntryConverter headerConverter = transactionsListItem -> { - String[] columns = new String[11]; + String[] columns = new String[12]; for (int i = 0; i < columns.length; i++) - columns[i] = tableColumns.get(i).getText(); - + columns[i] = ((AutoTooltipLabel) tableColumns.get(i).getGraphic()).getText(); return columns; }; CSVEntryConverter contentConverter = item -> { - String[] columns = new String[11]; + String[] columns = new String[12]; columns[0] = model.getTradeId(item); columns[1] = model.getDate(item); - columns[2] = model.getAmount(item); + columns[2] = model.getMarketLabel(item); columns[3] = model.getPrice(item); - columns[4] = model.getVolume(item); - columns[5] = model.getTxFee(item); - columns[6] = model.getMakerFee(item); - columns[7] = model.getBuyerSecurityDeposit(item); - columns[8] = model.getSellerSecurityDeposit(item); - columns[9] = model.getDirectionLabel(item); - columns[10] = model.getState(item); + columns[4] = model.getAmount(item); + columns[5] = model.getVolume(item); + columns[6] = model.getTxFee(item); + columns[7] = model.getMakerFee(item); + columns[8] = model.getBuyerSecurityDeposit(item); + columns[9] = model.getSellerSecurityDeposit(item); + columns[10] = model.getDirectionLabel(item); + columns[11] = model.getState(item); return columns; }; @@ -627,5 +627,5 @@ public void updateItem(final ClosedTradableListItem item, boolean empty) { } }); } - + }