Fix raw type warnings in bgp/bmp
[bgpcep.git] / bmp / bmp-impl / src / test / java / org / opendaylight / protocol / bmp / impl / session / BmpTestSessionListener.java
1 /*
2  * Copyright (c) 2015 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.protocol.bmp.impl.session;
9
10 import java.util.ArrayList;
11 import java.util.List;
12 import org.opendaylight.protocol.bmp.api.BmpSession;
13 import org.opendaylight.protocol.bmp.api.BmpSessionListener;
14 import org.opendaylight.yangtools.yang.binding.Notification;
15 import org.slf4j.Logger;
16 import org.slf4j.LoggerFactory;
17
18 public final class BmpTestSessionListener implements BmpSessionListener {
19     private static final Logger LOG = LoggerFactory.getLogger(BmpTestSessionListener.class);
20
21     private final List<Notification<?>> messages = new ArrayList<>();
22     private boolean up = false;
23
24     public boolean isUp() {
25         return up;
26     }
27
28     public List<Notification<?>> getListMsg() {
29         return messages;
30     }
31
32     @Override
33     public void onMessage(final Notification<?> message) {
34         LOG.debug("Received message: {} {}", message.getClass(), message);
35         messages.add(message);
36     }
37
38     @Override
39     public synchronized void onSessionUp(final BmpSession session) {
40         LOG.debug("Session up.");
41         up = true;
42     }
43
44     @Override
45     public void onSessionDown(final Exception throwable) {
46         LOG.debug("Session down.", throwable);
47         up = false;
48     }
49 }
50
51