Exemple #1
0
  @Test(groups = {"functional.encode", "circuitSwitchedCall"})
  public void testEncode() throws Exception {

    ResetTimerRequestImpl elem =
        new ResetTimerRequestImpl(
            TimerID.tssf, 1000, CAPExtensionsTest.createTestCAPExtensions(), 100);
    AsnOutputStream aos = new AsnOutputStream();
    elem.encodeAll(aos);
    assertTrue(Arrays.equals(aos.toByteArray(), this.getData1()));
  }
Exemple #2
0
  @Test(groups = {"functional.decode", "circuitSwitchedCall"})
  public void testDecode() throws Exception {

    byte[] data = this.getData1();
    AsnInputStream ais = new AsnInputStream(data);
    ResetTimerRequestImpl elem = new ResetTimerRequestImpl();
    int tag = ais.readTag();
    elem.decodeAll(ais);
    assertEquals(elem.getTimerID(), TimerID.tssf);
    assertEquals(elem.getTimerValue(), 1000);
    assertTrue(CAPExtensionsTest.checkTestCAPExtensions(elem.getExtensions()));
    assertEquals((int) elem.getCallSegmentID(), 100);
  }
  @Test(groups = {"functional.encode", "circuitSwitchedCall"})
  public void testEncode() throws Exception {

    GenericNumberImpl genericNumber = new GenericNumberImpl(1, "1122", 1, 0, 0, false, 1);
    // int natureOfAddresIndicator, String address, int numberQualifierIndicator, int
    // numberingPlanIndicator, int
    // addressRepresentationREstrictedIndicator,
    // boolean numberIncomplete, int screeningIndicator
    DigitsImpl assistingSSPIPRoutingAddress = new DigitsImpl(genericNumber);
    GenericDigitsImpl genericDigits = new GenericDigitsImpl(2, 0, getCorrelationIDDigits());
    // int encodingScheme, int typeOfDigits, int[] digits
    DigitsImpl correlationID = new DigitsImpl(genericDigits);
    ScfIDImpl scfID = new ScfIDImpl(getScfIDData());
    ServiceInteractionIndicatorsTwoImpl serviceInteractionIndicatorsTwo =
        new ServiceInteractionIndicatorsTwoImpl(
            null,
            null,
            BothwayThroughConnectionInd.bothwayPathNotRequired,
            null,
            false,
            null,
            null,
            null);
    // ForwardServiceInteractionInd forwardServiceInteractionInd,
    // BackwardServiceInteractionInd backwardServiceInteractionInd, BothwayThroughConnectionInd
    // bothwayThroughConnectionInd,
    // ConnectedNumberTreatmentInd connectedNumberTreatmentInd, boolean nonCUGCall,
    // HoldTreatmentIndicator
    // holdTreatmentIndicator,
    // CwTreatmentIndicator cwTreatmentIndicator, EctTreatmentIndicator ectTreatmentIndicator
    NAOliInfoImpl naOliInfo = new NAOliInfoImpl(11);

    EstablishTemporaryConnectionRequestImpl elem =
        new EstablishTemporaryConnectionRequestImpl(
            assistingSSPIPRoutingAddress,
            correlationID,
            scfID,
            CAPExtensionsTest.createTestCAPExtensions(),
            null,
            serviceInteractionIndicatorsTwo,
            null,
            naOliInfo,
            null,
            null,
            null,
            false);
    AsnOutputStream aos = new AsnOutputStream();
    elem.encodeAll(aos);
    assertTrue(Arrays.equals(aos.toByteArray(), this.getData1()));

    // Digits assistingSSPIPRoutingAddress, Digits correlationID, ScfID scfID, CAPExtensions
    // extensions,
    // Carrier carrier, ServiceInteractionIndicatorsTwo serviceInteractionIndicatorsTwo, Integer
    // callSegmentID, NAOliInfo
    // naOliInfo,
    // LocationNumberCap chargeNumber, OriginalCalledNumberCap originalCalledPartyID,
    // CallingPartyNumberCap
    // callingPartyNumber,
    // boolean isCAPVersion3orLater

    elem =
        new EstablishTemporaryConnectionRequestImpl(
            assistingSSPIPRoutingAddress,
            correlationID,
            scfID,
            CAPExtensionsTest.createTestCAPExtensions(),
            null,
            serviceInteractionIndicatorsTwo,
            8,
            naOliInfo,
            null,
            null,
            null,
            true);
    aos = new AsnOutputStream();
    elem.encodeAll(aos);
    assertTrue(Arrays.equals(aos.toByteArray(), this.getData2()));

    Carrier carrier = new CarrierImpl(getCarrierData());
    LocationNumber locationNumber = new LocationNumberImpl();
    locationNumber.setNatureOfAddresIndicator(LocationNumber._NAI_INTERNATIONAL_NUMBER);
    locationNumber.setAddress("0000077777");
    LocationNumberCap chargeNumber = new LocationNumberCapImpl(locationNumber);
    OriginalCalledNumber originalCalledNumber =
        new OriginalCalledNumberImpl(LocationNumber._NAI_INTERNATIONAL_NUMBER, "1111188888", 0, 0);
    // int natureOfAddresIndicator, String address, int numberingPlanIndicator,
    // int addressRepresentationRestrictedIndicator
    OriginalCalledNumberCap originalCalledPartyID =
        new OriginalCalledNumberCapImpl(originalCalledNumber);
    CallingPartyNumber callingPartyNumber0 =
        new CallingPartyNumberImpl(
            LocationNumber._NAI_INTERNATIONAL_NUMBER, "2222288888", 0, 0, 0, 0);
    CallingPartyNumberCap callingPartyNumber = new CallingPartyNumberCapImpl(callingPartyNumber0);
    elem =
        new EstablishTemporaryConnectionRequestImpl(
            assistingSSPIPRoutingAddress,
            null,
            null,
            null,
            carrier,
            null,
            null,
            null,
            chargeNumber,
            originalCalledPartyID,
            callingPartyNumber,
            true);
    aos = new AsnOutputStream();
    elem.encodeAll(aos);
    assertTrue(Arrays.equals(aos.toByteArray(), this.getData3()));
  }
  @Test(groups = {"functional.decode", "circuitSwitchedCall"})
  public void testDecode() throws Exception {

    byte[] data = this.getData1();
    AsnInputStream ais = new AsnInputStream(data);
    EstablishTemporaryConnectionRequestImpl elem =
        new EstablishTemporaryConnectionRequestImpl(false);
    int tag = ais.readTag();
    elem.decodeAll(ais);

    assertEquals(
        elem.getAssistingSSPIPRoutingAddress().getGenericNumber().getNatureOfAddressIndicator(), 1);
    assertTrue(
        elem.getAssistingSSPIPRoutingAddress().getGenericNumber().getAddress().equals("1122"));
    assertEquals(
        elem.getAssistingSSPIPRoutingAddress().getGenericNumber().getNumberQualifierIndicator(), 1);
    assertEquals(
        elem.getAssistingSSPIPRoutingAddress().getGenericNumber().getNumberingPlanIndicator(), 0);
    assertEquals(
        elem.getAssistingSSPIPRoutingAddress()
            .getGenericNumber()
            .getAddressRepresentationRestrictedIndicator(),
        0);
    assertEquals(
        elem.getAssistingSSPIPRoutingAddress().getGenericNumber().getScreeningIndicator(), 1);
    assertEquals(elem.getCorrelationID().getGenericDigits().getEncodingScheme(), 2);
    assertEquals(elem.getCorrelationID().getGenericDigits().getTypeOfDigits(), 0);
    assertTrue(
        Arrays.equals(
            elem.getCorrelationID().getGenericDigits().getEncodedDigits(),
            getCorrelationIDDigits()));
    assertTrue(Arrays.equals(elem.getScfID().getData(), getScfIDData()));
    assertEquals(
        elem.getServiceInteractionIndicatorsTwo().getBothwayThroughConnectionInd(),
        BothwayThroughConnectionInd.bothwayPathNotRequired);
    assertNull(elem.getCallSegmentID());
    assertEquals((int) elem.getNAOliInfo().getData(), 11);
    assertTrue(CAPExtensionsTest.checkTestCAPExtensions(elem.getExtensions()));
    assertNull(elem.getCarrier());
    assertNull(elem.getChargeNumber());
    assertNull(elem.getOriginalCalledPartyID());
    assertNull(elem.getCallingPartyNumber());

    data = this.getData2();
    ais = new AsnInputStream(data);
    elem = new EstablishTemporaryConnectionRequestImpl(true);
    tag = ais.readTag();
    elem.decodeAll(ais);

    assertEquals(
        elem.getAssistingSSPIPRoutingAddress().getGenericNumber().getNatureOfAddressIndicator(), 1);
    assertTrue(
        elem.getAssistingSSPIPRoutingAddress().getGenericNumber().getAddress().equals("1122"));
    assertEquals(
        elem.getAssistingSSPIPRoutingAddress().getGenericNumber().getNumberQualifierIndicator(), 1);
    assertEquals(
        elem.getAssistingSSPIPRoutingAddress().getGenericNumber().getNumberingPlanIndicator(), 0);
    assertEquals(
        elem.getAssistingSSPIPRoutingAddress()
            .getGenericNumber()
            .getAddressRepresentationRestrictedIndicator(),
        0);
    assertEquals(
        elem.getAssistingSSPIPRoutingAddress().getGenericNumber().getScreeningIndicator(), 1);
    assertEquals(elem.getCorrelationID().getGenericDigits().getEncodingScheme(), 2);
    assertEquals(elem.getCorrelationID().getGenericDigits().getTypeOfDigits(), 0);
    assertTrue(
        Arrays.equals(
            elem.getCorrelationID().getGenericDigits().getEncodedDigits(),
            getCorrelationIDDigits()));
    assertTrue(Arrays.equals(elem.getScfID().getData(), getScfIDData()));
    assertEquals(
        elem.getServiceInteractionIndicatorsTwo().getBothwayThroughConnectionInd(),
        BothwayThroughConnectionInd.bothwayPathNotRequired);
    assertEquals((int) elem.getCallSegmentID(), 8);
    assertEquals((int) elem.getNAOliInfo().getData(), 11);
    assertTrue(CAPExtensionsTest.checkTestCAPExtensions(elem.getExtensions()));
    assertNull(elem.getCarrier());
    assertNull(elem.getChargeNumber());
    assertNull(elem.getOriginalCalledPartyID());
    assertNull(elem.getCallingPartyNumber());

    data = this.getData3();
    ais = new AsnInputStream(data);
    elem = new EstablishTemporaryConnectionRequestImpl(true);
    tag = ais.readTag();
    elem.decodeAll(ais);

    assertEquals(
        elem.getAssistingSSPIPRoutingAddress().getGenericNumber().getNatureOfAddressIndicator(), 1);
    assertTrue(
        elem.getAssistingSSPIPRoutingAddress().getGenericNumber().getAddress().equals("1122"));
    assertEquals(
        elem.getAssistingSSPIPRoutingAddress().getGenericNumber().getNumberQualifierIndicator(), 1);
    assertEquals(
        elem.getAssistingSSPIPRoutingAddress().getGenericNumber().getNumberingPlanIndicator(), 0);
    assertEquals(
        elem.getAssistingSSPIPRoutingAddress()
            .getGenericNumber()
            .getAddressRepresentationRestrictedIndicator(),
        0);
    assertEquals(
        elem.getAssistingSSPIPRoutingAddress().getGenericNumber().getScreeningIndicator(), 1);
    assertNull(elem.getCorrelationID());
    assertNull(elem.getScfID());
    assertNull(elem.getCallSegmentID());
    assertNull(elem.getNAOliInfo());
    assertNull(elem.getExtensions());
    assertEquals(elem.getCarrier().getData(), getCarrierData());
    assertEquals(
        elem.getChargeNumber().getLocationNumber().getNatureOfAddressIndicator(),
        LocationNumber._NAI_INTERNATIONAL_NUMBER);
    assertEquals(elem.getChargeNumber().getLocationNumber().getAddress(), "0000077777");
    assertEquals(
        elem.getOriginalCalledPartyID().getOriginalCalledNumber().getAddress(), "1111188888");
    assertEquals(elem.getCallingPartyNumber().getCallingPartyNumber().getAddress(), "2222288888");
  }