BUG-5280: switch transactionIdentifier
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / test / java / org / opendaylight / controller / cluster / datastore / MockIdentifiers.java
1 /*
2  * Copyright (c) 2016 Cisco Systems, Inc. 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.datastore;
9
10 import org.opendaylight.controller.cluster.access.concepts.ClientIdentifier;
11 import org.opendaylight.controller.cluster.access.concepts.FrontendIdentifier;
12 import org.opendaylight.controller.cluster.access.concepts.FrontendType;
13 import org.opendaylight.controller.cluster.access.concepts.LocalHistoryIdentifier;
14 import org.opendaylight.controller.cluster.access.concepts.MemberName;
15 import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
16
17 public final class MockIdentifiers {
18     public static ClientIdentifier clientIdentifier(final Class<?> clazz, final String memberName) {
19         return ClientIdentifier.create(FrontendIdentifier.create(MemberName.forName(memberName),
20             FrontendType.forName(clazz.getSimpleName())), 0);
21     }
22
23     public static LocalHistoryIdentifier historyIdentifier(final Class<?> clazz, final String memberName) {
24         return new LocalHistoryIdentifier(clientIdentifier(clazz, memberName), 0);
25     }
26
27     public static TransactionIdentifier transactionIdentifier(final Class<?> clazz, final String memberName) {
28         return new TransactionIdentifier(historyIdentifier(clazz, memberName), 0);
29     };
30 }