Improve segmented journal actor metrics
[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 package ntfbenchmark.impl;
9
10 import com.google.common.util.concurrent.Futures;
11 import java.util.concurrent.Future;
12 import org.opendaylight.mdsal.binding.api.NotificationService.Listener;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ntfbench.payload.rev150709.Ntfbench;
14
15 public class NtfbenchTestListener implements Listener<Ntfbench> {
16     private final int expectedSize;
17     private int received = 0;
18
19     public NtfbenchTestListener(final int expectedSize) {
20         this.expectedSize = expectedSize;
21     }
22
23     @Override
24     public void onNotification(final Ntfbench notification) {
25         if (expectedSize == notification.getPayload().size()) {
26             received++;
27         }
28     }
29
30     public int getReceived() {
31         return received;
32     }
33
34     public Future<?> getAllDone() {
35         return Futures.immediateFuture(null);
36     }
37 }