UT test cases for Pcep initiate message (updated with given review comments).
Change-Id: I8de13aa3f0816022ddda26f60fa8cf2baf943775
diff --git a/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepInitiateMsgTest.java b/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepInitiateMsgTest.java
index 224afaa..8247dfb 100644
--- a/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepInitiateMsgTest.java
+++ b/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepInitiateMsgTest.java
@@ -17,30 +17,28 @@
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
-import org.junit.Assert;
import org.junit.Test;
import org.onosproject.pcepio.exceptions.PcepParseException;
import org.onosproject.pcepio.protocol.PcepFactories;
import org.onosproject.pcepio.protocol.PcepInitiateMsg;
import org.onosproject.pcepio.protocol.PcepMessage;
import org.onosproject.pcepio.protocol.PcepMessageReader;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+import static org.hamcrest.core.IsSame.sameInstance;
public class PcepInitiateMsgTest {
- protected static final Logger log = LoggerFactory.getLogger(PcepInitiateMsgTest.class);
-
/**
* This test case checks for srp, lsp, end-point, ERO objects in PcInitiate message.
- * @throws PcepParseException when message paring fails
*/
@Test
public void initiateMessageTest1() throws PcepParseException {
/* srp, lsp, end-point, ERO.
*/
- byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, 0x54,
+ byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, 0x54,
0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP object
0x20, 0x10, 0x00, 0x24, 0x00, 0x00, 0x00, 0x08, //LSP object
0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
@@ -59,39 +57,38 @@
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
+
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcInitiate",
- (message instanceof PcepInitiateMsg));
+ assertThat(message, sameInstance((PcepInitiateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+
message.writeTo(buf);
+
testInitiateCreationMsg = buf.array();
- int iReadLen = buf.writerIndex() - 0;
+ int iReadLen = buf.writerIndex();
testInitiateCreationMsg = new byte[iReadLen];
buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
- Assert.assertArrayEquals("PCInitiate messages are not equal ", initiateCreationMsg, testInitiateCreationMsg);
-
+ assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
}
/**
* This test case checks for srp and lsp objects in PcInitiate message.
- *
- * @throws PcepParseException when message paring fails
*/
@Test
public void initiateMessageTest2() throws PcepParseException {
/* srp, lsp.
*/
- byte[] initiateDeletionMsg = new byte[] {0x20, 0x0C, 0x00, 0x34,
+ byte[] initiateDeletionMsg = new byte[]{0x20, 0x0C, 0x00, 0x34,
0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, //SRP object
0x20, 0x10, 0x00, 0x24, 0x00, 0x00, 0x20, 0x10, //LSP object
0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
0x01, 0x01, 0x01, 0x01, 0x00, 0x43, (byte) 0x83, 0x01,
0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02,
- 0x00, 0x11, 0x00, 0x04, 0x54, 0x31, 0x32, 0x33 }; //SymbolicPathTlv
+ 0x00, 0x11, 0x00, 0x04, 0x54, 0x31, 0x32, 0x33}; //SymbolicPathTlv
byte[] testInitiateDeletionMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
@@ -102,27 +99,24 @@
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcInitiate",
- (message instanceof PcepInitiateMsg));
+ assertThat(message, sameInstance((PcepInitiateMsg) message));
+
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testInitiateDeletionMsg = buf.array();
- int iReadLen = buf.writerIndex() - 0;
+ int iReadLen = buf.writerIndex();
testInitiateDeletionMsg = new byte[iReadLen];
buf.readBytes(testInitiateDeletionMsg, 0, iReadLen);
- Assert.assertArrayEquals("PcInitiate(with R flag set) messages are not equal",
- initiateDeletionMsg, testInitiateDeletionMsg);
+ assertThat(testInitiateDeletionMsg, is(initiateDeletionMsg));
}
/**
* This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv,
* StatefulLspErrorCodeTlv, StatefulRsvpErrorSpecTlv), END-POINTS, ERO objects
* in PcInitiate message.
- *
- * @throws PcepParseException when message paring fails
*/
@Test
public void initiateMessageTest3() throws PcepParseException {
@@ -130,9 +124,9 @@
/* SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv,
* StatefulLspErrorCodeTlv, StatefulRsvpErrorSpecTlv), END-POINTS, ERO.
*/
- byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0x64,
+ byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x64,
0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
- 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
+ 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP object
0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
(byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
@@ -153,25 +147,23 @@
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcInitiate",
- (message instanceof PcepInitiateMsg));
+ assertThat(message, sameInstance((PcepInitiateMsg) message));
+
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+
message.writeTo(buf);
testInitiateCreationMsg = buf.array();
- int iReadLen = buf.writerIndex() - 0;
+ int iReadLen = buf.writerIndex();
testInitiateCreationMsg = new byte[iReadLen];
buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
- Assert.assertArrayEquals("PcInitiate messages are not equal", initiateCreationMsg, testInitiateCreationMsg);
-
+ assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
}
/**
* This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv,
* StatefulLspErrorCodeTlv), END-POINT, ERO objects in PcInitiate message.
- *
- * @throws PcepParseException when message paring fails
*/
@Test
public void initiateMessageTest4() throws PcepParseException {
@@ -179,14 +171,14 @@
/* SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv,
* StatefulLspErrorCodeTlv), END-POINT, ERO.
*/
- byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0x64,
+ byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x64,
0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
- 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
+ 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP object
0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
(byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
(byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
- 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
+ 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv
0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
0x07, 0x10, 0x00, 0x14, //ERO object
@@ -202,25 +194,22 @@
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcInitiate",
- (message instanceof PcepInitiateMsg));
+ assertThat(message, sameInstance((PcepInitiateMsg) message));
+
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testInitiateCreationMsg = buf.array();
- int iReadLen = buf.writerIndex() - 0;
+ int iReadLen = buf.writerIndex();
testInitiateCreationMsg = new byte[iReadLen];
buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
- Assert.assertArrayEquals("PcInitiate messages are not equal",
- initiateCreationMsg, testInitiateCreationMsg);
+ assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
}
/**
* This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv),
* END-POINT, ERO objects in PcInitiate message.
- *
- * @throws PcepParseException when message paring fails
*/
@Test
public void initiateMessageTest5() throws PcepParseException {
@@ -228,18 +217,18 @@
/* SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv),
* END-POINT, ERO.
*/
- byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0x5c,
+ byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x5c,
0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
- 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
+ 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
0x20, 0x10, 0x00, 0x24, 0x00, 0x00, 0x10, 0x03, //LSP object
0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
(byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
(byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
- 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
+ 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
0x07, 0x10, 0x00, 0x14, //ERO object
0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00,
- 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00 };
+ 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00};
byte[] testInitiateCreationMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
@@ -250,25 +239,24 @@
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcInitiate",
- (message instanceof PcepInitiateMsg));
+ assertThat(message, sameInstance((PcepInitiateMsg) message));
+
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+
message.writeTo(buf);
+
testInitiateCreationMsg = buf.array();
- int iReadLen = buf.writerIndex() - 0;
+ int iReadLen = buf.writerIndex();
testInitiateCreationMsg = new byte[iReadLen];
buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
- Assert.assertArrayEquals("PcInitiate messages are not equal",
- initiateCreationMsg, testInitiateCreationMsg);
+ assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
}
/**
* This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv),
* END-POINT, ERO objects in PcInitiate message.
- *
- * @throws PcepParseException when message paring fails
*/
@Test
public void initiateMessageTest6() throws PcepParseException {
@@ -276,18 +264,18 @@
/* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv),
* END-POINT, ERO.
*/
- byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0x5c,
+ byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x5c,
0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
- 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
+ 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
0x20, 0x10, 0x00, 0x24, 0x00, 0x00, 0x10, 0x03,
0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
(byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
(byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
- 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
+ 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
0x07, 0x10, 0x00, 0x14, //ERO object
0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00,
- 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00 };
+ 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00};
byte[] testInitiateCreationMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
@@ -296,27 +284,27 @@
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
+
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcInitiate",
- (message instanceof PcepInitiateMsg));
+ assertThat(message, sameInstance((PcepInitiateMsg) message));
+
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+
message.writeTo(buf);
+
testInitiateCreationMsg = buf.array();
- int iReadLen = buf.writerIndex() - 0;
+ int iReadLen = buf.writerIndex();
testInitiateCreationMsg = new byte[iReadLen];
buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
- Assert.assertArrayEquals("PcInitiate messages are not equal",
- initiateCreationMsg, testInitiateCreationMsg);
+ assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
}
/**
* This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv),
* END-POINT, ERO objects in PcInitiate message.
- *
- * @throws PcepParseException when message paring fails
*/
@Test
public void initiateMessageTest7() throws PcepParseException {
@@ -324,9 +312,9 @@
/* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv),
* END-POINT, ERO.
*/
- byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0x54,
+ byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x54,
0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
- 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
+ 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
(byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
@@ -343,27 +331,27 @@
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
+
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcInitiate",
- (message instanceof PcepInitiateMsg));
+ assertThat(message, sameInstance((PcepInitiateMsg) message));
+
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+
message.writeTo(buf);
+
testInitiateCreationMsg = buf.array();
- int iReadLen = buf.writerIndex() - 0;
+ int iReadLen = buf.writerIndex();
testInitiateCreationMsg = new byte[iReadLen];
buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
- Assert.assertArrayEquals("PcInitiate messages are not equal",
- initiateCreationMsg, testInitiateCreationMsg);
+ assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
}
/**
* This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv),
* END-POINT, ERO objects in PcInitiate message.
- *
- * @throws PcepParseException when message paring fails
*/
@Test
public void initiateMessageTest8() throws PcepParseException {
@@ -371,7 +359,7 @@
/* SRP, LSP (StatefulIPv4LspIdentidiersTlv),
* END-POINT, ERO.
*/
- byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0x4c,
+ byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x4c,
0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
@@ -389,27 +377,27 @@
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
+
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcInitiate",
- (message instanceof PcepInitiateMsg));
+ assertThat(message, sameInstance((PcepInitiateMsg) message));
+
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+
message.writeTo(buf);
+
testInitiateCreationMsg = buf.array();
- int iReadLen = buf.writerIndex() - 0;
+ int iReadLen = buf.writerIndex();
testInitiateCreationMsg = new byte[iReadLen];
buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
- Assert.assertArrayEquals("PcInitiate messages are not equal",
- initiateCreationMsg, testInitiateCreationMsg);
+ assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
}
/**
* This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv),
* END-POINT, ERO objects in PcInitiate message.
- *
- * @throws PcepParseException when message paring fails
*/
@Test
public void initiateMessageTest9() throws PcepParseException {
@@ -417,7 +405,7 @@
/* SRP, LSP (StatefulIPv4LspIdentidiersTlv),
* END-POINT, ERO.
*/
- byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0x3c,
+ byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x3c,
0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
@@ -433,34 +421,34 @@
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
+
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcInitiate",
- (message instanceof PcepInitiateMsg));
+ assertThat(message, sameInstance((PcepInitiateMsg) message));
+
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+
message.writeTo(buf);
+
testInitiateCreationMsg = buf.array();
- int iReadLen = buf.writerIndex() - 0;
+ int iReadLen = buf.writerIndex();
testInitiateCreationMsg = new byte[iReadLen];
buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
- Assert.assertArrayEquals("PcInitiate messages are not equal",
- initiateCreationMsg, testInitiateCreationMsg);
+ assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
}
/**
* This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, StatefulRsvpErrorSpecTlv)
* objects in PcInitiate message.
- *
- * @throws PcepParseException when message paring fails
*/
@Test
public void initiateMessageTest10() throws PcepParseException {
/* SRP, LSP (StatefulIPv4LspIdentidiersTlv, StatefulRsvpErrorSpecTlv).
*/
- byte[] initiateDeletionMsg = new byte[] {0x20, 0x0C, 0x00, 0x44,
+ byte[] initiateDeletionMsg = new byte[]{0x20, 0x0C, 0x00, 0x44,
0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, //SRP object
0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathTlv
0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP object
@@ -477,34 +465,34 @@
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
+
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcInitiate",
- (message instanceof PcepInitiateMsg));
+ assertThat(message, sameInstance((PcepInitiateMsg) message));
+
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+
message.writeTo(buf);
+
testInitiateDeletionMsg = buf.array();
- int iReadLen = buf.writerIndex() - 0;
+ int iReadLen = buf.writerIndex();
testInitiateDeletionMsg = new byte[iReadLen];
buf.readBytes(testInitiateDeletionMsg, 0, iReadLen);
- Assert.assertArrayEquals("PcInitiate messages are not equal",
- initiateDeletionMsg, testInitiateDeletionMsg);
+ assertThat(testInitiateDeletionMsg, is(initiateDeletionMsg));
}
/**
* This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv,
* StatefulLspErrorCodeTlv) objects in PcInitiate message.
- *
- * @throws PcepParseException when message paring fails
*/
@Test
public void initiateMessageTest11() throws PcepParseException {
/* SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv,
StatefulLspErrorCodeTlv).*/
- byte[] initiateDeletionMsg = new byte[] {0x20, 0x0C, 0x00, 0x44,
+ byte[] initiateDeletionMsg = new byte[]{0x20, 0x0C, 0x00, 0x44,
0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, //SRP object
0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathTlv
0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP object
@@ -521,35 +509,34 @@
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
+
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcInitiate",
- (message instanceof PcepInitiateMsg));
+ assertThat(message, sameInstance((PcepInitiateMsg) message));
+
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+
message.writeTo(buf);
+
testInitiateDeletionMsg = buf.array();
- int iReadLen = buf.writerIndex() - 0;
+ int iReadLen = buf.writerIndex();
testInitiateDeletionMsg = new byte[iReadLen];
buf.readBytes(testInitiateDeletionMsg, 0, iReadLen);
- Assert.assertArrayEquals("PcInitiate(with R flag set) messages are not equal",
- initiateDeletionMsg, testInitiateDeletionMsg);
-
+ assertThat(testInitiateDeletionMsg, is(initiateDeletionMsg));
}
/**
* This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv)
* objects in PcInitiate message.
- *
- * @throws PcepParseException when message paring fails
*/
@Test
public void initiateMessageTest12() throws PcepParseException {
/* SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv).
*/
- byte[] initiateDeletionMsg = new byte[] {0x20, 0x0C, 0x00, 0x3c,
+ byte[] initiateDeletionMsg = new byte[]{0x20, 0x0C, 0x00, 0x3c,
0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, //SRP object
0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathTlv
0x20, 0x10, 0x00, 0x24, 0x00, 0x00, 0x10, 0x03, 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
@@ -565,40 +552,40 @@
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
+
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcInitiate",
- (message instanceof PcepInitiateMsg));
+ assertThat(message, sameInstance((PcepInitiateMsg) message));
+
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+
message.writeTo(buf);
+
testInitiateDeletionMsg = buf.array();
- int iReadLen = buf.writerIndex() - 0;
+ int iReadLen = buf.writerIndex();
testInitiateDeletionMsg = new byte[iReadLen];
buf.readBytes(testInitiateDeletionMsg, 0, iReadLen);
- Assert.assertArrayEquals("PcInitiate(with R flag set) messages are not equal",
- initiateDeletionMsg, testInitiateDeletionMsg);
+ assertThat(testInitiateDeletionMsg, is(initiateDeletionMsg));
}
/**
* This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv)
* objects in PcInitiate message.
- *
- * @throws PcepParseException when message paring fails
*/
@Test
public void initiateMessageTest13() throws PcepParseException {
/* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv).
*/
- byte[] initiateDeletionMsg = new byte[] {0x20, 0x0C, 0x00, 0x3c,
+ byte[] initiateDeletionMsg = new byte[]{0x20, 0x0C, 0x00, 0x3c,
0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, //SRP object
0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathTlv
0x20, 0x10, 0x00, 0x24, 0x00, 0x00, 0x10, 0x03, 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
(byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
(byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
- 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00 }; //SymbolicPathNameTlv
+ 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00}; //SymbolicPathNameTlv
byte[] testInitiateDeletionMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
@@ -607,40 +594,40 @@
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
+
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcInitiate",
- (message instanceof PcepInitiateMsg));
+ assertThat(message, sameInstance((PcepInitiateMsg) message));
+
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+
message.writeTo(buf);
+
testInitiateDeletionMsg = buf.array();
- int iReadLen = buf.writerIndex() - 0;
+ int iReadLen = buf.writerIndex();
testInitiateDeletionMsg = new byte[iReadLen];
buf.readBytes(testInitiateDeletionMsg, 0, iReadLen);
- Assert.assertArrayEquals("PcInitiate(with R flag set) messages are not equal",
- initiateDeletionMsg, testInitiateDeletionMsg);
+ assertThat(testInitiateDeletionMsg, is(initiateDeletionMsg));
}
/**
* This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv)
* objects in PcInitiate message.
- *
- * @throws PcepParseException when message paring fails
*/
@Test
public void initiateMessageTest14() throws PcepParseException {
/* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv).
*/
- byte[] initiateDeletionMsg = new byte[] {0x20, 0x0C, 0x00, 0x34,
+ byte[] initiateDeletionMsg = new byte[]{0x20, 0x0C, 0x00, 0x34,
0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, //SRP object
0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathTlv
0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
(byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
- (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20 };
+ (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20};
byte[] testInitiateDeletionMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
@@ -649,35 +636,34 @@
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
+
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcInitiate",
- (message instanceof PcepInitiateMsg));
+ assertThat(message, sameInstance((PcepInitiateMsg) message));
+
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+
message.writeTo(buf);
+
testInitiateDeletionMsg = buf.array();
- int iReadLen = buf.writerIndex() - 0;
+ int iReadLen = buf.writerIndex();
testInitiateDeletionMsg = new byte[iReadLen];
buf.readBytes(testInitiateDeletionMsg, 0, iReadLen);
- Assert.assertArrayEquals("PcInitiate(with R flag set) messages are not equal",
- initiateDeletionMsg, testInitiateDeletionMsg);
-
+ assertThat(testInitiateDeletionMsg, is(initiateDeletionMsg));
}
/**
* This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv)
* objects in PcInitiate message.
- *
- * @throws PcepParseException when message paring fails
*/
@Test
public void initiateMessageTest15() throws PcepParseException {
/* SRP, LSP (StatefulIPv4LspIdentidiersTlv).
*/
- byte[] initiateDeletionMsg = new byte[] {0x20, 0x0C, 0x00, 0x2c,
+ byte[] initiateDeletionMsg = new byte[]{0x20, 0x0C, 0x00, 0x2c,
0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, //SRP object
0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
@@ -691,33 +677,33 @@
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
+
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcInitiate",
- (message instanceof PcepInitiateMsg));
+ assertThat(message, sameInstance((PcepInitiateMsg) message));
+
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+
message.writeTo(buf);
+
testInitiateDeletionMsg = buf.array();
- int iReadLen = buf.writerIndex() - 0;
+ int iReadLen = buf.writerIndex();
testInitiateDeletionMsg = new byte[iReadLen];
buf.readBytes(testInitiateDeletionMsg, 0, iReadLen);
- Assert.assertArrayEquals("PcInitiate messages are not equal", initiateDeletionMsg, testInitiateDeletionMsg);
-
+ assertThat(testInitiateDeletionMsg, is(initiateDeletionMsg));
}
/**
* This test case checks for srp,lsp (StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa
* objects in PcInitiate message.
- *
- * @throws PcepParseException when message paring fails
*/
@Test
public void initiateMessageTest16() throws PcepParseException {
//srp,lsp (StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa
- byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0x50,
+ byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x50,
0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
@@ -735,33 +721,33 @@
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
+
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcInitiate",
- (message instanceof PcepInitiateMsg));
+ assertThat(message, sameInstance((PcepInitiateMsg) message));
+
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+
message.writeTo(buf);
+
testInitiateCreationMsg = buf.array();
- int iReadLen = buf.writerIndex() - 0;
+ int iReadLen = buf.writerIndex();
testInitiateCreationMsg = new byte[iReadLen];
buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
- Assert.assertArrayEquals("PcInitiate messages are not equal",
- initiateCreationMsg, testInitiateCreationMsg);
+ assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
}
/**
* This test case checks for srp,lsp (StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth
* objects in PcInitiate message.
- *
- * @throws PcepParseException when message paring fails
*/
@Test
public void initiateMessageTest17() throws PcepParseException {
//srp,lsp (StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth
- byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0x58,
+ byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x58,
0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
@@ -780,32 +766,31 @@
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
+
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcInitiate",
- (message instanceof PcepInitiateMsg));
+ assertThat(message, sameInstance((PcepInitiateMsg) message));
+
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+
message.writeTo(buf);
testInitiateCreationMsg = buf.array();
- int iReadLen = buf.writerIndex() - 0;
+ int iReadLen = buf.writerIndex();
testInitiateCreationMsg = new byte[iReadLen];
buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
- Assert.assertArrayEquals("PcInitiate messages are not equal", initiateCreationMsg, testInitiateCreationMsg);
-
+ assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
}
/**
* This test case checks for srp,lsp (StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth,metric-list
* objects in PcInitiate message.
- *
- * @throws PcepParseException when message paring fails
*/
@Test
public void initiateMessageTest18() throws PcepParseException {
//srp,lsp (StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth,metric-list
- byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0x64,
+ byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x64,
0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
@@ -825,33 +810,32 @@
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
+
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcInitiate",
- (message instanceof PcepInitiateMsg));
+ assertThat(message, sameInstance((PcepInitiateMsg) message));
+
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+
message.writeTo(buf);
+
testInitiateCreationMsg = buf.array();
- int iReadLen = buf.writerIndex() - 0;
+ int iReadLen = buf.writerIndex();
testInitiateCreationMsg = new byte[iReadLen];
buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
- Assert.assertArrayEquals("PcInitiate messages are not equal",
- initiateCreationMsg, testInitiateCreationMsg);
-
+ assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
}
/**
* This test case checks for srp,lsp(all tlvs),end-point,ero,lspa,bandwidth,metric-list
* objects in PcInitiate message.
- *
- * @throws PcepParseException when message paring fails
*/
@Test
public void initiateMessageTest19() throws PcepParseException {
//srp,lsp(all tlvs),end-point,ero,lspa,bandwidth,metric-list
- byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0x74,
+ byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x74,
0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP object
0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
@@ -873,42 +857,42 @@
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
+
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcInitiate",
- (message instanceof PcepInitiateMsg));
+ assertThat(message, sameInstance((PcepInitiateMsg) message));
+
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+
message.writeTo(buf);
+
testInitiateCreationMsg = buf.array();
- int iReadLen = buf.writerIndex() - 0;
+ int iReadLen = buf.writerIndex();
testInitiateCreationMsg = new byte[iReadLen];
buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
- Assert.assertArrayEquals("PcInitiate messages are not equal",
- initiateCreationMsg, testInitiateCreationMsg);
+ assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
}
/**
* This test case checks for srp,lsp (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, srp,
* lsp(SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv) objects in PcInitiate message.
- *
- * @throws PcepParseException when message paring fails
*/
@Test
public void initiateMessageTest20() throws PcepParseException {
/* srp,lsp (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, srp,
* lsp(SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv).
*/
- byte[] initiateDeletionMsg = new byte[] {0x20, 0x0C, 0x00, 0x64,
+ byte[] initiateDeletionMsg = new byte[]{0x20, 0x0C, 0x00, 0x64,
0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, //SRP object
- 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
+ 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
(byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
(byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, //SRP object
- 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
+ 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
(byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
@@ -921,35 +905,34 @@
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
+
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcInitiate",
- (message instanceof PcepInitiateMsg));
+ assertThat(message, sameInstance((PcepInitiateMsg) message));
+
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+
message.writeTo(buf);
+
testInitiateDeletionMsg = buf.array();
- int iReadLen = buf.writerIndex() - 0;
+ int iReadLen = buf.writerIndex();
testInitiateDeletionMsg = new byte[iReadLen];
buf.readBytes(testInitiateDeletionMsg, 0, iReadLen);
- Assert.assertArrayEquals("PcInitiate messages are not equal",
- initiateDeletionMsg, testInitiateDeletionMsg);
-
+ assertThat(testInitiateDeletionMsg, is(initiateDeletionMsg));
}
/**
* This test case checks for srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero
* objects in PcInitiate message.
- *
- * @throws PcepParseException when message paring fails
*/
@Test
public void initiateMessageTest21() throws PcepParseException {
/*srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,
* srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero
*/
- byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0x94,
+ byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x94,
0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
@@ -976,35 +959,34 @@
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
+
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcInitiate",
- (message instanceof PcepInitiateMsg));
+ assertThat(message, sameInstance((PcepInitiateMsg) message));
+
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+
message.writeTo(buf);
+
testInitiateCreationMsg = buf.array();
- int iReadLen = buf.writerIndex() - 0;
+ int iReadLen = buf.writerIndex();
testInitiateCreationMsg = new byte[iReadLen];
buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
- Assert.assertArrayEquals("PcInitiate messages are not equal",
- initiateCreationMsg, testInitiateCreationMsg);
-
+ assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
}
/**
* This test case checks for srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa
* objects in PcInitiate message.
- *
- * @throws PcepParseException when message paring fails
*/
@Test
public void initiateMessageTest22() throws PcepParseException {
/*srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,
* srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa
*/
- byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0xA8,
+ byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0xA8,
0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
@@ -1032,34 +1014,34 @@
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
+
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcInitiate",
- (message instanceof PcepInitiateMsg));
+ assertThat(message, sameInstance((PcepInitiateMsg) message));
+
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+
message.writeTo(buf);
+
testInitiateCreationMsg = buf.array();
- int iReadLen = buf.writerIndex() - 0;
+ int iReadLen = buf.writerIndex();
testInitiateCreationMsg = new byte[iReadLen];
buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
- Assert.assertArrayEquals("PcInitiate messages are not equal", initiateCreationMsg, testInitiateCreationMsg);
-
+ assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
}
/**
* This test case checks for srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth
* objects in PcInitiate message.
- *
- * @throws PcepParseException when message paring fails
*/
@Test
public void initiateMessageTest23() throws PcepParseException {
/*srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,
* srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth
*/
- byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0xB0,
+ byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0xB0,
0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
@@ -1089,33 +1071,33 @@
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
+
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcInitiate",
- (message instanceof PcepInitiateMsg));
+ assertThat(message, sameInstance((PcepInitiateMsg) message));
+
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+
message.writeTo(buf);
+
testInitiateCreationMsg = buf.array();
- int iReadLen = buf.writerIndex() - 0;
+ int iReadLen = buf.writerIndex();
testInitiateCreationMsg = new byte[iReadLen];
buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
- Assert.assertArrayEquals("PcInitiate messages are not equal",
- initiateCreationMsg, testInitiateCreationMsg);
+ assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
}
/**
* This test case checks for srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth
* objects in PcInitiate message.
- *
- * @throws PcepParseException when message paring fails
*/
@Test
public void initiateMessageTest24() throws PcepParseException {
/*srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,
* srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth*/
- byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0xBC,
+ byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0xBC,
0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
@@ -1146,27 +1128,28 @@
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
+
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcInitiate",
- (message instanceof PcepInitiateMsg));
+ assertThat(message, sameInstance((PcepInitiateMsg) message));
+
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+
message.writeTo(buf);
+
testInitiateCreationMsg = buf.array();
- int iReadLen = buf.writerIndex() - 0;
+ int iReadLen = buf.writerIndex();
testInitiateCreationMsg = new byte[iReadLen];
buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
- Assert.assertArrayEquals("PcInitiate messages are not equal", initiateCreationMsg, testInitiateCreationMsg);
+ assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
}
/**
* This test case checks for srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,bandwidth,
* srp,lsp(StatefulIPv4LspIdentidiersTlv), end-point,ero,lspa,bandwidth,metric-list
* objects in PcInitiate message.
- *
- * @throws PcepParseException when message paring fails
*/
@Test
public void initiateMessageTest25() throws PcepParseException {
@@ -1174,7 +1157,7 @@
/*srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,bandwidth,
* srp,lsp(StatefulIPv4LspIdentidiersTlv),
* end-point,ero,lspa,bandwidth,metric-list */
- byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0xC4,
+ byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0xC4,
0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
@@ -1206,29 +1189,28 @@
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
+
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcInitiate",
- (message instanceof PcepInitiateMsg));
+ assertThat(message, sameInstance((PcepInitiateMsg) message));
+
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+
message.writeTo(buf);
+
testInitiateCreationMsg = buf.array();
- int iReadLen = buf.writerIndex() - 0;
+ int iReadLen = buf.writerIndex();
testInitiateCreationMsg = new byte[iReadLen];
buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
- Assert.assertArrayEquals("PcInitiate messages are not equal",
- initiateCreationMsg, testInitiateCreationMsg);
-
+ assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
}
/**
* This test case checks for srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,bandwidth,metric-list,
* srp,lsp(StatefulIPv4LspIdentidiersTlv), end-point,ero,lspa,bandwidth,metric-list
* objects in PcInitiate message.
- *
- * @throws PcepParseException when message paring fails
*/
@Test
public void initiateMessageTest26() throws PcepParseException {
@@ -1236,7 +1218,7 @@
/*srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,bandwidth,metric-list,
* srp,lsp(StatefulIPv4LspIdentidiersTlv),
* end-point,ero,lspa,bandwidth,metric-list */
- byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0xD0,
+ byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0xD0,
0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
@@ -1269,29 +1251,28 @@
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
+
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcInitiate",
- (message instanceof PcepInitiateMsg));
+ assertThat(message, sameInstance((PcepInitiateMsg) message));
+
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+
message.writeTo(buf);
+
testInitiateCreationMsg = buf.array();
- int iReadLen = buf.writerIndex() - 0;
+ int iReadLen = buf.writerIndex();
testInitiateCreationMsg = new byte[iReadLen];
buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
- Assert.assertArrayEquals("PcInitiate messages are not equal",
- initiateCreationMsg, testInitiateCreationMsg);
-
+ assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
}
/**
* This test case checks for srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth,metric-list,
* srp,lsp(StatefulIPv4LspIdentidiersTlv), end-point,ero,lspa,bandwidth,metric-list
* objects in PcInitiate message.
- *
- * @throws PcepParseException when message paring fails
*/
@Test
public void initiateMessageTest27() throws PcepParseException {
@@ -1299,7 +1280,7 @@
/*srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth,metric-list,
* srp,lsp(StatefulIPv4LspIdentidiersTlv),
* end-point,ero,lspa,bandwidth,metric-list */
- byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0xE4,
+ byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0xE4,
0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
@@ -1334,19 +1315,21 @@
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
+
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcInitiate",
- (message instanceof PcepInitiateMsg));
+ assertThat(message, sameInstance((PcepInitiateMsg) message));
+
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+
message.writeTo(buf);
+
testInitiateCreationMsg = buf.array();
- int iReadLen = buf.writerIndex() - 0;
+ int iReadLen = buf.writerIndex();
testInitiateCreationMsg = new byte[iReadLen];
buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
- Assert.assertArrayEquals("PcInitiate messages are not equal",
- initiateCreationMsg, testInitiateCreationMsg);
+ assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
}
-}
\ No newline at end of file
+}
diff --git a/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepInitiateMsgTest2.java b/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepInitiateMsgTest2.java
index 570c871..088a73c 100644
--- a/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepInitiateMsgTest2.java
+++ b/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepInitiateMsgTest2.java
@@ -24,19 +24,17 @@
import org.onosproject.pcepio.protocol.PcepInitiateMsg;
import org.onosproject.pcepio.protocol.PcepMessage;
import org.onosproject.pcepio.protocol.PcepMessageReader;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+import static org.hamcrest.core.IsSame.sameInstance;
public class PcepInitiateMsgTest2 {
- protected static final Logger log = LoggerFactory.getLogger(PcepInitiateMsgTest.class);
-
/**
* This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv,
* SymbolicPathNameTlv, StatefulLspDbVerTlv, StatefulLspErrorCodeTlv, StatefulRsvpErrorSpecTlv),
* END-POINTS, ERO, LSPA, BANDWIDTH, METRIC-LIST objects in PcInitiate message.
- *
- * @throws PcepParseException when message paring fails
*/
@Test
public void initiateMessageTest1() throws PcepParseException {
@@ -44,9 +42,9 @@
/* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, StatefulLspDbVerTlv,
* StatefulLspErrorCodeTlv, StatefulRsvpErrorSpecTlv), END-POINTS, ERO, LSPA, BANDWIDTH, METRIC-LIST.
*/
- byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0xA4,
+ byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0xA4,
0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
- 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
+ 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
0x20, 0x10, 0x00, 0x38, 0x00, 0x00, 0x10, 0x03,
0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
(byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
@@ -62,7 +60,7 @@
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
0x05, 0x20, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, //Bandwidth object
0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, //Metric object
- 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object
+ 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20}; //Metric object
byte[] testInitiateCreationMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
@@ -71,19 +69,21 @@
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
+
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg));
+ assertThat(message, sameInstance((PcepInitiateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+
message.writeTo(buf);
+
testInitiateCreationMsg = buf.array();
- int iReadLen = buf.writerIndex() - 0;
+ int iReadLen = buf.writerIndex();
testInitiateCreationMsg = new byte[iReadLen];
buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
- Assert.assertArrayEquals("PcInitiate messages are not equal", initiateCreationMsg, testInitiateCreationMsg);
-
+ assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
}
/**
@@ -91,8 +91,6 @@
* SymbolicPathNameTlv, StatefulLspDbVerTlv, StatefulLspErrorCodeTlv,
* StatefulRsvpErrorSpecTlv), END-POINTS, ERO, LSPA, BANDWIDTH, METRIC OBJECT
* objects in PcInitiate message.
- *
- * @throws PcepParseException when message paring fails
*/
@Test
public void initiateMessageTest2() throws PcepParseException {
@@ -100,9 +98,9 @@
/* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, StatefulLspDbVerTlv,
* StatefulLspErrorCodeTlv, StatefulRsvpErrorSpecTlv), END-POINTS, ERO, LSPA, BANDWIDTH, METRIC OBJECT.
*/
- byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0x98,
+ byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x98,
0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
- 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
+ 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
0x20, 0x10, 0x00, 0x38, 0x00, 0x00, 0x10, 0x03, //LSP object
0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
(byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
@@ -119,7 +117,7 @@
0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
0x05, 0x20, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00,
- 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01 };
+ 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01};
byte[] testInitiateCreationMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
@@ -128,27 +126,27 @@
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
+
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg));
+ assertThat(message, sameInstance((PcepInitiateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+
message.writeTo(buf);
+
testInitiateCreationMsg = buf.array();
- int iReadLen = buf.writerIndex() - 0;
+ int iReadLen = buf.writerIndex();
testInitiateCreationMsg = new byte[iReadLen];
buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
- Assert.assertArrayEquals("PcInitiate messages are not equal",
- initiateCreationMsg, testInitiateCreationMsg);
+ assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
}
/**
* This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv,
* StatefulLspDbVerTlv, StatefulLspErrorCodeTlv, StatefulRsvpErrorSpecTlv), END-POINTS,
* ERO, LSPA, BANDWIDTH objects in PcInitiate message.
- *
- * @throws PcepParseException when message paring fails
*/
@Test
public void initiateMessageTest3() throws PcepParseException {
@@ -156,9 +154,9 @@
/* SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, StatefulLspDbVerTlv,
* StatefulLspErrorCodeTlv, StatefulRsvpErrorSpecTlv), END-POINTS, ERO, LSPA, BANDWIDTH.
*/
- byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0x8c,
+ byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x8c,
0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
- 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
+ 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
0x20, 0x10, 0x00, 0x38, 0x00, 0x00, 0x10, 0x03, //LSP object
0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
(byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
@@ -174,7 +172,7 @@
0x01, 0x01, 0x00, 0x00, (byte) 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
- 0x05, 0x20, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00 };
+ 0x05, 0x20, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00};
byte[] testInitiateCreationMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
@@ -183,26 +181,27 @@
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
+
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg));
+ assertThat(message, sameInstance((PcepInitiateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+
message.writeTo(buf);
+
testInitiateCreationMsg = buf.array();
- int iReadLen = buf.writerIndex() - 0;
+ int iReadLen = buf.writerIndex();
testInitiateCreationMsg = new byte[iReadLen];
buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
- Assert.assertArrayEquals("PcInitiate messages are not equal", initiateCreationMsg, testInitiateCreationMsg);
+ assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
}
/**
* This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv,
* SymbolicPathNameTlv, StatefulLspDbVerTlv, StatefulLspErrorCodeTlv, StatefulRsvpErrorSpecTlv),
* END-POINTS, ERO, LSPA objects in PcInitiate message.
- *
- * @throws PcepParseException when message paring fails
*/
@Test
public void initiateMessageTest4() throws PcepParseException {
@@ -210,9 +209,9 @@
/* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, StatefulLspDbVerTlv,
* StatefulLspErrorCodeTlv, StatefulRsvpErrorSpecTlv), END-POINTS, ERO, LSPA.
*/
- byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0x84,
+ byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x84,
0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
- 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
+ 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
0x20, 0x10, 0x00, 0x38, 0x00, 0x00, 0x10, 0x03, //LSP object
0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
(byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
@@ -227,7 +226,7 @@
0x07, 0x10, 0x00, 0x14, (byte) 0x01, 0x08, 0x0C, 0x01, //ERO object
0x01, 0x01, 0x00, 0x00, (byte) 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00 };
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00};
byte[] testInitiateCreationMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
@@ -236,26 +235,27 @@
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
+
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg));
+ assertThat(message, sameInstance((PcepInitiateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+
message.writeTo(buf);
+
testInitiateCreationMsg = buf.array();
- int iReadLen = buf.writerIndex() - 0;
+ int iReadLen = buf.writerIndex();
testInitiateCreationMsg = new byte[iReadLen];
buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
- Assert.assertArrayEquals("PcInitiate messages are not equal", initiateCreationMsg, testInitiateCreationMsg);
+ assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
}
/**
* This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv,
* SymbolicPathNameTlv, StatefulLspDbVerTlv, StatefulLspErrorCodeTlv), END-POINTS, ERO, LSPA
* objects in PcInitiate message.
- *
- * @throws PcepParseException when message paring fails
*/
@Test
public void initiateMessageTest5() throws PcepParseException {
@@ -263,9 +263,9 @@
/* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, StatefulLspDbVerTlv,
* StatefulLspErrorCodeTlv), END-POINTS, ERO, LSPA.
*/
- byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0x84,
+ byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x84,
0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
- 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
+ 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
0x20, 0x10, 0x00, 0x38, 0x00, 0x00, 0x10, 0x03, //LSP object
0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
(byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
@@ -278,7 +278,7 @@
0x07, 0x10, 0x00, 0x14, (byte) 0x01, 0x08, 0x0C, 0x01, //ERO object
0x01, 0x01, 0x00, 0x00, (byte) 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00 };
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00};
byte[] testInitiateCreationMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
@@ -287,29 +287,28 @@
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
+
message = reader.readFrom(buffer);
Assert.assertTrue("PcepMessage is not instance of PcInitiate",
(message instanceof PcepInitiateMsg));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+
message.writeTo(buf);
+
testInitiateCreationMsg = buf.array();
- int iReadLen = buf.writerIndex() - 0;
+ int iReadLen = buf.writerIndex();
testInitiateCreationMsg = new byte[iReadLen];
buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
- Assert.assertArrayEquals("PcInitiate messages are not equal",
- initiateCreationMsg, testInitiateCreationMsg);
-
+ assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
}
/**
* This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv,
* SymbolicPathNameTlv, StatefulLspDbVerTlv, StatefulLspErrorCodeTlv), END-POINTS, ERO, LSPA,
* BANDWIDTH OBJECT objects in PcInitiate message.
- *
- * @throws PcepParseException when message paring fails
*/
@Test
public void initiateMessageTest6() throws PcepParseException {
@@ -317,9 +316,9 @@
/* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, StatefulLspDbVerTlv,
* StatefulLspErrorCodeTlv), END-POINTS, ERO, LSPA, BANDWIDTH OBJECT.
*/
- byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0x8c,
+ byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x8c,
0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
- 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
+ 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
0x20, 0x10, 0x00, 0x38, 0x00, 0x00, 0x10, 0x03, //LSP object
0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
(byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
@@ -333,7 +332,7 @@
0x01, 0x01, 0x00, 0x00, (byte) 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
- 0x05, 0x20, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00 };
+ 0x05, 0x20, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00};
byte[] testInitiateCreationMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
@@ -342,27 +341,27 @@
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
+
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg));
+ assertThat(message, sameInstance((PcepInitiateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+
message.writeTo(buf);
+
testInitiateCreationMsg = buf.array();
- int iReadLen = buf.writerIndex() - 0;
+ int iReadLen = buf.writerIndex();
testInitiateCreationMsg = new byte[iReadLen];
buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
- Assert.assertArrayEquals("PcInitiate messages are not equal", initiateCreationMsg, testInitiateCreationMsg);
-
+ assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
}
/**
* This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv,
* SymbolicPathNameTlv, StatefulLspDbVerTlv, StatefulLspErrorCodeTlv), END-POINTS, ERO,
* LSPA, BANDWIDTH, METRIC OBJECT objects in PcInitiate message.
- *
- * @throws PcepParseException when message paring fails
*/
@Test
public void initiateMessageTest7() throws PcepParseException {
@@ -370,9 +369,9 @@
/* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, StatefulLspDbVerTlv,
* StatefulLspErrorCodeTlv), END-POINTS, ERO, LSPA, BANDWIDTH, METRIC OBJECT.
*/
- byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0x98,
+ byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x98,
0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
- 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
+ 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
0x20, 0x10, 0x00, 0x38, 0x00, 0x00, 0x10, 0x03, //LSP object
0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
(byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
@@ -387,7 +386,7 @@
0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
0x05, 0x20, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00,
- 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01 };
+ 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01};
byte[] testInitiateCreationMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
@@ -396,27 +395,27 @@
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
+
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg));
+ assertThat(message, sameInstance((PcepInitiateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+
message.writeTo(buf);
+
testInitiateCreationMsg = buf.array();
- int iReadLen = buf.writerIndex() - 0;
+ int iReadLen = buf.writerIndex();
testInitiateCreationMsg = new byte[iReadLen];
buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
- Assert.assertArrayEquals("PcInitiate messages are not equal", initiateCreationMsg, testInitiateCreationMsg);
-
+ assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
}
/**
* This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv,
* SymbolicPathNameTlv, StatefulLspDbVerTlv), END-POINTS, ERO, LSPA, BANDWIDTH, METRIC OBJECT
* objects in PcInitiate message.
- *
- * @throws PcepParseException when message paring fails
*/
@Test
public void initiateMessageTest8() throws PcepParseException {
@@ -424,9 +423,9 @@
/* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, StatefulLspDbVerTlv),
* END-POINTS, ERO, LSPA, BANDWIDTH, METRIC OBJECT.
*/
- byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0x90,
+ byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x90,
0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
- 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
+ 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
0x20, 0x10, 0x00, 0x30, 0x00, 0x00, 0x10, 0x03, //LSP object
0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
(byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
@@ -440,7 +439,7 @@
0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
0x05, 0x20, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00,
- 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01 };
+ 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01};
byte[] testInitiateCreationMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
@@ -449,28 +448,27 @@
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
+
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg));
+ assertThat(message, sameInstance((PcepInitiateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+
message.writeTo(buf);
+
testInitiateCreationMsg = buf.array();
- int iReadLen = buf.writerIndex() - 0;
+ int iReadLen = buf.writerIndex();
testInitiateCreationMsg = new byte[iReadLen];
buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
- Assert.assertArrayEquals("PcInitiate messages are not equal",
- initiateCreationMsg, testInitiateCreationMsg);
-
+ assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
}
/**
* This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv,
* SymbolicPathNameTlv, StatefulLspDbVerTlv), END-POINTS, ERO, LSPA, BANDWIDTH OBJECT
* objects in PcInitiate message.
- *
- * @throws PcepParseException when message paring fails
*/
@Test
public void initiateMessageTest9() throws PcepParseException {
@@ -478,9 +476,9 @@
/* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, StatefulLspDbVerTlv),
* END-POINTS, ERO, LSPA, BANDWIDTH OBJECT.
*/
- byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0x84,
+ byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x84,
0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
- 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
+ 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
0x20, 0x10, 0x00, 0x30, 0x00, 0x00, 0x10, 0x03, //LSP object
0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
(byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
@@ -493,7 +491,7 @@
0x01, 0x01, 0x00, 0x00, (byte) 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
- 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00 }; //Bandwidth object
+ 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00}; //Bandwidth object
byte[] testInitiateCreationMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
@@ -502,26 +500,26 @@
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
+
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg));
+ assertThat(message, sameInstance((PcepInitiateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+
message.writeTo(buf);
+
testInitiateCreationMsg = buf.array();
- int iReadLen = buf.writerIndex() - 0;
+ int iReadLen = buf.writerIndex();
testInitiateCreationMsg = new byte[iReadLen];
buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
- Assert.assertArrayEquals("PcInitiate messages are not equal", initiateCreationMsg, testInitiateCreationMsg);
-
+ assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
}
/**
* This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv,
* SymbolicPathNameTlv), END-POINTS, ERO, LSPA OBJECT objects in PcInitiate message.
- *
- * @throws PcepParseException when message paring fails
*/
@Test
public void initiateMessageTest10() throws PcepParseException {
@@ -529,9 +527,9 @@
/* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv),
* END-POINTS, ERO, LSPA OBJECT.
*/
- byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0x70,
+ byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x70,
0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
- 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
+ 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
0x20, 0x10, 0x00, 0x24, 0x00, 0x00, 0x10, 0x03,
0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
(byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
@@ -541,7 +539,7 @@
0x07, 0x10, 0x00, 0x14, (byte) 0x01, 0x08, 0x0C, 0x01, //ERO object
0x01, 0x01, 0x00, 0x00, (byte) 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00 };
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00};
byte[] testInitiateCreationMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
@@ -550,26 +548,27 @@
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
+
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg));
+ assertThat(message, sameInstance((PcepInitiateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+
message.writeTo(buf);
+
testInitiateCreationMsg = buf.array();
- int iReadLen = buf.writerIndex() - 0;
+ int iReadLen = buf.writerIndex();
testInitiateCreationMsg = new byte[iReadLen];
buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
- Assert.assertArrayEquals("PcInitiate messages are not equal", initiateCreationMsg, testInitiateCreationMsg);
+ assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
}
/**
* This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv,
* SymbolicPathNameTlv, StatefulLspDbVerTlv), END-POINTS, ERO, LSPA OBJECT
* objects in PcInitiate message.
- *
- * @throws PcepParseException when message paring fails
*/
@Test
public void initiateMessageTest11() throws PcepParseException {
@@ -577,9 +576,9 @@
/* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, StatefulLspDbVerTlv),
* END-POINTS, ERO, LSPA OBJECT.
*/
- byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0x7C,
+ byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x7C,
0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
- 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
+ 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
0x20, 0x10, 0x00, 0x30, 0x00, 0x00, 0x10, 0x03,
0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
(byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
@@ -591,7 +590,7 @@
0x07, 0x10, 0x00, 0x14, (byte) 0x01, 0x08, 0x0C, 0x01, //ERO object
0x01, 0x01, 0x00, 0x00, (byte) 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00 };
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00};
byte[] testInitiateCreationMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
@@ -600,26 +599,25 @@
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
+
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg));
+ assertThat(message, sameInstance((PcepInitiateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+
message.writeTo(buf);
- int iReadLen = buf.writerIndex() - 0;
+ int iReadLen = buf.writerIndex();
testInitiateCreationMsg = new byte[iReadLen];
buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
- Assert.assertArrayEquals("PcInitiate messages are not equal",
- initiateCreationMsg, testInitiateCreationMsg);
+ assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
}
/**
* This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv,
* SymbolicPathNameTlv), END-POINTS, ERO, LSPA, BANDWIDTH OBJECT
* objects in PcInitiate message.
- *
- * @throws PcepParseException when message paring fails
*/
@Test
public void initiateMessageTest12() throws PcepParseException {
@@ -627,9 +625,9 @@
/* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv),
* END-POINTS, ERO, LSPA, BANDWIDTH OBJECT.
*/
- byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0x78,
+ byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x78,
0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
- 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
+ 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
0x20, 0x10, 0x00, 0x24, 0x00, 0x00, 0x10, 0x03,
0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
(byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
@@ -640,7 +638,7 @@
0x01, 0x01, 0x00, 0x00, (byte) 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
- 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00 }; //Bandwidth object
+ 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00}; //Bandwidth object
byte[] testInitiateCreationMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
@@ -649,27 +647,27 @@
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
+
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg));
+ assertThat(message, sameInstance((PcepInitiateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+
message.writeTo(buf);
+
testInitiateCreationMsg = buf.array();
- int iReadLen = buf.writerIndex() - 0;
+ int iReadLen = buf.writerIndex();
testInitiateCreationMsg = new byte[iReadLen];
buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
- Assert.assertArrayEquals("PcInitiate messages are not equal",
- initiateCreationMsg, testInitiateCreationMsg);
+ assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
}
/**
* This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv,
* SymbolicPathNameTlv, StatefulLspDbVerTlv), END-POINTS, ERO, LSPA, BANDWIDTH , METRIC OBJECT
* objects in PcInitiate message.
- *
- * @throws PcepParseException when message paring fails
*/
@Test
public void initiateMessageTest13() throws PcepParseException {
@@ -677,9 +675,9 @@
/* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, StatefulLspDbVerTlv),
* END-POINTS, ERO, LSPA, BANDWIDTH , METRIC OBJECT.
*/
- byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0x84,
+ byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x84,
0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
- 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
+ 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
0x20, 0x10, 0x00, 0x24, 0x00, 0x00, 0x10, 0x03,
0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
(byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
@@ -691,7 +689,7 @@
0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object
- 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01 };
+ 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01};
byte[] testInitiateCreationMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
@@ -700,26 +698,26 @@
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
+
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg));
+ assertThat(message, sameInstance((PcepInitiateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+
message.writeTo(buf);
+
testInitiateCreationMsg = buf.array();
- int iReadLen = buf.writerIndex() - 0;
+ int iReadLen = buf.writerIndex();
testInitiateCreationMsg = new byte[iReadLen];
buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
- Assert.assertArrayEquals("PcInitiate messages are not equal",
- initiateCreationMsg, testInitiateCreationMsg);
+ assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
}
/**
* This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv),
* END-POINTS, ERO, LSPA, BANDWIDTH , METRIC OBJECT objects in PcInitiate message.
- *
- * @throws PcepParseException when message paring fails
*/
@Test
public void initiateMessageTest14() throws PcepParseException {
@@ -727,9 +725,9 @@
/* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv),
* END-POINTS, ERO, LSPA, BANDWIDTH , METRIC OBJECT.
*/
- byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0x7c,
+ byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x7c,
0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
- 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
+ 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
(byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
@@ -740,7 +738,7 @@
0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object
- 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01 };
+ 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01};
byte[] testInitiateCreationMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
@@ -749,26 +747,26 @@
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
+
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg));
+ assertThat(message, sameInstance((PcepInitiateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+
message.writeTo(buf);
+
testInitiateCreationMsg = buf.array();
- int iReadLen = buf.writerIndex() - 0;
+ int iReadLen = buf.writerIndex();
testInitiateCreationMsg = new byte[iReadLen];
buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
- Assert.assertArrayEquals("PcInitiate messages are not equal",
- initiateCreationMsg, testInitiateCreationMsg);
+ assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
}
/**
* This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv),
* END-POINTS, ERO, LSPA, BANDWIDTH OBJECT objects in PcInitiate message.
- *
- * @throws PcepParseException when message paring fails
*/
@Test
public void initiateMessageTest15() throws PcepParseException {
@@ -776,9 +774,9 @@
/* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv),
* END-POINTS, ERO, LSPA, BANDWIDTH OBJECT.
*/
- byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0x70,
+ byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x70,
0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
- 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
+ 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
(byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
@@ -788,7 +786,7 @@
0x01, 0x01, 0x00, 0x00, (byte) 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
- 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00 }; //Bandwidth object
+ 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00}; //Bandwidth object
byte[] testInitiateCreationMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
@@ -797,26 +795,26 @@
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
+
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg));
+ assertThat(message, sameInstance((PcepInitiateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+
message.writeTo(buf);
+
testInitiateCreationMsg = buf.array();
- int iReadLen = buf.writerIndex() - 0;
+ int iReadLen = buf.writerIndex();
testInitiateCreationMsg = new byte[iReadLen];
buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
- Assert.assertArrayEquals("PcInitiate messages are not equal",
- initiateCreationMsg, testInitiateCreationMsg);
+ assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
}
/**
* This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv),
* END-POINTS, ERO, LSPA OBJECT objects in PcInitiate message.
- *
- * @throws PcepParseException when message paring fails
*/
@Test
public void initiateMessageTest16() throws PcepParseException {
@@ -824,9 +822,9 @@
/* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv),
* END-POINTS, ERO, LSPA OBJECT.
*/
- byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0x68,
+ byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x68,
0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
- 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
+ 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
(byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
@@ -835,7 +833,7 @@
0x07, 0x10, 0x00, 0x14, (byte) 0x01, 0x08, 0x0C, 0x01, //ERO object
0x01, 0x01, 0x00, 0x00, (byte) 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00 };
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00};
byte[] testInitiateCreationMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
@@ -844,33 +842,33 @@
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
+
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg));
+ assertThat(message, sameInstance((PcepInitiateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+
message.writeTo(buf);
+
testInitiateCreationMsg = buf.array();
- int iReadLen = buf.writerIndex() - 0;
+ int iReadLen = buf.writerIndex();
testInitiateCreationMsg = new byte[iReadLen];
buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
- Assert.assertArrayEquals("PcInitiate messages are not equal",
- initiateCreationMsg, testInitiateCreationMsg);
+ assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
}
/**
* This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO, LSPA OBJECT
* objects in PcInitiate message.
- *
- * @throws PcepParseException when message paring fails
*/
@Test
public void initiateMessageTest17() throws PcepParseException {
/* SRP, LSP (StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO, LSPA OBJECT.
*/
- byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0x5c,
+ byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x5c,
0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
@@ -880,7 +878,7 @@
0x07, 0x10, 0x00, 0x14, (byte) 0x01, 0x08, 0x0C, 0x01, //ERO object
0x01, 0x01, 0x00, 0x00, (byte) 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00 };
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00};
byte[] testInitiateCreationMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
@@ -889,33 +887,33 @@
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
+
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg));
+ assertThat(message, sameInstance((PcepInitiateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+
message.writeTo(buf);
+
testInitiateCreationMsg = buf.array();
- int iReadLen = buf.writerIndex() - 0;
+ int iReadLen = buf.writerIndex();
testInitiateCreationMsg = new byte[iReadLen];
buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
- Assert.assertArrayEquals("PcInitiate messages are not equal",
- initiateCreationMsg, testInitiateCreationMsg);
+ assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
}
/**
* This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO, LSPA,
* BANDWIDTH OBJECT objects in PcInitiate message.
- *
- * @throws PcepParseException when message paring fails
*/
@Test
public void initiateMessageTest18() throws PcepParseException {
/* SRP, LSP (StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO, LSPA, BANDWIDTH OBJECT.
*/
- byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0x64,
+ byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x64,
0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, (byte) 0x83,
0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
@@ -926,7 +924,7 @@
0x01, 0x01, 0x00, 0x00, (byte) 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
- 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00 }; //Bandwidth object
+ 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00}; //Bandwidth object
byte[] testInitiateCreationMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
@@ -935,33 +933,33 @@
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
+
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg));
+ assertThat(message, sameInstance((PcepInitiateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+
message.writeTo(buf);
+
testInitiateCreationMsg = buf.array();
- int iReadLen = buf.writerIndex() - 0;
+ int iReadLen = buf.writerIndex();
testInitiateCreationMsg = new byte[iReadLen];
buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
- Assert.assertArrayEquals("PcInitiate messages are not equal",
- initiateCreationMsg, testInitiateCreationMsg);
+ assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
}
/**
* This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO, LSPA,
* BANDWIDTH, METRIC OBJECT objects in PcInitiate message.
- *
- * @throws PcepParseException when message paring fails
*/
@Test
public void initiateMessageTest19() throws PcepParseException {
/* SRP, LSP (StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO, LSPA, BANDWIDTH, METRIC OBJECT.
*/
- byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0x70,
+ byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x70,
0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
@@ -973,7 +971,7 @@
0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object
- 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01 };
+ 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01};
byte[] testInitiateCreationMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
@@ -982,32 +980,33 @@
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
+
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg));
+ assertThat(message, sameInstance((PcepInitiateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+
message.writeTo(buf);
+
testInitiateCreationMsg = buf.array();
- int iReadLen = buf.writerIndex() - 0;
+ int iReadLen = buf.writerIndex();
testInitiateCreationMsg = new byte[iReadLen];
buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
- Assert.assertArrayEquals("PcInitiate messages are not equal", initiateCreationMsg, testInitiateCreationMsg);
+ assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
}
/**
* This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO, LSPA,
* BANDWIDTH, METRIC OBJECT objects in PcInitiate message.
- *
- * @throws PcepParseException when message paring fails
*/
@Test
public void initiateMessageTest20() throws PcepParseException {
/* SRP, LSP (StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO, LSPA, BANDWIDTH, METRIC OBJECT.
*/
- byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0x60,
+ byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x60,
0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
@@ -1018,7 +1017,7 @@
0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object
- 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01 };
+ 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01};
byte[] testInitiateCreationMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
@@ -1027,33 +1026,33 @@
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
+
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg));
+ assertThat(message, sameInstance((PcepInitiateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+
message.writeTo(buf);
+
testInitiateCreationMsg = buf.array();
- int iReadLen = buf.writerIndex() - 0;
+ int iReadLen = buf.writerIndex();
testInitiateCreationMsg = new byte[iReadLen];
buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
- Assert.assertArrayEquals("PcInitiate messages are not equal",
- initiateCreationMsg, testInitiateCreationMsg);
+ assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
}
/**
* This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO, LSPA,
* BANDWIDTH OBJECT objects in PcInitiate message.
- *
- * @throws PcepParseException when message paring fails
*/
@Test
public void initiateMessageTest21() throws PcepParseException {
/* SRP, LSP (StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO, LSPA, BANDWIDTH OBJECT.
*/
- byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0x54,
+ byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x54,
0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
@@ -1063,7 +1062,7 @@
0x07, 0x10, 0x00, 0x04,
0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
- 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00 }; //Bandwidth object
+ 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00}; //Bandwidth object
byte[] testInitiateCreationMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
@@ -1072,32 +1071,33 @@
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
+
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg));
+ assertThat(message, sameInstance((PcepInitiateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+
message.writeTo(buf);
+
testInitiateCreationMsg = buf.array();
- int iReadLen = buf.writerIndex() - 0;
+ int iReadLen = buf.writerIndex();
testInitiateCreationMsg = new byte[iReadLen];
buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
- Assert.assertArrayEquals("PcInitiate messages are not equal", initiateCreationMsg, testInitiateCreationMsg);
+ assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
}
/**
* This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO,
* LSPA OBJECT objects in PcInitiate message.
- *
- * @throws PcepParseException when message paring fails
*/
@Test
public void initiateMessageTest22() throws PcepParseException {
/* SRP, LSP (StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO, LSPA OBJECT.
*/
- byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0x4c,
+ byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x4c,
0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
@@ -1106,7 +1106,7 @@
0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
0x07, 0x10, 0x00, 0x04, //ERO object
0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00 };
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00};
byte[] testInitiateCreationMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
@@ -1115,35 +1115,35 @@
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
+
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg));
+ assertThat(message, sameInstance((PcepInitiateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+
message.writeTo(buf);
+
testInitiateCreationMsg = buf.array();
- int iReadLen = buf.writerIndex() - 0;
+ int iReadLen = buf.writerIndex();
testInitiateCreationMsg = new byte[iReadLen];
buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
- Assert.assertArrayEquals("PcInitiate messages are not equal",
- initiateCreationMsg, testInitiateCreationMsg);
+ assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
}
/**
* This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv),
* END-POINTS, ERO, LSPA OBJECT objects in PcInitiate message.
- *
- * @throws PcepParseException when message paring fails
*/
@Test
public void initiateMessageTest23() throws PcepParseException {
/* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO, LSPA OBJECT.
*/
- byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0x54,
+ byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x54,
0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
- 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
+ 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
(byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
@@ -1151,7 +1151,7 @@
0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
0x07, 0x10, 0x00, 0x04, //ERO object
0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00 };
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00};
byte[] testInitiateCreationMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
@@ -1160,35 +1160,35 @@
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
+
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg));
+ assertThat(message, sameInstance((PcepInitiateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+
message.writeTo(buf);
+
testInitiateCreationMsg = buf.array();
- int iReadLen = buf.writerIndex() - 0;
+ int iReadLen = buf.writerIndex();
testInitiateCreationMsg = new byte[iReadLen];
buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
- Assert.assertArrayEquals("PcInitiate messages are not equal",
- initiateCreationMsg, testInitiateCreationMsg);
+ assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
}
/**
* This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv),
* END-POINTS, ERO, LSPA BANDWIDTH OBJECT objects in PcInitiate message.
- *
- * @throws PcepParseException when message paring fails
*/
@Test
public void initiateMessageTest25() throws PcepParseException {
/* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO, LSPA BANDWIDTH OBJECT.
*/
- byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0x5c,
+ byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x5c,
0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
- 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
+ 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
(byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
@@ -1197,7 +1197,7 @@
0x07, 0x10, 0x00, 0x04, //ERO object
0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
- 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00 }; //Bandwidth object
+ 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00}; //Bandwidth object
byte[] testInitiateCreationMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
@@ -1206,26 +1206,26 @@
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
+
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg));
+ assertThat(message, sameInstance((PcepInitiateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+
message.writeTo(buf);
+
testInitiateCreationMsg = buf.array();
- int iReadLen = buf.writerIndex() - 0;
+ int iReadLen = buf.writerIndex();
testInitiateCreationMsg = new byte[iReadLen];
buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
- Assert.assertArrayEquals("PcInitiate messages are not equal",
- initiateCreationMsg, testInitiateCreationMsg);
+ assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
}
/**
* This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv), END-POINTS,
* ERO, LSPA, BANDWIDTH, METRIC OBJECT objects in PcInitiate message.
- *
- * @throws PcepParseException when message paring fails
*/
@Test
public void initiateMessageTest26() throws PcepParseException {
@@ -1233,9 +1233,9 @@
/* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv), END-POINTS,
* ERO, LSPA, BANDWIDTH, METRIC OBJECT.
*/
- byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0x68,
+ byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x68,
0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
- 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
+ 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
(byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
@@ -1245,7 +1245,7 @@
0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object
- 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01 }; //Metric object
+ 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01}; //Metric object
byte[] testInitiateCreationMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
@@ -1254,43 +1254,43 @@
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
+
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg));
+ assertThat(message, sameInstance((PcepInitiateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+
message.writeTo(buf);
+
testInitiateCreationMsg = buf.array();
- int iReadLen = buf.writerIndex() - 0;
+ int iReadLen = buf.writerIndex();
testInitiateCreationMsg = new byte[iReadLen];
buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
- Assert.assertArrayEquals("PcInitiate messages are not equal",
- initiateCreationMsg, testInitiateCreationMsg);
+ assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
}
/**
* This test case checks for SRP, LSP (SymbolicPathNameTlv, SymbolicPathNameTlv), END-POINTS, ERO, LSPA,
* BANDWIDTH, METRIC OBJECT objects in PcInitiate message.
- *
- * @throws PcepParseException when message paring fails
*/
@Test
public void initiateMessageTest27() throws PcepParseException {
/* SRP, LSP (SymbolicPathNameTlv, SymbolicPathNameTlv), END-POINTS, ERO, LSPA, BANDWIDTH, METRIC OBJECT.
*/
- byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0x54,
+ byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x54,
0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
- 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
+ 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object
- 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
+ 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
0x07, 0x10, 0x00, 0x04, //ERO object
0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object
- 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01 }; //Metric object
+ 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01}; //Metric object
byte[] testInitiateCreationMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
@@ -1299,41 +1299,42 @@
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
+
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg));
+ assertThat(message, sameInstance((PcepInitiateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+
message.writeTo(buf);
+
testInitiateCreationMsg = buf.array();
- int iReadLen = buf.writerIndex() - 0;
+ int iReadLen = buf.writerIndex();
testInitiateCreationMsg = new byte[iReadLen];
buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
- Assert.assertArrayEquals("PcInitiate messages are not equal", initiateCreationMsg, testInitiateCreationMsg);
+ assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
}
/**
* This test case checks for SRP, LSP (SymbolicPathNameTlv, SymbolicPathNameTlv), END-POINTS, ERO,
* LSPA, BANDWIDTH OBJECT objects in PcInitiate message.
- *
- * @throws PcepParseException when message paring fails
*/
@Test
public void initiateMessageTest28() throws PcepParseException {
/* SRP, LSP (SymbolicPathNameTlv, SymbolicPathNameTlv), END-POINTS, ERO, LSPA, BANDWIDTH OBJECT.
*/
- byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0x48,
+ byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x48,
0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
- 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
+ 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object
- 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
+ 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
0x07, 0x10, 0x00, 0x04, //ERO object
0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
- 0x05, 0x20, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00 }; //Bandwidth object
+ 0x05, 0x20, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00}; //Bandwidth object
byte[] testInitiateCreationMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
@@ -1342,41 +1343,41 @@
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
+
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg));
+ assertThat(message, sameInstance((PcepInitiateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+
message.writeTo(buf);
+
testInitiateCreationMsg = buf.array();
- int iReadLen = buf.writerIndex() - 0;
+ int iReadLen = buf.writerIndex();
testInitiateCreationMsg = new byte[iReadLen];
buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
- Assert.assertArrayEquals("PcInitiate messages are not equal",
- initiateCreationMsg, testInitiateCreationMsg);
+ assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
}
/**
* This test case checks for SRP, LSP (SymbolicPathNameTlv, SymbolicPathNameTlv),
* END-POINTS, ERO, LSPA OBJECT objects in PcInitiate message.
- *
- * @throws PcepParseException when message paring fails
*/
@Test
public void initiateMessageTest29() throws PcepParseException {
/* SRP, LSP (SymbolicPathNameTlv, SymbolicPathNameTlv), END-POINTS, ERO, LSPA OBJECT.
*/
- byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0x40,
+ byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x40,
0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
- 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
+ 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object
- 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
+ 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
0x07, 0x10, 0x00, 0x04, //ERO object
0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00 };
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00};
byte[] testInitiateCreationMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
@@ -1385,41 +1386,42 @@
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
+
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg));
+ assertThat(message, sameInstance((PcepInitiateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+
message.writeTo(buf);
+
testInitiateCreationMsg = buf.array();
- int iReadLen = buf.writerIndex() - 0;
+ int iReadLen = buf.writerIndex();
testInitiateCreationMsg = new byte[iReadLen];
buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
- Assert.assertArrayEquals("PcInitiate messages are not equal", initiateCreationMsg, testInitiateCreationMsg);
+ assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
}
/**
* This test case checks for SRP, LSP (SymbolicPathNameTlv, SymbolicPathNameTlv),
* END-POINTS, ERO, LSPA OBJECT objects in PcInitiate message.
- *
- * @throws PcepParseException when message paring fails
*/
@Test
public void initiateMessageTest30() throws PcepParseException {
/* SRP, LSP (SymbolicPathNameTlv, SymbolicPathNameTlv), END-POINTS, ERO, LSPA OBJECT.
*/
- byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0x50,
+ byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x50,
0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
- 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
+ 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object
- 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
+ 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
0x07, 0x10, 0x00, 0x14, (byte) 0x01, 0x08, 0x0C, 0x01, //ERO object
0x01, 0x01, 0x00, 0x00, (byte) 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00 };
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00};
byte[] testInitiateCreationMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
@@ -1428,40 +1430,41 @@
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
+
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg));
+ assertThat(message, sameInstance((PcepInitiateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+
message.writeTo(buf);
+
testInitiateCreationMsg = buf.array();
- int iReadLen = buf.writerIndex() - 0;
+ int iReadLen = buf.writerIndex();
testInitiateCreationMsg = new byte[iReadLen];
buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
- Assert.assertArrayEquals("PcInitiate messages are not equal", initiateCreationMsg, testInitiateCreationMsg);
+ assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
}
/**
* This test case checks for SRP, LSP (SymbolicPathNameTlv), END-POINTS, ERO, LSPA OBJECT
* objects in PcInitiate message.
- *
- * @throws PcepParseException when message paring fails
*/
@Test
public void initiateMessageTest31() throws PcepParseException {
/* SRP, LSP (SymbolicPathNameTlv), END-POINTS, ERO, LSPA OBJECT.
*/
- byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0x48,
+ byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x48,
0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object
- 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
+ 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
0x07, 0x10, 0x00, 0x14, (byte) 0x01, 0x08, 0x0C, 0x01, //ERO object
0x01, 0x01, 0x00, 0x00, (byte) 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00 };
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00};
byte[] testInitiateCreationMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
@@ -1470,25 +1473,26 @@
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
+
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg));
+ assertThat(message, sameInstance((PcepInitiateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+
message.writeTo(buf);
+
testInitiateCreationMsg = buf.array();
- int iReadLen = buf.writerIndex() - 0;
+ int iReadLen = buf.writerIndex();
testInitiateCreationMsg = new byte[iReadLen];
buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
- Assert.assertArrayEquals("PcInitiate messages are not equal", initiateCreationMsg, testInitiateCreationMsg);
+ assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
}
/**
* This test case checks for SRP, LSP ( StatefulLspDbVerTlv), END-POINTS,
* ERO, LSPA, BANDWIDTH, METRIC OBJECT objects in PcInitiate message.
- *
- * @throws PcepParseException when message paring fails
*/
@Test
public void initiateMessageTest32() throws PcepParseException {
@@ -1496,9 +1500,9 @@
/* SRP, LSP ( StatefulLspDbVerTlv), END-POINTS,
* ERO, LSPA, BANDWIDTH, METRIC OBJECT.
*/
- byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0x64,
+ byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x64,
0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
- 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
+ 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
0x20, 0x10, 0x00, 0x14, 0x00, 0x00, 0x10, 0x03, //LSP object
0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
@@ -1507,7 +1511,7 @@
0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object
- 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01 }; //Metric object
+ 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01}; //Metric object
byte[] testInitiateCreationMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
@@ -1516,26 +1520,26 @@
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
+
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg));
+ assertThat(message, sameInstance((PcepInitiateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+
message.writeTo(buf);
+
testInitiateCreationMsg = buf.array();
- int iReadLen = buf.writerIndex() - 0;
+ int iReadLen = buf.writerIndex();
testInitiateCreationMsg = new byte[iReadLen];
buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
- Assert.assertArrayEquals("PcInitiate messages are not equal", initiateCreationMsg, testInitiateCreationMsg);
-
+ assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
}
/**
* This test case checks for SRP, LSP ( StatefulLspDbVerTlv), END-POINTS,
* ERO, LSPA, BANDWIDTH OBJECT objects in PcInitiate message.
- *
- * @throws PcepParseException when message paring fails
*/
@Test
public void initiateMessageTest33() throws PcepParseException {
@@ -1543,9 +1547,9 @@
/* SRP, LSP ( StatefulLspDbVerTlv), END-POINTS,
* ERO, LSPA, BANDWIDTH OBJECT.
*/
- byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0x58,
+ byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x58,
0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
- 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
+ 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
0x20, 0x10, 0x00, 0x14, 0x00, 0x00, 0x10, 0x03, //LSP object
0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
@@ -1553,7 +1557,7 @@
0x07, 0x10, 0x00, 0x04, //ERO object
0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
- 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00 }; //Bandwidth object
+ 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00}; //Bandwidth object
byte[] testInitiateCreationMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
@@ -1562,26 +1566,26 @@
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
+
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg));
+ assertThat(message, sameInstance((PcepInitiateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+
message.writeTo(buf);
+
testInitiateCreationMsg = buf.array();
- int iReadLen = buf.writerIndex() - 0;
+ int iReadLen = buf.writerIndex();
testInitiateCreationMsg = new byte[iReadLen];
buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
- Assert.assertArrayEquals("PcInitiate messages are not equal",
- initiateCreationMsg, testInitiateCreationMsg);
+ assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
}
/**
* This test case checks for SRP, LSP ( StatefulLspDbVerTlv), END-POINTS,
* ERO, LSPA OBJECT objects in PcInitiate message.
- *
- * @throws PcepParseException when message paring fails
*/
@Test
public void initiateMessageTest34() throws PcepParseException {
@@ -1589,16 +1593,16 @@
/* SRP, LSP ( StatefulLspDbVerTlv), END-POINTS,
* ERO, LSPA OBJECT.
*/
- byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0x50,
+ byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x50,
0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
- 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
+ 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
0x20, 0x10, 0x00, 0x14, 0x00, 0x00, 0x10, 0x03, //LSP object
0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
0x07, 0x10, 0x00, 0x04, //ERO object
0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00 };
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00};
byte[] testInitiateCreationMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
@@ -1607,25 +1611,26 @@
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
+
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg));
+ assertThat(message, sameInstance((PcepInitiateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+
message.writeTo(buf);
+
testInitiateCreationMsg = buf.array();
- int iReadLen = buf.writerIndex() - 0;
+ int iReadLen = buf.writerIndex();
testInitiateCreationMsg = new byte[iReadLen];
buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
- Assert.assertArrayEquals("PcInitiate messages are not equal", initiateCreationMsg, testInitiateCreationMsg);
+ assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
}
/**
* This test case checks for SRP, LSP ( StatefulLspDbVerTlv), END-POINTS,
* ERO, LSPA OBJECT objects in PcInitiate message.
- *
- * @throws PcepParseException when message paring fails
*/
@Test
public void initiateMessageTest35() throws PcepParseException {
@@ -1633,9 +1638,9 @@
/* SRP, LSP ( StatefulLspDbVerTlv), END-POINTS,
* ERO, LSPA OBJECT.
*/
- byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0x60,
+ byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x60,
0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
- 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
+ 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
0x20, 0x10, 0x00, 0x14, 0x00, 0x00, 0x10, 0x03, //LSP object
0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
@@ -1643,7 +1648,7 @@
0x07, 0x10, 0x00, 0x14, (byte) 0x01, 0x08, 0x0C, 0x01, //ERO object
0x01, 0x01, 0x00, 0x00, (byte) 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00 };
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00};
byte[] testInitiateCreationMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
@@ -1652,26 +1657,26 @@
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
+
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg));
+ assertThat(message, sameInstance((PcepInitiateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+
message.writeTo(buf);
+
testInitiateCreationMsg = buf.array();
- int iReadLen = buf.writerIndex() - 0;
+ int iReadLen = buf.writerIndex();
testInitiateCreationMsg = new byte[iReadLen];
buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
- Assert.assertArrayEquals("PcInitiate messages are not equal",
- initiateCreationMsg, testInitiateCreationMsg);
+ assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
}
/**
* This test case checks for SRP, LSP ( StatefulLspDbVerTlv), END-POINTS,
* ERO, LSPA OBJECT objects in PcInitiate message.
- *
- * @throws PcepParseException when message paring fails
*/
@Test
public void initiateMessageTest36() throws PcepParseException {
@@ -1679,7 +1684,7 @@
/* SRP, LSP ( StatefulLspDbVerTlv), END-POINTS,
* ERO, LSPA OBJECT.
*/
- byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0x58,
+ byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x58,
0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
0x20, 0x10, 0x00, 0x14, 0x00, 0x00, 0x10, 0x03, //LSP object
0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv
@@ -1688,7 +1693,7 @@
0x07, 0x10, 0x00, 0x14, (byte) 0x01, 0x08, 0x0C, 0x01, //ERO object
0x01, 0x01, 0x00, 0x00, (byte) 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00 };
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00};
byte[] testInitiateCreationMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
@@ -1697,20 +1702,21 @@
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
+
message = reader.readFrom(buffer);
- Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg));
+ assertThat(message, sameInstance((PcepInitiateMsg) message));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+
message.writeTo(buf);
+
testInitiateCreationMsg = buf.array();
- int iReadLen = buf.writerIndex() - 0;
+ int iReadLen = buf.writerIndex();
testInitiateCreationMsg = new byte[iReadLen];
buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
- Assert.assertArrayEquals("PcInitiate messages are not equal",
- initiateCreationMsg, testInitiateCreationMsg);
-
+ assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
}
}