BUG-47 : migrated Keepalive message to generated source code. 20/1720/1
authorDana Kutenicsova <dkutenic@cisco.com>
Mon, 7 Oct 2013 12:46:42 +0000 (14:46 +0200)
committerDana Kutenicsova <dkutenic@cisco.com>
Mon, 7 Oct 2013 12:46:42 +0000 (14:46 +0200)
Change-Id: Id798377f996c5f9b61fe0d9ecc28185154d4c205
Signed-off-by: Dana Kutenicsova <dkutenic@cisco.com>
pcep/api/src/main/java/org/opendaylight/protocol/pcep/message/PCEPKeepAliveMessage.java [deleted file]
pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/message/PCEPKeepAliveMessageParser.java
pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/message/PCEPKeepAliveMessageValidator.java
pcep/impl/src/test/java/org/opendaylight/protocol/pcep/impl/PCEPValidatorTest.java
pcep/testtool/src/test/java/org/opendaylight/protocol/pcep/testtool/PCEPTestingToolTest.java

diff --git a/pcep/api/src/main/java/org/opendaylight/protocol/pcep/message/PCEPKeepAliveMessage.java b/pcep/api/src/main/java/org/opendaylight/protocol/pcep/message/PCEPKeepAliveMessage.java
deleted file mode 100644 (file)
index d9f3600..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.protocol.pcep.message;
-
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Message;
-
-/**
- * Structure of Keepalive Message
- * 
- * @see <a href="http://tools.ietf.org/html/rfc5440#section-6.3">KeepAlive Message</a>
- */
-public final class PCEPKeepAliveMessage implements Message {
-
-       /**
-        * Default constructor PCEPKeepAliveMessage.
-        */
-       public PCEPKeepAliveMessage() {
-       }
-
-       @Override
-       public String toString() {
-               final StringBuilder builder = new StringBuilder();
-               builder.append("PCEPKeepAliveMessage []");
-               return builder.toString();
-       }
-}
index b0d20ab822962dd3c1b0b65e182531ce83f6e2c5..ac5830f0cd14b5267e5c976288b49ffa8af0c55f 100644 (file)
@@ -8,7 +8,7 @@
 package org.opendaylight.protocol.pcep.impl.message;
 
 import org.opendaylight.protocol.pcep.impl.PCEPMessageParser;
-import org.opendaylight.protocol.pcep.message.PCEPKeepAliveMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.KeepaliveMessage;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Message;
 
 /**
@@ -18,7 +18,7 @@ public class PCEPKeepAliveMessageParser implements PCEPMessageParser {
 
        @Override
        public byte[] put(final Message msg) {
-               if (!(msg instanceof PCEPKeepAliveMessage))
+               if (!(msg instanceof KeepaliveMessage))
                        throw new IllegalArgumentException("Wrong instance of PCEPMessage. Passed instance of " + msg.getClass()
                                        + ". Nedded PCEPKeepAliveMessage.");
 
index 47b77f9c2d54c95c62a821fcef90f16cc9c14773..bc89130c697c3a14cb7c95f325ee86fe09e2ba9e 100644 (file)
@@ -13,8 +13,9 @@ import java.util.List;
 import org.opendaylight.protocol.pcep.PCEPDeserializerException;
 import org.opendaylight.protocol.pcep.PCEPObject;
 import org.opendaylight.protocol.pcep.impl.PCEPMessageValidator;
-import org.opendaylight.protocol.pcep.message.PCEPKeepAliveMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.KeepaliveBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Message;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.keepalive.message.KeepaliveMessageBuilder;
 
 /**
  * PCEPKeepAliveMessage validator. Validates message integrity.
@@ -30,7 +31,7 @@ public class PCEPKeepAliveMessageValidator extends PCEPMessageValidator {
                        private static final long serialVersionUID = 1L;
 
                        {
-                               this.add(new PCEPKeepAliveMessage());
+                               this.add(new KeepaliveBuilder().setKeepaliveMessage(new KeepaliveMessageBuilder().build()).build());
                        }
                };
        }
index 60a31fd4bcc4b39a940be79a39bdc49313c8146e..1dad2fce44117c2297cc64dbae1287e173d55900 100644 (file)
@@ -33,7 +33,6 @@ import org.opendaylight.protocol.pcep.impl.object.UnknownObject;
 import org.opendaylight.protocol.pcep.message.PCCreateMessage;
 import org.opendaylight.protocol.pcep.message.PCEPCloseMessage;
 import org.opendaylight.protocol.pcep.message.PCEPErrorMessage;
-import org.opendaylight.protocol.pcep.message.PCEPKeepAliveMessage;
 import org.opendaylight.protocol.pcep.message.PCEPNotificationMessage;
 import org.opendaylight.protocol.pcep.message.PCEPOpenMessage;
 import org.opendaylight.protocol.pcep.message.PCEPReplyMessage;
@@ -88,7 +87,9 @@ import org.opendaylight.protocol.pcep.tlv.PCEStatefulCapabilityTlv;
 import org.opendaylight.protocol.util.ByteArray;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nps.concepts.rev130930.Bandwidth;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.KeepaliveBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Message;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.keepalive.message.KeepaliveMessageBuilder;
 
 import com.google.common.collect.Lists;
 
@@ -154,8 +155,9 @@ public class PCEPValidatorTest {
        public void testKeepAliveMessageValidationFromBin() throws IOException, PCEPDeserializerException, PCEPDocumentedException,
                        DeserializerException, DocumentedException {
                assertEquals(deserMsg("src/test/resources/PCEPKeepAliveMessage1.bin").toString(),
-                               asList((Message) new PCEPKeepAliveMessage()).toString());
-               assertEquals(deserMsg("src/test/resources/Keepalive.1.bin").toString(), asList(new PCEPKeepAliveMessage()).toString());
+                               asList(new KeepaliveBuilder().setKeepaliveMessage(new KeepaliveMessageBuilder().build()).build()).toString());
+               assertEquals(deserMsg("src/test/resources/Keepalive.1.bin").toString(),
+                               asList(new KeepaliveBuilder().setKeepaliveMessage(new KeepaliveMessageBuilder().build()).build()).toString());
        }
 
        @Test
index 55fefd6bb5fb69b3a796507b3bd8e1ce05145236..c3421ffefdba1739e94a2c431bc2b4203813682c 100644 (file)
@@ -12,7 +12,9 @@ import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
 import org.junit.Test;
-import org.opendaylight.protocol.pcep.message.PCEPKeepAliveMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.KeepaliveBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.KeepaliveMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.keepalive.message.KeepaliveMessageBuilder;
 
 public class PCEPTestingToolTest {
 
@@ -20,9 +22,9 @@ public class PCEPTestingToolTest {
        public void testSimpleSessionListener() {
                final TestingSessionListener ssl = new TestingSessionListener();
                assertEquals(0, ssl.messages.size());
-               ssl.onMessage(null, new PCEPKeepAliveMessage());
+               ssl.onMessage(null, new KeepaliveBuilder().setKeepaliveMessage(new KeepaliveMessageBuilder().build()).build());
                assertEquals(1, ssl.messages.size());
-               assertTrue(ssl.messages.get(0) instanceof PCEPKeepAliveMessage);
+               assertTrue(ssl.messages.get(0) instanceof KeepaliveMessage);
                assertFalse(ssl.up);
                ssl.onSessionUp(null);
                assertTrue(ssl.up);