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.AbstractRequestTest;
13 import org.opendaylight.controller.cluster.access.concepts.ClientIdentifier;
14 import org.opendaylight.controller.cluster.access.concepts.FrontendIdentifier;
15 import org.opendaylight.controller.cluster.access.concepts.FrontendType;
16 import org.opendaylight.controller.cluster.access.concepts.LocalHistoryIdentifier;
17 import org.opendaylight.controller.cluster.access.concepts.MemberName;
18 import org.opendaylight.controller.cluster.access.concepts.RequestException;
19 import org.opendaylight.controller.cluster.access.concepts.RuntimeRequestException;
20 import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
22 public abstract class AbstractTransactionRequestTest<T extends TransactionRequest<T>>
23 extends AbstractRequestTest<T> {
24 private static final FrontendIdentifier FRONTEND_IDENTIFIER = FrontendIdentifier.create(
25 MemberName.forName("test"), FrontendType.forName("one"));
26 private static final ClientIdentifier CLIENT_IDENTIFIER = ClientIdentifier.create(FRONTEND_IDENTIFIER, 0);
27 private static final LocalHistoryIdentifier HISTORY_IDENTIFIER = new LocalHistoryIdentifier(
28 CLIENT_IDENTIFIER, 0);
29 protected static final TransactionIdentifier TRANSACTION_IDENTIFIER = new TransactionIdentifier(
30 HISTORY_IDENTIFIER, 0);
33 protected abstract T object();
36 public void toRequestFailureTest() {
37 final Throwable cause = new Throwable();
38 final RequestException exception = new RuntimeRequestException("fail", cause);
39 final TransactionFailure failure = object().toRequestFailure(exception);
40 Assert.assertNotNull(failure);