Search in sources :

Example 1 with BesuNodeFactory

use of org.hyperledger.besu.tests.acceptance.dsl.node.configuration.BesuNodeFactory in project besu by hyperledger.

the class PermissionedNodeBuilder method build.

public BesuNode build() {
    if (name == null) {
        name = "perm_node_" + UUID.randomUUID().toString().substring(0, 8);
    }
    Optional<LocalPermissioningConfiguration> localPermConfig = Optional.empty();
    if (localConfigNodesPermissioningEnabled || localConfigAccountsPermissioningEnabled) {
        localPermConfig = Optional.of(localConfigPermissioningConfiguration());
    }
    Optional<SmartContractPermissioningConfiguration> smartContractPermConfig = Optional.empty();
    if (nodeSmartContractPermissioningEnabled || accountSmartContractPermissioningEnabled) {
        smartContractPermConfig = Optional.of(smartContractPermissioningConfiguration());
    }
    final PermissioningConfiguration permissioningConfiguration = new PermissioningConfiguration(localPermConfig, smartContractPermConfig, Optional.empty());
    final BesuNodeConfigurationBuilder builder = new BesuNodeConfigurationBuilder();
    builder.name(name).jsonRpcConfiguration(jsonRpcConfigWithPermApiEnabled()).permissioningConfiguration(permissioningConfiguration).bootnodeEligible(false);
    if (mining) {
        builder.miningEnabled();
    }
    if (!staticNodes.isEmpty()) {
        builder.staticNodes(staticNodes);
    }
    builder.dnsEnabled(isDnsEnabled);
    if (genesisFile != null) {
        builder.genesisConfigProvider((a) -> Optional.of(genesisFile));
        builder.devMode(false);
    }
    try {
        return new BesuNodeFactory().create(builder.build());
    } catch (IOException e) {
        throw new RuntimeException("Error creating BesuNode", e);
    }
}
Also used : LocalPermissioningConfiguration(org.hyperledger.besu.ethereum.permissioning.LocalPermissioningConfiguration) BesuNodeConfigurationBuilder(org.hyperledger.besu.tests.acceptance.dsl.node.configuration.BesuNodeConfigurationBuilder) PermissioningConfiguration(org.hyperledger.besu.ethereum.permissioning.PermissioningConfiguration) SmartContractPermissioningConfiguration(org.hyperledger.besu.ethereum.permissioning.SmartContractPermissioningConfiguration) LocalPermissioningConfiguration(org.hyperledger.besu.ethereum.permissioning.LocalPermissioningConfiguration) BesuNodeFactory(org.hyperledger.besu.tests.acceptance.dsl.node.configuration.BesuNodeFactory) SmartContractPermissioningConfiguration(org.hyperledger.besu.ethereum.permissioning.SmartContractPermissioningConfiguration) IOException(java.io.IOException)

Example 2 with BesuNodeFactory

use of org.hyperledger.besu.tests.acceptance.dsl.node.configuration.BesuNodeFactory in project besu by hyperledger.

the class ExecutionEngineAcceptanceTest method init.

@BeforeClass
public static void init() throws IOException {
    cluster = new Cluster(new NetConditions(new NetTransactions()));
    executionEngine = new BesuNodeFactory().createExecutionEngineGenesisNode("executionEngine", GENESIS_FILE);
    cluster.start(executionEngine);
    consensusClient = new OkHttpClient();
    mapper = new ObjectMapper();
}
Also used : OkHttpClient(okhttp3.OkHttpClient) Cluster(org.hyperledger.besu.tests.acceptance.dsl.node.cluster.Cluster) BesuNodeFactory(org.hyperledger.besu.tests.acceptance.dsl.node.configuration.BesuNodeFactory) NetConditions(org.hyperledger.besu.tests.acceptance.dsl.condition.net.NetConditions) NetTransactions(org.hyperledger.besu.tests.acceptance.dsl.transaction.net.NetTransactions) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) BeforeClass(org.junit.BeforeClass)

Aggregations

BesuNodeFactory (org.hyperledger.besu.tests.acceptance.dsl.node.configuration.BesuNodeFactory)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 IOException (java.io.IOException)1 OkHttpClient (okhttp3.OkHttpClient)1 LocalPermissioningConfiguration (org.hyperledger.besu.ethereum.permissioning.LocalPermissioningConfiguration)1 PermissioningConfiguration (org.hyperledger.besu.ethereum.permissioning.PermissioningConfiguration)1 SmartContractPermissioningConfiguration (org.hyperledger.besu.ethereum.permissioning.SmartContractPermissioningConfiguration)1 NetConditions (org.hyperledger.besu.tests.acceptance.dsl.condition.net.NetConditions)1 Cluster (org.hyperledger.besu.tests.acceptance.dsl.node.cluster.Cluster)1 BesuNodeConfigurationBuilder (org.hyperledger.besu.tests.acceptance.dsl.node.configuration.BesuNodeConfigurationBuilder)1 NetTransactions (org.hyperledger.besu.tests.acceptance.dsl.transaction.net.NetTransactions)1 BeforeClass (org.junit.BeforeClass)1