Search in sources :

Example 11 with Approvable

use of com.icodici.universa.Approvable in project universa by UniversaBlockchain.

the class MainTest method registerContract500approved_seal.

@Test
public void registerContract500approved_seal() throws Exception {
    TestSpace ts = prepareTestSpace();
    Contract contract = createContract500(ts.myKey);
    int i = 0;
    for (Approvable sub : contract.getNewItems()) {
        Contract subContract = (Contract) sub;
        ItemResult subItemResult = ts.client.register(subContract.getLastSealedBinary(), 1000);
        assertEquals(ItemState.APPROVED, subItemResult.state);
        ++i;
        if (i % 10 == 0)
            System.out.println("register subContract: " + i);
    }
    ItemResult itemResult = ts.client.register(contract.getLastSealedBinary(), 10000);
    assertEquals(ItemState.DECLINED, itemResult.state);
    i = 0;
    for (Approvable sub : contract.getNewItems()) {
        ItemResult subItemResult = ts.client.getState(sub);
        System.out.println("" + (i++) + " - " + subItemResult.state);
        assertEquals(ItemState.APPROVED, subItemResult.state);
    }
    ts.nodes.forEach(n -> n.shutdown());
}
Also used : Approvable(com.icodici.universa.Approvable) Test(org.junit.Test)

Aggregations

Approvable (com.icodici.universa.Approvable)11 Test (org.junit.Test)6 Decimal (com.icodici.universa.Decimal)3 Contract (com.icodici.universa.contract.Contract)3 PrivateKey (com.icodici.crypto.PrivateKey)1 HashId (com.icodici.universa.HashId)1