Search in sources :

Example 6 with MastershipTerm

use of org.onosproject.mastership.MastershipTerm in project onos by opennetworkinglab.

the class MastershipTermCodecTest method testMastershipTermEncode.

/**
 * Tests encoding of a mastership term object.
 */
@Test
public void testMastershipTermEncode() {
    NodeId masterNodeId = NodeId.nodeId("1");
    long termNumber = 10;
    MastershipTerm mastershipTerm = MastershipTerm.of(masterNodeId, termNumber);
    ObjectNode mastershipTermJson = mastershipTermCodec.encode(mastershipTerm, context);
    assertThat(mastershipTermJson, MastershipTermJsonMatcher.matchesMastershipTerm(mastershipTerm));
}
Also used : MastershipTerm(org.onosproject.mastership.MastershipTerm) ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) NodeId(org.onosproject.cluster.NodeId) Test(org.junit.Test)

Aggregations

MastershipTerm (org.onosproject.mastership.MastershipTerm)6 ExecutionException (java.util.concurrent.ExecutionException)3 Test (org.junit.Test)2 NodeId (org.onosproject.cluster.NodeId)2 MastershipRole (org.onosproject.net.MastershipRole)2 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)1 Preconditions.checkNotNull (com.google.common.base.Preconditions.checkNotNull)1 Preconditions.checkState (com.google.common.base.Preconditions.checkState)1 ImmutableList (com.google.common.collect.ImmutableList)1 Lists (com.google.common.collect.Lists)1 Maps (com.google.common.collect.Maps)1 Multimap (com.google.common.collect.Multimap)1 Multimaps.newListMultimap (com.google.common.collect.Multimaps.newListMultimap)1 Multimaps.synchronizedListMultimap (com.google.common.collect.Multimaps.synchronizedListMultimap)1 Futures (com.google.common.util.concurrent.Futures)1 InputStream (java.io.InputStream)1 System.currentTimeMillis (java.lang.System.currentTimeMillis)1 Instant (java.time.Instant)1 Collection (java.util.Collection)1