--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.cluster.access.commands;
+
+import org.opendaylight.controller.cluster.access.concepts.ClientIdentifier;
+import org.opendaylight.controller.cluster.access.concepts.FrontendIdentifier;
+import org.opendaylight.controller.cluster.access.concepts.FrontendType;
+import org.opendaylight.controller.cluster.access.concepts.LocalHistoryIdentifier;
+import org.opendaylight.controller.cluster.access.concepts.MemberName;
+import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
+
+public abstract class AbstractTransactionSuccessTest<T extends TransactionSuccess> {
+ private static final FrontendIdentifier FRONTEND_IDENTIFIER = FrontendIdentifier.create(
+ MemberName.forName("test"), FrontendType.forName("one"));
+ private static final ClientIdentifier CLIENT_IDENTIFIER = ClientIdentifier.create(FRONTEND_IDENTIFIER, 0);
+ private static final LocalHistoryIdentifier HISTORY_IDENTIFIER = new LocalHistoryIdentifier(
+ CLIENT_IDENTIFIER, 0);
+
+ protected static final TransactionIdentifier TRANSACTION_IDENTIFIER = new TransactionIdentifier(
+ HISTORY_IDENTIFIER, 0);
+}
private static final TransactionIdentifier TRANSACTION = new TransactionIdentifier(HISTORY, 0);
private static final DataTreeModification MODIFICATION = Mockito.mock(DataTreeModification.class);
- private static final boolean COORDINATED = Boolean.TRUE;
+ private static final boolean COORDINATED = true;
private static final CommitLocalTransactionRequest OBJECT = new CommitLocalTransactionRequest(
TRANSACTION, 0, ACTOR_REF, MODIFICATION, COORDINATED);
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.cluster.access.commands;
+
+import com.google.common.base.MoreObjects;
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.controller.cluster.access.ABIVersion;
+
+public class ExistsTransactionSuccessTest extends AbstractTransactionSuccessTest<ExistsTransactionSuccess> {
+ private static final boolean EXISTS = true;
+
+ private static final ExistsTransactionSuccess OBJECT = new ExistsTransactionSuccess(
+ TRANSACTION_IDENTIFIER, 0, EXISTS);
+
+ @Test
+ public void getExists() throws Exception {
+ final boolean result = OBJECT.getExists();
+ Assert.assertEquals(EXISTS, result);
+ }
+
+ @Test
+ public void externalizableProxy() throws Exception {
+ final ExistsTransactionSuccessProxyV1 proxy = OBJECT.externalizableProxy(ABIVersion.BORON);
+ Assert.assertNotNull(proxy);
+ }
+
+ @Test
+ public void cloneAsVersion() throws Exception {
+ final ExistsTransactionSuccess clone = OBJECT.cloneAsVersion(ABIVersion.BORON);
+ Assert.assertEquals(OBJECT, clone);
+ }
+
+ @Test
+ public void addToStringAttributes() throws Exception {
+ final MoreObjects.ToStringHelper result = OBJECT.addToStringAttributes(MoreObjects.toStringHelper(OBJECT));
+ Assert.assertTrue(result.toString().contains("exists=" + EXISTS));
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.cluster.access.commands;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.controller.cluster.access.ABIVersion;
+
+public class ModifyTransactionSuccessTest extends AbstractTransactionSuccessTest<ModifyTransactionSuccess> {
+ private static final ModifyTransactionSuccess OBJECT = new ModifyTransactionSuccess(
+ TRANSACTION_IDENTIFIER, 0);
+
+ @Test
+ public void externalizableProxy() throws Exception {
+ final AbstractTransactionSuccessProxy<ModifyTransactionSuccess> proxy = OBJECT.externalizableProxy(
+ ABIVersion.BORON);
+ Assert.assertNotNull(proxy);
+ }
+
+ @Test
+ public void cloneAsVersion() throws Exception {
+ final ModifyTransactionSuccess clone = OBJECT.cloneAsVersion(ABIVersion.BORON);
+ Assert.assertEquals(OBJECT.getVersion(), clone.getVersion());
+ Assert.assertEquals(OBJECT.getSequence(), clone.getSequence());
+ Assert.assertEquals(OBJECT.getTarget(), clone.getTarget());
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.cluster.access.commands;
+
+import com.google.common.base.Optional;
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.controller.cluster.access.ABIVersion;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
+
+public class ReadTransactionSuccessTest extends AbstractTransactionSuccessTest<ReadTransactionSuccess> {
+ private static final NormalizedNode<?, ?> NODE = Builders.containerBuilder().withNodeIdentifier(
+ YangInstanceIdentifier.NodeIdentifier.create(QName.create("namespace", "localName"))).build();
+
+ private static final ReadTransactionSuccess OBJECT = new ReadTransactionSuccess(
+ TRANSACTION_IDENTIFIER, 0, Optional.of(NODE));
+
+ @Test
+ public void getData() throws Exception {
+ final Optional<NormalizedNode<?, ?>> result = OBJECT.getData();
+ Assert.assertTrue(result.isPresent());
+ Assert.assertEquals(NODE.getValue(), result.get().getValue());
+ }
+
+ @Test
+ public void externalizableProxy() throws Exception {
+ final AbstractTransactionSuccessProxy<ReadTransactionSuccess> proxy = OBJECT.externalizableProxy(
+ ABIVersion.BORON);
+ Assert.assertNotNull(proxy);
+ }
+
+ @Test
+ public void cloneAsVersion() throws Exception {
+ final ReadTransactionSuccess clone = OBJECT.cloneAsVersion(ABIVersion.BORON);
+ Assert.assertEquals(OBJECT, clone);
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.cluster.access.commands;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.controller.cluster.access.ABIVersion;
+
+public class TransactionAbortSuccessTest extends AbstractTransactionSuccessTest<TransactionAbortSuccess> {
+ private static final TransactionAbortSuccess OBJECT = new TransactionAbortSuccess(
+ TRANSACTION_IDENTIFIER, 0);
+
+ @Test
+ public void externalizableProxy() throws Exception {
+ final AbstractTransactionSuccessProxy<TransactionAbortSuccess> proxy = OBJECT.externalizableProxy(
+ ABIVersion.BORON);
+ Assert.assertNotNull(proxy);
+ }
+
+ @Test
+ public void cloneAsVersion() throws Exception {
+ final TransactionAbortSuccess clone = OBJECT.cloneAsVersion(ABIVersion.BORON);
+ Assert.assertEquals(OBJECT, clone);
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.cluster.access.commands;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.controller.cluster.access.ABIVersion;
+
+public class TransactionCanCommitSuccessTest extends AbstractTransactionSuccessTest<TransactionCanCommitSuccess> {
+ private static final TransactionCanCommitSuccess OBJECT = new TransactionCanCommitSuccess(
+ TRANSACTION_IDENTIFIER, 0);
+
+ @Test
+ public void externalizableProxy() throws Exception {
+ final AbstractTransactionSuccessProxy<TransactionCanCommitSuccess> proxy = OBJECT.externalizableProxy(
+ ABIVersion.BORON);
+ Assert.assertNotNull(proxy);
+ }
+
+ @Test
+ public void cloneAsVersion() throws Exception {
+ final TransactionCanCommitSuccess clone = OBJECT.cloneAsVersion(ABIVersion.BORON);
+ Assert.assertEquals(OBJECT, clone);
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.cluster.access.commands;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.controller.cluster.access.ABIVersion;
+
+public class TransactionCommitSuccessTest extends AbstractTransactionSuccessTest<TransactionCommitSuccess> {
+ private static final TransactionCommitSuccess OBJECT = new TransactionCommitSuccess(
+ TRANSACTION_IDENTIFIER, 0);
+
+ @Test
+ public void externalizableProxy() throws Exception {
+ final AbstractTransactionSuccessProxy<TransactionCommitSuccess> proxy = OBJECT.externalizableProxy(
+ ABIVersion.BORON);
+ Assert.assertNotNull(proxy);
+ }
+
+ @Test
+ public void cloneAsVersion() throws Exception {
+ final TransactionCommitSuccess clone = OBJECT.cloneAsVersion(ABIVersion.BORON);
+ Assert.assertEquals(OBJECT, clone);
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.cluster.access.commands;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.controller.cluster.access.ABIVersion;
+
+public class TransactionPreCommitSuccessTest extends AbstractTransactionSuccessTest<TransactionPreCommitSuccess> {
+ private static final TransactionPreCommitSuccess OBJECT = new TransactionPreCommitSuccess(
+ TRANSACTION_IDENTIFIER, 0);
+
+ @Test
+ public void externalizableProxy() throws Exception {
+ final AbstractTransactionSuccessProxy<TransactionPreCommitSuccess> proxy = OBJECT.externalizableProxy(
+ ABIVersion.BORON);
+ Assert.assertNotNull(proxy);
+ }
+
+ @Test
+ public void cloneAsVersion() throws Exception {
+ final TransactionPreCommitSuccess clone = OBJECT.cloneAsVersion(ABIVersion.BORON);
+ Assert.assertEquals(OBJECT, clone);
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.cluster.access.commands;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.controller.cluster.access.ABIVersion;
+
+public class TransactionPurgeResponseTest extends AbstractTransactionSuccessTest<TransactionPurgeResponse> {
+ private static final TransactionPurgeResponse OBJECT = new TransactionPurgeResponse(
+ TRANSACTION_IDENTIFIER, 0);
+
+ @Test
+ public void externalizableProxy() throws Exception {
+ final AbstractTransactionSuccessProxy<TransactionPurgeResponse> proxy = OBJECT.externalizableProxy(
+ ABIVersion.BORON);
+ Assert.assertNotNull(proxy);
+ }
+
+ @Test
+ public void cloneAsVersion() throws Exception {
+ final TransactionPurgeResponse clone = OBJECT.cloneAsVersion(ABIVersion.BORON);
+ Assert.assertEquals(OBJECT, clone);
+ }
+}
\ No newline at end of file