mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-07-21 06:11:46 -04:00
rename all packages and other names from bisq to haveno
This commit is contained in:
parent
ab0b9e3b77
commit
1a1fb130c0
1775 changed files with 14575 additions and 16767 deletions
|
@ -15,23 +15,21 @@
|
|||
* along with Haveno. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package bisq.apitest;
|
||||
package haveno.apitest;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import static bisq.apitest.Scaffold.EXIT_FAILURE;
|
||||
import static bisq.apitest.Scaffold.EXIT_SUCCESS;
|
||||
import static bisq.apitest.config.ApiTestRateMeterInterceptorConfig.appendCallRateMeteringConfigPathOpt;
|
||||
import static bisq.apitest.config.ApiTestRateMeterInterceptorConfig.getTestRateMeterInterceptorConfig;
|
||||
import static bisq.apitest.config.ApiTestRateMeterInterceptorConfig.hasCallRateMeteringConfigPathOpt;
|
||||
import static haveno.apitest.Scaffold.EXIT_FAILURE;
|
||||
import static haveno.apitest.Scaffold.EXIT_SUCCESS;
|
||||
import static haveno.apitest.config.ApiTestRateMeterInterceptorConfig.appendCallRateMeteringConfigPathOpt;
|
||||
import static haveno.apitest.config.ApiTestRateMeterInterceptorConfig.getTestRateMeterInterceptorConfig;
|
||||
import static haveno.apitest.config.ApiTestRateMeterInterceptorConfig.hasCallRateMeteringConfigPathOpt;
|
||||
import static java.lang.System.err;
|
||||
import static java.lang.System.exit;
|
||||
|
||||
|
||||
|
||||
import bisq.apitest.config.ApiTestConfig;
|
||||
import haveno.apitest.config.ApiTestConfig;
|
||||
|
||||
/**
|
||||
* ApiTestMain is a placeholder for the gradle build file, which requires a valid
|
||||
|
@ -39,12 +37,12 @@ import bisq.apitest.config.ApiTestConfig;
|
|||
*
|
||||
* It has some uses:
|
||||
*
|
||||
* It can be used to print test scaffolding options: bisq-apitest --help.
|
||||
* It can be used to print test scaffolding options: haveno-apitest --help.
|
||||
*
|
||||
* It can be used to smoke test your bitcoind environment: bisq-apitest.
|
||||
* It can be used to smoke test your bitcoind environment: haveno-apitest.
|
||||
*
|
||||
* It can be used to run the regtest environment for release testing:
|
||||
* bisq-test --shutdownAfterTests=false
|
||||
* haveno-test --shutdownAfterTests=false
|
||||
*
|
||||
* All method, scenario and end-to-end tests are found in the test sources folder.
|
||||
*
|
||||
|
@ -81,7 +79,7 @@ public class ApiTestMain {
|
|||
|
||||
} catch (Throwable ex) {
|
||||
err.println("Fault: An unexpected error occurred. " +
|
||||
"Please file a report at https://bisq.network/issues");
|
||||
"Please file a report at https://haveno.network/issues");
|
||||
ex.printStackTrace(err);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
|
@ -15,11 +15,17 @@
|
|||
* along with Haveno. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package bisq.apitest;
|
||||
|
||||
import bisq.common.config.HavenoHelpFormatter;
|
||||
import bisq.common.util.Utilities;
|
||||
package haveno.apitest;
|
||||
|
||||
import haveno.apitest.config.ApiTestConfig;
|
||||
import haveno.apitest.config.HavenoAppConfig;
|
||||
import haveno.apitest.linux.BashCommand;
|
||||
import haveno.apitest.linux.BitcoinDaemon;
|
||||
import haveno.apitest.linux.HavenoProcess;
|
||||
import haveno.apitest.linux.LinuxProcess;
|
||||
import haveno.cli.GrpcClient;
|
||||
import haveno.common.config.HavenoHelpFormatter;
|
||||
import haveno.common.util.Utilities;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
|
@ -41,11 +47,11 @@ import lombok.extern.slf4j.Slf4j;
|
|||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import static bisq.apitest.Scaffold.BitcoinCoreApp.bitcoind;
|
||||
import static bisq.apitest.config.ApiTestConfig.MEDIATOR;
|
||||
import static bisq.apitest.config.ApiTestConfig.REFUND_AGENT;
|
||||
import static bisq.apitest.config.HavenoAppConfig.*;
|
||||
import static bisq.common.app.DevEnv.DEV_PRIVILEGE_PRIV_KEY;
|
||||
import static haveno.apitest.Scaffold.BitcoinCoreApp.bitcoind;
|
||||
import static haveno.apitest.config.ApiTestConfig.MEDIATOR;
|
||||
import static haveno.apitest.config.ApiTestConfig.REFUND_AGENT;
|
||||
import static haveno.apitest.config.HavenoAppConfig.*;
|
||||
import static haveno.common.app.DevEnv.DEV_PRIVILEGE_PRIV_KEY;
|
||||
import static java.lang.String.format;
|
||||
import static java.lang.System.exit;
|
||||
import static java.lang.System.out;
|
||||
|
@ -54,16 +60,6 @@ import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
|
|||
import static java.util.concurrent.TimeUnit.MILLISECONDS;
|
||||
import static java.util.concurrent.TimeUnit.SECONDS;
|
||||
|
||||
|
||||
|
||||
import bisq.apitest.config.ApiTestConfig;
|
||||
import bisq.apitest.config.HavenoAppConfig;
|
||||
import bisq.apitest.linux.BashCommand;
|
||||
import bisq.apitest.linux.HavenoProcess;
|
||||
import bisq.apitest.linux.BitcoinDaemon;
|
||||
import bisq.apitest.linux.LinuxProcess;
|
||||
import bisq.cli.GrpcClient;
|
||||
|
||||
@Slf4j
|
||||
public class Scaffold {
|
||||
|
||||
|
@ -130,8 +126,8 @@ public class Scaffold {
|
|||
if (config.helpRequested) {
|
||||
config.printHelp(out,
|
||||
new HavenoHelpFormatter(
|
||||
"Bisq ApiTest",
|
||||
"bisq-apitest",
|
||||
"Haveno ApiTest",
|
||||
"haveno-apitest",
|
||||
"0.1.0"));
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
@ -249,7 +245,7 @@ public class Scaffold {
|
|||
Runtime.getRuntime().addShutdownHook(new Thread(this::tearDown));
|
||||
}
|
||||
|
||||
// Starts bitcoind and bisq apps (seednode, arbnode, etc...)
|
||||
// Starts bitcoind and haveno apps (seednode, arbnode, etc...)
|
||||
private void startBackgroundProcesses(ExecutorService executor,
|
||||
CountDownLatch countdownLatch)
|
||||
throws InterruptedException, IOException {
|
||||
|
@ -261,7 +257,7 @@ public class Scaffold {
|
|||
bitcoinDaemon.verifyBitcoinPathsExist(true);
|
||||
bitcoindTask = new SetupTask(bitcoinDaemon, countdownLatch);
|
||||
bitcoindTaskFuture = executor.submit(bitcoindTask);
|
||||
MILLISECONDS.sleep(config.bisqAppInitTime);
|
||||
MILLISECONDS.sleep(config.havenoAppInitTime);
|
||||
|
||||
LinuxProcess bitcoindProcess = bitcoindTask.getLinuxProcess();
|
||||
if (bitcoindProcess.hasStartupExceptions()) {
|
||||
|
@ -272,28 +268,28 @@ public class Scaffold {
|
|||
bitcoinDaemon.verifyBitcoindRunning();
|
||||
}
|
||||
|
||||
// Start Bisq apps defined by the supportingApps option, in the in proper order.
|
||||
// Start Haveno apps defined by the supportingApps option, in the in proper order.
|
||||
|
||||
if (config.hasSupportingApp(seednode.name()))
|
||||
startBisqApp(seednode, executor, countdownLatch);
|
||||
startHavenoApp(seednode, executor, countdownLatch);
|
||||
|
||||
if (config.hasSupportingApp(arbdaemon.name()))
|
||||
startBisqApp(arbdaemon, executor, countdownLatch);
|
||||
startHavenoApp(arbdaemon, executor, countdownLatch);
|
||||
else if (config.hasSupportingApp(arbdesktop.name()))
|
||||
startBisqApp(arbdesktop, executor, countdownLatch);
|
||||
startHavenoApp(arbdesktop, executor, countdownLatch);
|
||||
|
||||
if (config.hasSupportingApp(alicedaemon.name()))
|
||||
startBisqApp(alicedaemon, executor, countdownLatch);
|
||||
startHavenoApp(alicedaemon, executor, countdownLatch);
|
||||
else if (config.hasSupportingApp(alicedesktop.name()))
|
||||
startBisqApp(alicedesktop, executor, countdownLatch);
|
||||
startHavenoApp(alicedesktop, executor, countdownLatch);
|
||||
|
||||
if (config.hasSupportingApp(bobdaemon.name()))
|
||||
startBisqApp(bobdaemon, executor, countdownLatch);
|
||||
startHavenoApp(bobdaemon, executor, countdownLatch);
|
||||
else if (config.hasSupportingApp(bobdesktop.name()))
|
||||
startBisqApp(bobdesktop, executor, countdownLatch);
|
||||
startHavenoApp(bobdesktop, executor, countdownLatch);
|
||||
}
|
||||
|
||||
private void startBisqApp(HavenoAppConfig HavenoAppConfig,
|
||||
private void startHavenoApp(HavenoAppConfig HavenoAppConfig,
|
||||
ExecutorService executor,
|
||||
CountDownLatch countdownLatch)
|
||||
throws IOException, InterruptedException {
|
||||
|
@ -322,8 +318,8 @@ public class Scaffold {
|
|||
default:
|
||||
throw new IllegalStateException("Unknown HavenoAppConfig " + HavenoAppConfig.name());
|
||||
}
|
||||
log.info("Giving {} ms for {} to initialize ...", config.bisqAppInitTime, HavenoAppConfig.appName);
|
||||
MILLISECONDS.sleep(config.bisqAppInitTime);
|
||||
log.info("Giving {} ms for {} to initialize ...", config.havenoAppInitTime, HavenoAppConfig.appName);
|
||||
MILLISECONDS.sleep(config.havenoAppInitTime);
|
||||
if (HavenoProcess.hasStartupExceptions()) {
|
||||
HavenoProcess.logExceptions(HavenoProcess.getStartupExceptions(), log);
|
||||
throw new IllegalStateException(HavenoProcess.getStartupExceptions().get(0));
|
|
@ -15,7 +15,7 @@
|
|||
* along with Haveno. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package bisq.apitest;
|
||||
package haveno.apitest;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
|
@ -28,9 +28,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||
import static java.lang.String.format;
|
||||
import static java.util.concurrent.TimeUnit.MILLISECONDS;
|
||||
|
||||
|
||||
|
||||
import bisq.apitest.linux.LinuxProcess;
|
||||
import haveno.apitest.linux.LinuxProcess;
|
||||
|
||||
@Slf4j
|
||||
public class SetupTask implements Callable<SetupTask.Status> {
|
|
@ -15,16 +15,13 @@
|
|||
* along with Haveno. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package bisq.apitest;
|
||||
package haveno.apitest;
|
||||
|
||||
import haveno.apitest.linux.BashCommand;
|
||||
import java.io.IOException;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
|
||||
|
||||
import bisq.apitest.linux.BashCommand;
|
||||
|
||||
@Slf4j
|
||||
class SmokeTestBashCommand {
|
||||
|
|
@ -15,7 +15,7 @@
|
|||
* along with Haveno. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package bisq.apitest;
|
||||
package haveno.apitest;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
@ -23,10 +23,8 @@ import lombok.extern.slf4j.Slf4j;
|
|||
|
||||
import static java.lang.String.format;
|
||||
|
||||
|
||||
|
||||
import bisq.apitest.config.ApiTestConfig;
|
||||
import bisq.apitest.linux.BitcoinCli;
|
||||
import haveno.apitest.config.ApiTestConfig;
|
||||
import haveno.apitest.linux.BitcoinCli;
|
||||
|
||||
@Slf4j
|
||||
class SmokeTestBitcoind {
|
|
@ -15,9 +15,7 @@
|
|||
* along with Haveno. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package bisq.apitest.config;
|
||||
|
||||
import bisq.common.config.CompositeOptionSet;
|
||||
package haveno.apitest.config;
|
||||
|
||||
import joptsimple.AbstractOptionSpec;
|
||||
import joptsimple.ArgumentAcceptingOptionSpec;
|
||||
|
@ -51,6 +49,8 @@ import static java.util.Arrays.asList;
|
|||
import static java.util.Arrays.stream;
|
||||
import static joptsimple.internal.Strings.EMPTY;
|
||||
|
||||
import haveno.common.config.CompositeOptionSet;
|
||||
|
||||
@Slf4j
|
||||
public class ApiTestConfig {
|
||||
|
||||
|
@ -76,12 +76,12 @@ public class ApiTestConfig {
|
|||
static final String ROOT_APP_DATA_DIR = "rootAppDataDir";
|
||||
static final String API_PASSWORD = "apiPassword";
|
||||
static final String RUN_SUBPROJECT_JARS = "runSubprojectJars";
|
||||
static final String BISQ_APP_INIT_TIME = "bisqAppInitTime";
|
||||
static final String HAVENO_APP_INIT_TIME = "havenoAppInitTime";
|
||||
static final String SKIP_TESTS = "skipTests";
|
||||
static final String SHUTDOWN_AFTER_TESTS = "shutdownAfterTests";
|
||||
static final String SUPPORTING_APPS = "supportingApps";
|
||||
static final String CALL_RATE_METERING_CONFIG_PATH = "callRateMeteringConfigPath";
|
||||
static final String ENABLE_BISQ_DEBUGGING = "enableBisqDebugging";
|
||||
static final String ENABLE_HAVENO_DEBUGGING = "enableHavenoDebugging";
|
||||
static final String REGISTER_DISPUTE_AGENTS = "registerDisputeAgents";
|
||||
|
||||
// Default values for certain options
|
||||
|
@ -109,12 +109,12 @@ public class ApiTestConfig {
|
|||
// Daemon instances can use same gRPC password, but each needs a different apiPort.
|
||||
public final String apiPassword;
|
||||
public final boolean runSubprojectJars;
|
||||
public final long bisqAppInitTime;
|
||||
public final long havenoAppInitTime;
|
||||
public final boolean skipTests;
|
||||
public final boolean shutdownAfterTests;
|
||||
public final List<String> supportingApps;
|
||||
public final String callRateMeteringConfigPath;
|
||||
public final boolean enableBisqDebugging;
|
||||
public final boolean enableHavenoDebugging;
|
||||
public final boolean registerDisputeAgents;
|
||||
|
||||
// Immutable system configurations set in the constructor.
|
||||
|
@ -132,7 +132,7 @@ public class ApiTestConfig {
|
|||
this.userDir = getProperty("user.dir");
|
||||
// If running a @Test, the current working directory is the :apitest subproject
|
||||
// folder. If running ApiTestMain, the current working directory is the
|
||||
// bisq root project folder.
|
||||
// haveno root project folder.
|
||||
this.isRunningTest = Paths.get(userDir).getFileName().toString().equals("apitest");
|
||||
this.rootProjectDir = isRunningTest
|
||||
? Paths.get(userDir).getParent().toFile().getAbsolutePath()
|
||||
|
@ -213,9 +213,9 @@ public class ApiTestConfig {
|
|||
.ofType(Boolean.class)
|
||||
.defaultsTo(false);
|
||||
|
||||
ArgumentAcceptingOptionSpec<Long> bisqAppInitTimeOpt =
|
||||
parser.accepts(BISQ_APP_INIT_TIME,
|
||||
"Amount of time (ms) to wait on a Bisq instance's initialization")
|
||||
ArgumentAcceptingOptionSpec<Long> havenoAppInitTimeOpt =
|
||||
parser.accepts(HAVENO_APP_INIT_TIME,
|
||||
"Amount of time (ms) to wait on a Haveno instance's initialization")
|
||||
.withRequiredArg()
|
||||
.ofType(Long.class)
|
||||
.defaultsTo(5000L);
|
||||
|
@ -247,9 +247,9 @@ public class ApiTestConfig {
|
|||
.withRequiredArg()
|
||||
.defaultsTo(EMPTY);
|
||||
|
||||
ArgumentAcceptingOptionSpec<Boolean> enableBisqDebuggingOpt =
|
||||
parser.accepts(ENABLE_BISQ_DEBUGGING,
|
||||
"Start Bisq apps with remote debug options")
|
||||
ArgumentAcceptingOptionSpec<Boolean> enableHavenoDebuggingOpt =
|
||||
parser.accepts(ENABLE_HAVENO_DEBUGGING,
|
||||
"Start Haveno apps with remote debug options")
|
||||
.withRequiredArg()
|
||||
.ofType(Boolean.class)
|
||||
.defaultsTo(false);
|
||||
|
@ -311,12 +311,12 @@ public class ApiTestConfig {
|
|||
this.bitcoinRpcPassword = options.valueOf(bitcoinRpcPasswordOpt);
|
||||
this.apiPassword = options.valueOf(apiPasswordOpt);
|
||||
this.runSubprojectJars = options.valueOf(runSubprojectJarsOpt);
|
||||
this.bisqAppInitTime = options.valueOf(bisqAppInitTimeOpt);
|
||||
this.havenoAppInitTime = options.valueOf(havenoAppInitTimeOpt);
|
||||
this.skipTests = options.valueOf(skipTestsOpt);
|
||||
this.shutdownAfterTests = options.valueOf(shutdownAfterTestsOpt);
|
||||
this.supportingApps = asList(options.valueOf(supportingAppsOpt).split(","));
|
||||
this.callRateMeteringConfigPath = options.valueOf(callRateMeteringConfigPathOpt);
|
||||
this.enableBisqDebugging = options.valueOf(enableBisqDebuggingOpt);
|
||||
this.enableHavenoDebugging = options.valueOf(enableHavenoDebuggingOpt);
|
||||
this.registerDisputeAgents = options.valueOf(registerDisputeAgentsOpt);
|
||||
|
||||
// Assign values to special-case static fields.
|
|
@ -1,19 +1,17 @@
|
|||
package bisq.apitest.config;
|
||||
package haveno.apitest.config;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import static bisq.apitest.config.ApiTestConfig.CALL_RATE_METERING_CONFIG_PATH;
|
||||
import static bisq.proto.grpc.DisputeAgentsGrpc.getRegisterDisputeAgentMethod;
|
||||
import static bisq.proto.grpc.GetVersionGrpc.getGetVersionMethod;
|
||||
import static haveno.proto.grpc.DisputeAgentsGrpc.getRegisterDisputeAgentMethod;
|
||||
import static haveno.proto.grpc.GetVersionGrpc.getGetVersionMethod;
|
||||
import static haveno.apitest.config.ApiTestConfig.CALL_RATE_METERING_CONFIG_PATH;
|
||||
import static java.lang.System.arraycopy;
|
||||
import static java.util.Arrays.stream;
|
||||
import static java.util.concurrent.TimeUnit.MILLISECONDS;
|
||||
import static java.util.concurrent.TimeUnit.SECONDS;
|
||||
|
||||
|
||||
|
||||
import bisq.daemon.grpc.GrpcVersionService;
|
||||
import bisq.daemon.grpc.interceptor.GrpcServiceRateMeteringConfig;
|
||||
import haveno.daemon.grpc.GrpcVersionService;
|
||||
import haveno.daemon.grpc.interceptor.GrpcServiceRateMeteringConfig;
|
||||
|
||||
public class ApiTestRateMeterInterceptorConfig {
|
||||
|
|
@ -15,72 +15,68 @@
|
|||
* along with Haveno. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package bisq.apitest.config;
|
||||
package haveno.apitest.config;
|
||||
|
||||
import bisq.seednode.SeedNodeMain;
|
||||
|
||||
import bisq.desktop.app.HavenoAppMain;
|
||||
|
||||
|
||||
|
||||
import bisq.daemon.app.HavenoDaemonMain;
|
||||
import haveno.daemon.app.HavenoDaemonMain;
|
||||
import haveno.desktop.app.HavenoAppMain;
|
||||
import haveno.seednode.SeedNodeMain;
|
||||
|
||||
/**
|
||||
Some non user configurable Bisq seednode, arb node, bob and alice daemon option values.
|
||||
Some non user configurable Haveno seednode, arb node, bob and alice daemon option values.
|
||||
@see <a href="https://github.com/bisq-network/bisq/blob/master/docs/dev-setup.md">dev-setup.md</a>
|
||||
*/
|
||||
public enum HavenoAppConfig {
|
||||
|
||||
seednode("bisq-XMR_STAGENET_Seed_2002",
|
||||
"bisq-seednode",
|
||||
seednode("haveno-XMR_STAGENET_Seed_2002",
|
||||
"haveno-seednode",
|
||||
"-XX:MaxRAM=2g -Dlogback.configurationFile=apitest/build/resources/main/logback.xml",
|
||||
SeedNodeMain.class.getName(),
|
||||
2002,
|
||||
5120,
|
||||
-1,
|
||||
49996),
|
||||
arbdaemon("bisq-XMR_STAGENET_Arb",
|
||||
"bisq-daemon",
|
||||
arbdaemon("haveno-XMR_STAGENET_Arb",
|
||||
"haveno-daemon",
|
||||
"-XX:MaxRAM=2g -Dlogback.configurationFile=apitest/build/resources/main/logback.xml",
|
||||
HavenoDaemonMain.class.getName(),
|
||||
4444,
|
||||
5121,
|
||||
9997,
|
||||
49997),
|
||||
arbdesktop("bisq-XMR_STAGENET_Arb",
|
||||
"bisq-desktop",
|
||||
arbdesktop("haveno-XMR_STAGENET_Arb",
|
||||
"haveno-desktop",
|
||||
"-XX:MaxRAM=3g -Dlogback.configurationFile=apitest/build/resources/main/logback.xml",
|
||||
HavenoAppMain.class.getName(),
|
||||
4444,
|
||||
5121,
|
||||
-1,
|
||||
49997),
|
||||
alicedaemon("bisq-XMR_STAGENET_Alice",
|
||||
"bisq-daemon",
|
||||
alicedaemon("haveno-XMR_STAGENET_Alice",
|
||||
"haveno-daemon",
|
||||
"-XX:MaxRAM=2g -Dlogback.configurationFile=apitest/build/resources/main/logback.xml",
|
||||
HavenoDaemonMain.class.getName(),
|
||||
7777,
|
||||
5122,
|
||||
9998,
|
||||
49998),
|
||||
alicedesktop("bisq-XMR_STAGENET_Alice",
|
||||
"bisq-desktop",
|
||||
alicedesktop("haveno-XMR_STAGENET_Alice",
|
||||
"haveno-desktop",
|
||||
"-XX:MaxRAM=4g -Dlogback.configurationFile=apitest/build/resources/main/logback.xml",
|
||||
HavenoAppMain.class.getName(),
|
||||
7777,
|
||||
5122,
|
||||
-1,
|
||||
49998),
|
||||
bobdaemon("bisq-XMR_STAGENET_Bob",
|
||||
"bisq-daemon",
|
||||
bobdaemon("haveno-XMR_STAGENET_Bob",
|
||||
"haveno-daemon",
|
||||
"-XX:MaxRAM=2g -Dlogback.configurationFile=apitest/build/resources/main/logback.xml",
|
||||
HavenoDaemonMain.class.getName(),
|
||||
8888,
|
||||
5123,
|
||||
9999,
|
||||
49999),
|
||||
bobdesktop("bisq-XMR_STAGENET_Bob",
|
||||
"bisq-desktop",
|
||||
bobdesktop("haveno-XMR_STAGENET_Bob",
|
||||
"haveno-desktop",
|
||||
"-XX:MaxRAM=4g -Dlogback.configurationFile=apitest/build/resources/main/logback.xml",
|
||||
HavenoAppMain.class.getName(),
|
||||
8888,
|
|
@ -15,7 +15,7 @@
|
|||
* along with Haveno. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package bisq.apitest.linux;
|
||||
package haveno.apitest.linux;
|
||||
|
||||
import java.nio.file.Paths;
|
||||
|
||||
|
@ -27,13 +27,11 @@ import java.util.List;
|
|||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import static bisq.apitest.linux.BashCommand.isAlive;
|
||||
import static haveno.apitest.linux.BashCommand.isAlive;
|
||||
import static java.lang.String.format;
|
||||
import static joptsimple.internal.Strings.EMPTY;
|
||||
|
||||
|
||||
|
||||
import bisq.apitest.config.ApiTestConfig;
|
||||
import haveno.apitest.config.ApiTestConfig;
|
||||
|
||||
@Slf4j
|
||||
abstract class AbstractLinuxProcess implements LinuxProcess {
|
|
@ -15,7 +15,7 @@
|
|||
* along with Haveno. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package bisq.apitest.linux;
|
||||
package haveno.apitest.linux;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
@ -26,7 +26,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import static bisq.apitest.config.ApiTestConfig.BASH_PATH_VALUE;
|
||||
import static haveno.apitest.config.ApiTestConfig.BASH_PATH_VALUE;
|
||||
import static java.lang.management.ManagementFactory.getRuntimeMXBean;
|
||||
|
||||
@Slf4j
|
|
@ -15,16 +15,13 @@
|
|||
* along with Haveno. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package bisq.apitest.linux;
|
||||
package haveno.apitest.linux;
|
||||
|
||||
import haveno.apitest.config.ApiTestConfig;
|
||||
import java.io.IOException;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
|
||||
|
||||
import bisq.apitest.config.ApiTestConfig;
|
||||
|
||||
@Slf4j
|
||||
public class BitcoinCli extends AbstractLinuxProcess implements LinuxProcess {
|
||||
|
|
@ -15,20 +15,18 @@
|
|||
* along with Haveno. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package bisq.apitest.linux;
|
||||
package haveno.apitest.linux;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import static bisq.apitest.linux.BashCommand.isAlive;
|
||||
import static haveno.apitest.linux.BashCommand.isAlive;
|
||||
import static java.lang.String.format;
|
||||
import static java.util.concurrent.TimeUnit.MILLISECONDS;
|
||||
import static joptsimple.internal.Strings.EMPTY;
|
||||
|
||||
|
||||
|
||||
import bisq.apitest.config.ApiTestConfig;
|
||||
import haveno.apitest.config.ApiTestConfig;
|
||||
|
||||
@Slf4j
|
||||
public class BitcoinDaemon extends AbstractLinuxProcess implements LinuxProcess {
|
|
@ -15,7 +15,7 @@
|
|||
* along with Haveno. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package bisq.apitest.linux;
|
||||
package haveno.apitest.linux;
|
||||
|
||||
import java.nio.file.Paths;
|
||||
|
||||
|
@ -27,18 +27,16 @@ import java.util.List;
|
|||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import static bisq.apitest.linux.BashCommand.isAlive;
|
||||
import static haveno.apitest.linux.BashCommand.isAlive;
|
||||
import static java.lang.String.format;
|
||||
import static java.util.concurrent.TimeUnit.MILLISECONDS;
|
||||
|
||||
|
||||
|
||||
import bisq.apitest.config.ApiTestConfig;
|
||||
import bisq.apitest.config.HavenoAppConfig;
|
||||
import bisq.daemon.app.HavenoDaemonMain;
|
||||
import haveno.apitest.config.ApiTestConfig;
|
||||
import haveno.apitest.config.HavenoAppConfig;
|
||||
import haveno.daemon.app.HavenoDaemonMain;
|
||||
|
||||
/**
|
||||
* Runs a regtest/dao Bisq application instance in the background.
|
||||
* Runs a regtest/dao Haveno application instance in the background.
|
||||
*/
|
||||
@Slf4j
|
||||
public class HavenoProcess extends AbstractLinuxProcess implements LinuxProcess {
|
||||
|
@ -50,7 +48,7 @@ public class HavenoProcess extends AbstractLinuxProcess implements LinuxProcess
|
|||
private final String seedNodes;
|
||||
private final boolean useLocalhostForP2P;
|
||||
public final boolean useDevPrivilegeKeys;
|
||||
private final String findBisqPidScript;
|
||||
private final String findHavenoPidScript;
|
||||
private final String debugOpts;
|
||||
|
||||
public HavenoProcess(HavenoAppConfig havenoAppConfig, ApiTestConfig config) {
|
||||
|
@ -62,9 +60,9 @@ public class HavenoProcess extends AbstractLinuxProcess implements LinuxProcess
|
|||
this.seedNodes = "localhost:2002";
|
||||
this.useLocalhostForP2P = true;
|
||||
this.useDevPrivilegeKeys = true;
|
||||
this.findBisqPidScript = (config.isRunningTest ? "." : "./apitest")
|
||||
+ "/scripts/get-bisq-pid.sh";
|
||||
this.debugOpts = config.enableBisqDebugging
|
||||
this.findHavenoPidScript = (config.isRunningTest ? "." : "./apitest")
|
||||
+ "/scripts/get-haveno-pid.sh";
|
||||
this.debugOpts = config.enableHavenoDebugging
|
||||
? " -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:" + havenoAppConfig.remoteDebugPort
|
||||
: "";
|
||||
}
|
||||
|
@ -75,7 +73,7 @@ public class HavenoProcess extends AbstractLinuxProcess implements LinuxProcess
|
|||
if (config.runSubprojectJars)
|
||||
runJar(); // run subproject/build/lib/*.jar (not full build)
|
||||
else
|
||||
runStartupScript(); // run bisq-* script for end to end test (default)
|
||||
runStartupScript(); // run haveno-* script for end to end test (default)
|
||||
} catch (Throwable t) {
|
||||
startupExceptions.add(t);
|
||||
}
|
||||
|
@ -120,7 +118,7 @@ public class HavenoProcess extends AbstractLinuxProcess implements LinuxProcess
|
|||
}
|
||||
|
||||
public void verifyAppNotRunning() throws IOException, InterruptedException {
|
||||
long pid = findBisqAppPid();
|
||||
long pid = findHavenoAppPid();
|
||||
if (pid >= 0)
|
||||
throw new IllegalStateException(format("%s %s already running with pid %d",
|
||||
havenoAppConfig.mainClassName, havenoAppConfig.appName, pid));
|
||||
|
@ -134,8 +132,8 @@ public class HavenoProcess extends AbstractLinuxProcess implements LinuxProcess
|
|||
case alicedesktop:
|
||||
case bobdaemon:
|
||||
case bobdesktop:
|
||||
File bisqDataDir = new File(config.rootAppDataDir, havenoAppConfig.appName);
|
||||
if (!bisqDataDir.exists())
|
||||
File havenoDataDir = new File(config.rootAppDataDir, havenoAppConfig.appName);
|
||||
if (!havenoDataDir.exists())
|
||||
throw new IllegalStateException(format("Application dataDir %s/%s not found",
|
||||
config.rootAppDataDir, havenoAppConfig.appName));
|
||||
break;
|
||||
|
@ -144,50 +142,50 @@ public class HavenoProcess extends AbstractLinuxProcess implements LinuxProcess
|
|||
}
|
||||
}
|
||||
|
||||
// This is the non-default way of running a Bisq app (--runSubprojectJars=true).
|
||||
// It runs a java cmd, and does not depend on a full build. Bisq jars are loaded
|
||||
// This is the non-default way of running a Haveno app (--runSubprojectJars=true).
|
||||
// It runs a java cmd, and does not depend on a full build. Haveno jars are loaded
|
||||
// from the :subproject/build/libs directories.
|
||||
private void runJar() throws IOException, InterruptedException {
|
||||
String java = getJavaExecutable().getAbsolutePath();
|
||||
String classpath = System.getProperty("java.class.path");
|
||||
String bisqCmd = getJavaOptsSpec()
|
||||
String havenoCmd = getJavaOptsSpec()
|
||||
+ " " + java + " -cp " + classpath
|
||||
+ " " + havenoAppConfig.mainClassName
|
||||
+ " " + String.join(" ", getOptsList())
|
||||
+ " &"; // run in background without nohup
|
||||
runBashCommand(bisqCmd);
|
||||
runBashCommand(havenoCmd);
|
||||
}
|
||||
|
||||
// This is the default way of running a Bisq app (--runSubprojectJars=false).
|
||||
// It runs a bisq-* startup script, and depends on a full build. Bisq jars
|
||||
// This is the default way of running a Haveno app (--runSubprojectJars=false).
|
||||
// It runs a haveno-* startup script, and depends on a full build. Haveno jars
|
||||
// are loaded from the root project's lib directory.
|
||||
private void runStartupScript() throws IOException, InterruptedException {
|
||||
String startupScriptPath = config.rootProjectDir
|
||||
+ "/" + havenoAppConfig.startupScript;
|
||||
String bisqCmd = getJavaOptsSpec()
|
||||
String havenoCmd = getJavaOptsSpec()
|
||||
+ " " + startupScriptPath
|
||||
+ " " + String.join(" ", getOptsList())
|
||||
+ " &"; // run in background without nohup
|
||||
runBashCommand(bisqCmd);
|
||||
runBashCommand(havenoCmd);
|
||||
}
|
||||
|
||||
private void runBashCommand(String bisqCmd) throws IOException, InterruptedException {
|
||||
private void runBashCommand(String havenoCmd) throws IOException, InterruptedException {
|
||||
String cmdDescription = config.runSubprojectJars
|
||||
? "java -> " + havenoAppConfig.mainClassName + " -> " + havenoAppConfig.appName
|
||||
: havenoAppConfig.startupScript + " -> " + havenoAppConfig.appName;
|
||||
BashCommand bashCommand = new BashCommand(bisqCmd);
|
||||
BashCommand bashCommand = new BashCommand(havenoCmd);
|
||||
log.info("Starting {} ...\n$ {}", cmdDescription, bashCommand.getCommand());
|
||||
bashCommand.runInBackground();
|
||||
|
||||
if (bashCommand.getExitStatus() != 0)
|
||||
throw new IllegalStateException(format("Error starting BisqApp%n%s%nError: %s",
|
||||
throw new IllegalStateException(format("Error starting HavenoApp%n%s%nError: %s",
|
||||
havenoAppConfig.appName,
|
||||
bashCommand.getError()));
|
||||
|
||||
// Sometimes it takes a little extra time to find the linux process id.
|
||||
// Wait up to two seconds before giving up and throwing an Exception.
|
||||
for (int i = 0; i < 4; i++) {
|
||||
pid = findBisqAppPid();
|
||||
pid = findHavenoAppPid();
|
||||
if (pid != -1)
|
||||
break;
|
||||
|
||||
|
@ -197,12 +195,12 @@ public class HavenoProcess extends AbstractLinuxProcess implements LinuxProcess
|
|||
throw new IllegalStateException(format("Error finding pid for %s", this.name));
|
||||
|
||||
log.info("{} running with pid {}", cmdDescription, pid);
|
||||
log.info("Log {}", config.rootAppDataDir + "/" + havenoAppConfig.appName + "/bisq.log");
|
||||
log.info("Log {}", config.rootAppDataDir + "/" + havenoAppConfig.appName + "/haveno.log");
|
||||
}
|
||||
|
||||
private long findBisqAppPid() throws IOException, InterruptedException {
|
||||
private long findHavenoAppPid() throws IOException, InterruptedException {
|
||||
// Find the pid of the java process by grepping for the mainClassName and appName.
|
||||
String findPidCmd = findBisqPidScript + " " + havenoAppConfig.mainClassName + " " + havenoAppConfig.appName;
|
||||
String findPidCmd = findHavenoPidScript + " " + havenoAppConfig.mainClassName + " " + havenoAppConfig.appName;
|
||||
String psCmdOutput = new BashCommand(findPidCmd).run().getOutput();
|
||||
return (psCmdOutput == null || psCmdOutput.isEmpty()) ? -1 : Long.parseLong(psCmdOutput);
|
||||
}
|
|
@ -15,7 +15,7 @@
|
|||
* along with Haveno. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package bisq.apitest.linux;
|
||||
package haveno.apitest.linux;
|
||||
|
||||
import java.io.IOException;
|
||||
|
|
@ -15,7 +15,7 @@
|
|||
* along with Haveno. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package bisq.apitest.linux;
|
||||
package haveno.apitest.linux;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
|
@ -15,7 +15,7 @@
|
|||
* along with Haveno. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package bisq.apitest.linux;
|
||||
package haveno.apitest.linux;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStream;
|
Loading…
Add table
Add a link
Reference in a new issue