Search in sources :

Example 16 with ErrCode

use of org.aion.precompiled.contracts.ATB.ErrCode in project aion by aionnetwork.

the class BridgeRingInitializationTest method testRingMultiMemberInitialization.

@Test
public void testRingMultiMemberInitialization() {
    byte[][] members = new byte[][] { HashUtil.h256("member1".getBytes()), HashUtil.h256("member2".getBytes()), HashUtil.h256("member3".getBytes()), HashUtil.h256("member4".getBytes()), HashUtil.h256("member5".getBytes()) };
    ErrCode code = this.controller.ringInitialize(OWNER_ADDR.toByteArray(), members);
    assertThat(code).isEqualTo(ErrCode.NO_ERROR);
    assertThat(this.connector.getMemberCount()).isEqualTo(5);
    assertThat(this.connector.getMinThresh()).isEqualTo(3);
}
Also used : ErrCode(org.aion.precompiled.contracts.ATB.ErrCode) Test(org.junit.Test)

Example 17 with ErrCode

use of org.aion.precompiled.contracts.ATB.ErrCode in project aion by aionnetwork.

the class BridgeRingInitializationTest method testRingEmptyInitialization.

@Test
public void testRingEmptyInitialization() {
    ErrCode code = this.controller.ringInitialize(OWNER_ADDR.toByteArray(), new byte[][] {});
    assertThat(code).isEqualTo(ErrCode.NO_ERROR);
    assertThat(this.connector.getMemberCount()).isEqualTo(0);
    assertThat(this.connector.getMinThresh()).isEqualTo(1);
}
Also used : ErrCode(org.aion.precompiled.contracts.ATB.ErrCode) Test(org.junit.Test)

Example 18 with ErrCode

use of org.aion.precompiled.contracts.ATB.ErrCode in project aion by aionnetwork.

the class BridgeRingInitializationTest method testRingInitializationNotOwner.

@Test
public void testRingInitializationNotOwner() {
    byte[] notOwner = HashUtil.h256("not owner".getBytes());
    ErrCode code = this.controller.ringInitialize(notOwner, new byte[][] {});
    assertThat(code).isEqualTo(ErrCode.NOT_OWNER);
    assertThat(this.connector.getMemberCount()).isEqualTo(0);
    assertThat(this.connector.getMinThresh()).isEqualTo(0);
}
Also used : ErrCode(org.aion.precompiled.contracts.ATB.ErrCode) Test(org.junit.Test)

Example 19 with ErrCode

use of org.aion.precompiled.contracts.ATB.ErrCode in project aion by aionnetwork.

the class BridgeRingInitializationTest method testRingSingleMemberInitialization.

@Test
public void testRingSingleMemberInitialization() {
    ErrCode code = this.controller.ringInitialize(OWNER_ADDR.toByteArray(), new byte[][] { OWNER_ADDR.toByteArray() });
    assertThat(code).isEqualTo(ErrCode.NO_ERROR);
    assertThat(this.connector.getMemberCount()).isEqualTo(1);
    assertThat(this.connector.getMinThresh()).isEqualTo(1);
}
Also used : ErrCode(org.aion.precompiled.contracts.ATB.ErrCode) Test(org.junit.Test)

Aggregations

ErrCode (org.aion.precompiled.contracts.ATB.ErrCode)19 Test (org.junit.Test)18 BridgeController (org.aion.precompiled.contracts.ATB.BridgeController)6 BridgeTransfer (org.aion.precompiled.contracts.ATB.BridgeTransfer)5 AionAddress (org.aion.types.AionAddress)4 Log (org.aion.types.Log)1