@Test(groups = {"functional.decode"})
  public void testDecode() throws Exception {

    byte[] rawData = getEncodedData();
    AsnInputStream asn = new AsnInputStream(rawData);

    int tag = asn.readTag();
    UpdateLocationRequestImpl asc = new UpdateLocationRequestImpl(3);
    asc.decodeAll(asn);

    assertEquals(tag, Tag.SEQUENCE);
    assertEquals(asn.getTagClass(), Tag.CLASS_UNIVERSAL);
    assertEquals(asc.getMapProtocolVersion(), 3);

    IMSI imsi = asc.getImsi();
    assertTrue(imsi.getData().equals("1111122222"));

    assertNull(asc.getRoamingNumber());
    ISDNAddressString mscNumber = asc.getMscNumber();
    assertTrue(mscNumber.getAddress().equals("22228"));
    assertEquals(mscNumber.getAddressNature(), AddressNature.international_number);
    assertEquals(mscNumber.getNumberingPlan(), NumberingPlan.ISDN);

    ISDNAddressString vlrNumber = asc.getVlrNumber();
    assertTrue(vlrNumber.getAddress().equals("22229"));
    assertEquals(vlrNumber.getAddressNature(), AddressNature.international_number);
    assertEquals(vlrNumber.getNumberingPlan(), NumberingPlan.ISDN);

    VLRCapability vlrCap = asc.getVlrCapability();
    assertTrue(vlrCap.getSupportedLCSCapabilitySets().getCapabilitySetRelease98_99());
    assertFalse(vlrCap.getSupportedLCSCapabilitySets().getCapabilitySetRelease4());

    assertNull(asc.getLmsi());
    assertNull(asc.getExtensionContainer());

    assertFalse(asc.getInformPreviousNetworkEntity());
    assertFalse(asc.getCsLCSNotSupportedByUE());
    assertFalse(asc.getSkipSubscriberDataUpdate());
    assertFalse(asc.getRestorationIndicator());

    rawData = getEncodedData2();
    asn = new AsnInputStream(rawData);

    tag = asn.readTag();
    asc = new UpdateLocationRequestImpl(3);
    asc.decodeAll(asn);

    assertEquals(tag, Tag.SEQUENCE);
    assertEquals(asn.getTagClass(), Tag.CLASS_UNIVERSAL);
    assertEquals(asc.getMapProtocolVersion(), 3);

    imsi = asc.getImsi();
    assertTrue(imsi.getData().equals("1111122233"));

    assertNull(asc.getRoamingNumber());
    mscNumber = asc.getMscNumber();
    assertTrue(mscNumber.getAddress().equals("22228"));
    assertEquals(mscNumber.getAddressNature(), AddressNature.international_number);
    assertEquals(mscNumber.getNumberingPlan(), NumberingPlan.ISDN);

    vlrNumber = asc.getVlrNumber();
    assertTrue(vlrNumber.getAddress().equals("22229"));
    assertEquals(vlrNumber.getAddressNature(), AddressNature.international_number);
    assertEquals(vlrNumber.getNumberingPlan(), NumberingPlan.ISDN);

    vlrCap = asc.getVlrCapability();
    assertTrue(vlrCap.getSupportedLCSCapabilitySets().getCapabilitySetRelease98_99());
    assertFalse(vlrCap.getSupportedLCSCapabilitySets().getCapabilitySetRelease4());

    assertTrue(Arrays.equals(asc.getLmsi().getData(), getLmsiData()));
    assertTrue(MAPExtensionContainerTest.CheckTestExtensionContainer(asc.getExtensionContainer()));

    assertTrue(asc.getInformPreviousNetworkEntity());
    assertTrue(asc.getCsLCSNotSupportedByUE());
    assertTrue(asc.getSkipSubscriberDataUpdate());
    assertTrue(asc.getRestorationIndicator());

    rawData = getEncodedData3();
    asn = new AsnInputStream(rawData);

    tag = asn.readTag();
    asc = new UpdateLocationRequestImpl(3);
    asc.decodeAll(asn);

    assertEquals(tag, Tag.SEQUENCE);
    assertEquals(asn.getTagClass(), Tag.CLASS_UNIVERSAL);
    assertEquals(asc.getMapProtocolVersion(), 3);

    imsi = asc.getImsi();
    assertTrue(imsi.getData().equals("1111122233"));

    assertNull(asc.getRoamingNumber());
    mscNumber = asc.getMscNumber();
    assertTrue(mscNumber.getAddress().equals("22228"));
    assertEquals(mscNumber.getAddressNature(), AddressNature.international_number);
    assertEquals(mscNumber.getNumberingPlan(), NumberingPlan.ISDN);

    vlrNumber = asc.getVlrNumber();
    assertTrue(vlrNumber.getAddress().equals("22229"));
    assertEquals(vlrNumber.getAddressNature(), AddressNature.international_number);
    assertEquals(vlrNumber.getNumberingPlan(), NumberingPlan.ISDN);

    vlrCap = asc.getVlrCapability();
    assertTrue(vlrCap.getSupportedLCSCapabilitySets().getCapabilitySetRelease98_99());
    assertFalse(vlrCap.getSupportedLCSCapabilitySets().getCapabilitySetRelease4());

    assertTrue(Arrays.equals(asc.getLmsi().getData(), getLmsiData()));
    assertNull(asc.getExtensionContainer());

    assertTrue(asc.getInformPreviousNetworkEntity());
    assertTrue(asc.getCsLCSNotSupportedByUE());
    assertTrue(asc.getSkipSubscriberDataUpdate());
    assertTrue(asc.getRestorationIndicator());

    assertTrue(Arrays.equals(asc.getVGmlcAddress().getData(), getGSNAddressData()));
    assertTrue(asc.getADDInfo().getImeisv().getIMEI().equals("123456789009876"));
    assertFalse(asc.getADDInfo().getSkipSubscriberDataUpdate());
    assertEquals(asc.getPagingArea().getLocationAreas().size(), 1);
    assertEquals(asc.getPagingArea().getLocationAreas().get(0).getLAC().getLac(), 123);

    rawData = getEncodedData_V1();
    asn = new AsnInputStream(rawData);

    tag = asn.readTag();
    asc = new UpdateLocationRequestImpl(1);
    asc.decodeAll(asn);

    assertEquals(tag, Tag.SEQUENCE);
    assertEquals(asn.getTagClass(), Tag.CLASS_UNIVERSAL);
    assertEquals(asc.getMapProtocolVersion(), 1);

    imsi = asc.getImsi();
    assertTrue(imsi.getData().equals("1111122233"));

    assertNull(asc.getMscNumber());
    ISDNAddressString roamingNumber = asc.getRoamingNumber();
    assertTrue(roamingNumber.getAddress().equals("22220"));
    assertEquals(roamingNumber.getAddressNature(), AddressNature.international_number);
    assertEquals(roamingNumber.getNumberingPlan(), NumberingPlan.ISDN);

    vlrNumber = asc.getVlrNumber();
    assertTrue(vlrNumber.getAddress().equals("22221"));
    assertEquals(vlrNumber.getAddressNature(), AddressNature.international_number);
    assertEquals(vlrNumber.getNumberingPlan(), NumberingPlan.ISDN);

    assertNull(asc.getVlrCapability());
    assertNull(asc.getLmsi());
    assertNull(asc.getExtensionContainer());
    assertFalse(asc.getInformPreviousNetworkEntity());
    assertFalse(asc.getCsLCSNotSupportedByUE());
    assertFalse(asc.getSkipSubscriberDataUpdate());
    assertFalse(asc.getRestorationIndicator());
  }
