Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

regtest: Remove dependency to process module #2766

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

package bisq.wallets.bitcoind;

import bisq.wallets.bitcoind.regtest.BitcoindExtension;
import bisq.wallets.regtest.BitcoindExtension;
import bisq.wallets.regtest.ConnectionFailureIntegrationTests;
import bisq.wallets.regtest.bitcoind.BitcoindRegtestSetup;
import bisq.wallets.regtest.process.MultiProcessCoordinator;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

package bisq.wallets.bitcoind;

import bisq.wallets.bitcoind.regtest.BitcoindExtension;
import bisq.wallets.regtest.BitcoindExtension;
import bisq.wallets.bitcoind.rpc.BitcoindDaemon;
import bisq.wallets.bitcoind.rpc.calls.BitcoindCreateWalletRpcCall;
import bisq.wallets.json_rpc.RpcConfig;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

package bisq.wallets.bitcoind;

import bisq.wallets.bitcoind.regtest.BitcoindExtension;
import bisq.wallets.regtest.BitcoindExtension;
import bisq.wallets.bitcoind.rpc.BitcoindDaemon;
import bisq.wallets.regtest.AbstractRegtestSetup;
import bisq.wallets.regtest.bitcoind.BitcoindRegtestSetup;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

package bisq.wallets.bitcoind;

import bisq.wallets.bitcoind.regtest.BitcoindExtension;
import bisq.wallets.regtest.BitcoindExtension;
import bisq.wallets.bitcoind.rpc.BitcoindWallet;
import bisq.wallets.bitcoind.rpc.responses.BitcoindDescriptor;
import bisq.wallets.bitcoind.rpc.responses.BitcoindListDescriptorResponse;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

package bisq.wallets.bitcoind;

import bisq.wallets.bitcoind.regtest.BitcoindExtension;
import bisq.wallets.regtest.BitcoindExtension;
import bisq.wallets.bitcoind.rpc.BitcoindDaemon;
import bisq.wallets.bitcoind.rpc.BitcoindWallet;
import bisq.wallets.bitcoind.rpc.calls.requests.BitcoindImportDescriptorRequestEntry;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

package bisq.wallets.bitcoind;

import bisq.wallets.bitcoind.regtest.BitcoindExtension;
import bisq.wallets.regtest.BitcoindExtension;
import bisq.wallets.bitcoind.rpc.BitcoindWallet;
import bisq.wallets.core.model.AddressType;
import bisq.wallets.regtest.bitcoind.BitcoindRegtestSetup;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

package bisq.wallets.bitcoind;

import bisq.wallets.bitcoind.regtest.BitcoindExtension;
import bisq.wallets.regtest.BitcoindExtension;
import bisq.wallets.bitcoind.rpc.BitcoindWallet;
import bisq.wallets.bitcoind.rpc.responses.BitcoindListTransactionsResponse;
import bisq.wallets.core.model.AddressType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

package bisq.wallets.bitcoind;

import bisq.wallets.bitcoind.regtest.BitcoindExtension;
import bisq.wallets.regtest.BitcoindExtension;
import bisq.wallets.bitcoind.rpc.BitcoindWallet;
import bisq.wallets.bitcoind.rpc.responses.BitcoindListUnspentResponse;
import bisq.wallets.regtest.bitcoind.BitcoindRegtestSetup;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

package bisq.wallets.bitcoind;

import bisq.wallets.bitcoind.regtest.BitcoindExtension;
import bisq.wallets.regtest.BitcoindExtension;
import bisq.wallets.bitcoind.rpc.BitcoindWallet;
import bisq.wallets.core.model.AddressType;
import bisq.wallets.regtest.bitcoind.BitcoindRegtestSetup;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

package bisq.wallets.bitcoind;

import bisq.wallets.bitcoind.regtest.BitcoindExtension;
import bisq.wallets.regtest.BitcoindExtension;
import bisq.wallets.bitcoind.rpc.BitcoindWallet;
import bisq.wallets.core.model.AddressType;
import bisq.wallets.regtest.bitcoind.BitcoindRegtestSetup;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

package bisq.wallets.bitcoind;

import bisq.wallets.bitcoind.regtest.BitcoindExtension;
import bisq.wallets.regtest.BitcoindExtension;
import bisq.wallets.bitcoind.rpc.BitcoindDaemon;
import bisq.wallets.bitcoind.rpc.BitcoindWallet;
import bisq.wallets.json_rpc.RpcConfig;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

package bisq.wallets.bitcoind.zmq;

