2 new revisions:
Revision: bf3314b80cd1
Author: Sergey Vetyutnev <[email protected]>
Date: Thu Dec 6 05:07:28 2012
Log: SCCP new features: updating interfaces + fixing unit tests
http://code.google.com/p/jss7/source/detail?r=bf3314b80cd1
Revision: 96bb979433e9
Author: Sergey Vetyutnev <[email protected]>
Date: Thu Dec 6 05:27:17 2012
Log: SCP new features update - update transferTest
http://code.google.com/p/jss7/source/detail?r=96bb979433e9
==============================================================================
Revision: bf3314b80cd1
Author: Sergey Vetyutnev <[email protected]>
Date: Thu Dec 6 05:07:28 2012
Log: SCCP new features: updating interfaces + fixing unit tests
http://code.google.com/p/jss7/source/detail?r=bf3314b80cd1
Modified:
/sccp/sccp-api/src/main/java/org/mobicents/protocols/ss7/sccp/Router.java
/sccp/sccp-impl/src/main/java/org/mobicents/protocols/ss7/sccp/impl/oam/SccpExecutor.java
/sccp/sccp-impl/src/main/java/org/mobicents/protocols/ss7/sccp/impl/router/RouterImpl.java
/sccp/sccp-impl/src/main/java/org/mobicents/protocols/ss7/sccp/impl/router/RuleImpl.java
/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/message/GetMaxUserDataLengthTest.java
/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/messageflow/LoadSharingTest.java
/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/oam/SccpExecutorTest.java
/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/router/RouterTest.java
/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/router/RuleComparatorTest.java
/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/router/RuleTest.java
/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/translation/GT0001SccpStackImplTest.java
/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/translation/GT0010SccpStackImplTest.java
/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/translation/GT0011SccpStackImplTest.java
/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/translation/GT0100SccpStackImplTest.java
=======================================
---
/sccp/sccp-api/src/main/java/org/mobicents/protocols/ss7/sccp/Router.java
Thu Dec 6 03:29:38 2012
+++
/sccp/sccp-api/src/main/java/org/mobicents/protocols/ss7/sccp/Router.java
Thu Dec 6 05:07:28 2012
@@ -80,11 +80,11 @@
public Map<Integer, LongMessageRule> getLongMessageRules();
- public void addRule(int id, RuleType ruleType, LoadSharingAlgorithm algo,
SccpAddress pattern, String mask,
- int pAddressId, int sAddressId) throws Exception;
+ public void addRule(int id, RuleType ruleType, LoadSharingAlgorithm algo,
OriginationType originationType, SccpAddress pattern, String mask,
+ int pAddressId, int sAddressId, Integer
newCallingPartyAddressAddressId) throws Exception;
- public void modifyRule(int id, RuleType ruleType, LoadSharingAlgorithm
algo, SccpAddress pattern, String mask,
- int pAddressId, int sAddressId) throws Exception;
+ public void modifyRule(int id, RuleType ruleType, LoadSharingAlgorithm
algo, OriginationType originationType, SccpAddress pattern, String mask,
+ int pAddressId, int sAddressId, Integer
newCallingPartyAddressAddressId) throws Exception;
public Rule getRule(int id);
=======================================
---
/sccp/sccp-impl/src/main/java/org/mobicents/protocols/ss7/sccp/impl/oam/SccpExecutor.java
Thu Dec 6 03:29:38 2012
+++
/sccp/sccp-impl/src/main/java/org/mobicents/protocols/ss7/sccp/impl/oam/SccpExecutor.java
Thu Dec 6 05:07:28 2012
@@ -35,6 +35,7 @@
import org.mobicents.protocols.ss7.sccp.LongMessageRuleType;
import org.mobicents.protocols.ss7.sccp.Mtp3Destination;
import org.mobicents.protocols.ss7.sccp.Mtp3ServiceAccessPoint;
+import org.mobicents.protocols.ss7.sccp.OriginationType;
import org.mobicents.protocols.ss7.sccp.RemoteSignalingPointCode;
import org.mobicents.protocols.ss7.sccp.RemoteSubSystem;
import org.mobicents.protocols.ss7.sccp.Router;
@@ -547,7 +548,7 @@
SccpAddress pattern = this.createAddress(options, 5);
- this.router.addRule(ruleId, ruleType, algo, pattern, mask, pAddressId,
sAddressId);
+ this.router.addRule(ruleId, ruleType, algo, OriginationType.All,
pattern, mask, pAddressId, sAddressId, null);
return SccpOAMMessage.RULE_SUCCESSFULLY_ADDED;
}
@@ -599,7 +600,7 @@
}
SccpAddress pattern = this.createAddress(options, 5);
- this.router.modifyRule(ruleId, ruleType, algo, pattern, mask,
pAddressId, sAddressId);
+ this.router.modifyRule(ruleId, ruleType, algo, OriginationType.All,
pattern, mask, pAddressId, sAddressId, null);
return SccpOAMMessage.RULE_SUCCESSFULLY_MODIFIED;
}
=======================================
---
/sccp/sccp-impl/src/main/java/org/mobicents/protocols/ss7/sccp/impl/router/RouterImpl.java
Thu Dec 6 03:29:38 2012
+++
/sccp/sccp-impl/src/main/java/org/mobicents/protocols/ss7/sccp/impl/router/RouterImpl.java
Thu Dec 6 05:07:28 2012
@@ -40,6 +40,7 @@
import org.mobicents.protocols.ss7.sccp.LongMessageRule;
import org.mobicents.protocols.ss7.sccp.LongMessageRuleType;
import org.mobicents.protocols.ss7.sccp.Mtp3ServiceAccessPoint;
+import org.mobicents.protocols.ss7.sccp.OriginationType;
import org.mobicents.protocols.ss7.sccp.Router;
import org.mobicents.protocols.ss7.sccp.Rule;
import org.mobicents.protocols.ss7.sccp.RuleType;
@@ -363,8 +364,8 @@
return saps.unmodifiable();
}
- public void addRule(int id, RuleType ruleType, LoadSharingAlgorithm algo,
SccpAddress pattern, String mask,
- int pAddressId, int sAddressId) throws Exception {
+ public void addRule(int id, RuleType ruleType, LoadSharingAlgorithm algo,
OriginationType originationType, SccpAddress pattern, String mask,
+ int pAddressId, int sAddressId, Integer
newCallingPartyAddressAddressId) throws Exception {
Rule ruleTmp = this.getRule(id);
@@ -406,9 +407,10 @@
}
synchronized (this) {
- RuleImpl rule = new RuleImpl(ruleType, algo, pattern,
mask);
+ RuleImpl rule = new RuleImpl(ruleType, algo, originationType, pattern,
mask);
rule.setPrimaryAddressId(pAddressId);
rule.setSecondaryAddressId(sAddressId);
+
rule.setNewCallingPartyAddressAddressId(newCallingPartyAddressAddressId);
rule.setRuleId(id);
RuleImpl[] rulesArray = new
RuleImpl[(this.rulesMap.size() + 1)];
@@ -437,8 +439,8 @@
}
}
- public void modifyRule(int id, RuleType ruleType, LoadSharingAlgorithm
algo, SccpAddress pattern, String mask,
- int pAddressId, int sAddressId) throws Exception {
+ public void modifyRule(int id, RuleType ruleType, LoadSharingAlgorithm
algo, OriginationType originationType, SccpAddress pattern, String mask,
+ int pAddressId, int sAddressId, Integer
newCallingPartyAddressAddressId) throws Exception {
Rule ruleTmp = this.getRule(id);
if (ruleTmp == null) {
@@ -477,9 +479,10 @@
throw new
Exception(SccpOAMMessage.RULETYPE_NOT_SOLI_SEC_ADD_MANDATORY);
}
synchronized (this) {
- RuleImpl rule = new RuleImpl(ruleType, algo, pattern,
mask);
+ RuleImpl rule = new RuleImpl(ruleType, algo, originationType, pattern,
mask);
rule.setPrimaryAddressId(pAddressId);
rule.setSecondaryAddressId(sAddressId);
+
rule.setNewCallingPartyAddressAddressId(newCallingPartyAddressAddressId);
rule.setRuleId(id);
RuleImpl[] rulesArray = new
RuleImpl[(this.rulesMap.size() + 1)];
=======================================
---
/sccp/sccp-impl/src/main/java/org/mobicents/protocols/ss7/sccp/impl/router/RuleImpl.java
Thu Dec 6 03:29:38 2012
+++
/sccp/sccp-impl/src/main/java/org/mobicents/protocols/ss7/sccp/impl/router/RuleImpl.java
Thu Dec 6 05:07:28 2012
@@ -101,11 +101,12 @@
* Creates new routing rule.
*
*/
- public RuleImpl(RuleType ruleType, LoadSharingAlgorithm loadSharingAlgo,
SccpAddress pattern, String mask) {
+ public RuleImpl(RuleType ruleType, LoadSharingAlgorithm loadSharingAlgo,
OriginationType originationType, SccpAddress pattern, String mask) {
this.ruleType = ruleType;
this.pattern = pattern;
this.mask = mask;
this.setLoadSharingAlgorithm(loadSharingAlgo);
+ this.setOriginationType(originationType);
configure();
}
=======================================
---
/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/message/GetMaxUserDataLengthTest.java
Thu Dec 6 03:29:38 2012
+++
/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/message/GetMaxUserDataLengthTest.java
Thu Dec 6 05:07:28 2012
@@ -27,6 +27,7 @@
import org.mobicents.protocols.ss7.indicator.RoutingIndicator;
import org.mobicents.protocols.ss7.sccp.LoadSharingAlgorithm;
import org.mobicents.protocols.ss7.sccp.LongMessageRuleType;
+import org.mobicents.protocols.ss7.sccp.OriginationType;
import org.mobicents.protocols.ss7.sccp.RuleType;
import org.mobicents.protocols.ss7.sccp.impl.Mtp3UserPartImpl;
import org.mobicents.protocols.ss7.sccp.impl.SccpStackImpl;
@@ -73,7 +74,7 @@
stack.getRouter().addRoutingAddress(1, primaryAddress);
SccpAddress pattern = new
SccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, 2,
GlobalTitle.getInstance(0, "1122334455"), 18);
- stack.getRouter().addRule(1, RuleType.Solitary,
LoadSharingAlgorithm.Undefined, pattern, "K", 1, -1);
+ stack.getRouter().addRule(1, RuleType.Solitary,
LoadSharingAlgorithm.Undefined, OriginationType.All, pattern, "K", 1, -1,
null);
int len = stack.getSccpProvider().getMaxUserDataLength(a1, a2);
assertEquals(len, 248);
=======================================
---
/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/messageflow/LoadSharingTest.java
Thu Dec 6 03:29:38 2012
+++
/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/messageflow/LoadSharingTest.java
Thu Dec 6 05:07:28 2012
@@ -26,6 +26,7 @@
import org.mobicents.protocols.ss7.indicator.RoutingIndicator;
import org.mobicents.protocols.ss7.sccp.LoadSharingAlgorithm;
+import org.mobicents.protocols.ss7.sccp.OriginationType;
import org.mobicents.protocols.ss7.sccp.RuleType;
import org.mobicents.protocols.ss7.sccp.impl.Mtp3UserPartImpl;
import org.mobicents.protocols.ss7.sccp.impl.SccpHarness;
@@ -117,13 +118,14 @@
SccpAddress primaryAddress2 = new
SccpAddress(RoutingIndicator.ROUTING_BASED_ON_DPC_AND_SSN, getStack2PC(),
GlobalTitle.getInstance(1, "111111"), 0);
sccpStack1.getRouter().addRoutingAddress(2, primaryAddress2);
SccpAddress backupAddress = new
SccpAddress(RoutingIndicator.ROUTING_BASED_ON_DPC_AND_SSN, 12,
GlobalTitle.getInstance(1, "111111"), 8);
- sccpStack1.getRouter().addBackupAddress(1, backupAddress);
+ sccpStack1.getRouter().addRoutingAddress(1, backupAddress);
+// sccpStack1.getRouter().addBackupAddress(1, backupAddress);
// ---- Solitary case
SccpAddress pattern = new
SccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, 0,
GlobalTitle.getInstance(1, "111111"), 0);
// pattern2 - with default ssn value
SccpAddress pattern2 = new
SccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, 0,
GlobalTitle.getInstance(1, "222222"), 0);
- sccpStack1.getRouter().addRule(1, RuleType.Solitary,
LoadSharingAlgorithm.Undefined, pattern, "K", 1, -1);
+ sccpStack1.getRouter().addRule(1, RuleType.Solitary,
LoadSharingAlgorithm.Undefined, OriginationType.All, pattern, "K", 1, -1,
null);
// Primary and backup are available
SccpAddress a3 = new
SccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, 0,
GlobalTitle.getInstance(1, "111111"), 0);
@@ -174,7 +176,7 @@
// ---- Dominant case
sccpStack1.getRouter().removeRule(1);
- sccpStack1.getRouter().addRule(1, RuleType.Dominant,
LoadSharingAlgorithm.Undefined, pattern, "K", 1, 1);
+ sccpStack1.getRouter().addRule(1, RuleType.Dominant,
LoadSharingAlgorithm.Undefined, OriginationType.All, pattern, "K", 1, 1,
null);
// Primary and backup are available
a3 = new SccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, 0,
GlobalTitle.getInstance(1, "111111"), 0);
@@ -225,9 +227,9 @@
// ---- Loadshared case
sccpStack1.getRouter().removeRule(1);
- sccpStack1.getRouter().addRule(1, RuleType.Loadshared,
LoadSharingAlgorithm.Bit4, pattern, "K", 1, 1);
+ sccpStack1.getRouter().addRule(1, RuleType.Loadshared,
LoadSharingAlgorithm.Bit4, OriginationType.All, pattern, "K", 1, 1, null);
// rule which primaryAddress ssn==0 (getting ssn from origin
CalledPartyAddress)
- sccpStack1.getRouter().addRule(2, RuleType.Loadshared,
LoadSharingAlgorithm.Bit4, pattern2, "K", 2, 1);
+ sccpStack1.getRouter().addRule(2, RuleType.Loadshared,
LoadSharingAlgorithm.Bit4, OriginationType.All, pattern2, "K", 2, 1, null);
// Primary and backup are available
// - class 1 (route by sls): sls = 0xEF: primary route (sls & 0x10
rule)
=======================================
---
/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/oam/SccpExecutorTest.java
Thu Dec 6 03:29:38 2012
+++
/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/oam/SccpExecutorTest.java
Thu Dec 6 05:07:28 2012
@@ -152,10 +152,10 @@
assertEquals(gt.getNatureOfAddress(),
NatureOfAddress.INTERNATIONAL);
assertEquals(rule.getRuleType(), RuleType.Solitary);
- String sec_addressCmd = "sccp backup_add create 1 71 3 8 0 0 3
123456789";
- result = this.sccpExecutor.execute(sec_addressCmd.split(" "));
-
assertTrue(result.equals(SccpOAMMessage.ADDRESS_SUCCESSFULLY_ADDED));
- assertEquals(this.router.getBackupAddresses().size(), 1);
+// String sec_addressCmd = "sccp backup_add create 1 71 3 8 0 0 3
123456789";
+// result = this.sccpExecutor.execute(sec_addressCmd.split(" "));
+//
assertTrue(result.equals(SccpOAMMessage.ADDRESS_SUCCESSFULLY_ADDED));
+// assertEquals(this.router.getBackupAddresses().size(), 1);
String createRuleCmd2 = "sccp rule create 3 R 71 2 8 0 0 3 123456789
dominant 1 1";
result = this.sccpExecutor.execute(createRuleCmd2.split(" "));
@@ -339,61 +339,61 @@
assertEquals(this.router.getRoutingAddresses().size(), 0);
}
- @Test(groups = { "oam", "functional.mgmt" })
- public void testBackupAddress() {
-
- String rspCmd = "sccp backup_add create 11 71 6535 8 0 0 12
93707100007";
- // <id> <address-indicator> <point-code> <subsystem-number>
- // <translation-type> <numbering-plan>
<nature-of-address-indicator>
- // <digits>
- String res = this.sccpExecutor.execute(rspCmd.split(" "));
- assertEquals(this.router.getBackupAddresses().size(), 1);
- SccpAddress addr = this.router.getBackupAddress(11);
- assertEquals(addr.getAddressIndicator().getValue(), 71);
- assertEquals(addr.getSignalingPointCode(), 6535);
- assertEquals(addr.getSubsystemNumber(), 8);
-
assertTrue(addr.getGlobalTitle().getDigits().equals("93707100007"));
-
- // test show
- rspCmd = "sccp backup_add show";
- res = this.sccpExecutor.execute(rspCmd.split(" "));
- assertEquals(res, "key=11
backup_add=pc=6535,ssn=8,AI=71,gt=GT0001{na=SPARE_12,
digits=93707100007}\n");
-
- rspCmd = "sccp backup_add create 11 71 6536 8 0 0 12
93707100007";
- res = this.sccpExecutor.execute(rspCmd.split(" "));
- assertTrue(res.equals(SccpOAMMessage.ADDRESS_ALREADY_EXIST));
- assertEquals(this.router.getBackupAddresses().size(), 1);
- addr = this.router.getBackupAddress(11);
- assertEquals(addr.getSignalingPointCode(), 6535);
-
- rspCmd = "sccp backup_add modify 11 71 6537 8 0 0 12
93707100007";
- res = this.sccpExecutor.execute(rspCmd.split(" "));
- assertEquals(this.router.getBackupAddresses().size(), 1);
- addr = this.router.getBackupAddress(11);
- assertEquals(addr.getSignalingPointCode(), 6537);
-
- rspCmd = "sccp backup_add modify 12 71 6538 8 0 0 12
93707100007";
- res = this.sccpExecutor.execute(rspCmd.split(" "));
- assertTrue(res.equals(SccpOAMMessage.ADDRESS_DOESNT_EXIST));
- assertEquals(this.router.getBackupAddresses().size(), 1);
- addr = this.router.getBackupAddress(11);
- assertEquals(addr.getSignalingPointCode(), 6537);
-
- rspCmd = "sccp backup_add show 11";
- res = this.sccpExecutor.execute(rspCmd.split(" "));
-
- rspCmd = "sccp backup_add show";
- res = this.sccpExecutor.execute(rspCmd.split(" "));
-
- rspCmd = "sccp backup_add delete 12";
- res = this.sccpExecutor.execute(rspCmd.split(" "));
- assertTrue(res.equals(SccpOAMMessage.ADDRESS_DOESNT_EXIST));
- assertEquals(this.router.getBackupAddresses().size(), 1);
-
- rspCmd = "sccp backup_add delete 11";
- res = this.sccpExecutor.execute(rspCmd.split(" "));
- assertEquals(this.router.getBackupAddresses().size(), 0);
- }
+// @Test(groups = { "oam", "functional.mgmt" })
+// public void testBackupAddress() {
+//
+// String rspCmd = "sccp backup_add create 11 71 6535 8 0 0 12
93707100007";
+// // <id> <address-indicator> <point-code> <subsystem-number>
+// // <translation-type> <numbering-plan>
<nature-of-address-indicator>
+// // <digits>
+// String res = this.sccpExecutor.execute(rspCmd.split(" "));
+// assertEquals(this.router.getBackupAddresses().size(), 1);
+// SccpAddress addr = this.router.getBackupAddress(11);
+// assertEquals(addr.getAddressIndicator().getValue(), 71);
+// assertEquals(addr.getSignalingPointCode(), 6535);
+// assertEquals(addr.getSubsystemNumber(), 8);
+//
assertTrue(addr.getGlobalTitle().getDigits().equals("93707100007"));
+//
+// // test show
+// rspCmd = "sccp backup_add show";
+// res = this.sccpExecutor.execute(rspCmd.split(" "));
+// assertEquals(res, "key=11
backup_add=pc=6535,ssn=8,AI=71,gt=GT0001{na=SPARE_12,
digits=93707100007}\n");
+//
+// rspCmd = "sccp backup_add create 11 71 6536 8 0 0 12
93707100007";
+// res = this.sccpExecutor.execute(rspCmd.split(" "));
+// assertTrue(res.equals(SccpOAMMessage.ADDRESS_ALREADY_EXIST));
+// assertEquals(this.router.getBackupAddresses().size(), 1);
+// addr = this.router.getBackupAddress(11);
+// assertEquals(addr.getSignalingPointCode(), 6535);
+//
+// rspCmd = "sccp backup_add modify 11 71 6537 8 0 0 12
93707100007";
+// res = this.sccpExecutor.execute(rspCmd.split(" "));
+// assertEquals(this.router.getBackupAddresses().size(), 1);
+// addr = this.router.getBackupAddress(11);
+// assertEquals(addr.getSignalingPointCode(), 6537);
+//
+// rspCmd = "sccp backup_add modify 12 71 6538 8 0 0 12
93707100007";
+// res = this.sccpExecutor.execute(rspCmd.split(" "));
+// assertTrue(res.equals(SccpOAMMessage.ADDRESS_DOESNT_EXIST));
+// assertEquals(this.router.getBackupAddresses().size(), 1);
+// addr = this.router.getBackupAddress(11);
+// assertEquals(addr.getSignalingPointCode(), 6537);
+//
+// rspCmd = "sccp backup_add show 11";
+// res = this.sccpExecutor.execute(rspCmd.split(" "));
+//
+// rspCmd = "sccp backup_add show";
+// res = this.sccpExecutor.execute(rspCmd.split(" "));
+//
+// rspCmd = "sccp backup_add delete 12";
+// res = this.sccpExecutor.execute(rspCmd.split(" "));
+// assertTrue(res.equals(SccpOAMMessage.ADDRESS_DOESNT_EXIST));
+// assertEquals(this.router.getBackupAddresses().size(), 1);
+//
+// rspCmd = "sccp backup_add delete 11";
+// res = this.sccpExecutor.execute(rspCmd.split(" "));
+// assertEquals(this.router.getBackupAddresses().size(), 0);
+// }
@Test(groups = { "oam", "functional.mgmt" })
public void testLmr() {
=======================================
---
/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/router/RouterTest.java
Thu Dec 6 03:29:38 2012
+++
/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/router/RouterTest.java
Thu Dec 6 05:07:28 2012
@@ -22,8 +22,7 @@
package org.mobicents.protocols.ss7.sccp.impl.router;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.*;
import java.io.IOException;
import java.util.Map;
@@ -41,6 +40,7 @@
import org.mobicents.protocols.ss7.sccp.LongMessageRuleType;
import org.mobicents.protocols.ss7.sccp.Mtp3Destination;
import org.mobicents.protocols.ss7.sccp.Mtp3ServiceAccessPoint;
+import org.mobicents.protocols.ss7.sccp.OriginationType;
import org.mobicents.protocols.ss7.sccp.Router;
import org.mobicents.protocols.ss7.sccp.Rule;
import org.mobicents.protocols.ss7.sccp.RuleType;
@@ -117,27 +117,27 @@
assertEquals(pa.getSignalingPointCode(), 321);
assertEquals(router.getRoutingAddresses().size(), 1);
- assertEquals(router.getBackupAddresses().size(), 0);
+// assertEquals(router.getBackupAddresses().size(), 0);
+//
+// router.addBackupAddress(1, primaryAddr1);
+// assertEquals(router.getBackupAddresses().size(), 1);
+//
+// router.addBackupAddress(2, primaryAddr2);
+// assertEquals(router.getBackupAddresses().size(), 2);
- router.addBackupAddress(1, primaryAddr1);
- assertEquals(router.getBackupAddresses().size(), 1);
-
- router.addBackupAddress(2, primaryAddr2);
- assertEquals(router.getBackupAddresses().size(), 2);
-
- router.removeBackupAddress(1);
- pa = router.getBackupAddresses().values().iterator().next();
- assertNotNull(pa);
- assertEquals(pa.getSignalingPointCode(), 321);
- assertEquals(router.getBackupAddresses().size(), 1);
+// router.removeBackupAddress(1);
+// pa = router.getBackupAddresses().values().iterator().next();
+// assertNotNull(pa);
+// assertEquals(pa.getSignalingPointCode(), 321);
+// assertEquals(router.getBackupAddresses().size(), 1);
SccpAddress pattern = new
SccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, 0,
GlobalTitle.getInstance(1, "123456789"), 0);
- router.addRule(1, RuleType.Solitary, LoadSharingAlgorithm.Undefined,
pattern, "R", 2, 2);
+ router.addRule(1, RuleType.Solitary, LoadSharingAlgorithm.Undefined,
OriginationType.All, pattern, "R", 2, 2, null);
assertEquals(router.getRules().size(), 1);
- router.addRule(2, RuleType.Loadshared, LoadSharingAlgorithm.Bit4,
pattern, "K", 2, 2);
+ router.addRule(2, RuleType.Loadshared, LoadSharingAlgorithm.Bit4,
OriginationType.All, pattern, "K", 2, 2, null);
assertEquals(router.getRules().size(), 2);
router.removeRule(2);
@@ -181,11 +181,11 @@
public void testSerialization() throws Exception {
router.addRoutingAddress(1, primaryAddr1);
router.addRoutingAddress(2, primaryAddr2);
- router.addBackupAddress(1, primaryAddr1);
+// router.addBackupAddress(1, primaryAddr1);
SccpAddress pattern = new
SccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, 0,
GlobalTitle.getInstance(1, "123456789"), 0);
- router.addRule(1, RuleType.Loadshared, LoadSharingAlgorithm.Bit4,
pattern, "K", 1, 1);
+ router.addRule(1, RuleType.Loadshared, LoadSharingAlgorithm.Bit4,
OriginationType.RemoteOriginated, pattern, "K", 1, 2, null);
router.addLongMessageRule(1, 1, 2,
LongMessageRuleType.XudtEnabled);
router.addMtp3ServiceAccessPoint(3, 1, 11, 2);
@@ -197,16 +197,19 @@
Rule rl = router1.getRule(1);
SccpAddress adp = router1.getRoutingAddress(2);
- SccpAddress adb = router1.getBackupAddress(1);
+// SccpAddress adb = router1.getBackupAddress(1);
LongMessageRule lmr = router1.getLongMessageRule(1);
Mtp3ServiceAccessPoint sap =
router1.getMtp3ServiceAccessPoint(3);
Mtp3Destination dst = sap.getMtp3Destination(1);
assertEquals(rl.getPrimaryAddressId(), 1);
- assertEquals(rl.getSecondaryAddressId(), 1);
+ assertEquals(rl.getSecondaryAddressId(), 2);
+ assertNull(rl.getNewCallingPartyAddressAddressId());
assertEquals(rl.getLoadSharingAlgorithm(),
LoadSharingAlgorithm.Bit4);
+ assertEquals(rl.getOriginationType(),
OriginationType.RemoteOriginated);
+ assertNull(rl.getNewCallingPartyAddressAddressId());
assertEquals(adp.getSignalingPointCode(),
primaryAddr2.getSignalingPointCode());
- assertEquals(adb.getSignalingPointCode(),
primaryAddr1.getSignalingPointCode());
+// assertEquals(adb.getSignalingPointCode(),
primaryAddr1.getSignalingPointCode());
assertEquals(lmr.getFirstSpc(), 1);
assertEquals(sap.getMtp3Destinations().size(), 1);
assertEquals(dst.getLastDpc(), 110);
@@ -225,7 +228,7 @@
SccpAddress pattern1 = new
SccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, 0,
GlobalTitle.getInstance(1, "800/????/9"), 0);
- router.addRule(1, RuleType.Solitary, LoadSharingAlgorithm.Undefined,
pattern1, "R/K/R", 1, -1);
+ router.addRule(1, RuleType.Solitary, LoadSharingAlgorithm.Undefined,
OriginationType.All, pattern1, "R/K/R", 1, -1, null);
// Rule 2
SccpAddress pattern2 = new
SccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, 0,
@@ -234,7 +237,7 @@
GlobalTitle.getInstance(1, "-"), 0);
router.addRoutingAddress(2, primaryAddr2);
- router.addRule(2, RuleType.Solitary, LoadSharingAlgorithm.Undefined,
pattern2, "K", 2, -1);
+ router.addRule(2, RuleType.Solitary, LoadSharingAlgorithm.Undefined,
OriginationType.All, pattern2, "K", 2, -1, null);
// Rule 3
SccpAddress pattern3 = new
SccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, 0,
@@ -242,7 +245,7 @@
SccpAddress primaryAddr3 = new
SccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, 123,
GlobalTitle.getInstance(1, "-/-/-/-"), 0);
router.addRoutingAddress(3, primaryAddr3);
- router.addRule(3, RuleType.Solitary, LoadSharingAlgorithm.Undefined,
pattern3, "K/K/K/K", 3, -1);
+ router.addRule(3, RuleType.Solitary, LoadSharingAlgorithm.Undefined,
OriginationType.All, pattern3, "K/K/K/K", 3, -1, null);
// Rule 4
SccpAddress pattern4 = new
SccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, 0,
@@ -250,7 +253,7 @@
SccpAddress primaryAddr4 = new
SccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, 123,
GlobalTitle.getInstance(1, "90/-/1/-/7"), 0);
router.addRoutingAddress(4, primaryAddr4);
- router.addRule(4, RuleType.Solitary, LoadSharingAlgorithm.Undefined,
pattern4, "R/K/R/K/R", 4, -1);
+ router.addRule(4, RuleType.Solitary, LoadSharingAlgorithm.Undefined,
OriginationType.All, pattern4, "R/K/R/K/R", 4, -1, null);
// Rule 5
SccpAddress pattern5 = new
SccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, 0,
@@ -258,7 +261,7 @@
SccpAddress primaryAddr5 = new
SccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, 123,
GlobalTitle.getInstance(1, "90/-/7"), 0);
router.addRoutingAddress(5, primaryAddr5);
- router.addRule(5, RuleType.Solitary, LoadSharingAlgorithm.Undefined,
pattern5, "R/K/R", 5, -1);
+ router.addRule(5, RuleType.Solitary, LoadSharingAlgorithm.Undefined,
OriginationType.All, pattern5, "R/K/R", 5, -1, null);
// Rule 6
SccpAddress pattern6 = new
SccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, 0,
@@ -266,7 +269,7 @@
SccpAddress primaryAddr6 = new
SccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, 123,
GlobalTitle.getInstance(1, "-"), 0);
router.addRoutingAddress(6, primaryAddr6);
- router.addRule(6, RuleType.Solitary, LoadSharingAlgorithm.Undefined,
pattern6, "K", 6, -1);
+ router.addRule(6, RuleType.Solitary, LoadSharingAlgorithm.Undefined,
OriginationType.All, pattern6, "K", 6, -1, null);
// Rule 7
SccpAddress pattern7 = new
SccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, 0,
@@ -274,7 +277,7 @@
SccpAddress primaryAddr7 = new
SccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, 123,
GlobalTitle.getInstance(1, "-"), 0);
router.addRoutingAddress(7, primaryAddr7);
- router.addRule(7, RuleType.Solitary, LoadSharingAlgorithm.Undefined,
pattern7, "K", 7, -1);
+ router.addRule(7, RuleType.Solitary, LoadSharingAlgorithm.Undefined,
OriginationType.All, pattern7, "K", 7, -1, null);
// Rule 8
@@ -283,7 +286,7 @@
SccpAddress primaryAddr8 = new
SccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, 123,
GlobalTitle.getInstance(1, "111/-"), 0);
router.addRoutingAddress(8, primaryAddr8);
- router.addRule(8, RuleType.Solitary, LoadSharingAlgorithm.Undefined,
pattern8, "R/K", 8, -1);
+ router.addRule(8, RuleType.Solitary, LoadSharingAlgorithm.Undefined,
OriginationType.All, pattern8, "R/K", 8, -1, null);
// TEST find rule
=======================================
---
/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/router/RuleComparatorTest.java
Tue Nov 13 06:18:58 2012
+++
/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/router/RuleComparatorTest.java
Thu Dec 6 05:07:28 2012
@@ -26,6 +26,7 @@
import org.mobicents.protocols.ss7.indicator.RoutingIndicator;
import org.mobicents.protocols.ss7.sccp.LoadSharingAlgorithm;
+import org.mobicents.protocols.ss7.sccp.OriginationType;
import org.mobicents.protocols.ss7.sccp.RuleType;
import org.mobicents.protocols.ss7.sccp.parameter.GlobalTitle;
import org.mobicents.protocols.ss7.sccp.parameter.SccpAddress;
@@ -63,28 +64,28 @@
public void testSorting() throws Exception {
SccpAddress pattern1 = new
SccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, 0,
GlobalTitle.getInstance(1, "800/????/9"), 0);
- RuleImpl rule1 = new RuleImpl(RuleType.Solitary,
LoadSharingAlgorithm.Undefined, pattern1, "R/K/R");
+ RuleImpl rule1 = new RuleImpl(RuleType.Solitary,
LoadSharingAlgorithm.Undefined, OriginationType.All, pattern1, "R/K/R");
SccpAddress pattern2 = new
SccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, 0,
GlobalTitle.getInstance(1, "*"), 0);
- RuleImpl rule2 = new RuleImpl(RuleType.Solitary,
LoadSharingAlgorithm.Undefined, pattern2, "K");
+ RuleImpl rule2 = new RuleImpl(RuleType.Solitary,
LoadSharingAlgorithm.Undefined, OriginationType.All, pattern2, "K");
SccpAddress pattern3 = new
SccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, 0,
GlobalTitle.getInstance(1, "9/?/9/*"), 0);
- RuleImpl rule3 = new RuleImpl(RuleType.Solitary,
LoadSharingAlgorithm.Undefined, pattern3, "K/K/K/K");
+ RuleImpl rule3 = new RuleImpl(RuleType.Solitary,
LoadSharingAlgorithm.Undefined, OriginationType.All, pattern3, "K/K/K/K");
SccpAddress pattern4 = new
SccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, 0,
GlobalTitle.getInstance(1, "80/??/0/???/9"), 0);
- RuleImpl rule4 = new RuleImpl(RuleType.Solitary,
LoadSharingAlgorithm.Undefined, pattern4, "R/K/R/K/R");
+ RuleImpl rule4 = new RuleImpl(RuleType.Solitary,
LoadSharingAlgorithm.Undefined, OriginationType.All, pattern4, "R/K/R/K/R");
SccpAddress pattern5 = new
SccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, 0,
GlobalTitle.getInstance(1, "800/?????/9"), 0);
- RuleImpl rule5 = new RuleImpl(RuleType.Solitary,
LoadSharingAlgorithm.Undefined, pattern5, "R/K/R");
+ RuleImpl rule5 = new RuleImpl(RuleType.Solitary,
LoadSharingAlgorithm.Undefined, OriginationType.All, pattern5, "R/K/R");
SccpAddress pattern6 = new
SccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, 0,
GlobalTitle.getInstance(1, "123456"), 0);
- RuleImpl rule6 = new RuleImpl(RuleType.Solitary,
LoadSharingAlgorithm.Undefined, pattern6, "K");
+ RuleImpl rule6 = new RuleImpl(RuleType.Solitary,
LoadSharingAlgorithm.Undefined, OriginationType.All, pattern6, "K");
SccpAddress pattern7 = new
SccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, 0,
GlobalTitle.getInstance(1, "1234567890"), 0);
- RuleImpl rule7 = new RuleImpl(RuleType.Solitary,
LoadSharingAlgorithm.Undefined, pattern7, "R/K/R");
+ RuleImpl rule7 = new RuleImpl(RuleType.Solitary,
LoadSharingAlgorithm.Undefined, OriginationType.All, pattern7, "R/K/R");
SccpAddress pattern8 = new
SccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, 0,
GlobalTitle.getInstance(1, "999/*"), 0);
- RuleImpl rule8 = new RuleImpl(RuleType.Solitary,
LoadSharingAlgorithm.Undefined, pattern8, "R/K");
+ RuleImpl rule8 = new RuleImpl(RuleType.Solitary,
LoadSharingAlgorithm.Undefined, OriginationType.All, pattern8, "R/K");
// This is unsorted
RuleImpl[] rules = new RuleImpl[] { rule1, rule2, rule3, rule4, rule5,
rule6, rule7, rule8 };
=======================================
---
/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/router/RuleTest.java
Tue Nov 13 06:18:58 2012
+++
/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/router/RuleTest.java
Thu Dec 6 05:07:28 2012
@@ -40,6 +40,7 @@
import org.mobicents.protocols.ss7.indicator.NumberingPlan;
import org.mobicents.protocols.ss7.indicator.RoutingIndicator;
import org.mobicents.protocols.ss7.sccp.LoadSharingAlgorithm;
+import org.mobicents.protocols.ss7.sccp.OriginationType;
import org.mobicents.protocols.ss7.sccp.RuleType;
import org.mobicents.protocols.ss7.sccp.parameter.GT0100;
import org.mobicents.protocols.ss7.sccp.parameter.GlobalTitle;
@@ -86,7 +87,7 @@
SccpAddress pattern = new
SccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, 0,
GlobalTitle.getInstance(1, "123456789"), 0);
SccpAddress primaryAddress = new
SccpAddress(RoutingIndicator.ROUTING_BASED_ON_DPC_AND_SSN, 123,
GlobalTitle.getInstance("-"), 8);
- RuleImpl rule = new RuleImpl(RuleType.Solitary,
LoadSharingAlgorithm.Undefined, pattern, "R");
+ RuleImpl rule = new RuleImpl(RuleType.Solitary,
LoadSharingAlgorithm.Undefined, OriginationType.All, pattern, "R");
rule.setPrimaryAddressId(1);
SccpAddress address = new
SccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, 0,
GlobalTitle.getInstance(1, "123456789"), 0);
@@ -111,7 +112,7 @@
SccpAddress primaryAddress = new
SccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, 123,
GlobalTitle.getInstance(1, "333/---/4"), 0);
- RuleImpl rule = new RuleImpl(RuleType.Solitary,
LoadSharingAlgorithm.Undefined, pattern, "R/K/R");
+ RuleImpl rule = new RuleImpl(RuleType.Solitary,
LoadSharingAlgorithm.Undefined, OriginationType.All, pattern, "R/K/R");
rule.setPrimaryAddressId(1);
SccpAddress address = new
SccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, 0,
GlobalTitle.getInstance(1, "1234567"), 0);
@@ -136,7 +137,7 @@
SccpAddress primaryAddress = new
SccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, 123,
GlobalTitle.getInstance("-/-"), 8);
- RuleImpl rule = new RuleImpl(RuleType.Solitary,
LoadSharingAlgorithm.Undefined, pattern, "R/K");
+ RuleImpl rule = new RuleImpl(RuleType.Solitary,
LoadSharingAlgorithm.Undefined, OriginationType.All, pattern, "R/K");
rule.setPrimaryAddressId(1);
SccpAddress address = new
SccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, 0,
GlobalTitle.getInstance(1, "4414257897897"), 0);
@@ -160,7 +161,7 @@
SccpAddress primaryAddress = new
SccpAddress(RoutingIndicator.ROUTING_BASED_ON_DPC_AND_SSN, 123,
GlobalTitle.getInstance("-"), 8);
- RuleImpl rule = new RuleImpl(RuleType.Solitary,
LoadSharingAlgorithm.Undefined, pattern, "K");
+ RuleImpl rule = new RuleImpl(RuleType.Solitary,
LoadSharingAlgorithm.Undefined, OriginationType.All, pattern, "K");
rule.setPrimaryAddressId(1);
SccpAddress address = new
SccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, 0,
GlobalTitle.getInstance(1, "4414257897897"), 0);
@@ -185,7 +186,7 @@
SccpAddress primaryAddress = new
SccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, 6045,
GlobalTitle.getInstance("-"), 6);
- RuleImpl rule = new RuleImpl(RuleType.Solitary,
LoadSharingAlgorithm.Undefined, pattern, "K");
+ RuleImpl rule = new RuleImpl(RuleType.Solitary,
LoadSharingAlgorithm.Undefined, OriginationType.All, pattern, "K");
rule.setPrimaryAddressId(1);
SccpAddress address = new
SccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, 0,
GlobalTitle.getInstance(0, NumberingPlan.valueOf(1),
@@ -216,7 +217,7 @@
SccpAddress primaryAddress = new
SccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, 123,
GlobalTitle.getInstance(1, "-"), 0);
- RuleImpl rule = new RuleImpl(RuleType.Solitary,
LoadSharingAlgorithm.Undefined, pattern, "K");
+ RuleImpl rule = new RuleImpl(RuleType.Solitary,
LoadSharingAlgorithm.Undefined, OriginationType.All, pattern, "K");
rule.setPrimaryAddressId(1);
SccpAddress address = new
SccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, 0,
GlobalTitle.getInstance(1, "1234567"), 8);
@@ -240,7 +241,7 @@
SccpAddress primaryAddress = new
SccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, 123,
GlobalTitle.getInstance(1, "-"), 0);
- RuleImpl rule = new RuleImpl(RuleType.Solitary,
LoadSharingAlgorithm.Undefined, pattern, "K");
+ RuleImpl rule = new RuleImpl(RuleType.Solitary,
LoadSharingAlgorithm.Undefined, OriginationType.All, pattern, "K");
rule.setPrimaryAddressId(1);
SccpAddress address = new
SccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, 0,
GlobalTitle.getInstance(1, "55"), 8);
@@ -257,7 +258,7 @@
SccpAddress primaryAddress = new
SccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, 123,
GlobalTitle.getInstance(1, "-/-"), 0);
- RuleImpl rule = new RuleImpl(RuleType.Solitary,
LoadSharingAlgorithm.Undefined, pattern, "K/K");
+ RuleImpl rule = new RuleImpl(RuleType.Solitary,
LoadSharingAlgorithm.Undefined, OriginationType.All, pattern, "K/K");
rule.setPrimaryAddressId(1);
SccpAddress address = new
SccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, 0,
GlobalTitle.getInstance(1, "222"), 8);
@@ -280,7 +281,7 @@
SccpAddress primaryAddress = new
SccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, 123,
GlobalTitle.getInstance("-/-"), 8);
- RuleImpl rule = new RuleImpl(RuleType.Solitary,
LoadSharingAlgorithm.Undefined, pattern, "R/K");
+ RuleImpl rule = new RuleImpl(RuleType.Solitary,
LoadSharingAlgorithm.Undefined, OriginationType.All, pattern, "R/K");
rule.setPrimaryAddressId(1);
// Writes
@@ -298,6 +299,44 @@
RuleImpl aiOut = reader.read("Rule", RuleImpl.class);
assertNotNull(aiOut);
+ assertEquals(aiOut.getRuleType(), RuleType.Solitary);
+ assertEquals(aiOut.getLoadSharingAlgorithm(),
LoadSharingAlgorithm.Undefined);
+ assertEquals(aiOut.getOriginationType(), OriginationType.All);
+
assertTrue(aiOut.getPattern().getGlobalTitle().getDigits().equals("441425/*"));
+ assertTrue(aiOut.getMask().equals("R/K"));
+ assertEquals(aiOut.getPrimaryAddressId(), 1);
+ assertEquals(aiOut.getSecondaryAddressId(), 0);
+ assertNull(aiOut.getNewCallingPartyAddressAddressId());
+
+
+ rule = new RuleImpl(RuleType.Broadcast, LoadSharingAlgorithm.Bit2,
OriginationType.LocalOriginated, pattern, "R/K");
+ rule.setPrimaryAddressId(11);
+ rule.setSecondaryAddressId(12);
+ rule.setNewCallingPartyAddressAddressId(13);
+
+ // Writes
+ output = new ByteArrayOutputStream();
+ writer = XMLObjectWriter.newInstance(output);
+ writer.setIndentation("\t"); // Optional (use tabulation for
+ // indentation).
+ writer.write(rule, "Rule", RuleImpl.class);
+ writer.close();
+
+ System.out.println(output.toString());
+
+ input = new ByteArrayInputStream(output.toByteArray());
+ reader = XMLObjectReader.newInstance(input);
+ aiOut = reader.read("Rule", RuleImpl.class);
+
+ assertNotNull(aiOut);
+ assertEquals(aiOut.getRuleType(), RuleType.Broadcast);
+ assertEquals(aiOut.getLoadSharingAlgorithm(),
LoadSharingAlgorithm.Bit2);
+ assertEquals(aiOut.getOriginationType(),
OriginationType.LocalOriginated);
+
assertTrue(aiOut.getPattern().getGlobalTitle().getDigits().equals("441425/*"));
+ assertTrue(aiOut.getMask().equals("R/K"));
+ assertEquals(aiOut.getPrimaryAddressId(), 11);
+ assertEquals(aiOut.getSecondaryAddressId(), 12);
+ assertEquals((int)aiOut.getNewCallingPartyAddressAddressId(),
13);
}
@@ -310,7 +349,7 @@
SccpAddress primaryAddress = new
SccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, 123,
GlobalTitle.getInstance(1, "333/---/4"), 0);
- RuleImpl rule = new RuleImpl(RuleType.Solitary,
LoadSharingAlgorithm.Undefined, pattern, "R/K/R");
+ RuleImpl rule = new RuleImpl(RuleType.Solitary,
LoadSharingAlgorithm.Undefined, OriginationType.All, pattern, "R/K/R");
rule.setPrimaryAddressId(1);
rule.setSecondaryAddressId(2);
=======================================
---
/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/translation/GT0001SccpStackImplTest.java
Thu Dec 6 03:29:38 2012
+++
/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/translation/GT0001SccpStackImplTest.java
Thu Dec 6 05:07:28 2012
@@ -27,6 +27,7 @@
import org.mobicents.protocols.ss7.indicator.NatureOfAddress;
import org.mobicents.protocols.ss7.indicator.RoutingIndicator;
import org.mobicents.protocols.ss7.sccp.LoadSharingAlgorithm;
+import org.mobicents.protocols.ss7.sccp.OriginationType;
import org.mobicents.protocols.ss7.sccp.RuleType;
import org.mobicents.protocols.ss7.sccp.impl.SccpHarness;
import org.mobicents.protocols.ss7.sccp.impl.User;
@@ -98,8 +99,8 @@
SccpAddress rule1SccpAddress = new
SccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, 0, new
GT0001(NatureOfAddress.NATIONAL,GT2_pattern_digits), getSSN());
SccpAddress rule2SccpAddress = new
SccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, 0, new
GT0001(NatureOfAddress.NATIONAL,GT1_pattern_digits), getSSN());
- super.router1.addRule(1, RuleType.Solitary,
LoadSharingAlgorithm.Undefined, rule1SccpAddress, "K/R/K", 22, -1);
- super.router2.addRule(1, RuleType.Solitary,
LoadSharingAlgorithm.Undefined, rule2SccpAddress, "R/R/R", 33, -1);
+ super.router1.addRule(1, RuleType.Solitary,
LoadSharingAlgorithm.Undefined, OriginationType.All,
rule1SccpAddress, "K/R/K", 22, -1, null);
+ super.router2.addRule(1, RuleType.Solitary,
LoadSharingAlgorithm.Undefined, OriginationType.All,
rule2SccpAddress, "R/R/R", 33, -1, null);
@@ -165,8 +166,8 @@
SccpAddress rule1SccpAddress = new
SccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, 0, new
GT0001(NatureOfAddress.NATIONAL,GT2_pattern_digits), getSSN());
SccpAddress rule2SccpAddress = new
SccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, 0, new
GT0001(NatureOfAddress.NATIONAL,GT1_pattern_digits), getSSN());
- super.router1.addRule(1, RuleType.Solitary,
LoadSharingAlgorithm.Undefined, rule1SccpAddress, "K/R/K", 22, -1);
- super.router2.addRule(1, RuleType.Solitary,
LoadSharingAlgorithm.Undefined, rule2SccpAddress, "R/K/R", 33, -1);
+ super.router1.addRule(1, RuleType.Solitary,
LoadSharingAlgorithm.Undefined, OriginationType.All,
rule1SccpAddress, "K/R/K", 22, -1, null);
+ super.router2.addRule(1, RuleType.Solitary,
LoadSharingAlgorithm.Undefined, OriginationType.All,
rule2SccpAddress, "R/K/R", 33, -1, null);
//add rules for incoming messages,
@@ -179,8 +180,8 @@
//2. add rules to make translation to above
rule1SccpAddress = new
SccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, 0, new
GT0001(NatureOfAddress.NATIONAL,"23456/?/8"), getSSN());
rule2SccpAddress = new
SccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, 0, new
GT0001(NatureOfAddress.NATIONAL,"02/?"), getSSN());
- super.router1.addRule(2, RuleType.Solitary,
LoadSharingAlgorithm.Undefined, rule1SccpAddress, "K/K/K", 44, -1);
- super.router2.addRule(2, RuleType.Solitary,
LoadSharingAlgorithm.Undefined, rule2SccpAddress, "K/K", 66, -1);
+ super.router1.addRule(2, RuleType.Solitary,
LoadSharingAlgorithm.Undefined, OriginationType.All,
rule1SccpAddress, "K/K/K", 44, -1, null);
+ super.router2.addRule(2, RuleType.Solitary,
LoadSharingAlgorithm.Undefined, OriginationType.All,
rule2SccpAddress, "K/K", 66, -1, null);
//now create users, we need to override matchX methods, since our rules
do kinky stuff with digits, plus
=======================================
---
/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/translation/GT0010SccpStackImplTest.java
Thu Dec 6 03:29:38 2012
+++
/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/translation/GT0010SccpStackImplTest.java
Thu Dec 6 05:07:28 2012
@@ -26,6 +26,7 @@
import org.mobicents.protocols.ss7.indicator.RoutingIndicator;
import org.mobicents.protocols.ss7.sccp.LoadSharingAlgorithm;
+import org.mobicents.protocols.ss7.sccp.OriginationType;
import org.mobicents.protocols.ss7.sccp.RuleType;
import org.mobicents.protocols.ss7.sccp.impl.SccpHarness;
import org.mobicents.protocols.ss7.sccp.impl.User;
@@ -95,8 +96,8 @@
SccpAddress rule1SccpAddress = new
SccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, 0, new
GT0010(0,GT2_pattern_digits), getSSN());
SccpAddress rule2SccpAddress = new
SccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, 0, new
GT0010(0,GT1_pattern_digits), getSSN());
- super.router1.addRule(1, RuleType.Solitary,
LoadSharingAlgorithm.Undefined, rule1SccpAddress, "K/R/K", 22, -1);
- super.router2.addRule(1, RuleType.Solitary,
LoadSharingAlgorithm.Undefined, rule2SccpAddress, "R/R/R", 33, -1);
+ super.router1.addRule(1, RuleType.Solitary,
LoadSharingAlgorithm.Undefined, OriginationType.All,
rule1SccpAddress, "K/R/K", 22, -1, null);
+ super.router2.addRule(1, RuleType.Solitary,
LoadSharingAlgorithm.Undefined, OriginationType.All,
rule2SccpAddress, "R/R/R", 33, -1, null);
=======================================
---
/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/translation/GT0011SccpStackImplTest.java
Thu Dec 6 03:29:38 2012
+++
/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/translation/GT0011SccpStackImplTest.java
Thu Dec 6 05:07:28 2012
@@ -27,6 +27,7 @@
import org.mobicents.protocols.ss7.indicator.NumberingPlan;
import org.mobicents.protocols.ss7.indicator.RoutingIndicator;
import org.mobicents.protocols.ss7.sccp.LoadSharingAlgorithm;
+import org.mobicents.protocols.ss7.sccp.OriginationType;
import org.mobicents.protocols.ss7.sccp.RuleType;
import org.mobicents.protocols.ss7.sccp.impl.SccpHarness;
import org.mobicents.protocols.ss7.sccp.impl.User;
@@ -101,8 +102,8 @@
NumberingPlan.ISDN_TELEPHONY,
GT2_pattern_digits), getSSN());
SccpAddress rule2SccpAddress = new
SccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, 0, new GT0011(0,
NumberingPlan.ISDN_MOBILE, GT1_pattern_digits),
getSSN());
- super.router1.addRule(1, RuleType.Solitary,
LoadSharingAlgorithm.Undefined, rule1SccpAddress, "K/R/K", 22, -1);
- super.router2.addRule(1, RuleType.Solitary,
LoadSharingAlgorithm.Undefined, rule2SccpAddress, "R/R/R", 33, -1);
+ super.router1.addRule(1, RuleType.Solitary,
LoadSharingAlgorithm.Undefined, OriginationType.All,
rule1SccpAddress, "K/R/K", 22, -1, null);
+ super.router2.addRule(1, RuleType.Solitary,
LoadSharingAlgorithm.Undefined, OriginationType.All,
rule2SccpAddress, "R/R/R", 33, -1, null);
// now create users, we need to override matchX methods, since
our rules
// do kinky stuff with digits, plus
@@ -170,8 +171,8 @@
NumberingPlan.ISDN_TELEPHONY,
GT2_pattern_digits), getSSN());
SccpAddress rule2SccpAddress = new
SccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, 0, new GT0011(0,
NumberingPlan.ISDN_MOBILE, GT1_pattern_digits),
getSSN());
- super.router1.addRule(1, RuleType.Solitary,
LoadSharingAlgorithm.Undefined, rule1SccpAddress, "K/R/K", 22, -1);
- super.router2.addRule(1, RuleType.Solitary,
LoadSharingAlgorithm.Undefined, rule2SccpAddress, "R/K/R", 33, -1);
+ super.router1.addRule(1, RuleType.Solitary,
LoadSharingAlgorithm.Undefined, OriginationType.All,
rule1SccpAddress, "K/R/K", 22, -1, null);
+ super.router2.addRule(1, RuleType.Solitary,
LoadSharingAlgorithm.Undefined, OriginationType.All,
rule2SccpAddress, "R/K/R", 33, -1, null);
// add rules for incoming messages,
@@ -188,8 +189,8 @@
NumberingPlan.ISDN_MOBILE, "23456/?/8"),
getSSN());
rule2SccpAddress = new
SccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, 0, new GT0011(0,
NumberingPlan.ISDN_TELEPHONY, "02/?"),
getSSN());
- super.router1.addRule(2, RuleType.Solitary,
LoadSharingAlgorithm.Undefined, rule1SccpAddress, "K/K/K", 44, -1);
- super.router2.addRule(2, RuleType.Solitary,
LoadSharingAlgorithm.Undefined, rule2SccpAddress, "K/K", 66, -1);
+ super.router1.addRule(2, RuleType.Solitary,
LoadSharingAlgorithm.Undefined, OriginationType.All,
rule1SccpAddress, "K/K/K", 44, -1, null);
+ super.router2.addRule(2, RuleType.Solitary,
LoadSharingAlgorithm.Undefined, OriginationType.All,
rule2SccpAddress, "K/K", 66, -1, null);
// now create users, we need to override matchX methods, since
our rules
// do kinky stuff with digits, plus
=======================================
---
/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/translation/GT0100SccpStackImplTest.java
Thu Dec 6 03:29:38 2012
+++
/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/translation/GT0100SccpStackImplTest.java
Thu Dec 6 05:07:28 2012
@@ -28,6 +28,7 @@
import org.mobicents.protocols.ss7.indicator.NumberingPlan;
import org.mobicents.protocols.ss7.indicator.RoutingIndicator;
import org.mobicents.protocols.ss7.sccp.LoadSharingAlgorithm;
+import org.mobicents.protocols.ss7.sccp.OriginationType;
import org.mobicents.protocols.ss7.sccp.RuleType;
import org.mobicents.protocols.ss7.sccp.impl.SccpHarness;
import org.mobicents.protocols.ss7.sccp.impl.User;
@@ -102,8 +103,8 @@
NumberingPlan.ISDN_TELEPHONY, NatureOfAddress.NATIONAL,
GT2_pattern_digits), getSSN());
SccpAddress rule2SccpAddress = new
SccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, 0, new GT0100(0,
NumberingPlan.ISDN_MOBILE, NatureOfAddress.NATIONAL,
GT1_pattern_digits), getSSN());
- super.router1.addRule(1, RuleType.Solitary,
LoadSharingAlgorithm.Undefined, rule1SccpAddress, "K/R/K", 22, -1);
- super.router2.addRule(1, RuleType.Solitary,
LoadSharingAlgorithm.Undefined, rule2SccpAddress, "R/R/R", 33, -1);
+ super.router1.addRule(1, RuleType.Solitary,
LoadSharingAlgorithm.Undefined, OriginationType.All,
rule1SccpAddress, "K/R/K", 22, -1, null);
+ super.router2.addRule(1, RuleType.Solitary,
LoadSharingAlgorithm.Undefined, OriginationType.All,
rule2SccpAddress, "R/R/R", 33, -1, null);
// now create users, we need to override matchX methods, since
our rules
// do kinky stuff with digits, plus
@@ -172,8 +173,8 @@
NumberingPlan.ISDN_TELEPHONY, NatureOfAddress.NATIONAL,
GT2_pattern_digits), getSSN());
SccpAddress rule2SccpAddress = new
SccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, 0, new GT0100(0,
NumberingPlan.ISDN_MOBILE, NatureOfAddress.NATIONAL,
GT1_pattern_digits), getSSN());
- super.router1.addRule(1, RuleType.Solitary,
LoadSharingAlgorithm.Undefined, rule1SccpAddress, "K/R/K", 22, -1);
- super.router2.addRule(1, RuleType.Solitary,
LoadSharingAlgorithm.Undefined, rule2SccpAddress, "R/K/R", 33, -1);
+ super.router1.addRule(1, RuleType.Solitary,
LoadSharingAlgorithm.Undefined, OriginationType.All,
rule1SccpAddress, "K/R/K", 22, -1, null);
+ super.router2.addRule(1, RuleType.Solitary,
LoadSharingAlgorithm.Undefined, OriginationType.All,
rule2SccpAddress, "R/K/R", 33, -1, null);
// add rules for incoming messages,
@@ -190,8 +191,8 @@
NumberingPlan.ISDN_MOBILE, NatureOfAddress.NATIONAL, "23456/?/8"),
getSSN());
rule2SccpAddress = new
SccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, 0, new GT0100(0,
NumberingPlan.ISDN_TELEPHONY, NatureOfAddress.NATIONAL, "02/?"),
getSSN());
- super.router1.addRule(2, RuleType.Solitary,
LoadSharingAlgorithm.Undefined, rule1SccpAddress, "K/K/K", 44, -1);
- super.router2.addRule(2, RuleType.Solitary,
LoadSharingAlgorithm.Undefined, rule2SccpAddress, "K/K", 66, -1);
+ super.router1.addRule(2, RuleType.Solitary,
LoadSharingAlgorithm.Undefined, OriginationType.All,
rule1SccpAddress, "K/K/K", 44, -1, null);
+ super.router2.addRule(2, RuleType.Solitary,
LoadSharingAlgorithm.Undefined, OriginationType.All,
rule2SccpAddress, "K/K", 66, -1, null);
// now create users, we need to override matchX methods, since
our rules
// do kinky stuff with digits, plus
==============================================================================
Revision: 96bb979433e9
Author: Sergey Vetyutnev <[email protected]>
Date: Thu Dec 6 05:27:17 2012
Log: SCP new features update - update transferTest
http://code.google.com/p/jss7/source/detail?r=96bb979433e9
Modified:
/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/messageflow/LoadSharingTest.java
=======================================
---
/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/messageflow/LoadSharingTest.java
Thu Dec 6 05:07:28 2012
+++
/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/messageflow/LoadSharingTest.java
Thu Dec 6 05:27:17 2012
@@ -118,7 +118,7 @@
SccpAddress primaryAddress2 = new
SccpAddress(RoutingIndicator.ROUTING_BASED_ON_DPC_AND_SSN, getStack2PC(),
GlobalTitle.getInstance(1, "111111"), 0);
sccpStack1.getRouter().addRoutingAddress(2, primaryAddress2);
SccpAddress backupAddress = new
SccpAddress(RoutingIndicator.ROUTING_BASED_ON_DPC_AND_SSN, 12,
GlobalTitle.getInstance(1, "111111"), 8);
- sccpStack1.getRouter().addRoutingAddress(1, backupAddress);
+ sccpStack1.getRouter().addRoutingAddress(3, backupAddress);
// sccpStack1.getRouter().addBackupAddress(1, backupAddress);
// ---- Solitary case
@@ -176,7 +176,7 @@
// ---- Dominant case
sccpStack1.getRouter().removeRule(1);
- sccpStack1.getRouter().addRule(1, RuleType.Dominant,
LoadSharingAlgorithm.Undefined, OriginationType.All, pattern, "K", 1, 1,
null);
+ sccpStack1.getRouter().addRule(1, RuleType.Dominant,
LoadSharingAlgorithm.Undefined, OriginationType.All, pattern, "K", 1, 3,
null);
// Primary and backup are available
a3 = new SccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, 0,
GlobalTitle.getInstance(1, "111111"), 0);
@@ -227,9 +227,9 @@
// ---- Loadshared case
sccpStack1.getRouter().removeRule(1);
- sccpStack1.getRouter().addRule(1, RuleType.Loadshared,
LoadSharingAlgorithm.Bit4, OriginationType.All, pattern, "K", 1, 1, null);
+ sccpStack1.getRouter().addRule(1, RuleType.Loadshared,
LoadSharingAlgorithm.Bit4, OriginationType.All, pattern, "K", 1, 3, null);
// rule which primaryAddress ssn==0 (getting ssn from origin
CalledPartyAddress)
- sccpStack1.getRouter().addRule(2, RuleType.Loadshared,
LoadSharingAlgorithm.Bit4, OriginationType.All, pattern2, "K", 2, 1, null);
+ sccpStack1.getRouter().addRule(2, RuleType.Loadshared,
LoadSharingAlgorithm.Bit4, OriginationType.All, pattern2, "K", 2, 3, null);
// Primary and backup are available
// - class 1 (route by sls): sls = 0xEF: primary route (sls & 0x10
rule)