Removed some sonar warnings from pcep.
[bgpcep.git] / pcep / testtool / src / main / java / org / opendaylight / protocol / pcep / testtool / TestingSessionListener.java
index d785d6bb109ed396258551834f8fb40c6cf837c8..30a62268dc26514b1b5cac14809fbccb57d4aacc 100644 (file)
@@ -7,19 +7,20 @@
  */
 package org.opendaylight.protocol.pcep.testtool;
 
-import java.util.ArrayList;
 import java.util.List;
 
-import org.opendaylight.protocol.pcep.PCEPMessage;
 import org.opendaylight.protocol.pcep.PCEPSession;
 import org.opendaylight.protocol.pcep.PCEPSessionListener;
 import org.opendaylight.protocol.pcep.PCEPTerminationReason;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Message;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import com.google.common.collect.Lists;
+
 public class TestingSessionListener implements PCEPSessionListener {
 
-       public List<PCEPMessage> messages = new ArrayList<PCEPMessage>();
+       private final List<Message> messages = Lists.newArrayList();
 
        public boolean up = false;
 
@@ -29,7 +30,7 @@ public class TestingSessionListener implements PCEPSessionListener {
        }
 
        @Override
-       public void onMessage(final PCEPSession session, final PCEPMessage message) {
+       public void onMessage(final PCEPSession session, final Message message) {
                logger.debug("Received message: {}", message);
                this.messages.add(message);
        }
@@ -38,18 +39,20 @@ public class TestingSessionListener implements PCEPSessionListener {
        public void onSessionUp(final PCEPSession session) {
                logger.debug("Session up.");
                this.up = true;
-               // this.notifyAll();
        }
 
        @Override
        public void onSessionDown(final PCEPSession session, final Exception e) {
                logger.debug("Session down. Cause : {} or {}", e);
                this.up = false;
-               // this.notifyAll();
        }
 
        @Override
        public void onSessionTerminated(final PCEPSession session, final PCEPTerminationReason cause) {
                logger.debug("Session terminated. Cause : {}", cause);
        }
+
+       public List<Message> messages() {
+               return this.messages;
+       }
 }