Example #2
0
  @Test(groups = {"functional.decode", "primitives"})
  public void testDecode() throws Exception {
    byte[] data = this.getData();
    AsnInputStream asn = new AsnInputStream(data);
    int tag = asn.readTag();
    ExtForwFeatureImpl prim = new ExtForwFeatureImpl();
    prim.decodeAll(asn);

    assertEquals(tag, Tag.SEQUENCE);
    assertEquals(asn.getTagClass(), Tag.CLASS_UNIVERSAL);

    MAPExtensionContainer extensionContainer = prim.getExtensionContainer();
    assertEquals(
        prim.getBasicService().getExtBearerService().getBearerServiceCodeValue(),
        BearerServiceCodeValue.padAccessCA_9600bps);
    assertNull(prim.getBasicService().getExtTeleservice());
    assertNotNull(prim.getSsStatus());
    assertTrue(prim.getSsStatus().getBitA());
    assertTrue(!prim.getSsStatus().getBitP());
    assertTrue(!prim.getSsStatus().getBitQ());
    assertTrue(prim.getSsStatus().getBitR());

    ISDNAddressString forwardedToNumber = prim.getForwardedToNumber();
    assertNotNull(forwardedToNumber);
    assertTrue(forwardedToNumber.getAddress().equals("22228"));
    assertEquals(forwardedToNumber.getAddressNature(), AddressNature.international_number);
    assertEquals(forwardedToNumber.getNumberingPlan(), NumberingPlan.ISDN);

    assertTrue(
        Arrays.equals(
            prim.getForwardedToSubaddress().getData(), this.getISDNSubaddressStringData()));
    assertTrue(prim.getForwardingOptions().getNotificationToCallingParty());
    assertTrue(prim.getForwardingOptions().getNotificationToForwardingParty());
    assertTrue(!prim.getForwardingOptions().getRedirectingPresentation());
    assertEquals(
        prim.getForwardingOptions().getExtForwOptionsForwardingReason(),
        ExtForwOptionsForwardingReason.msBusy);
    assertNotNull(prim.getNoReplyConditionTime());
    assertEquals(prim.getNoReplyConditionTime().intValue(), 2);
    FTNAddressString longForwardedToNumber = prim.getLongForwardedToNumber();
    assertNotNull(longForwardedToNumber);
    assertTrue(longForwardedToNumber.getAddress().equals("22227"));
    assertEquals(longForwardedToNumber.getAddressNature(), AddressNature.international_number);
    assertEquals(longForwardedToNumber.getNumberingPlan(), NumberingPlan.ISDN);
    assertNotNull(extensionContainer);
    assertTrue(MAPExtensionContainerTest.CheckTestExtensionContainer(extensionContainer));

    data = this.getData2();
    asn = new AsnInputStream(data);
    tag = asn.readTag();
    prim = new ExtForwFeatureImpl();
    prim.decodeAll(asn);

    assertEquals(tag, Tag.SEQUENCE);
    assertEquals(asn.getTagClass(), Tag.CLASS_UNIVERSAL);

    extensionContainer = prim.getExtensionContainer();
    assertEquals(
        prim.getBasicService().getExtTeleservice().getTeleserviceCodeValue(),
        TeleserviceCodeValue.allSpeechTransmissionServices);
    assertNull(prim.getBasicService().getExtBearerService());
    assertNotNull(prim.getSsStatus());
    assertTrue(prim.getSsStatus().getBitA());
    assertTrue(prim.getSsStatus().getBitP());
    assertTrue(prim.getSsStatus().getBitQ());
    assertTrue(prim.getSsStatus().getBitR());

    forwardedToNumber = prim.getForwardedToNumber();
    assertNotNull(forwardedToNumber);
    assertTrue(forwardedToNumber.getAddress().equals("999888777"));
    assertEquals(forwardedToNumber.getAddressNature(), AddressNature.international_number);
    assertEquals(forwardedToNumber.getNumberingPlan(), NumberingPlan.ISDN);

    assertNull(prim.getForwardedToSubaddress());
    assertFalse(prim.getForwardingOptions().getNotificationToCallingParty());
    assertFalse(prim.getForwardingOptions().getNotificationToForwardingParty());
    assertFalse(prim.getForwardingOptions().getRedirectingPresentation());
    assertEquals(
        prim.getForwardingOptions().getExtForwOptionsForwardingReason(),
        ExtForwOptionsForwardingReason.msNotReachable);
    assertNull(prim.getNoReplyConditionTime());
    longForwardedToNumber = prim.getLongForwardedToNumber();
    assertNull(longForwardedToNumber);
    assertNull(extensionContainer);
  }