Search in sources :

Example 1 with MicroKernelBootstrap

use of io.nuls.kernel.MicroKernelBootstrap in project nuls by nuls-io.

the class BlockHeaderStorageServiceImplTest method init.

@Before
public void init() {
    MicroKernelBootstrap mk = MicroKernelBootstrap.getInstance();
    mk.init();
    mk.start();
    LevelDbModuleBootstrap bootstrap = new LevelDbModuleBootstrap();
    bootstrap.init();
    bootstrap.start();
    service = NulsContext.getServiceBean(BlockHeaderStorageService.class);
    BlockHeaderPo po = new BlockHeaderPo();
    po.setHash(NulsDigestData.calcDigestData("hashhash".getBytes()));
    po.setHeight(1286L);
    po.setExtend("extends".getBytes());
    po.setMerkleHash(NulsDigestData.calcDigestData("merkleHash".getBytes()));
    po.setPreHash(NulsDigestData.calcDigestData("prehash".getBytes()));
    try {
        po.setPackingAddress("address".getBytes());
    } catch (Exception e) {
        e.printStackTrace();
        assertTrue(false);
    }
    po.setScriptSign(new BlockSignature());
    po.setTime(12345678901L);
    po.setTxCount(3);
    List<NulsDigestData> txHashList = new ArrayList<>();
    txHashList.add(NulsDigestData.calcDigestData("first-tx-hash".getBytes()));
    txHashList.add(NulsDigestData.calcDigestData("second-tx-hash".getBytes()));
    txHashList.add(NulsDigestData.calcDigestData("third-tx-hash".getBytes()));
    po.setTxHashList(txHashList);
    this.entity = po;
}
Also used : LevelDbModuleBootstrap(io.nuls.db.module.impl.LevelDbModuleBootstrap) BlockSignature(io.nuls.kernel.script.BlockSignature) ArrayList(java.util.ArrayList) NulsDigestData(io.nuls.kernel.model.NulsDigestData) BlockHeaderStorageService(io.nuls.protocol.storage.service.BlockHeaderStorageService) BlockHeaderPo(io.nuls.protocol.storage.po.BlockHeaderPo) MicroKernelBootstrap(io.nuls.kernel.MicroKernelBootstrap) Before(org.junit.Before)

Example 2 with MicroKernelBootstrap

use of io.nuls.kernel.MicroKernelBootstrap in project nuls by nuls-io.

the class BlockServiceImplTest method init.

@Before
public void init() {
    MicroKernelBootstrap mk = MicroKernelBootstrap.getInstance();
    mk.init();
    mk.start();
    LevelDbModuleBootstrap bootstrap = new LevelDbModuleBootstrap();
    bootstrap.init();
    bootstrap.start();
    UtxoLedgerModuleBootstrap ledgerModuleBootstrap = new UtxoLedgerModuleBootstrap();
    ledgerModuleBootstrap.init();
    ledgerModuleBootstrap.start();
    service = NulsContext.getServiceBean(BlockService.class);
    Block block = new Block();
    BlockHeader blockHeader = new BlockHeader();
    blockHeader.setHash(NulsDigestData.calcDigestData("hashhash".getBytes()));
    blockHeader.setHeight(1286L);
    blockHeader.setExtend("extends".getBytes());
    blockHeader.setMerkleHash(NulsDigestData.calcDigestData("merkleHash".getBytes()));
    blockHeader.setPreHash(NulsDigestData.calcDigestData("prehash".getBytes()));
    try {
        blockHeader.setPackingAddress("address".getBytes());
    } catch (Exception e) {
        e.printStackTrace();
        assertTrue(false);
    }
    blockHeader.setBlockSignature(new BlockSignature());
    blockHeader.setTime(12345678901L);
    blockHeader.setTxCount(3);
    List<NulsDigestData> txHashList = new ArrayList<>();
    txHashList.add(NulsDigestData.calcDigestData("first-tx-hash".getBytes()));
    txHashList.add(NulsDigestData.calcDigestData("second-tx-hash".getBytes()));
    txHashList.add(NulsDigestData.calcDigestData("third-tx-hash".getBytes()));
// block.setTxHashList(txHashList);
// this.model = blockHeader;
}
Also used : LevelDbModuleBootstrap(io.nuls.db.module.impl.LevelDbModuleBootstrap) BlockSignature(io.nuls.kernel.script.BlockSignature) UtxoLedgerModuleBootstrap(io.nuls.ledger.module.impl.UtxoLedgerModuleBootstrap) ArrayList(java.util.ArrayList) BlockService(io.nuls.protocol.service.BlockService) Block(io.nuls.kernel.model.Block) NulsDigestData(io.nuls.kernel.model.NulsDigestData) BlockHeader(io.nuls.kernel.model.BlockHeader) MicroKernelBootstrap(io.nuls.kernel.MicroKernelBootstrap) Before(org.junit.Before)

