package org.opendaylight.controller.cluster.datastore.messages;
import static org.junit.Assert.assertEquals;
+
import java.io.Serializable;
import org.apache.commons.lang.SerializationUtils;
import org.junit.Test;
import org.opendaylight.controller.cluster.datastore.DataStoreVersions;
-import org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages;
/**
* Unit tests for CanCommitTransactionReply.
CanCommitTransactionReply.class);
}
- private void testSerialization(CanCommitTransactionReply expected, Class<?> expSerialized) {
+ private static void testSerialization(CanCommitTransactionReply expected, Class<?> expSerialized) {
Object serialized = expected.toSerializable();
assertEquals("Serialized type", expSerialized, serialized.getClass());
assertEquals("getVersion", DataStoreVersions.CURRENT_VERSION, actual.getVersion());
}
- @Test
- public void testSerializationWithPreBoronVersion() {
- testSerialization(CanCommitTransactionReply.yes(DataStoreVersions.LITHIUM_VERSION),
- ThreePhaseCommitCohortMessages.CanCommitTransactionReply.class);
- testSerialization(CanCommitTransactionReply.no(DataStoreVersions.LITHIUM_VERSION),
- ThreePhaseCommitCohortMessages.CanCommitTransactionReply.class);
- }
-
@Test
public void testIsSerializedType() {
- assertEquals("isSerializedType", true, CanCommitTransactionReply.isSerializedType(
- ThreePhaseCommitCohortMessages.CanCommitTransactionReply.newBuilder().setCanCommit(true).build()));
-
assertEquals("isSerializedType", true, CanCommitTransactionReply.isSerializedType(
new CanCommitTransactionReply()));
assertEquals("isSerializedType", false, CanCommitTransactionReply.isSerializedType(new Object()));