Ejemplo n.º 1
0
  @Test(groups = {"functional.encode", "functional.decode", "message"})
  public void testTwo_Params() throws Exception {
    byte[] message = getDefaultBody();

    // CircuitGroupUnblockingMessage cgb=new CircuitGroupUnblockingMessageImpl(this,message);
    CircuitGroupUnblockingMessage cgb = super.messageFactory.createCGU(0);
    ((AbstractISUPMessage) cgb).decode(message, messageFactory, parameterFactory);

    try {
      RangeAndStatus RS = (RangeAndStatus) cgb.getParameter(RangeAndStatus._PARAMETER_CODE);
      assertNotNull(RS, "Range And Status return is null, it should not be");
      if (RS == null) return;
      byte range = RS.getRange();
      assertEquals(range, 0x11, "Range is wrong");
      byte[] b = RS.getStatus();
      assertNotNull(b, "RangeAndStatus.getRange() is null");
      if (b == null) {
        return;
      }
      assertEquals(b.length, 3, "Length of param is wrong");
      if (b.length != 3) return;
      assertTrue(
          super.makeCompare(b, new byte[] {0x02, 0x03, 0x04}),
          "RangeAndStatus.getRange() is wrong");

    } catch (Exception e) {
      e.printStackTrace();
      fail("Failed on get parameter[" + CallReference._PARAMETER_CODE + "]:" + e);
    }
  }
Ejemplo n.º 2
0
  @Test(groups = {"functional.encode", "functional.decode", "message"})
  public void testTwo_Params() throws Exception {
    // FIXME: for now we strip MTP part
    byte[] message = {
      0x0C,
      (byte) 0x0B,
      CircuitGroupBlockingMessage.MESSAGE_CODE
      // Circuit group supervision message type
      ,
      0x01 // hardware failure oriented
      ,
      0x01 // ptr to variable part
      // no optional, so no pointer
      // RangeAndStatus._PARAMETER_CODE
      ,
      0x03,
      0x0A,
      0x02,
      0x03
    };

    // CircuitGroupBlockingMessage cgb=new CircuitGroupBlockingMessageImpl(this,message);
    CircuitGroupBlockingMessage cgb = super.messageFactory.createCGB(0);
    ((AbstractISUPMessage) cgb).decode(message, messageFactory, parameterFactory);

    try {
      RangeAndStatus RS = (RangeAndStatus) cgb.getParameter(RangeAndStatus._PARAMETER_CODE);
      assertNotNull(RS, "Range And Status return is null, it should not be");
      if (RS == null) return;
      byte range = RS.getRange();
      assertEquals(range, 0x0A, "Range is wrong");
      byte[] b = RS.getStatus();
      assertNotNull(b, "RangeAndStatus.getRange() is null");
      if (b == null) {
        return;
      }
      assertEquals(b.length, 2, "Length of param is wrong");
      if (b.length != 2) return;
      assertTrue(
          super.makeCompare(b, new byte[] {0x02, 0x03}), "RangeAndStatus.getRange() is wrong");

    } catch (Exception e) {
      e.printStackTrace();
      fail("Failed on get parameter[" + CallReference._PARAMETER_CODE + "]:" + e);
    }
  }