/** * This test case validates the parsing process. * * @throws IOException This exception should be never thrown. * @throws InternetSCSIException This exception should be never thrown. * @throws DigestException This exception should be never thrown. */ @Test public void testDeserialize2() throws IOException, InternetSCSIException, DigestException { super.setUp(TEST_CASE_2); super.testDeserialize( false, true, OperationCode.SCSI_RESPONSE, 0x00000000, 0x00000000, 0x00000001); assertTrue(recognizedParser instanceof SCSIResponseParser); SCSIResponseParser parser = (SCSIResponseParser) recognizedParser; // test SCSI response fields assertFalse(parser.isBidirectionalReadResidualOverflow()); assertFalse(parser.isBidirectionalReadResidualUnderflow()); assertFalse(parser.isResidualOverflow()); assertFalse(parser.isResidualUnderflow()); assertEquals(ServiceResponse.COMMAND_COMPLETED_AT_TARGET, parser.getResponse()); assertEquals(SCSIStatus.GOOD, parser.getStatus()); assertEquals(0x00000013, parser.getStatusSequenceNumber()); assertEquals(0x00000013, parser.getExpectedCommandSequenceNumber()); assertEquals(0x00000033, parser.getMaximumCommandSequenceNumber()); assertEquals(0x00000000, parser.getExpectedDataSequenceNumber()); assertEquals(0x00000000, parser.getBidirectionalReadResidualCount()); assertEquals(0x00000000, parser.getResidualCount()); }
/** * This test case validates the serialization process. * * @throws InternetSCSIException This exception should be never thrown. * @throws IOException This exception should be never thrown. * @throws DigestException This exception should be never thrown. */ @Test public void testSerialize2() throws InternetSCSIException, IOException, DigestException { super.setUp(TEST_CASE_2); ByteBuffer expectedResult = WiresharkMessageParser.parseToByteBuffer(TEST_CASE_2); assertTrue(expectedResult.equals(protocolDataUnit.serialize())); }