Search in sources :

Example 6 with RskContext

use of co.rsk.RskContext 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();
}
Also used : RskTestContext(org.ethereum.util.RskTestContext) RskContext(co.rsk.RskContext) Test(org.junit.Test)

Example 7 with RskContext

use of co.rsk.RskContext in project rskj by rsksmart.

the class PreflightChecksUtilsTest method runChecks_currentJavaVersionIs1dot8_OK.

@Test
public void runChecks_currentJavaVersionIs1dot8_OK() throws Exception {
    RskContext rskContext = new RskTestContext(new String[0]);
    PreflightChecksUtils preflightChecksUtilsSpy = spy(new PreflightChecksUtils(rskContext));
    when(preflightChecksUtilsSpy.getJavaVersion()).thenReturn("1.8");
    preflightChecksUtilsSpy.runChecks();
    verify(preflightChecksUtilsSpy, times(1)).getJavaVersion();
    verify(preflightChecksUtilsSpy, times(1)).getIntJavaVersion("1.8");
    rskContext.close();
}
Also used : RskTestContext(org.ethereum.util.RskTestContext) RskContext(co.rsk.RskContext) Test(org.junit.Test)

Example 8 with RskContext

use of co.rsk.RskContext in project rskj by rsksmart.

the class PreflightChecksUtilsTest method runChecks_runAllChecks_OK.

@Test
public void runChecks_runAllChecks_OK() throws Exception {
    RskContext rskContext = new RskTestContext(new String[0]);
    PreflightChecksUtils preflightChecksUtilsSpy = spy(new PreflightChecksUtils(rskContext));
    when(preflightChecksUtilsSpy.getJavaVersion()).thenReturn("1.8.0_275");
    preflightChecksUtilsSpy.runChecks();
    verify(preflightChecksUtilsSpy, times(1)).getJavaVersion();
    verify(preflightChecksUtilsSpy, times(1)).getIntJavaVersion("1.8.0_275");
    verify(preflightChecksUtilsSpy, times(1)).checkSupportedJavaVersion();
    rskContext.close();
}
Also used : RskTestContext(org.ethereum.util.RskTestContext) RskContext(co.rsk.RskContext) Test(org.junit.Test)

Example 9 with RskContext

use of co.rsk.RskContext in project rskj by rsksmart.

the class PreflightChecksUtilsTest method getIntJavaVersion_OK.

@Test
public void getIntJavaVersion_OK() {
    RskContext rskContext = new RskTestContext(new String[0]);
    PreflightChecksUtils preflightChecksUtils = new PreflightChecksUtils(rskContext);
    assertEquals(preflightChecksUtils.getIntJavaVersion("1.8.0_275"), 8);
    assertEquals(preflightChecksUtils.getIntJavaVersion("1.8.0_72-ea"), 8);
    assertEquals(preflightChecksUtils.getIntJavaVersion("11.8.0_71-ea"), 11);
    assertEquals(preflightChecksUtils.getIntJavaVersion("11.0"), 11);
    assertEquals(preflightChecksUtils.getIntJavaVersion("9"), 9);
    assertEquals(preflightChecksUtils.getIntJavaVersion("11"), 11);
    assertEquals(preflightChecksUtils.getIntJavaVersion("333"), 333);
    assertEquals(preflightChecksUtils.getIntJavaVersion("9-ea"), 9);
    rskContext.close();
}
Also used : RskTestContext(org.ethereum.util.RskTestContext) RskContext(co.rsk.RskContext) Test(org.junit.Test)

Example 10 with RskContext

use of co.rsk.RskContext in project rskj by rsksmart.

the class IndexBlooms method main.

public static void main(String[] args) {
    try (RskContext ctx = new RskContext(args)) {
        BlockStore blockStore = ctx.getBlockStore();
        BlocksBloomStore blocksBloomStore = ctx.getBlocksBloomStore();
        execute(makeBlockRange(args, blockStore), blockStore, blocksBloomStore);
    }
}
Also used : BlockStore(org.ethereum.db.BlockStore) RskContext(co.rsk.RskContext) BlocksBloomStore(co.rsk.logfilter.BlocksBloomStore)

Aggregations

RskContext (co.rsk.RskContext)20 Test (org.junit.Test)17 NodeStopper (co.rsk.util.NodeStopper)10 ActivationConfigsForTest (org.ethereum.config.blockchain.upgrades.ActivationConfigsForTest)9 RskTestContext (org.ethereum.util.RskTestContext)8 World (co.rsk.test.World)6 DslParser (co.rsk.test.dsl.DslParser)6 WorldDslProcessor (co.rsk.test.dsl.WorldDslProcessor)6 Block (org.ethereum.core.Block)6 Keccak256 (co.rsk.crypto.Keccak256)4 BlockFactory (org.ethereum.core.BlockFactory)3 Blockchain (org.ethereum.core.Blockchain)3 HashMapDB (org.ethereum.datasource.HashMapDB)3 PreflightChecksUtils (co.rsk.util.PreflightChecksUtils)2 Genesis (org.ethereum.core.Genesis)2 KeyValueDataSource (org.ethereum.datasource.KeyValueDataSource)2 BlockStore (org.ethereum.db.BlockStore)2 IndexedBlockStore (org.ethereum.db.IndexedBlockStore)2 ReceiptStore (org.ethereum.db.ReceiptStore)2 ReceiptStoreImpl (org.ethereum.db.ReceiptStoreImpl)2