Example 3 with MicroKernelBootstrap

use of io.nuls.kernel.MicroKernelBootstrap in project nuls by nuls-io.

the class BaseTest method initMicroKernel.

@BeforeClass
public static void initMicroKernel() {
    MicroKernelBootstrap mk = MicroKernelBootstrap.getInstance();
    mk.init();
    mk.start();
}
Also used : MicroKernelBootstrap(io.nuls.kernel.MicroKernelBootstrap) BeforeClass(org.junit.BeforeClass)

Example 4 with MicroKernelBootstrap

use of io.nuls.kernel.MicroKernelBootstrap in project nuls by nuls-io.

the class RpcServerManagerTest method startServer.

public void startServer() {
    MicroKernelBootstrap bootstrap = MicroKernelBootstrap.getInstance();
    bootstrap.init();
    bootstrap.start();
    RpcServerManager.getInstance().startServer("127.0.0.1", 8080);
    assertTrue(true);
}
Also used : MicroKernelBootstrap(io.nuls.kernel.MicroKernelBootstrap)

Example 5 with MicroKernelBootstrap

use of io.nuls.kernel.MicroKernelBootstrap in project nuls by nuls-io.

the class TestNetwork method init.

@Before
public void init() {
    try {
        MicroKernelBootstrap mk = MicroKernelBootstrap.getInstance();
        mk.init();
        mk.start();
        LevelDbModuleBootstrap dbModuleBootstrap = new LevelDbModuleBootstrap();
        dbModuleBootstrap.init();
        dbModuleBootstrap.start();
        BaseProtocolsModuleBootstrap protocolsModuleBootstrap = new BaseProtocolsModuleBootstrap();
        protocolsModuleBootstrap.init();
        protocolsModuleBootstrap.start();
        MessageBusModuleBootstrap messageBusModuleBootstrap = new MessageBusModuleBootstrap();
        messageBusModuleBootstrap.init();
        messageBusModuleBootstrap.start();
        NettyNetworkModuleBootstrap networkModuleBootstrap = new NettyNetworkModuleBootstrap();
        networkModuleBootstrap.init();
        networkModuleBootstrap.start();
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : LevelDbModuleBootstrap(io.nuls.db.module.impl.LevelDbModuleBootstrap) BaseProtocolsModuleBootstrap(io.nuls.protocol.base.module.BaseProtocolsModuleBootstrap) NettyNetworkModuleBootstrap(io.nuls.network.netty.module.impl.NettyNetworkModuleBootstrap) MessageBusModuleBootstrap(io.nuls.message.bus.module.MessageBusModuleBootstrap) MicroKernelBootstrap(io.nuls.kernel.MicroKernelBootstrap) Before(org.junit.Before)

Aggregations

MicroKernelBootstrap (io.nuls.kernel.MicroKernelBootstrap)13 LevelDbModuleBootstrap (io.nuls.db.module.impl.LevelDbModuleBootstrap)7 Before (org.junit.Before)6 BeforeClass (org.junit.BeforeClass)4 NulsDigestData (io.nuls.kernel.model.NulsDigestData)3 Block (io.nuls.kernel.model.Block)2 BlockSignature (io.nuls.kernel.script.BlockSignature)2 UtxoLedgerModuleBootstrap (io.nuls.ledger.module.impl.UtxoLedgerModuleBootstrap)2 NettyNetworkModuleBootstrap (io.nuls.network.netty.module.impl.NettyNetworkModuleBootstrap)2 ArrayList (java.util.ArrayList)2 ShutdownHook (io.nuls.client.rpc.resources.thread.ShutdownHook)1 LanguageService (io.nuls.client.storage.LanguageService)1 WebViewBootstrap (io.nuls.client.web.view.WebViewBootstrap)1 BaseTest (io.nuls.consensus.poc.BaseTest)1 NulsContext (io.nuls.kernel.context.NulsContext)1 BlockHeader (io.nuls.kernel.model.BlockHeader)1 MessageBusModuleBootstrap (io.nuls.message.bus.module.MessageBusModuleBootstrap)1 Node (io.nuls.network.model.Node)1 NetworkService (io.nuls.network.service.NetworkService)1 BaseProtocolsModuleBootstrap (io.nuls.protocol.base.module.BaseProtocolsModuleBootstrap)1