@Test(expected = Exception.class) public void testReadFrom1() throws Exception { byte[] temp = {0, 0, 0}; inputByteArray = temp; lsaHeader = createLsaHeader(); summaryLsa = new SummaryLsa(lsaHeader); channelBuffer = ChannelBuffers.copiedBuffer(inputByteArray); summaryLsa.readFrom(channelBuffer); assertThat(summaryLsa, is(notNullValue())); }
public void readFrom(ChannelBuffer channelBuffer) throws OspfParseException { try { byte[] tempByteArray = new byte[OspfUtil.FOUR_BYTES]; channelBuffer.readBytes(tempByteArray, 0, OspfUtil.FOUR_BYTES); this.setNetworkMask(Ip4Address.valueOf(tempByteArray)); int unsedByte = channelBuffer.readByte(); this.setMetric(channelBuffer.readUnsignedMedium()); } catch (Exception e) { log.debug("Error::SummaryLsa:: {}", e.getMessage()); throw new OspfParseException(OspfErrorType.OSPF_MESSAGE_ERROR, OspfErrorType.BAD_MESSAGE); } }
SummaryLsa extends LsaHeader { public void readFrom(ChannelBuffer channelBuffer) throws OspfParseException { try { byte[] tempByteArray = new byte[OspfUtil.FOUR_BYTES]; channelBuffer.readBytes(tempByteArray, 0, OspfUtil.FOUR_BYTES); this.setNetworkMask(Ip4Address.valueOf(tempByteArray)); int unsedByte = channelBuffer.readByte(); this.setMetric(channelBuffer.readUnsignedMedium()); } catch (Exception e) { log.debug("Error::SummaryLsa:: {}", e.getMessage()); throw new OspfParseException(OspfErrorType.OSPF_MESSAGE_ERROR, OspfErrorType.BAD_MESSAGE); } } }
SummaryLsa extends LsaHeader { public void readFrom(ChannelBuffer channelBuffer) throws OspfParseException { try { byte[] tempByteArray = new byte[OspfUtil.FOUR_BYTES]; channelBuffer.readBytes(tempByteArray, 0, OspfUtil.FOUR_BYTES); this.setNetworkMask(Ip4Address.valueOf(tempByteArray)); int unsedByte = channelBuffer.readByte(); this.setMetric(channelBuffer.readUnsignedMedium()); } catch (Exception e) { log.debug("Error::SummaryLsa:: {}", e.getMessage()); throw new OspfParseException(OspfErrorType.OSPF_MESSAGE_ERROR, OspfErrorType.BAD_MESSAGE); } } SummaryLsa(LsaHeader lsaHeader); }
SummaryLsa extends LsaHeader { public void readFrom(ChannelBuffer channelBuffer) throws OspfParseException { try { byte[] tempByteArray = new byte[OspfUtil.FOUR_BYTES]; channelBuffer.readBytes(tempByteArray, 0, OspfUtil.FOUR_BYTES); this.setNetworkMask(Ip4Address.valueOf(tempByteArray)); int unsedByte = channelBuffer.readByte(); this.setMetric(channelBuffer.readUnsignedMedium()); } catch (Exception e) { log.debug("Error::SummaryLsa:: {}", e.getMessage()); throw new OspfParseException(OspfErrorType.OSPF_MESSAGE_ERROR, OspfErrorType.BAD_MESSAGE); } } SummaryLsa(LsaHeader lsaHeader); Ip4Address networkMask(); void setNetworkMask(Ip4Address networkMask); int metric(); void setMetric(int metric); void readFrom(ChannelBuffer channelBuffer); byte[] asBytes(); byte[] getLsaBodyAsByteArray(); @Override OspfLsaType getOspfLsaType(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); }
SummaryLsa extends LsaHeader { public void readFrom(ChannelBuffer channelBuffer) throws OspfParseException { try { byte[] tempByteArray = new byte[OspfUtil.FOUR_BYTES]; channelBuffer.readBytes(tempByteArray, 0, OspfUtil.FOUR_BYTES); this.setNetworkMask(Ip4Address.valueOf(tempByteArray)); int unsedByte = channelBuffer.readByte(); this.setMetric(channelBuffer.readUnsignedMedium()); } catch (Exception e) { log.debug("Error::SummaryLsa:: {}", e.getMessage()); throw new OspfParseException(OspfErrorType.OSPF_MESSAGE_ERROR, OspfErrorType.BAD_MESSAGE); } } SummaryLsa(LsaHeader lsaHeader); Ip4Address networkMask(); void setNetworkMask(Ip4Address networkMask); int metric(); void setMetric(int metric); void readFrom(ChannelBuffer channelBuffer); byte[] asBytes(); byte[] getLsaBodyAsByteArray(); @Override OspfLsaType getOspfLsaType(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode();  }