Ejemplo n.º 1
0
        @Override
        public void write(VariableMessageImpl obj, javolution.xml.XMLFormat.OutputElement xml)
            throws XMLStreamException {

          xml.add(obj.getElementaryMessageID(), ELEMENTARY_MESSAGE_ID, Integer.class);

          for (VariablePart vp : obj.getVariableParts()) {
            xml.add((VariablePartImpl) vp, VARIABLE_PART, VariablePartImpl.class);
          }
        }
Ejemplo n.º 2
0
        @Override
        public void read(
            javolution.xml.XMLFormat.InputElement xml, VariableMessageImpl variableMessage)
            throws XMLStreamException {

          variableMessage.elementaryMessageID = xml.get(ELEMENTARY_MESSAGE_ID, Integer.class);
          variableMessage.variableParts = new ArrayList<VariablePart>();
          while (xml.hasNext()) {
            VariablePartImpl vp = xml.get("variablePart", VariablePartImpl.class);
            variableMessage.variableParts.add(vp);
          }
        }
Ejemplo n.º 3
0
  @Test(groups = {"functional.encode", "circuitSwitchedCall.primitive"})
  public void testEncode() throws Exception {

    ArrayList<VariablePart> variableParts = new ArrayList<VariablePart>();
    VariablePartImpl vp = new VariablePartImpl(111);
    variableParts.add(vp);
    VariablePartTimeImpl time = new VariablePartTimeImpl(23, 59);
    vp = new VariablePartImpl(time);
    variableParts.add(vp);

    VariableMessageImpl elem = new VariableMessageImpl(800, variableParts);
    AsnOutputStream aos = new AsnOutputStream();
    elem.encodeAll(aos);
    assertTrue(Arrays.equals(aos.toByteArray(), this.getData1()));

    // int elementaryMessageID, ArrayList<VariablePart> variableParts
  }
Ejemplo n.º 4
0
  @Test(groups = {"functional.decode", "circuitSwitchedCall.primitive"})
  public void testDecode() throws Exception {

    byte[] data = this.getData1();
    AsnInputStream ais = new AsnInputStream(data);
    VariableMessageImpl elem = new VariableMessageImpl();
    int tag = ais.readTag();
    assertEquals(tag, Tag.SEQUENCE);
    elem.decodeAll(ais);
    assertEquals(elem.getElementaryMessageID(), 800);
    assertEquals(elem.getVariableParts().size(), 2);
    assertEquals((int) elem.getVariableParts().get(0).getInteger(), 111);
    assertEquals((int) elem.getVariableParts().get(1).getTime().getHour(), 23);
    assertEquals((int) elem.getVariableParts().get(1).getTime().getMinute(), 59);
  }