use of neo.model.core.Block in project neo-java by coranos.
the class TestDBH2 method test002getFullBlockFromHash.
/**
* test getFullBlockFromHash.
*/
@Test
public void test002getFullBlockFromHash() {
try (TestLocalControllerNode controller = getTestLocalControllerNode()) {
final Block actual = controller.getBlockDb().getFullBlockFromHash(GenesisBlockUtil.GENESIS_HASH);
Assert.assertEquals("getFullBlockFromHash should return null with empty db.", null, actual);
}
}
use of neo.model.core.Block in project neo-java by coranos.
the class TestDBH2 method test007putAndGetFullBlockFromHash.
/**
* test put, and getFullBlockFromHash.
*/
@Test
public void test007putAndGetFullBlockFromHash() {
try (TestLocalControllerNode controller = getTestLocalControllerNode()) {
final Block expectedBlock = MockUtil.getMockBlock001();
controller.getBlockDb().put(true, expectedBlock);
final Block actualBlock = controller.getBlockDb().getFullBlockFromHash(expectedBlock.hash);
Assert.assertEquals("blocks should match.", expectedBlock.toString(), actualBlock.toString());
}
}
use of neo.model.core.Block in project neo-java by coranos.
the class TestDBMapDb method test005putAndGetFullBlockFromHeight.
/**
* test put, and getFullBlockFromHeight.
*/
@Test
public void test005putAndGetFullBlockFromHeight() {
try (TestLocalControllerNode controller = getTestLocalControllerNode()) {
final Block expectedBlock = MockUtil.getMockBlock003();
controller.getBlockDb().put(true, GenesisBlockUtil.GENESIS_BLOCK);
controller.getBlockDb().put(true, expectedBlock);
final Block actualBlock = controller.getBlockDb().getFullBlockFromHeight(1);
Assert.assertEquals("blocks should match.", expectedBlock.toJSONObject().toString(2), actualBlock.toJSONObject().toString(2));
}
}
use of neo.model.core.Block in project neo-java by coranos.
the class TestDBMapDb method test002getFullBlockFromHash.
/**
* test getFullBlockFromHash.
*/
@Test
public void test002getFullBlockFromHash() {
try (TestLocalControllerNode controller = getTestLocalControllerNode()) {
final Block actual = controller.getBlockDb().getFullBlockFromHash(GenesisBlockUtil.GENESIS_HASH);
Assert.assertEquals("getFullBlockFromHash should return null with empty db.", null, actual);
}
}
use of neo.model.core.Block in project neo-java by coranos.
the class TestDBMapDb method test009putAndGetHeaderOfBlockWithMaxIndex.
/**
* test put, and getFullBlockFromHash.
*/
@Test
public void test009putAndGetHeaderOfBlockWithMaxIndex() {
try (TestLocalControllerNode controller = getTestLocalControllerNode()) {
final Block expectedBlock = MockUtil.getMockBlock003();
controller.getBlockDb().put(true, GenesisBlockUtil.GENESIS_BLOCK);
controller.getBlockDb().put(true, expectedBlock);
expectedBlock.getTransactionList().clear();
final Block actualBlock = controller.getBlockDb().getHeaderOfBlockWithMaxIndex();
Assert.assertEquals("blocks should match.", expectedBlock.toString(), actualBlock.toString());
}
}
Aggregations