Package org.jgroups.tests

Source Code of org.jgroups.tests.ViewIdTest

package org.jgroups.tests;

import org.jgroups.Global;
import org.jgroups.ViewId;
import org.jgroups.util.Util;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

import java.net.UnknownHostException;

/**
* Author: Bela Ban
*/
@Test(groups=Global.FUNCTIONAL)
public class ViewIdTest {
    private ViewId v1, v2, v3;

    @BeforeClass
    public void setUp() throws UnknownHostException {
        v1=new ViewId(Util.createRandomAddress(), 22);
        v2=new ViewId(Util.createRandomAddress(), 21);
        v3=(ViewId)v1.clone();
    }


    public void test0() {
        assert v1.equals(v2) == false;
    }

    public void test1() {
        assert v1.equals(v3) : "v1 and v3 should be the same view";
    }


    public void test2() {
        ViewId v4=(ViewId)v1.clone();
        assert v1.equals(v4);
    }


    public void test3() {
        assert v1.compareTo(v3) == 0;
    }


    public void test4() {
        assert v1.compareTo(v2) > 0;
    }


    public void test5() {
        assert v2.compareTo(v1) < 0;
    }

  
}

TOP

Related Classes of org.jgroups.tests.ViewIdTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.