private static final AbortLocalTransactionRequest OBJECT = new AbortLocalTransactionRequest(TRANSACTION, ACTOR_REF);
public AbortLocalTransactionRequestTest() {
- super(OBJECT, 0);
+ super(OBJECT, 0, 0);
}
@Override
public abstract class AbstractLocalTransactionRequestTest<T extends AbstractLocalTransactionRequest<T>>
extends AbstractTransactionRequestTest<T> {
- protected AbstractLocalTransactionRequestTest(final T object, final int baseSize) {
- super(object, baseSize);
+ protected AbstractLocalTransactionRequestTest(final T object, final int baseSize, final int legacySize) {
+ super(object, baseSize, legacySize);
}
@Test
protected static final YangInstanceIdentifier PATH = YangInstanceIdentifier.empty();
protected static final boolean SNAPSHOT_ONLY = true;
- protected AbstractReadTransactionRequestTest(final T object, final int baseSize) {
- super(object, baseSize);
+ protected AbstractReadTransactionRequestTest(final T object, final int baseSize, final int legacySize) {
+ super(object, baseSize, legacySize);
}
@Test
import org.apache.commons.lang.SerializationUtils;
import org.junit.Test;
+import org.opendaylight.controller.cluster.access.ABIVersion;
import org.opendaylight.controller.cluster.access.concepts.ClientIdentifier;
import org.opendaylight.controller.cluster.access.concepts.FrontendIdentifier;
import org.opendaylight.controller.cluster.access.concepts.FrontendType;
private final T object;
private final int expectedSize;
+ private final int legacySize;
- protected AbstractRequestFailureTest(final T object, final int baseSize) {
+ protected AbstractRequestFailureTest(final T object, final int baseSize, final int legacySize) {
this.object = requireNonNull(object);
this.expectedSize = baseSize + CAUSE_SIZE;
+ this.legacySize = legacySize + CAUSE_SIZE;
}
@Test
@Test
public void serializationTest() {
final var bytes = SerializationUtils.serialize(object);
- assertEquals(expectedSize, bytes.length);
+ assertEquals(legacySize, bytes.length);
+ assertEquals(expectedSize, SerializationUtils.serialize(object.toVersion(ABIVersion.CHLORINE_SR2)).length);
@SuppressWarnings("unchecked")
final var deserialize = (T) SerializationUtils.deserialize(bytes);
import org.apache.commons.lang.SerializationUtils;
import org.eclipse.jdt.annotation.NonNull;
import org.junit.Test;
+import org.opendaylight.controller.cluster.access.ABIVersion;
import org.opendaylight.controller.cluster.access.concepts.ClientIdentifier;
import org.opendaylight.controller.cluster.access.concepts.FrontendIdentifier;
import org.opendaylight.controller.cluster.access.concepts.FrontendType;
private final @NonNull T object;
private final int expectedSize;
+ private final int legacySize;
- protected AbstractRequestSuccessTest(final T object, final int expectedSize) {
+ protected AbstractRequestSuccessTest(final T object, final int expectedSize, final int legacySize) {
this.object = requireNonNull(object);
this.expectedSize = expectedSize;
+ this.legacySize = legacySize;
}
@Test
public void serializationTest() {
final var bytes = SerializationUtils.serialize(object);
- assertEquals(expectedSize, bytes.length);
+ assertEquals(legacySize, bytes.length);
+ assertEquals(expectedSize, SerializationUtils.serialize(object.toVersion(ABIVersion.CHLORINE_SR2)).length);
@SuppressWarnings("unchecked")
final var deserialize = (T) SerializationUtils.deserialize(bytes);
protected static final TransactionIdentifier TRANSACTION_IDENTIFIER = new TransactionIdentifier(
HISTORY_IDENTIFIER, 0);
- protected AbstractTransactionRequestTest(final T object, final int baseSize) {
- super(object, baseSize);
+ protected AbstractTransactionRequestTest(final T object, final int baseSize, final int legacySize) {
+ super(object, baseSize, legacySize);
}
@Test
protected static final TransactionIdentifier TRANSACTION_IDENTIFIER = new TransactionIdentifier(HISTORY_IDENTIFIER,
0);
- protected AbstractTransactionSuccessTest(final T object, final int expectedSize) {
- super(object, expectedSize);
+ protected AbstractTransactionSuccessTest(final T object, final int expectedSize, final int legacySize) {
+ super(object, expectedSize, legacySize);
}
}
ACTOR_REF, MODIFICATION, null, COORDINATED);
public CommitLocalTransactionRequestTest() {
- super(OBJECT, 0);
+ super(OBJECT, 0, 0);
}
@Test
private static final ConnectClientFailure OBJECT = new ConnectClientFailure(CLIENT_IDENTIFIER, 0, CAUSE);
public ConnectClientFailureTest() {
- super(OBJECT, 392);
+ super(OBJECT, 99, 392);
}
@Test
CLIENT_IDENTIFIER, 0, ACTOR_REF, MIN_VERSION, MAX_VERSION);
public ConnectClientRequestTest() {
- super(OBJECT, 310);
+ super(OBJECT, 112, 310);
}
@Test
DataTreeConfiguration.DEFAULT_OPERATIONAL);
private static final ActorSystem SYSTEM = ActorSystem.create("test");
private static final ActorRef ACTOR_REF = TestProbe.apply(SYSTEM).ref();
+ private static final int ACTOR_REF_SIZE = ACTOR_REF.path().toSerializationFormat().length();
private static final ActorSelection ACTOR_SELECTION = ActorSelection.apply(ACTOR_REF, "foo");
private static final List<ActorSelection> ALTERNATES = ImmutableList.of(ACTOR_SELECTION);
private static final int MAX_MESSAGES = 10;
- private static final ConnectClientSuccess OBJECT = new ConnectClientSuccess(
- CLIENT_IDENTIFIER, 0, ACTOR_REF, ALTERNATES, TREE, MAX_MESSAGES);
+ private static final ConnectClientSuccess OBJECT = new ConnectClientSuccess(CLIENT_IDENTIFIER, 0, ACTOR_REF,
+ ALTERNATES, TREE, MAX_MESSAGES);
public ConnectClientSuccessTest() {
- super(OBJECT, 432 + ACTOR_REF.path().toSerializationFormat().length());
+ super(OBJECT, 146 + ACTOR_REF_SIZE, 432 + ACTOR_REF_SIZE);
}
@Before
ACTOR_REF, PATH, SNAPSHOT_ONLY);
public ExistsTransactionRequestTest() {
- super(OBJECT, 620);
+ super(OBJECT, 108, 620);
}
@Test
EXISTS);
public ExistsTransactionSuccessTest() {
- super(OBJECT, 487);
+ super(OBJECT, 99, 487);
}
@Test
private static final LocalHistoryFailure OBJECT = new LocalHistoryFailure(HISTORY_IDENTIFIER, 0, CAUSE);
public LocalHistoryFailureTest() {
- super(OBJECT, 392);
+ super(OBJECT, 99, 392);
}
@Test
private static final LocalHistorySuccess OBJECT = new LocalHistorySuccess(HISTORY_IDENTIFIER, 0);
public LocalHistorySuccessTest() {
- super(OBJECT, 382);
+ super(OBJECT, 96, 382);
}
@Test
ACTOR_REF, List.of(), PROTOCOL);
public ModifyTransactionRequestEmptyTest() {
- super(OBJECT, 408);
+ super(OBJECT, 108, 408);
}
@Test
ACTOR_REF, MODIFICATIONS, PROTOCOL);
public ModifyTransactionRequestTest() {
- super(OBJECT, 440);
+ super(OBJECT, 140, 440);
}
@Test
private static final ModifyTransactionSuccess OBJECT = new ModifyTransactionSuccess(TRANSACTION_IDENTIFIER, 0);
public ModifyTransactionSuccessTest() {
- super(OBJECT, 486);
+ super(OBJECT, 98, 486);
}
@Test
ACTOR_REF, PATH, SNAPSHOT_ONLY);
public ReadTransactionRequestTest() {
- super(OBJECT, 618);
+ super(OBJECT, 108, 618);
}
@Test
Optional.empty());
public ReadTransactionSuccessNoDataTest() {
- super(OBJECT, 485);
+ super(OBJECT, 99, 485);
}
@Test
import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
public class ReadTransactionSuccessTest extends AbstractTransactionSuccessTest<ReadTransactionSuccess> {
- private static final ContainerNode NODE = Builders.containerBuilder().withNodeIdentifier(
- NodeIdentifier.create(QName.create("namespace", "localName"))).build();
+ private static final ContainerNode NODE = Builders.containerBuilder()
+ .withNodeIdentifier(NodeIdentifier.create(QName.create("namespace", "localName")))
+ .build();
- private static final ReadTransactionSuccess OBJECT = new ReadTransactionSuccess(
- TRANSACTION_IDENTIFIER, 0, Optional.of(NODE));
+ private static final ReadTransactionSuccess OBJECT = new ReadTransactionSuccess(TRANSACTION_IDENTIFIER, 0,
+ Optional.of(NODE));
public ReadTransactionSuccessTest() {
- super(OBJECT, 515);
+ super(OBJECT, 129, 515);
}
@Test
TRANSACTION_IDENTIFIER, 0, ACTOR_REF, List.of(UnsignedLong.ONE));
public SkipTransactionsRequestTest() {
- super(OBJECT, 403);
+ super(OBJECT, 109, 403);
}
@Test
private static final SkipTransactionsResponse OBJECT = new SkipTransactionsResponse(TRANSACTION_IDENTIFIER, 0);
public SkipTransactionsResponseTest() {
- super(OBJECT, 486);
+ super(OBJECT, 98, 486);
}
@Test
ACTOR_REF);
public TransactionAbortRequestTest() {
- super(OBJECT, 400);
+ super(OBJECT, 101, 400);
}
@Test
private static final TransactionAbortSuccess OBJECT = new TransactionAbortSuccess(TRANSACTION_IDENTIFIER, 0);
public TransactionAbortSuccessTest() {
- super(OBJECT, 485);
+ super(OBJECT, 98, 485);
}
@Test
0);
public TransactionCanCommitSuccessTest() {
- super(OBJECT, 489);
+ super(OBJECT, 99, 489);
}
@Test
private static final TransactionCommitSuccess OBJECT = new TransactionCommitSuccess(TRANSACTION_IDENTIFIER, 0);
public TransactionCommitSuccessTest() {
- super(OBJECT, 486);
+ super(OBJECT, 98, 486);
}
@Test
ACTOR_REF);
public TransactionDoCommitRequestTest() {
- super(OBJECT, 403);
+ super(OBJECT, 102, 403);
}
@Test
private static final TransactionFailure OBJECT = new TransactionFailure(TRANSACTION_IDENTIFIER, 0, CAUSE);
public TransactionFailureTest() {
- super(OBJECT, 392);
+ super(OBJECT, 100, 392);
}
@Test
ACTOR_REF);
public TransactionPreCommitRequestTest() {
- super(OBJECT, 404);
+ super(OBJECT, 102, 404);
}
@Test
0);
public TransactionPreCommitSuccessTest() {
- super(OBJECT, 489);
+ super(OBJECT, 99, 489);
}
@Test
ACTOR_REF);
public TransactionPurgeRequestTest() {
- super(OBJECT, 400);
+ super(OBJECT, 101, 400);
}
@Test
private static final TransactionPurgeResponse OBJECT = new TransactionPurgeResponse(TRANSACTION_IDENTIFIER, 0);
public TransactionPurgeResponseTest() {
- super(OBJECT, 486);
+ super(OBJECT, 98, 486);
}
@Test
import org.apache.commons.lang.SerializationUtils;
import org.junit.Before;
import org.junit.Test;
+import org.opendaylight.controller.cluster.access.ABIVersion;
public abstract class AbstractRequestTest<T extends Request<?, T>> {
private static final ActorSystem SYSTEM = ActorSystem.create("test");
private final T object;
private final int expectedSize;
+ private final int legacySize;
- protected AbstractRequestTest(final T object, final int baseSize) {
+ protected AbstractRequestTest(final T object, final int baseSize, final int legacySize) {
this.object = requireNonNull(object);
this.expectedSize = baseSize + ACTOR_REF_SIZE;
+ this.legacySize = legacySize + ACTOR_REF_SIZE;
}
protected final T object() {
@Test
public void serializationTest() {
+ assertEquals(expectedSize, SerializationUtils.serialize(object.cloneAsVersion(ABIVersion.CHLORINE_SR2)).length);
+
final byte[] bytes = SerializationUtils.serialize(object);
- assertEquals(expectedSize, bytes.length);
+ assertEquals(legacySize, bytes.length);
@SuppressWarnings("unchecked")
final T deserialize = (T) SerializationUtils.deserialize(bytes);