Exemplo n.º 1
0
  @Test(groups = {"functional.encode", "subscriberInformation"})
  public void testEncode() throws Exception {
    RequestedInfoImpl requestedInfo =
        new RequestedInfoImpl(true, true, null, false, null, false, false, false);
    AsnOutputStream asnOS = new AsnOutputStream();
    requestedInfo.encodeAll(asnOS, Tag.CLASS_CONTEXT_SPECIFIC, 1);

    byte[] encodedData = asnOS.toByteArray();
    assertTrue(Arrays.equals(encodedData, data));

    requestedInfo =
        new RequestedInfoImpl(
            true,
            true,
            MAPExtensionContainerTest.GetTestExtensionContainer(),
            true,
            DomainType.psDomain,
            true,
            true,
            true);
    asnOS = new AsnOutputStream();
    requestedInfo.encodeAll(asnOS);

    encodedData = asnOS.toByteArray();
    assertTrue(Arrays.equals(encodedData, dataFull));
  }
Exemplo n.º 2
0
  @Test(groups = {"functional.decode", "subscriberInformation"})
  public void testDecode() throws Exception {

    AsnInputStream asn = new AsnInputStream(data);
    int tag = asn.readTag();
    assertEquals(tag, 1);

    RequestedInfoImpl requestedInfo = new RequestedInfoImpl();
    requestedInfo.decodeAll(asn);

    assertTrue(requestedInfo.getLocationInformation());
    assertTrue(requestedInfo.getSubscriberState());
    assertNull(requestedInfo.getExtensionContainer());
    assertFalse(requestedInfo.getCurrentLocation());
    assertNull(requestedInfo.getRequestedDomain());
    assertFalse(requestedInfo.getImei());
    assertFalse(requestedInfo.getMsClassmark());
    assertFalse(requestedInfo.getMnpRequestedInfo());

    asn = new AsnInputStream(dataFull);
    tag = asn.readTag();
    assertEquals(tag, Tag.SEQUENCE);

    requestedInfo = new RequestedInfoImpl();
    requestedInfo.decodeAll(asn);

    assertTrue(requestedInfo.getLocationInformation());
    assertTrue(requestedInfo.getSubscriberState());
    assertTrue(
        MAPExtensionContainerTest.CheckTestExtensionContainer(
            requestedInfo.getExtensionContainer()));
    assertTrue(requestedInfo.getCurrentLocation());
    assertEquals(requestedInfo.getRequestedDomain(), DomainType.psDomain);
    assertTrue(requestedInfo.getImei());
    assertTrue(requestedInfo.getMsClassmark());
    assertTrue(requestedInfo.getMnpRequestedInfo());
  }