Unit tests: add serialization tests
[controller.git] / opendaylight / md-sal / cds-access-api / src / test / java / org / opendaylight / controller / cluster / access / commands / AbortLocalTransactionRequestTest.java
1 /*
2  * Copyright (c) 2017 Pantheon Technologies s.r.o. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.controller.cluster.access.commands;
9
10 import org.junit.Assert;
11 import org.opendaylight.controller.cluster.access.concepts.ClientIdentifier;
12 import org.opendaylight.controller.cluster.access.concepts.FrontendIdentifier;
13 import org.opendaylight.controller.cluster.access.concepts.FrontendType;
14 import org.opendaylight.controller.cluster.access.concepts.LocalHistoryIdentifier;
15 import org.opendaylight.controller.cluster.access.concepts.MemberName;
16 import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
17
18 public class AbortLocalTransactionRequestTest
19         extends AbstractLocalTransactionRequestTest<AbortLocalTransactionRequest> {
20     private static final FrontendIdentifier FRONTEND = FrontendIdentifier.create(
21             MemberName.forName("test"), FrontendType.forName("one"));
22     private static final ClientIdentifier CLIENT = ClientIdentifier.create(FRONTEND, 0);
23     private static final LocalHistoryIdentifier HISTORY = new LocalHistoryIdentifier(CLIENT, 0);
24     private static final TransactionIdentifier TRANSACTION = new TransactionIdentifier(HISTORY, 0);
25
26     private static final AbortLocalTransactionRequest OBJECT = new AbortLocalTransactionRequest(TRANSACTION, ACTOR_REF);
27
28     @Override
29     protected AbortLocalTransactionRequest object() {
30         return OBJECT;
31     }
32
33     @Override
34     protected void doAdditionalAssertions(final Object deserialize) {
35         Assert.assertTrue(deserialize instanceof AbortLocalTransactionRequest);
36         Assert.assertEquals(OBJECT.getReplyTo(), ((AbortLocalTransactionRequest) deserialize).getReplyTo());
37     }
38 }