*/
package org.opendaylight.controller.cluster.datastore.persisted;
-import static org.junit.Assert.assertEquals;
+public class AbortTransactionPayloadTest extends AbstractIdentifiablePayloadTest<AbortTransactionPayload> {
-import org.apache.commons.lang3.SerializationUtils;
-import org.junit.Test;
-import org.opendaylight.controller.cluster.datastore.AbstractTest;
-
-public class AbortTransactionPayloadTest extends AbstractTest {
- @Test
- public void testPayloadSerDes() {
- final AbortTransactionPayload template = AbortTransactionPayload.create(nextTransactionId());
- final AbortTransactionPayload cloned = SerializationUtils.clone(template);
- assertEquals(template.getIdentifier(), cloned.getIdentifier());
+ @Override
+ AbortTransactionPayload object() {
+ return AbortTransactionPayload.create(nextTransactionId());
}
}
--- /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.datastore.persisted;
+
+import org.apache.commons.lang3.SerializationUtils;
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.controller.cluster.datastore.AbstractTest;
+
+abstract class AbstractIdentifiablePayloadTest<T extends AbstractIdentifiablePayload> extends AbstractTest {
+
+ abstract T object();
+
+ @Test
+ public void testSerialization() {
+ final T object = object();
+ final T cloned = SerializationUtils.clone(object);
+ Assert.assertEquals(object.getIdentifier(), cloned.getIdentifier());
+ }
+}
--- /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.datastore.persisted;
+
+public class CloseLocalHistoryPayloadTest extends AbstractIdentifiablePayloadTest<CloseLocalHistoryPayload> {
+
+ @Override
+ CloseLocalHistoryPayload object() {
+ return CloseLocalHistoryPayload.create(nextHistoryId());
+ }
+}
\ 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.datastore.persisted;
+
+public class CreateLocalHistoryPayloadTest extends AbstractIdentifiablePayloadTest<CreateLocalHistoryPayload> {
+
+ @Override
+ CreateLocalHistoryPayload object() {
+ return CreateLocalHistoryPayload.create(nextHistoryId());
+ }
+}
\ 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.datastore.persisted;
+
+public class PurgeLocalHistoryPayloadTest extends AbstractIdentifiablePayloadTest<PurgeLocalHistoryPayload> {
+
+ @Override
+ PurgeLocalHistoryPayload object() {
+ return PurgeLocalHistoryPayload.create(nextHistoryId());
+ }
+}
\ 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.datastore.persisted;
+
+public class PurgeTransactionPayloadTest extends AbstractIdentifiablePayloadTest<PurgeTransactionPayload> {
+
+ @Override
+ PurgeTransactionPayload object() {
+ return PurgeTransactionPayload.create(nextTransactionId());
+ }
+}
\ No newline at end of file