@Test(groups = {"functional.decode", "circuitSwitchedCall.primitive"}) public void testDecode() throws Exception { byte[] data = this.getData(); AsnInputStream ais = new AsnInputStream(data); TDisconnectSpecificInfoImpl elem = new TDisconnectSpecificInfoImpl(); int tag = ais.readTag(); assertEquals(tag, EventSpecificInformationBCSMImpl._ID_tDisconnectSpecificInfo); assertEquals(ais.getTagClass(), Tag.CLASS_CONTEXT_SPECIFIC); elem.decodeAll(ais); assertTrue(Arrays.equals(elem.getReleaseCause().getData(), this.getIntData())); }
@Test(groups = {"functional.xml.serialize", "circuitSwitchedCall.primitive"}) public void testXMLSerializaion() throws Exception { CauseIndicatorsImpl prim = new CauseIndicatorsImpl( CauseIndicators._CODING_STANDARD_ITUT, CauseIndicators._LOCATION_PRIVATE_NSRU, 0, CauseIndicators._CV_CALL_REJECTED, null); CauseCapImpl cause = new CauseCapImpl(prim); TDisconnectSpecificInfoImpl original = new TDisconnectSpecificInfoImpl(cause); // Writes the area to a file. ByteArrayOutputStream baos = new ByteArrayOutputStream(); XMLObjectWriter writer = XMLObjectWriter.newInstance(baos); // writer.setBinding(binding); // Optional. writer.setIndentation("\t"); // Optional (use tabulation for // indentation). writer.write(original, "tDisconnectSpecificInfo", TDisconnectSpecificInfoImpl.class); writer.close(); byte[] rawData = baos.toByteArray(); String serializedEvent = new String(rawData); System.out.println(serializedEvent); ByteArrayInputStream bais = new ByteArrayInputStream(rawData); XMLObjectReader reader = XMLObjectReader.newInstance(bais); TDisconnectSpecificInfoImpl copy = reader.read("tDisconnectSpecificInfo", TDisconnectSpecificInfoImpl.class); assertEquals( copy.getReleaseCause().getCauseIndicators().getLocation(), original.getReleaseCause().getCauseIndicators().getLocation()); assertEquals( copy.getReleaseCause().getCauseIndicators().getCauseValue(), original.getReleaseCause().getCauseIndicators().getCauseValue()); assertEquals( copy.getReleaseCause().getCauseIndicators().getCodingStandard(), original.getReleaseCause().getCauseIndicators().getCodingStandard()); }