@Test(groups = {"functional.encode"}) public void testEncode() throws Exception { EpcAvImpl d1 = new EpcAvImpl( EpcAvTest.getRandData(), EpcAvTest.getXresData(), EpcAvTest.getAutnData(), EpcAvTest.getKasmeData(), null); EpcAvImpl d2 = new EpcAvImpl( EpcAvTest.getRandData(), getXresData(), EpcAvTest.getAutnData(), EpcAvTest.getKasmeData(), null); ArrayList<EpcAv> arr = new ArrayList<EpcAv>(); arr.add(d1); arr.add(d2); EpsAuthenticationSetListImpl asc = new EpsAuthenticationSetListImpl(arr); AsnOutputStream asnOS = new AsnOutputStream(); asc.encodeAll(asnOS); byte[] encodedData = asnOS.toByteArray(); byte[] rawData = getEncodedData(); assertTrue(Arrays.equals(rawData, encodedData)); }
@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)); }
@Test(groups = {"functional.encode", "service.lsm"}) public void testEncode() throws Exception { byte[] data = getEncodedData(); DeferredLocationEventTypeImpl deferredLocationEventType = new DeferredLocationEventTypeImpl(false, true, false, true); // boolean msAvailable, boolean enteringIntoArea, boolean leavingFromArea, boolean // beingInsideArea ISDNAddressStringImpl networkNodeNumber = new ISDNAddressStringImpl( AddressNature.international_number, NumberingPlan.ISDN, "330044005500"); LCSLocationInfoImpl lcsLocationInfo = new LCSLocationInfoImpl(networkNodeNumber, null, null, false, null, null, null, null, null); DeferredmtlrDataImpl imp = new DeferredmtlrDataImpl( deferredLocationEventType, TerminationCause.mtlrRestart, lcsLocationInfo); // DeferredLocationEventType deferredLocationEventType, TerminationCause terminationCause, // LCSLocationInfo // lcsLocationInfo AsnOutputStream asnOS = new AsnOutputStream(); imp.encodeAll(asnOS); byte[] encodedData = asnOS.toByteArray(); assertTrue(Arrays.equals(data, encodedData)); }
@Test(groups = {"functional.encode", "primitives"}) public void testEncode() throws Exception { // Option 0 TransferredVolumeRollOverImpl transferredVolumeRollOver = new TransferredVolumeRollOverImpl(new Integer(25)); ChargingRollOverImpl prim = new ChargingRollOverImpl(transferredVolumeRollOver); AsnOutputStream asn = new AsnOutputStream(); prim.encodeAll(asn); assertTrue(Arrays.equals(asn.toByteArray(), this.getData())); // Option 1 ROVolumeIfTariffSwitchImpl roVolumeIfTariffSwitch = new ROVolumeIfTariffSwitchImpl(new Integer(12), new Integer(24)); transferredVolumeRollOver = new TransferredVolumeRollOverImpl(roVolumeIfTariffSwitch); prim = new ChargingRollOverImpl(transferredVolumeRollOver); asn = new AsnOutputStream(); prim.encodeAll(asn); assertTrue(Arrays.equals(asn.toByteArray(), this.getData1())); // Option 2 ElapsedTimeRollOverImpl elapsedTimeRollOver = new ElapsedTimeRollOverImpl(new Integer(24)); prim = new ChargingRollOverImpl(elapsedTimeRollOver); asn = new AsnOutputStream(); prim.encodeAll(asn); assertTrue(Arrays.equals(asn.toByteArray(), this.getData2())); // Option 3 ROTimeGPRSIfTariffSwitchImpl roTimeGPRSIfTariffSwitch = new ROTimeGPRSIfTariffSwitchImpl(new Integer(12), new Integer(24)); elapsedTimeRollOver = new ElapsedTimeRollOverImpl(roTimeGPRSIfTariffSwitch); prim = new ChargingRollOverImpl(elapsedTimeRollOver); asn = new AsnOutputStream(); prim.encodeAll(asn); assertTrue(Arrays.equals(asn.toByteArray(), this.getData3())); }
public void encode(AsnOutputStream aos) throws EncodeException { try { aos.writeTag(Tag.CLASS_APPLICATION, false, _TAG); int pos = aos.StartContentDefiniteLength(); if (this.dialogAPDU == null) { throw new EncodeException( "No APDU in DialogPortion is defined when encoding DialogPortion"); } if (this.getOidValue() == null) { throw new EncodeException( "No setUnidirectional() for DialogPortion is defined when encoding DialogPortion"); } AsnOutputStream aos2 = new AsnOutputStream(); dialogAPDU.encode(aos2); ext.setEncodeType(aos2.toByteArray()); ext.encode(aos); aos.FinalizeContent(pos); } catch (AsnException e) { throw new EncodeException("AsnException when encoding DialogPortion: " + e.getMessage(), e); } }
@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())); }
@Override public Long addSendRoutingInfoForGprsRequest( int customInvokeTimeout, IMSI imsi, GSNAddress ggsnAddress, ISDNAddressString ggsnNumber, MAPExtensionContainer extensionContainer) throws MAPException { if ((this.appCntx.getApplicationContextName() != MAPApplicationContextName.gprsLocationInfoRetrievalContext) || (this.appCntx.getApplicationContextVersion() != MAPApplicationContextVersion.version3 && this.appCntx.getApplicationContextVersion() != MAPApplicationContextVersion.version4)) throw new MAPException( "Bad application context name for addSendRoutingInfoForGprsRequest: must be gprsLocationInfoRetrievalContext_V3 or V4"); Invoke invoke = this.mapProviderImpl .getTCAPProvider() .getComponentPrimitiveFactory() .createTCInvokeRequest(); if (customInvokeTimeout == _Timer_Default) invoke.setTimeout(_Timer_m); else invoke.setTimeout(customInvokeTimeout); OperationCode oc = this.mapProviderImpl.getTCAPProvider().getComponentPrimitiveFactory().createOperationCode(); oc.setLocalOperationCode((long) MAPOperationCode.sendRoutingInfoForGprs); invoke.setOperationCode(oc); SendRoutingInfoForGprsRequestImpl req = new SendRoutingInfoForGprsRequestImpl(imsi, ggsnAddress, ggsnNumber, extensionContainer); AsnOutputStream aos = new AsnOutputStream(); req.encodeData(aos); Parameter p = this.mapProviderImpl.getTCAPProvider().getComponentPrimitiveFactory().createParameter(); p.setTagClass(req.getTagClass()); p.setPrimitive(req.getIsPrimitive()); p.setTag(req.getTag()); p.setData(aos.toByteArray()); invoke.setParameter(p); Long invokeId; try { invokeId = this.tcapDialog.getNewInvokeId(); invoke.setInvokeId(invokeId); } catch (TCAPException e) { throw new MAPException(e.getMessage(), e); } this.sendInvokeComponent(invoke); return invokeId; }
public void encodeAll(AsnOutputStream asnOs, int tagClass, int tag) throws MAPException { try { asnOs.writeTag(tagClass, false, tag); int pos = asnOs.StartContentDefiniteLength(); this.encodeData(asnOs); asnOs.FinalizeContent(pos); } catch (AsnException e) { throw new MAPException("AsnException when encoding UnstructuredSSResponseIndication", e); } }
/* * (non-Javadoc) * * @see org.mobicents.protocols.ss7.map.api.primitives.MAPAsnPrimitive#encodeAll * (org.mobicents.protocols.asn.AsnOutputStream, int, int) */ public void encodeAll(AsnOutputStream asnOs, int tagClass, int tag) throws MAPException { try { asnOs.writeTag(tagClass, true, tag); int pos = asnOs.StartContentDefiniteLength(); this.encodeData(asnOs); asnOs.FinalizeContent(pos); } catch (AsnException e) { throw new MAPException( "AsnException when encoding " + _PrimitiveName + ": " + e.getMessage(), e); } }
@Test(groups = {"functional.encode", "circuitSwitchedCall.primitive"}) public void testEncode() throws Exception { CauseCapImpl cause = new CauseCapImpl(this.getIntData()); TDisconnectSpecificInfoImpl elem = new TDisconnectSpecificInfoImpl(cause); AsnOutputStream aos = new AsnOutputStream(); elem.encodeAll( aos, Tag.CLASS_CONTEXT_SPECIFIC, EventSpecificInformationBCSMImpl._ID_tDisconnectSpecificInfo); assertEquals(aos.toByteArray(), this.getData()); }
@Test(groups = {"functional.encode", "circuitSwitchedCall"}) public void testEncode() throws Exception { SendingSideIDImpl partyToCharge = new SendingSideIDImpl(LegType.leg2); FreeFormatData ffd = new FreeFormatDataImpl(getDataFFD()); FCIBCCCAMELsequence1Impl fci = new FCIBCCCAMELsequence1Impl(ffd, partyToCharge, AppendFreeFormatData.append); FurnishChargingInformationRequestImpl elem = new FurnishChargingInformationRequestImpl(fci); AsnOutputStream aos = new AsnOutputStream(); elem.encodeAll(aos); assertTrue(Arrays.equals(aos.toByteArray(), this.getData1())); }
@Test(groups = {"functional.encode", "primitives"}) public void testEncode() throws Exception { ExtBearerServiceCodeImpl b = new ExtBearerServiceCodeImpl(BearerServiceCodeValue.padAccessCA_9600bps); ExtBasicServiceCodeImpl basicService = new ExtBasicServiceCodeImpl(b); MAPExtensionContainer extensionContainer = MAPExtensionContainerTest.GetTestExtensionContainer(); ExtSSStatusImpl ssStatus = new ExtSSStatusImpl(false, false, true, true); ISDNAddressString forwardedToNumber = new ISDNAddressStringImpl(AddressNature.international_number, NumberingPlan.ISDN, "22228"); ISDNSubaddressString forwardedToSubaddress = new ISDNSubaddressStringImpl(this.getISDNSubaddressStringData()); ExtForwOptions forwardingOptions = new ExtForwOptionsImpl(true, false, true, ExtForwOptionsForwardingReason.msBusy); Integer noReplyConditionTime = new Integer(2); FTNAddressString longForwardedToNumber = new FTNAddressStringImpl(AddressNature.international_number, NumberingPlan.ISDN, "22227"); ExtForwFeatureImpl prim = new ExtForwFeatureImpl( basicService, ssStatus, forwardedToNumber, forwardedToSubaddress, forwardingOptions, noReplyConditionTime, extensionContainer, longForwardedToNumber); AsnOutputStream asn = new AsnOutputStream(); prim.encodeAll(asn); assertTrue(Arrays.equals(asn.toByteArray(), this.getData())); basicService = new ExtBasicServiceCodeImpl( new ExtTeleserviceCodeImpl(TeleserviceCodeValue.allSpeechTransmissionServices)); ssStatus = new ExtSSStatusImpl(true, true, true, true); forwardedToNumber = new ISDNAddressStringImpl( AddressNature.international_number, NumberingPlan.ISDN, "999888777"); forwardingOptions = new ExtForwOptionsImpl(false, false, false, ExtForwOptionsForwardingReason.msNotReachable); prim = new ExtForwFeatureImpl( basicService, ssStatus, forwardedToNumber, null, forwardingOptions, null, null, null); asn = new AsnOutputStream(); prim.encodeAll(asn); assertTrue(Arrays.equals(asn.toByteArray(), this.getData2())); }
@Test(groups = {"functional.encode", "subscriberInformation"}) public void testEncode() throws Exception { GeodeticInformationImpl impl = new GeodeticInformationImpl( 3, TypeOfShape.EllipsoidPointWithUncertaintyCircle, 21.5, 171, 0, 11); AsnOutputStream asnOS = new AsnOutputStream(); impl.encodeAll(asnOS); byte[] encodedData = asnOS.toByteArray(); byte[] rawData = getEncodedData(); assertTrue(Arrays.equals(rawData, encodedData)); }
@Test(groups = {"functional.encode", "primitives"}) public void testEncode() throws Exception { AccessRestrictionDataImpl imp = new AccessRestrictionDataImpl(false, true, false, true, false, true); AsnOutputStream asnOS = new AsnOutputStream(); imp.encodeAll(asnOS); assertTrue(Arrays.equals(getData(), asnOS.toByteArray())); imp = new AccessRestrictionDataImpl(true, false, true, false, true, false); asnOS = new AsnOutputStream(); imp.encodeAll(asnOS); assertTrue(Arrays.equals(getData1(), asnOS.toByteArray())); }
@Test(groups = {"functional.encode", "subscriberInformation"}) public void testEncode() throws Exception { ExtBasicServiceCode extBasicServiceCode = new ExtBasicServiceCodeImpl( new ExtTeleserviceCodeImpl(TeleserviceCodeValue.allShortMessageServices)); ExtCwFeatureImpl extCwFeature = new ExtCwFeatureImpl(extBasicServiceCode, new ExtSSStatusImpl(true, true, false, false)); AsnOutputStream asnOS = new AsnOutputStream(); extCwFeature.encodeAll(asnOS); byte[] encodedData = asnOS.toByteArray(); assertTrue(Arrays.equals(data, encodedData)); }
@Test(groups = {"functional.encode", "service.supplementary"}) public void testEncode() throws Exception { PasswordImpl pass = new PasswordImpl("0123"); GetPasswordResponseImpl impl = new GetPasswordResponseImpl(pass); AsnOutputStream asnOS = new AsnOutputStream(); impl.encodeAll(asnOS); byte[] encodedData = asnOS.toByteArray(); byte[] rawData = getEncodedData(); assertTrue(Arrays.equals(rawData, encodedData)); }
@Test(groups = {"functional.encode", "service.lsm"}) public void testEncode() throws Exception { SupportedGADShapesImpl supportedLCSCapabilityTest = new SupportedGADShapesImpl(true, true, true, true, true, true, true); AsnOutputStream asnOS = new AsnOutputStream(); supportedLCSCapabilityTest.encodeAll(asnOS); byte[] encodedData = asnOS.toByteArray(); byte[] rawData = getEncodedData(); assertTrue(Arrays.equals(rawData, encodedData)); }
@Test(groups = {"functional.encode", "service.sms"}) public void testEncode() throws Exception { ReadyForSMResponseImpl impl = new ReadyForSMResponseImpl(MAPExtensionContainerTest.GetTestExtensionContainer()); AsnOutputStream asnOS = new AsnOutputStream(); impl.encodeAll(asnOS); byte[] encodedData = asnOS.toByteArray(); byte[] rawData = getEncodedData(); assertTrue(Arrays.equals(rawData, encodedData)); }
@Test(groups = {"functional.encode", "service.oam"}) public void testEncode() throws Exception { PGWInterfaceListImpl asc = new PGWInterfaceListImpl(true, false, true, false, true, true, false, true); // boolean s2a, boolean s2b, boolean s2c, boolean s5, boolean s6b, // boolean gx, boolean s8b, boolean sgi AsnOutputStream asnOS = new AsnOutputStream(); asc.encodeAll(asnOS); byte[] encodedData = asnOS.toByteArray(); byte[] rawData = getEncodedData(); assertTrue(Arrays.equals(rawData, encodedData)); }
@Override public void encode(AsnOutputStream aos) throws EncodeException { try { aos.writeTag(Tag.CLASS_CONTEXT_SPECIFIC, false, 20); int pos = aos.StartContentDefiniteLength(); aos.writeNull(); aos.FinalizeContent(pos); } catch (IOException e) { throw new EncodeException("IOException while encoding Reject: " + e.getMessage(), e); } catch (AsnException e) { throw new EncodeException("AsnException while encoding Reject: " + e.getMessage(), e); } }
@Override public void encode(AsnOutputStream aos) throws EncodeException { try { aos.writeTag(Tag.CLASS_CONTEXT_SPECIFIC, false, _TAG); int pos = aos.StartContentDefiniteLength(); OperationCode oc = new OperationCodeImpl(); oc.setLocalOperationCode(20L); oc.encode(aos); aos.FinalizeContent(pos); } catch (AsnException e) { throw new EncodeException("AsnException while encoding Invoke: " + e.getMessage(), e); } }
@Override public void encodeData(AsnOutputStream asnOs) throws MAPException { if (data == null) throw new MAPException("Error while encoding " + _PrimitiveName + ": data is not provided."); if (data.length() != 4) throw new MAPException( "Error while encoding " + _PrimitiveName + ": data length is wrong, must be 4, found:" + data.length()); for (int i1 = 0; i1 < data.length(); i1++) { if (!Character.isDigit(data.charAt(i1))) { throw new MAPException( "Error while encoding " + _PrimitiveName + ": data content must be only digital, found char:" + data.charAt(i1)); } } try { asnOs.writeStringIA5Data(data); } catch (IOException e) { throw new MAPException( "IOException when encoding " + _PrimitiveName + ": " + e.getMessage(), e); } catch (AsnException e) { throw new MAPException( "AsnException when encoding " + _PrimitiveName + ": " + e.getMessage(), e); } }
@Test(groups = {"functional.encode", "primitives"}) public void testEncode() throws Exception { MAPExtensionContainer extensionContainer = MAPExtensionContainerTest.GetTestExtensionContainer(); QoSClassIdentifier qoSClassIdentifier = QoSClassIdentifier.QCI_1; AllocationRetentionPriority allocationRetentionPriority = new AllocationRetentionPriorityImpl(1, Boolean.TRUE, Boolean.TRUE, extensionContainer); EPSQoSSubscribedImpl prim = new EPSQoSSubscribedImpl( qoSClassIdentifier, allocationRetentionPriority, extensionContainer); AsnOutputStream asn = new AsnOutputStream(); prim.encodeAll(asn); assertTrue(Arrays.equals(asn.toByteArray(), this.getData())); }
@Override public void addSendRoutingInfoForGprsResponse( long invokeId, GSNAddress sgsnAddress, GSNAddress ggsnAddress, Integer mobileNotReachableReason, MAPExtensionContainer extensionContainer) throws MAPException { if ((this.appCntx.getApplicationContextName() != MAPApplicationContextName.gprsLocationInfoRetrievalContext) || (this.appCntx.getApplicationContextVersion() != MAPApplicationContextVersion.version3 && this.appCntx.getApplicationContextVersion() != MAPApplicationContextVersion.version4)) throw new MAPException( "Bad application context name for addSendRoutingInfoForGprsResponse: must be gprsLocationInfoRetrievalContext_V3 or V4"); ReturnResultLast resultLast = this.mapProviderImpl .getTCAPProvider() .getComponentPrimitiveFactory() .createTCResultLastRequest(); resultLast.setInvokeId(invokeId); // Operation Code OperationCode oc = this.mapProviderImpl.getTCAPProvider().getComponentPrimitiveFactory().createOperationCode(); oc.setLocalOperationCode((long) MAPOperationCode.sendRoutingInfoForGprs); resultLast.setOperationCode(oc); SendRoutingInfoForGprsResponseImpl resp = new SendRoutingInfoForGprsResponseImpl( sgsnAddress, ggsnAddress, mobileNotReachableReason, extensionContainer); AsnOutputStream aos = new AsnOutputStream(); resp.encodeData(aos); Parameter p = this.mapProviderImpl.getTCAPProvider().getComponentPrimitiveFactory().createParameter(); p.setTagClass(resp.getTagClass()); p.setPrimitive(resp.getIsPrimitive()); p.setTag(resp.getTag()); p.setData(aos.toByteArray()); resultLast.setParameter(p); this.sendReturnResultLastComponent(resultLast); }
@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 }
/* * (non-Javadoc) * * @see org.mobicents.protocols.ss7.map.primitives.MAPAsnPrimitive#encodeData (org.mobicents.protocols.asn.AsnOutputStream) */ public void encodeData(AsnOutputStream asnOs) throws MAPException { if (this.ssCode == null) throw new MAPException("Error while encoding " + _PrimitiveName + ": ssCode required."); if (this.ssStatus == null) throw new MAPException("Error while encoding " + _PrimitiveName + ": ssStatus required."); if (this.basicServiceGroupList != null && (this.basicServiceGroupList.size() < 1 || this.basicServiceGroupList.size() > 32)) { throw new MAPException( "Error while encoding " + _PrimitiveName + ": Parameter basicServiceGroupList size must be from 1 to 32, found: " + this.basicServiceGroupList.size()); } try { ((SSCodeImpl) this.ssCode).encodeAll(asnOs); ((ExtSSStatusImpl) this.ssStatus) .encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC, _TAG_ss_Status); if (this.ssSubscriptionOption != null) { ((SSSubscriptionOptionImpl) this.ssSubscriptionOption).encodeAll(asnOs); } if (this.basicServiceGroupList != null) { asnOs.writeTag(Tag.CLASS_UNIVERSAL, false, Tag.SEQUENCE); int pos = asnOs.StartContentDefiniteLength(); for (ExtBasicServiceCode serviceItem : this.basicServiceGroupList) { ((ExtBasicServiceCodeImpl) serviceItem).encodeAll(asnOs); } asnOs.FinalizeContent(pos); } if (this.extensionContainer != null) ((MAPExtensionContainerImpl) this.extensionContainer) .encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC, _TAG_extensionContainer); } catch (AsnException e) { throw new MAPException( "AsnException when encoding " + _PrimitiveName + ": " + e.getMessage(), e); } }
@Test(groups = {"functional.decode", "primitives"}) public void testEncode() throws Exception { LAIFixedLengthImpl lai = new LAIFixedLengthImpl(249, 1, 14010); LocationAreaImpl prim = new LocationAreaImpl(lai); AsnOutputStream asn = new AsnOutputStream(); prim.encodeAll(asn); assertTrue(Arrays.equals(asn.toByteArray(), this.getData1())); LAC lac = new LACImpl(14010); prim = new LocationAreaImpl(lac); asn = new AsnOutputStream(); prim.encodeAll(asn); assertTrue(Arrays.equals(asn.toByteArray(), this.getData2())); }
@Override public void encodeData(AsnOutputStream asnOs) throws CAPException { if (this.maxTransferredVolume == -1 && this.maxElapsedTime == -1 || this.maxTransferredVolume != -1 && this.maxElapsedTime != -1) { throw new CAPException( "Error while decoding " + _PrimitiveName + ": One and only one choice must be selected"); } try { if (this.maxTransferredVolume != -1) { asnOs.writeIntegerData(this.maxTransferredVolume); } else { asnOs.writeIntegerData(this.maxElapsedTime); } } catch (IOException e) { throw new CAPException( "IOException when encoding " + _PrimitiveName + ": " + e.getMessage(), e); } }
/* * (non-Javadoc) * * @see org.mobicents.protocols.ss7.tcap.asn.Encodable#encode(org.mobicents.protocols .asn.AsnOutputStream) */ public void encode(AsnOutputStream aos) throws EncodeException { try { aos.writeOctetString( Tag.CLASS_PRIVATE, ProtocolVersion._TAG_PROTOCOL_VERSION, new byte[] {(byte) this.data}); } catch (IOException e) { throw new EncodeException("IOException while encoding ProtocolVersion: " + e.getMessage(), e); } catch (AsnException e) { throw new EncodeException( "AsnException while encoding ProtocolVersion: " + e.getMessage(), e); } }
@Test(groups = {"functional.encode", "dialog"}) public void testEncode() throws Exception { MAPRefuseInfoImpl mapRefuseInfoImpl = new MAPRefuseInfoImpl(); mapRefuseInfoImpl.setReason(Reason.noReasonGiven); AsnOutputStream asnOS = new AsnOutputStream(); mapRefuseInfoImpl.encodeAll(asnOS); byte[] data = asnOS.toByteArray(); assertTrue(Arrays.equals(this.getData(), data)); mapRefuseInfoImpl = new MAPRefuseInfoImpl(); mapRefuseInfoImpl.setReason(Reason.invalidOriginatingReference); ApplicationContextName acn = new ApplicationContextNameImpl(); acn.setOid(new long[] {1, 2, 3, 4, 5, 6}); mapRefuseInfoImpl.setAlternativeAcn(acn); mapRefuseInfoImpl.setExtensionContainer(MAPExtensionContainerTest.GetTestExtensionContainer()); asnOS = new AsnOutputStream(); mapRefuseInfoImpl.encodeAll(asnOS); data = asnOS.toByteArray(); assertTrue(Arrays.equals(this.getDataFull(), data)); }