import bisq.wallets.bitcoind.regtest.BitcoindExtension;
import bisq.wallets.regtest.BitcoindExtension;
import bisq.wallets.regtest.bitcoind.BitcoindRegtestSetup;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

package bisq.wallets.bitcoind.zmq;

import bisq.wallets.bitcoind.regtest.BitcoindExtension;
import bisq.wallets.regtest.BitcoindExtension;
import bisq.wallets.bitcoind.rpc.BitcoindDaemon;
import bisq.wallets.bitcoind.rpc.responses.BitcoindGetZmqNotificationsResponse;
import bisq.wallets.regtest.bitcoind.BitcoindRegtestSetup;
Expand Down
3 changes: 2 additions & 1 deletion wallets/electrum/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ dependencies {
implementation("bisq:persistence")
implementation(project(":json-rpc"))
implementation(project(":process"))

implementation(project(":regtest"))

implementation(libs.typesafe.config)
implementation(libs.bundles.glassfish.jersey)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import bisq.wallets.electrum.rpc.ElectrumDaemon;
import bisq.wallets.electrum.rpc.ElectrumProcessConfig;
import bisq.wallets.electrum.rpc.responses.ElectrumCreateResponse;
import bisq.wallets.process.BisqProcess;
import bisq.wallets.regtest.process.BisqProcess;
import bisq.wallets.regtest.AbstractRegtestSetup;
import bisq.wallets.regtest.bitcoind.RemoteBitcoind;
import lombok.Getter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
import bisq.common.file.InputStreamScanner;
import bisq.common.file.LogScanner;
import bisq.wallets.json_rpc.RpcConfig;
import bisq.wallets.process.DaemonProcess;
import bisq.wallets.process.ProcessConfig;
import bisq.wallets.regtest.process.DaemonProcess;
import bisq.wallets.regtest.process.ProcessConfig;
import lombok.extern.slf4j.Slf4j;

import java.util.Collections;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import bisq.common.platform.PlatformUtils;
import bisq.wallets.electrum.rpc.ElectrumDaemon;
import bisq.wallets.electrum.rpc.ElectrumProcessConfig;
import bisq.wallets.process.BisqProcess;
import bisq.wallets.regtest.process.BisqProcess;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
import bisq.wallets.json_rpc.JsonRpcClient;
import bisq.wallets.json_rpc.RpcClientFactory;
import bisq.wallets.json_rpc.RpcConfig;
import bisq.wallets.process.DaemonProcess;
import bisq.wallets.process.ProcessConfig;
import bisq.wallets.regtest.process.DaemonProcess;
import bisq.wallets.regtest.process.ProcessConfig;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import bisq.wallets.elementsd.ElementsdConfig;
import bisq.wallets.elementsd.rpc.ElementsdDaemon;
import bisq.wallets.json_rpc.JsonRpcClient;
import bisq.wallets.process.ProcessConfig;
import bisq.wallets.regtest.process.ProcessConfig;
import bisq.wallets.regtest.bitcoind.BitcoindRegtestProcess;
import lombok.extern.slf4j.Slf4j;

Expand Down
3 changes: 0 additions & 3 deletions wallets/regtest/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ dependencies {
implementation(project(":core"))
implementation(project(":bitcoind"))
implementation(project(":json-rpc"))
implementation(project(":process"))

api(project(":process"))

implementation(libs.assertj.core)
implementation(libs.junit.jupiter)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import bisq.common.file.FileUtils;
import bisq.wallets.json_rpc.RpcConfig;
import bisq.wallets.process.BisqProcess;
import bisq.wallets.regtest.process.BisqProcess;

import java.io.IOException;
import java.nio.file.Path;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

package bisq.wallets.regtest;

import bisq.wallets.process.BisqProcess;
import bisq.wallets.regtest.process.BisqProcess;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.TestInstance;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/

package bisq.wallets.bitcoind.regtest;
package bisq.wallets.regtest;

import bisq.wallets.regtest.bitcoind.BitcoindRegtestSetup;
import org.junit.jupiter.api.extension.BeforeAllCallback;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import bisq.wallets.json_rpc.RpcClientFactory;
import bisq.wallets.json_rpc.JsonRpcClient;
import bisq.wallets.json_rpc.exceptions.InvalidRpcCredentialsException;
import bisq.wallets.process.BisqProcess;
import bisq.wallets.regtest.process.BisqProcess;
import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.Test;

Expand Down
62 changes: 62 additions & 0 deletions wallets/regtest/src/main/java/bisq/wallets/regtest/Os.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
package bisq.wallets.regtest;

import lombok.Getter;

import java.util.Locale;

public enum Os {
LINUX("linux"),
MAC_OS("macos"),
WINDOWS("win");

@Getter
private final String canonicalName;

Os(String canonicalName) {
this.canonicalName = canonicalName;
}

public static bisq.common.platform.OS getOS() {
String osName = getOsName();
if (isLinux(osName)) {
return bisq.common.platform.OS.LINUX;
} else if (isMacOs(osName)) {
return bisq.common.platform.OS.MAC_OS;
} else if (isWindows(osName)) {
return bisq.common.platform.OS.WINDOWS;
}
throw new IllegalStateException("Running on unsupported OS: " + osName);
}

public static boolean isLinux() {
return isLinux(getOsName());
}

public static boolean isLinux(String osName) {
return osName.contains("linux");
}

public static boolean isMacOs() {
return isMacOs(getOsName());
}

public static boolean isMacOs(String osName) {
return osName.contains("mac") || osName.contains("darwin");
}

public static boolean isWindows() {
return isWindows(getOsName());
}

public static boolean isWindows(String osName) {
return osName.contains("win");
}

public static String getOsName() {
return System.getProperty("os.name").toLowerCase(Locale.US);
}

public static String getOsVersion() {
return System.getProperty("os.version");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

package bisq.wallets.regtest;

import bisq.wallets.process.BisqProcess;
import bisq.wallets.regtest.process.BisqProcess;
import org.junit.jupiter.api.Test;

import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
import bisq.wallets.json_rpc.RpcCallFailureException;
import bisq.wallets.json_rpc.RpcClientFactory;
import bisq.wallets.json_rpc.RpcConfig;
import bisq.wallets.process.DaemonProcess;
import bisq.wallets.process.ProcessConfig;
import bisq.wallets.regtest.process.DaemonProcess;
import bisq.wallets.regtest.process.ProcessConfig;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@

package bisq.wallets.regtest.bitcoind;

import bisq.common.platform.OS;
import bisq.common.util.NetworkUtils;
import bisq.wallets.bitcoind.rpc.BitcoindDaemon;
import bisq.wallets.bitcoind.rpc.BitcoindWallet;
import bisq.wallets.bitcoind.rpc.responses.BitcoindListUnspentResponse;
import bisq.wallets.bitcoind.zmq.ZmqListeners;
import bisq.wallets.json_rpc.RpcConfig;
import bisq.wallets.regtest.AbstractRegtestSetup;
import bisq.wallets.regtest.Os;
import bisq.wallets.regtest.process.MultiProcessCoordinator;
import lombok.Getter;

Expand Down Expand Up @@ -158,7 +158,7 @@ private Path installBitcoind(Path bitcoindBinaryDir) throws IOException {
throw new IllegalStateException("Couldn't extract bitcoind binary.");
}

if (OS.isLinux() || OS.isMacOs()) {
if (Os.isLinux() || Os.isMacOs()) {
isSuccess = bitcoindPath.toFile().setExecutable(true);
if (!isSuccess) {
throw new IllegalStateException("Couldn't set executable bit on bitcoind binary.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import bisq.wallets.json_rpc.JsonRpcClient;
import bisq.wallets.json_rpc.RpcClientFactory;
import bisq.wallets.json_rpc.RpcConfig;
import bisq.wallets.process.BisqProcess;
import bisq.wallets.regtest.process.BisqProcess;
import lombok.Getter;

import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/

package bisq.wallets.process;
package bisq.wallets.regtest.process;

public interface BisqProcess {
void start() throws InterruptedException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/

package bisq.wallets.process;
package bisq.wallets.regtest.process;

public class CannotStartProcessException extends RuntimeException {
public CannotStartProcessException(String message, Throwable cause) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/

package bisq.wallets.process;
package bisq.wallets.regtest.process;

import bisq.common.file.FileUtils;
import bisq.common.file.LogScanner;
import bisq.wallets.core.exceptions.WalletStartupFailedException;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@

package bisq.wallets.regtest.process;

import bisq.wallets.core.exceptions.WalletStartupFailedException;
import bisq.wallets.process.BisqProcess;
import com.google.common.collect.Lists;

import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/

package bisq.wallets.process;
package bisq.wallets.regtest.process;

import lombok.Builder;
import lombok.EqualsAndHashCode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/

package bisq.wallets.core.exceptions;
package bisq.wallets.regtest.process;

public class WalletStartupFailedException extends RuntimeException {
public WalletStartupFailedException(String message, Throwable cause) {
Expand Down
Loading