Fix build faliures due to OFPlugin checktyle fixes
[netvirt.git] / elanmanager / elanmanager-impl / src / test / java / org / opendaylight / netvirt / elanmanager / tests / utils / IdHelper.java
1 /*
2  * Copyright © 2017 Ericsson India Global Services Pvt Ltd. 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
9 package org.opendaylight.netvirt.elanmanager.tests.utils;
10
11 import static org.opendaylight.netvirt.elanmanager.tests.ElanServiceTestBase.ELAN1;
12
13 import com.google.common.util.concurrent.Futures;
14 import java.util.HashMap;
15 import java.util.Map;
16 import java.util.concurrent.Future;
17
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.AllocateIdInput;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.AllocateIdOutput;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.AllocateIdOutputBuilder;
21 import org.opendaylight.yangtools.yang.common.RpcResult;
22 import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
23
24
25 public abstract class IdHelper implements
26         org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.IdManagerService {
27     static Map<String, Long> ids = new HashMap<>();
28
29     static {
30         ids.put(ELAN1, 5001L);
31     }
32
33     @Override
34     public Future<RpcResult<AllocateIdOutput>> allocateId(AllocateIdInput allocateIdInput) {
35         Long id = ids.get(allocateIdInput.getIdKey());
36         return Futures.immediateFuture(RpcResultBuilder.success(
37                 new AllocateIdOutputBuilder().setIdValue(id).build()).build());
38     }
39 }