Revision: 14894
Author: oleg.kulikoff
Date: Tue Oct 26 06:18:25 2010
Log: Issue 1912: SCCP routing rule interface
http://code.google.com/p/mobicents/source/detail?r=14894
Added:
/trunk/protocols/ss7/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/router
/trunk/protocols/ss7/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/router/AddressInformationTest.java
/trunk/protocols/ss7/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/router/MTPInfoTest.java
/trunk/protocols/ss7/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/router/RuleTest.java
=======================================
--- /dev/null
+++
/trunk/protocols/ss7/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/router/AddressInformationTest.java
Tue Oct 26 06:18:25 2010
@@ -0,0 +1,67 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.mobicents.protocols.ss7.sccp.impl.router;
+
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import static org.junit.Assert.*;
+import org.mobicents.protocols.ss7.indicator.NatureOfAddress;
+import org.mobicents.protocols.ss7.indicator.NumberingPlan;
+
+/**
+ *
+ * @author kulikov
+ */
+public class AddressInformationTest {
+ private final static String ADDRESS_INFORMATION_1 = "
#ISDN_MOBILE#NATIONAL#9023629581# ";
+
+ public AddressInformationTest() {
+ }
+
+ @BeforeClass
+ public static void setUpClass() throws Exception {
+ }
+
+ @AfterClass
+ public static void tearDownClass() throws Exception {
+ }
+
+ @Before
+ public void setUp() {
+ }
+
+ @After
+ public void tearDown() {
+ }
+
+ /**
+ * Test of getInstance method, of class AddressInformation.
+ */
+ @Test
+ public void testGetInstance() {
+ AddressInformation ai =
AddressInformation.getInstance(ADDRESS_INFORMATION_1);
+ assertEquals(-1, ai.getTranslationType());
+ assertEquals(NumberingPlan.ISDN_MOBILE, ai.getNumberingPlan());
+ assertEquals(NatureOfAddress.NATIONAL, ai.getNatureOfAddress());
+ assertEquals("9023629581", ai.getDigits());
+ assertEquals(-1, ai.getSubsystem());
+ }
+
+ /**
+ * Test of getTranslationType method, of class AddressInformation.
+ */
+ @Test
+ public void testToString() {
+ AddressInformation ai = new AddressInformation(-1,
NumberingPlan.ISDN_MOBILE,
+ NatureOfAddress.NATIONAL, "9023629581", -1);
+ assertEquals(ADDRESS_INFORMATION_1, ai.toString());
+ }
+
+
+}
=======================================
--- /dev/null
+++
/trunk/protocols/ss7/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/router/MTPInfoTest.java
Tue Oct 26 06:18:25 2010
@@ -0,0 +1,64 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.mobicents.protocols.ss7.sccp.impl.router;
+
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+/**
+ *
+ * @author kulikov
+ */
+public class MTPInfoTest {
+
+ private final static String MTP_INFO = "linkset#14083#14155#0";
+
+ public MTPInfoTest() {
+ }
+
+ @BeforeClass
+ public static void setUpClass() throws Exception {
+ }
+
+ @AfterClass
+ public static void tearDownClass() throws Exception {
+ }
+
+ @Before
+ public void setUp() {
+ }
+
+ @After
+ public void tearDown() {
+ }
+
+ /**
+ * Test of getName method, of class MTPInfo.
+ */
+ @Test
+ public void testToString() {
+ MTPInfo mtpInfo = new MTPInfo("linkset", 14083, 14155, 0);
+ assertEquals(MTP_INFO, mtpInfo.toString());
+ }
+
+ /**
+ * Test of getOpc method, of class MTPInfo.
+ */
+ @Test
+ public void testGetInstance() {
+ MTPInfo mtpInfo = MTPInfo.getInstance(MTP_INFO);
+ assertEquals("linkset", mtpInfo.getName());
+ assertEquals(14083, mtpInfo.getOpc());
+ assertEquals(14155, mtpInfo.getDpc());
+ assertEquals(0, mtpInfo.getSls());
+ }
+
+
+}
=======================================
--- /dev/null
+++
/trunk/protocols/ss7/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/router/RuleTest.java
Tue Oct 26 06:18:25 2010
@@ -0,0 +1,77 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.mobicents.protocols.ss7.sccp.impl.router;
+
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.mobicents.protocols.ss7.indicator.NatureOfAddress;
+import org.mobicents.protocols.ss7.indicator.NumberingPlan;
+import static org.junit.Assert.*;
+
+/**
+ *
+ * @author kulikov
+ */
+public class RuleTest {
+ private final static String RULE = "1;
#ISDN_MOBILE#NATIONAL#9023629581# ;
#ISDN_MOBILE#INTERNATIONAL#79023629581# ;linkset#14083#14155#0\n";
+
+ public RuleTest() {
+ }
+
+ @BeforeClass
+ public static void setUpClass() throws Exception {
+ }
+
+ @AfterClass
+ public static void tearDownClass() throws Exception {
+ }
+
+ @Before
+ public void setUp() {
+ }
+
+ @After
+ public void tearDown() {
+ }
+
+ /**
+ * Test of getInstance method, of class Rule.
+ */
+ @Test
+ public void testGetInstance() {
+ Rule rule = Rule.getInstance(RULE);
+ assertEquals(1, rule.getNo());
+ assertEquals(NumberingPlan.ISDN_MOBILE,
rule.getPattern().getNumberingPlan());
+ assertEquals(NatureOfAddress.NATIONAL,
rule.getPattern().getNatureOfAddress());
+ assertEquals("9023629581", rule.getPattern().getDigits());
+
+ assertEquals(NumberingPlan.ISDN_MOBILE,
rule.getTranslation().getNumberingPlan());
+ assertEquals(NatureOfAddress.INTERNATIONAL,
rule.getTranslation().getNatureOfAddress());
+ assertEquals("79023629581", rule.getTranslation().getDigits());
+
+ assertEquals("linkset", rule.getMTPInfo().getName());
+ assertEquals(14083, rule.getMTPInfo().getOpc());
+ assertEquals(14155, rule.getMTPInfo().getDpc());
+ assertEquals(0, rule.getMTPInfo().getSls());
+ }
+
+ /**
+ * Test of toString method, of class Rule.
+ */
+ @Test
+ public void testToString() {
+ AddressInformation ai = new AddressInformation(-1,
NumberingPlan.ISDN_MOBILE, NatureOfAddress.NATIONAL, "9023629581", -1);
+ AddressInformation tr = new AddressInformation(-1,
NumberingPlan.ISDN_MOBILE, NatureOfAddress.INTERNATIONAL, "79023629581",
-1);
+ MTPInfo mtpInfo = new MTPInfo("linkset", 14083, 14155, 0);
+
+ Rule rule = new Rule(1, ai, tr, mtpInfo);
+ assertEquals(RULE, rule.toString());
+ }
+
+}