use of org.ethereum.util.RskTestContext in project rskj by rsksmart.
the class NodeRunnerSmokeTest method contextRecreationSmokeTest.
@Test
public void contextRecreationSmokeTest() {
RskTestContext rskContext = new RskTestContext(new String[] { "--regtest" });
assertThat(rskContext.getNodeRunner(), notNullValue());
rskContext.close();
assertTrue(rskContext.isClosed());
// re-create context
rskContext = new RskTestContext(new String[] { "--regtest" });
assertThat(rskContext.getNodeRunner(), notNullValue());
rskContext.close();
assertTrue(rskContext.isClosed());
}
use of org.ethereum.util.RskTestContext in project rskj by rsksmart.
the class NodeRunnerSmokeTest method testnetSmokeTest.
@Test
public void testnetSmokeTest() {
RskTestContext rskContext = new RskTestContext(new String[] { "--testnet" });
assertThat(rskContext.getNodeRunner(), notNullValue());
rskContext.close();
}
use of org.ethereum.util.RskTestContext in project rskj by rsksmart.
the class GenesisHashesTest method testnetHashTest.
@Test
public void testnetHashTest() {
RskContext rskContext = new RskTestContext(new String[] { "--testnet" });
// this triggers changes in the Genesis through the BlockChainLoader
rskContext.getBlockchain();
Genesis genesis = rskContext.getGenesis();
assertThat(genesis.getHash(), is(new Keccak256("cabb7fbe88cd6d922042a32ffc08ce8b1fbb37d650b9d4e7dbfe2a7469adfa42")));
rskContext.close();
}
use of org.ethereum.util.RskTestContext in project rskj by rsksmart.
the class TransactionPoolImplTest method setUp.
@Before
public void setUp() {
rskTestContext = new RskTestContext(new String[] { "--regtest" }) {
@Override
protected GenesisLoader buildGenesisLoader() {
return new TestGenesisLoader(getTrieStore(), "rsk-unittests.json", BigInteger.ZERO, true, true, true);
}
@Override
protected RepositoryLocator buildRepositoryLocator() {
return spy(super.buildRepositoryLocator());
}
};
blockChain = rskTestContext.getBlockchain();
RepositoryLocator repositoryLocator = rskTestContext.getRepositoryLocator();
repository = repositoryLocator.startTrackingAt(blockChain.getBestBlock().getHeader());
signatureCache = spy(rskTestContext.getReceivedTxSignatureCache());
transactionPool = new TransactionPoolImpl(rskTestContext.getRskSystemProperties(), repositoryLocator, rskTestContext.getBlockStore(), rskTestContext.getBlockFactory(), rskTestContext.getCompositeEthereumListener(), rskTestContext.getTransactionExecutorFactory(), signatureCache, 10, 100);
// don't call start to avoid creating threads
transactionPool.processBest(blockChain.getBestBlock());
// this is to workaround the current test structure, which abuses the Repository by
// modifying it in place
doReturn(repository).when(repositoryLocator).snapshotAt(any());
}
use of org.ethereum.util.RskTestContext in project rskj by rsksmart.
the class PreflightChecksUtilsTest method runChecks_invalidJavaVersion_exceptionIsThrown.
@Test
public void runChecks_invalidJavaVersion_exceptionIsThrown() throws Exception {
expectedException.expect(PreflightCheckException.class);
expectedException.expectMessage("Invalid Java Version '16'. Supported versions: 8 11");
RskContext rskContext = new RskTestContext(new String[0]);
PreflightChecksUtils preflightChecksUtilsSpy = spy(new PreflightChecksUtils(rskContext));
when(preflightChecksUtilsSpy.getJavaVersion()).thenReturn("16");
preflightChecksUtilsSpy.runChecks();
rskContext.close();
}
Aggregations