Revision: ea0dfdc13e29
Author: Sergey Vetyutnev <[email protected]>
Date: Sun Dec 2 01:23:46 2012
Log: insertSubscriberInfo - some extra tests from live traces
http://code.google.com/p/jss7/source/detail?r=ea0dfdc13e29
Modified:
/map/map-impl/src/test/java/org/mobicents/protocols/ss7/map/service/mobility/subscriberManagement/ExtBasicServiceCodeTest.java
/map/map-impl/src/test/java/org/mobicents/protocols/ss7/map/service/mobility/subscriberManagement/ExtForwFeatureTest.java
/map/map-impl/src/test/java/org/mobicents/protocols/ss7/map/service/mobility/subscriberManagement/ExtForwInfoTest.java
/map/map-impl/src/test/java/org/mobicents/protocols/ss7/map/service/mobility/subscriberManagement/ExtForwOptionsTest.java
/map/map-impl/src/test/java/org/mobicents/protocols/ss7/map/service/mobility/subscriberManagement/ExtSSStatusTest.java
/map/map-impl/src/test/java/org/mobicents/protocols/ss7/map/service/mobility/subscriberManagement/ExtTeleserviceCodeTest.java
=======================================
---
/map/map-impl/src/test/java/org/mobicents/protocols/ss7/map/service/mobility/subscriberManagement/ExtBasicServiceCodeTest.java
Wed May 30 09:05:18 2012
+++
/map/map-impl/src/test/java/org/mobicents/protocols/ss7/map/service/mobility/subscriberManagement/ExtBasicServiceCodeTest.java
Sun Dec 2 01:23:46 2012
@@ -28,6 +28,7 @@
import org.mobicents.protocols.asn.AsnInputStream;
import org.mobicents.protocols.asn.AsnOutputStream;
+import
org.mobicents.protocols.ss7.map.api.service.mobility.subscriberManagement.TeleserviceCodeValue;
import
org.mobicents.protocols.ss7.map.service.mobility.subscriberManagement.ExtBasicServiceCodeImpl;
import
org.mobicents.protocols.ss7.map.service.mobility.subscriberManagement.ExtBearerServiceCodeImpl;
import
org.mobicents.protocols.ss7.map.service.mobility.subscriberManagement.ExtTeleserviceCodeImpl;
@@ -47,6 +48,10 @@
private byte[] getEncodedData2() {
return new byte[] { (byte) 131, 1, 17 };
}
+
+ private byte[] getEncodedData3() {
+ return new byte[] { (byte) 131, 1, 16 };
+ }
private byte[] getData1() {
return new byte[] { 22 };
@@ -74,6 +79,14 @@
impl.decodeAll(asn);
assertTrue(Arrays.equals(impl.getExtTeleservice().getData(),
this.getData2()));
assertNull(impl.getExtBearerService());
+
+ rawData = getEncodedData3();
+ asn = new AsnInputStream(rawData);
+ tag = asn.readTag();
+ impl = new ExtBasicServiceCodeImpl();
+ impl.decodeAll(asn);
+ assertEquals(impl.getExtTeleservice().getTeleserviceCodeValue(),
TeleserviceCodeValue.allSpeechTransmissionServices);
+ assertNull(impl.getExtBearerService());
}
@Test(groups = { "functional.encode","primitives"})
@@ -98,5 +111,15 @@
byte[] rawData = getEncodedData2();
assertTrue(Arrays.equals(rawData, encodedData));
}
+
+ {
+ ExtTeleserviceCodeImpl b = new
ExtTeleserviceCodeImpl(TeleserviceCodeValue.allSpeechTransmissionServices);
+ ExtBasicServiceCodeImpl impl = new
ExtBasicServiceCodeImpl(b);
+ AsnOutputStream asnOS = new AsnOutputStream();
+ impl.encodeAll(asnOS);
+ byte[] encodedData = asnOS.toByteArray();
+ byte[] rawData = getEncodedData3();
+ assertTrue(Arrays.equals(rawData, encodedData));
+ }
}
}
=======================================
---
/map/map-impl/src/test/java/org/mobicents/protocols/ss7/map/service/mobility/subscriberManagement/ExtForwFeatureTest.java
Fri Nov 30 10:02:31 2012
+++
/map/map-impl/src/test/java/org/mobicents/protocols/ss7/map/service/mobility/subscriberManagement/ExtForwFeatureTest.java
Sun Dec 2 01:23:46 2012
@@ -21,10 +21,7 @@
*/
package
org.mobicents.protocols.ss7.map.service.mobility.subscriberManagement;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertNull;
-import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.*;
import java.util.Arrays;
@@ -40,6 +37,7 @@
import
org.mobicents.protocols.ss7.map.api.service.mobility.subscriberManagement.BearerServiceCodeValue;
import
org.mobicents.protocols.ss7.map.api.service.mobility.subscriberManagement.ExtForwOptions;
import
org.mobicents.protocols.ss7.map.api.service.mobility.subscriberManagement.ExtForwOptionsForwardingReason;
+import
org.mobicents.protocols.ss7.map.api.service.mobility.subscriberManagement.TeleserviceCodeValue;
import org.mobicents.protocols.ss7.map.primitives.FTNAddressStringImpl;
import org.mobicents.protocols.ss7.map.primitives.ISDNAddressStringImpl;
import org.mobicents.protocols.ss7.map.primitives.ISDNSubaddressStringImpl;
@@ -60,6 +58,11 @@
42, 3, 6, 48, 11, 6, 3, 42, 3, 5, 21, 22, 23,
24, 25, 26, -95,
3, 31, 32, 33, -118, 4, -111, 34, 34, -9 };
};
+
+ public byte[] getData2() {
+ return new byte[] { 48, 17, (byte) 131, 1, 16, (byte) 132, 1, 15, (byte)
133, 6, (byte) 145, (byte) 153, (byte) 137, (byte) 136, 119, (byte) 247,
+ (byte) 134, 1, 0 };
+ };
private byte[] getISDNSubaddressStringData() {
return new byte[] { 2,5 };
@@ -106,6 +109,41 @@
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);
}
@Test(groups = { "functional.encode", "primitives" })
@@ -131,5 +169,18 @@
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()));
}
}
=======================================
---
/map/map-impl/src/test/java/org/mobicents/protocols/ss7/map/service/mobility/subscriberManagement/ExtForwInfoTest.java
Fri Nov 30 10:02:31 2012
+++
/map/map-impl/src/test/java/org/mobicents/protocols/ss7/map/service/mobility/subscriberManagement/ExtForwInfoTest.java
Sun Dec 2 01:23:46 2012
@@ -42,6 +42,7 @@
import
org.mobicents.protocols.ss7.map.api.service.mobility.subscriberManagement.ExtForwFeature;
import
org.mobicents.protocols.ss7.map.api.service.mobility.subscriberManagement.ExtForwOptions;
import
org.mobicents.protocols.ss7.map.api.service.mobility.subscriberManagement.ExtForwOptionsForwardingReason;
+import
org.mobicents.protocols.ss7.map.api.service.mobility.subscriberManagement.TeleserviceCodeValue;
import org.mobicents.protocols.ss7.map.api.service.supplementary.SSCode;
import
org.mobicents.protocols.ss7.map.api.service.supplementary.SupplementaryCodeValue;
import org.mobicents.protocols.ss7.map.primitives.FTNAddressStringImpl;
@@ -70,8 +71,13 @@
23, 24, 25, 26, -95, 3, 31, 32, 33 };
};
+ public byte[] getData2() {
+ return new byte[] { (byte) 160, 24, 4, 1, 43, 48, 19, 48, 17, (byte)
131, 1, 16, (byte) 132, 1, 15, (byte) 133, 6, (byte) 145, (byte) 136, 120,
119,
+ (byte) 153, (byte) 249, (byte) 134, 1, 0 };
+ };
+
private byte[] getISDNSubaddressStringData() {
- return new byte[] { 2,5 };
+ return new byte[] { 2, 5 };
}
@Test(groups = { "functional.decode", "primitives" })
@@ -79,12 +85,12 @@
byte[] data = this.getData();
AsnInputStream asn = new AsnInputStream(data);
int tag = asn.readTag();
+ assertEquals(tag, Tag.SEQUENCE);
+ assertEquals(asn.getTagClass(), Tag.CLASS_UNIVERSAL);
+
ExtForwInfoImpl prim = new ExtForwInfoImpl();
prim.decodeAll(asn);
- assertEquals(tag, Tag.SEQUENCE);
- assertEquals(asn.getTagClass(), Tag.CLASS_UNIVERSAL);
-
MAPExtensionContainer extensionContainer =
prim.getExtensionContainer();
assertEquals(prim.getSsCode().getSupplementaryCodeValue(),
SupplementaryCodeValue.allServices);
@@ -125,11 +131,34 @@
assertNotNull(extensionContainer);
assertTrue(MAPExtensionContainerTest.CheckTestExtensionContainer(extensionContainer));
+
+ data = this.getData2();
+ asn = new AsnInputStream(data);
+ tag = asn.readTag();
+ assertEquals(tag, 0);
+ assertEquals(asn.getTagClass(), Tag.CLASS_CONTEXT_SPECIFIC);
+
+ prim = new ExtForwInfoImpl();
+ prim.decodeAll(asn);
+
+ extensionContainer = prim.getExtensionContainer();
+ assertEquals(prim.getSsCode().getData(), 43);
+
+ forwardingFeatureList = prim.getForwardingFeatureList();;
+ assertNotNull(forwardingFeatureList);
+ assertTrue(forwardingFeatureList.size() == 1);
+ extForwFeature = forwardingFeatureList.get(0);
+ assertNotNull(extForwFeature);
+
+
assertEquals(extForwFeature.getBasicService().getExtTeleservice().getTeleserviceCodeValue(),
TeleserviceCodeValue.allSpeechTransmissionServices);
+
assertNull(extForwFeature.getBasicService().getExtBearerService());
+
+ assertNull(extensionContainer);
}
@Test(groups = { "functional.encode", "primitives" })
public void testEncode() throws Exception {
-
+
ExtBearerServiceCodeImpl b = new
ExtBearerServiceCodeImpl(BearerServiceCodeValue.Asynchronous9_6kbps);
ExtBasicServiceCodeImpl basicService = new
ExtBasicServiceCodeImpl(b);
MAPExtensionContainer extensionContainer =
MAPExtensionContainerTest.GetTestExtensionContainer();
@@ -155,5 +184,20 @@
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, "888777999");
+ forwardingOptions = new ExtForwOptionsImpl(false, false, false,
ExtForwOptionsForwardingReason.msNotReachable);
+ extForwFeature = new ExtForwFeatureImpl(basicService, ssStatus,
forwardedToNumber, null, forwardingOptions, null, null, null);
+ ssCode = new SSCodeImpl(43);
+ forwardingFeatureList = new ArrayList<ExtForwFeature>();
+ forwardingFeatureList.add(extForwFeature);
+ prim = new ExtForwInfoImpl(ssCode, forwardingFeatureList, null);
+ asn = new AsnOutputStream();
+ prim.encodeAll(asn, Tag.CLASS_CONTEXT_SPECIFIC, 0);
+
+ assertTrue(Arrays.equals(asn.toByteArray(), this.getData2()));
}
}
=======================================
---
/map/map-impl/src/test/java/org/mobicents/protocols/ss7/map/service/mobility/subscriberManagement/ExtForwOptionsTest.java
Fri Nov 30 10:02:31 2012
+++
/map/map-impl/src/test/java/org/mobicents/protocols/ss7/map/service/mobility/subscriberManagement/ExtForwOptionsTest.java
Sun Dec 2 01:23:46 2012
@@ -21,8 +21,7 @@
*/
package
org.mobicents.protocols.ss7.map.service.mobility.subscriberManagement;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.*;
import java.util.Arrays;
@@ -39,11 +38,15 @@
*
*/
public class ExtForwOptionsTest {
-
+
public byte[] getData() {
return new byte[] {4, 1, -92 };
};
+ public byte[] getData2() {
+ return new byte[] { (byte) 134, 1, 0 };
+ };
+
@Test(groups = { "functional.decode", "primitives" })
public void testDecode() throws Exception {
byte[] data = this.getData();
@@ -59,6 +62,21 @@
assertTrue(prim.getNotificationToForwardingParty());
assertTrue(!prim.getRedirectingPresentation());
assertEquals(prim.getExtForwOptionsForwardingReason(),
ExtForwOptionsForwardingReason.msBusy);
+
+
+ data = this.getData2();
+ asn = new AsnInputStream(data);
+ tag = asn.readTag();
+ prim = new ExtForwOptionsImpl();
+ prim.decodeAll(asn);
+
+ assertEquals(tag, 6);
+ assertEquals(asn.getTagClass(), Tag.CLASS_CONTEXT_SPECIFIC);
+
+ assertFalse(prim.getNotificationToCallingParty());
+ assertFalse(prim.getNotificationToForwardingParty());
+ assertFalse(prim.getRedirectingPresentation());
+ assertEquals(prim.getExtForwOptionsForwardingReason(),
ExtForwOptionsForwardingReason.msNotReachable);
}
@Test(groups = { "functional.encode", "primitives" })
@@ -69,5 +87,13 @@
prim.encodeAll(asn);
assertTrue(Arrays.equals(asn.toByteArray(), this.getData()));
+
+
+ prim = new ExtForwOptionsImpl(false,
+ false, false,
ExtForwOptionsForwardingReason.msNotReachable);
+ asn = new AsnOutputStream();
+ prim.encodeAll(asn, Tag.CLASS_CONTEXT_SPECIFIC, 6);
+
+ assertTrue(Arrays.equals(asn.toByteArray(), this.getData2()));
}
}
=======================================
---
/map/map-impl/src/test/java/org/mobicents/protocols/ss7/map/service/mobility/subscriberManagement/ExtSSStatusTest.java
Thu Nov 29 05:27:13 2012
+++
/map/map-impl/src/test/java/org/mobicents/protocols/ss7/map/service/mobility/subscriberManagement/ExtSSStatusTest.java
Sun Dec 2 01:23:46 2012
@@ -42,6 +42,10 @@
return new byte[] { 4, 1, 5 };
};
+ public byte[] getData2() {
+ return new byte[] { (byte) 132, 1, 15 };
+ };
+
@Test(groups = { "functional.decode", "primitives" })
public void testDecode() throws Exception {
byte[] data = this.getData();
@@ -57,6 +61,21 @@
assertTrue(prim.getBitP());
assertTrue(!prim.getBitR());
assertTrue(prim.getBitA());
+
+
+ data = this.getData2();
+ asn = new AsnInputStream(data);
+ tag = asn.readTag();
+ prim = new ExtSSStatusImpl();
+ prim.decodeAll(asn);
+
+ assertEquals(tag, 4);
+ assertEquals(asn.getTagClass(), Tag.CLASS_CONTEXT_SPECIFIC);
+
+ assertTrue(prim.getBitQ());
+ assertTrue(prim.getBitP());
+ assertTrue(prim.getBitR());
+ assertTrue(prim.getBitA());
}
@Test(groups = { "functional.encode", "primitives" })
@@ -66,5 +85,12 @@
prim.encodeAll(asn);
assertTrue(Arrays.equals(asn.toByteArray(), this.getData()));
+
+
+ prim = new ExtSSStatusImpl(true, true, true, true);
+ asn = new AsnOutputStream();
+ prim.encodeAll(asn, Tag.CLASS_CONTEXT_SPECIFIC, 4);
+
+ assertTrue(Arrays.equals(asn.toByteArray(), this.getData2()));
}
}
=======================================
---
/map/map-impl/src/test/java/org/mobicents/protocols/ss7/map/service/mobility/subscriberManagement/ExtTeleserviceCodeTest.java
Sat Oct 20 09:37:41 2012
+++
/map/map-impl/src/test/java/org/mobicents/protocols/ss7/map/service/mobility/subscriberManagement/ExtTeleserviceCodeTest.java
Sun Dec 2 01:23:46 2012
@@ -44,6 +44,9 @@
byte[] data = new byte[] { 4, 1, 0x11 };
byte[] dataEncoded = new byte[] { 0x11 };
+ byte[] data2 = new byte[] { (byte) 131, 1, 16 };
+ byte[] data3 = new byte[] { 4, 1, 34 };
+
@Test(groups = { "functional.decode", "subscriberManagement" })
public void testDecode() throws Exception {
@@ -56,6 +59,26 @@
assertTrue(Arrays.equals(impl.getData(), dataEncoded));
assertEquals(impl.getTeleserviceCodeValue(),
TeleserviceCodeValue.telephony);
+
+
+ asn = new AsnInputStream(data2);
+ tag = asn.readTag();
+ assertEquals(tag, 3);
+
+ impl = new ExtTeleserviceCodeImpl();
+ impl.decodeAll(asn);
+
+ assertEquals(impl.getTeleserviceCodeValue(),
TeleserviceCodeValue.allSpeechTransmissionServices);
+
+
+ asn = new AsnInputStream(data3);
+ tag = asn.readTag();
+ assertEquals(tag, Tag.STRING_OCTET);
+
+ impl = new ExtTeleserviceCodeImpl();
+ impl.decodeAll(asn);
+
+ assertEquals(impl.getTeleserviceCodeValue(),
TeleserviceCodeValue.shortMessageMO_PP);
}
@Test(groups = { "functional.encode","subscriberManagement"})
@@ -67,6 +90,20 @@
byte[] encodedData = asnOS.toByteArray();
byte[] rawData = data;
assertTrue(Arrays.equals(rawData, encodedData));
+
+ impl = new
ExtTeleserviceCodeImpl(TeleserviceCodeValue.allSpeechTransmissionServices);
+ asnOS = new AsnOutputStream();
+ impl.encodeAll(asnOS, Tag.CLASS_CONTEXT_SPECIFIC, 3);
+ encodedData = asnOS.toByteArray();
+ rawData = data2;
+ assertTrue(Arrays.equals(rawData, encodedData));
+
+ impl = new
ExtTeleserviceCodeImpl(TeleserviceCodeValue.shortMessageMO_PP);
+ asnOS = new AsnOutputStream();
+ impl.encodeAll(asnOS);
+ encodedData = asnOS.toByteArray();
+ rawData = data3;
+ assertTrue(Arrays.equals(rawData, encodedData));
}
}