use of org.ethereum.util.RskTestContext in project rskj by rsksmart.
the class BlockChainImplInvalidTest method setup.
@Before
public void setup() {
objects = new RskTestContext(new String[0]) {
@Override
protected synchronized RskSystemProperties buildRskSystemProperties() {
RskSystemProperties rskSystemProperties = super.buildRskSystemProperties();
ActivationConfig activationConfigSpy = spy(rskSystemProperties.getActivationConfig());
RskSystemProperties rskSystemPropertiesSpy = spy(rskSystemProperties);
doReturn(true).when(activationConfigSpy).isActive(eq(ConsensusRule.RSKIP126), anyLong());
doReturn(activationConfigSpy).when(rskSystemPropertiesSpy).getActivationConfig();
return rskSystemPropertiesSpy;
}
@Override
protected GenesisLoader buildGenesisLoader() {
return new TestGenesisLoader(getTrieStore(), "rsk-unittests.json", BigInteger.ZERO, true, true, true);
}
@Override
public BlockValidator buildBlockValidator() {
return new BlockValidatorImpl(getBlockStore(), getBlockParentDependantValidationRule(), getBlockValidationRule());
}
};
blockChain = objects.getBlockchain();
}
use of org.ethereum.util.RskTestContext in project rskj by rsksmart.
the class GenesisHashesTest method mainnetHashTest.
@Test
public void mainnetHashTest() {
RskContext rskContext = new RskTestContext(new String[0]);
// this triggers changes in the Genesis through the BlockChainLoader
rskContext.getBlockchain();
Genesis genesis = rskContext.getGenesis();
assertThat(genesis.getHash(), is(new Keccak256("f88529d4ab262c0f4d042e9d8d3f2472848eaafe1a9b7213f57617eb40a9f9e0")));
rskContext.close();
}
use of org.ethereum.util.RskTestContext in project rskj by rsksmart.
the class SnapshotManagerTest method setUp.
@Before
public void setUp() {
testContext = new RskTestContext(new String[] { "--regtest" });
blockchain = testContext.getBlockchain();
minerServer = testContext.getMinerServer();
minerClient = testContext.getMinerClient();
transactionPool = testContext.getTransactionPool();
BlockStore blockStore = testContext.getBlockStore();
// don't call start to avoid creating threads
transactionPool.processBest(blockchain.getBestBlock());
manager = new SnapshotManager(blockchain, blockStore, transactionPool, mock(MinerServer.class));
}
use of org.ethereum.util.RskTestContext in project rskj by rsksmart.
the class RskContextTest method getCliArgsSmokeTest.
@Test
public void getCliArgsSmokeTest() {
RskTestContext devnetContext = new RskTestContext(new String[] { "--devnet" });
assertThat(devnetContext.getCliArgs(), notNullValue());
assertThat(devnetContext.getCliArgs().getFlags(), contains(NodeCliFlags.NETWORK_DEVNET));
devnetContext.close();
}
use of org.ethereum.util.RskTestContext in project rskj by rsksmart.
the class PreflightChecksUtilsTest method runChecks_receivesSkipJavaCheck_skipsJavaChecks.
@Test
public void runChecks_receivesSkipJavaCheck_skipsJavaChecks() throws Exception {
String[] args = { "--skip-java-check" };
RskContext rskContext = new RskTestContext(args);
PreflightChecksUtils preflightChecksUtilsSpy = spy(new PreflightChecksUtils(rskContext));
when(preflightChecksUtilsSpy.getJavaVersion()).thenReturn(null);
preflightChecksUtilsSpy.runChecks();
verify(preflightChecksUtilsSpy, times(0)).getJavaVersion();
rskContext.close();
}
Aggregations