Added notification benchmark (ntfbenchmark) and rpc benchmark models
[controller.git] / benchmark / ntfbenchmark / src / main / java / ntfbenchmark / impl / NtfbenchTestListener.java
1 /*
2  * Copyright (c) 2015 Cisco Systems 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 ntfbenchmark.impl;
10
11 import java.util.concurrent.Future;
12
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ntfbench.payload.rev150709.Ntfbench;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ntfbench.payload.rev150709.NtfbenchPayloadListener;
15
16 import com.google.common.util.concurrent.Futures;
17
18 public class NtfbenchTestListener implements NtfbenchPayloadListener {
19
20     private final int expectedSize;
21     private int received = 0;
22
23     public NtfbenchTestListener(final int expectedSize) {
24         this.expectedSize = expectedSize;
25     }
26
27     @Override
28     public void onNtfbench(final Ntfbench notification) {
29         if (expectedSize == notification.getPayload().size()) {
30             received++;
31         }
32     };
33
34     public int getReceived() {
35         return received;
36     }
37
38     public Future<?> getAllDone() {
39         return Futures.immediateFuture(null);
40     }
41
42 }