2 * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
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
8 package org.opendaylight.controller.cluster.access.commands;
10 import org.junit.Assert;
11 import org.junit.Test;
12 import org.opendaylight.controller.cluster.access.concepts.ClientIdentifier;
13 import org.opendaylight.controller.cluster.access.concepts.FrontendIdentifier;
14 import org.opendaylight.controller.cluster.access.concepts.FrontendType;
15 import org.opendaylight.controller.cluster.access.concepts.LocalHistoryIdentifier;
16 import org.opendaylight.controller.cluster.access.concepts.MemberName;
17 import org.opendaylight.controller.cluster.access.concepts.RequestException;
18 import org.opendaylight.controller.cluster.access.concepts.RequestFailure;
19 import org.opendaylight.controller.cluster.access.concepts.RuntimeRequestException;
20 import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
22 public abstract class AbstractRequestFailureTest<T extends RequestFailure> {
23 private static final FrontendIdentifier FRONTEND_IDENTIFIER = FrontendIdentifier.create(
24 MemberName.forName("member"), FrontendType.forName("frontend"));
26 protected static final ClientIdentifier CLIENT_IDENTIFIER = ClientIdentifier.create(FRONTEND_IDENTIFIER, 0);
27 protected static final LocalHistoryIdentifier HISTORY_IDENTIFIER = new LocalHistoryIdentifier(CLIENT_IDENTIFIER, 0);
28 protected static final TransactionIdentifier TRANSACTION_IDENTIFIER = new TransactionIdentifier(
29 HISTORY_IDENTIFIER, 0);
30 protected static final RequestException CAUSE = new RuntimeRequestException("fail", new Throwable());
35 public void getCauseTest() throws Exception {
36 Assert.assertEquals(CAUSE, object().getCause());
40 public void isHardFailureTest() throws Exception {
41 Assert.assertTrue(object().isHardFailure());