Revision: 7c3c6dcc8253
Author: Normandes Junior <[email protected]>
Date: Tue Aug 21 11:54:35 2012
Log: Implementing checkIMEI MAP Message
Update issue #76
On branch checkImei
Changes to be committed:
modified:
map/map-api/src/main/java/org/mobicents/protocols/ss7/map/api/MAPParameterFactory.java
modified:
map/map-impl/src/main/java/org/mobicents/protocols/ss7/map/MAPParameterFactoryImpl.java
modified:
map/map-impl/src/main/java/org/mobicents/protocols/ss7/map/service/mobility/imei/CheckImeiResponseImpl.java
modified:
map/map-impl/src/test/java/org/mobicents/protocols/ss7/map/functional/Client.java
modified:
map/map-impl/src/test/java/org/mobicents/protocols/ss7/map/functional/MAPFunctionalTest.java
modified:
map/map-impl/src/test/java/org/mobicents/protocols/ss7/map/service/mobility/imei/CheckImeiRequestTest.java
modified:
map/map-impl/src/test/java/org/mobicents/protocols/ss7/map/service/mobility/imei/CheckImeiResponseTest.java
http://code.google.com/p/jss7/source/detail?r=7c3c6dcc8253
Modified:
/map/map-api/src/main/java/org/mobicents/protocols/ss7/map/api/MAPParameterFactory.java
/map/map-impl/src/main/java/org/mobicents/protocols/ss7/map/MAPParameterFactoryImpl.java
/map/map-impl/src/main/java/org/mobicents/protocols/ss7/map/service/mobility/imei/CheckImeiResponseImpl.java
/map/map-impl/src/test/java/org/mobicents/protocols/ss7/map/functional/Client.java
/map/map-impl/src/test/java/org/mobicents/protocols/ss7/map/functional/MAPFunctionalTest.java
/map/map-impl/src/test/java/org/mobicents/protocols/ss7/map/service/mobility/imei/CheckImeiRequestTest.java
/map/map-impl/src/test/java/org/mobicents/protocols/ss7/map/service/mobility/imei/CheckImeiResponseTest.java
=======================================
---
/map/map-api/src/main/java/org/mobicents/protocols/ss7/map/api/MAPParameterFactory.java
Wed Aug 1 05:39:20 2012
+++
/map/map-api/src/main/java/org/mobicents/protocols/ss7/map/api/MAPParameterFactory.java
Tue Aug 21 11:54:35 2012
@@ -98,6 +98,10 @@
import
org.mobicents.protocols.ss7.map.api.service.mobility.authentication.QuintupletList;
import
org.mobicents.protocols.ss7.map.api.service.mobility.authentication.ReSynchronisationInfo;
import
org.mobicents.protocols.ss7.map.api.service.mobility.authentication.TripletList;
+import
org.mobicents.protocols.ss7.map.api.service.mobility.imei.RequestedEquipmentInfo;
+import org.mobicents.protocols.ss7.map.api.service.mobility.imei.UESBIIu;
+import org.mobicents.protocols.ss7.map.api.service.mobility.imei.UESBIIuA;
+import org.mobicents.protocols.ss7.map.api.service.mobility.imei.UESBIIuB;
import
org.mobicents.protocols.ss7.map.api.service.mobility.locationManagement.ADDInfo;
import
org.mobicents.protocols.ss7.map.api.service.mobility.locationManagement.ISTSupportIndicator;
import
org.mobicents.protocols.ss7.map.api.service.mobility.locationManagement.LAC;
@@ -538,4 +542,9 @@
public Problem createProblemInvoke(InvokeProblemType prob);
public Problem createProblemResult(ReturnResultProblemType prob);
public Problem createProblemError(ReturnErrorProblemType prob);
+
+ public RequestedEquipmentInfo createRequestedEquipmentInfo(boolean
equipmentStatus, boolean bmuef);
+ public UESBIIuA createUESBIIuA(BitSetStrictLength data);
+ public UESBIIuB createUESBIIuB(BitSetStrictLength data);
+ public UESBIIu createUESBIIu(UESBIIuA uesbiIuA, UESBIIuB uesbiIuB);
}
=======================================
---
/map/map-impl/src/main/java/org/mobicents/protocols/ss7/map/MAPParameterFactoryImpl.java
Wed Aug 1 05:39:20 2012
+++
/map/map-impl/src/main/java/org/mobicents/protocols/ss7/map/MAPParameterFactoryImpl.java
Tue Aug 21 11:54:35 2012
@@ -100,6 +100,10 @@
import
org.mobicents.protocols.ss7.map.api.service.mobility.authentication.QuintupletList;
import
org.mobicents.protocols.ss7.map.api.service.mobility.authentication.ReSynchronisationInfo;
import
org.mobicents.protocols.ss7.map.api.service.mobility.authentication.TripletList;
+import
org.mobicents.protocols.ss7.map.api.service.mobility.imei.RequestedEquipmentInfo;
+import org.mobicents.protocols.ss7.map.api.service.mobility.imei.UESBIIu;
+import org.mobicents.protocols.ss7.map.api.service.mobility.imei.UESBIIuA;
+import org.mobicents.protocols.ss7.map.api.service.mobility.imei.UESBIIuB;
import
org.mobicents.protocols.ss7.map.api.service.mobility.locationManagement.ADDInfo;
import
org.mobicents.protocols.ss7.map.api.service.mobility.locationManagement.ISTSupportIndicator;
import
org.mobicents.protocols.ss7.map.api.service.mobility.locationManagement.LAC;
@@ -226,6 +230,10 @@
import
org.mobicents.protocols.ss7.map.service.mobility.authentication.QuintupletListImpl;
import
org.mobicents.protocols.ss7.map.service.mobility.authentication.ReSynchronisationInfoImpl;
import
org.mobicents.protocols.ss7.map.service.mobility.authentication.TripletListImpl;
+import
org.mobicents.protocols.ss7.map.service.mobility.imei.RequestedEquipmentInfoImpl;
+import org.mobicents.protocols.ss7.map.service.mobility.imei.UESBIIuAImpl;
+import org.mobicents.protocols.ss7.map.service.mobility.imei.UESBIIuBImpl;
+import org.mobicents.protocols.ss7.map.service.mobility.imei.UESBIIuImpl;
import
org.mobicents.protocols.ss7.map.service.mobility.locationManagement.ADDInfoImpl;
import
org.mobicents.protocols.ss7.map.service.mobility.locationManagement.LACImpl;
import
org.mobicents.protocols.ss7.map.service.mobility.locationManagement.LocationAreaImpl;
@@ -966,5 +974,25 @@
public VelocityEstimate createVelocityEstimate(byte[] data) {
return new VelocityEstimateImpl(data);
}
+
+ @Override
+ public RequestedEquipmentInfo createRequestedEquipmentInfo(boolean
equipmentStatus, boolean bmuef) {
+ return new RequestedEquipmentInfoImpl(equipmentStatus, bmuef);
+ }
+
+ @Override
+ public UESBIIuA createUESBIIuA(BitSetStrictLength data) {
+ return new UESBIIuAImpl(data);
+ }
+
+ @Override
+ public UESBIIuB createUESBIIuB(BitSetStrictLength data) {
+ return new UESBIIuBImpl(data);
+ }
+
+ @Override
+ public UESBIIu createUESBIIu(UESBIIuA uesbiIuA, UESBIIuB uesbiIuB) {
+ return new UESBIIuImpl(uesbiIuA, uesbiIuB);
+ }
}
=======================================
---
/map/map-impl/src/main/java/org/mobicents/protocols/ss7/map/service/mobility/imei/CheckImeiResponseImpl.java
Mon Aug 20 22:31:24 2012
+++
/map/map-impl/src/main/java/org/mobicents/protocols/ss7/map/service/mobility/imei/CheckImeiResponseImpl.java
Tue Aug 21 11:54:35 2012
@@ -217,7 +217,7 @@
((UESBIIuImpl)
this.bmuef).encodeAll(asnOs);
}
if (this.extensionContainer != null) {
- ((MAPExtensionContainerImpl)
this.extensionContainer).encodeAll(asnOs);
+ ((MAPExtensionContainerImpl)
this.extensionContainer).encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC,
_ID_extensionContainer);
}
} else {
if (this.equipmentStatus == null) {
=======================================
---
/map/map-impl/src/test/java/org/mobicents/protocols/ss7/map/functional/Client.java
Wed Aug 1 05:39:20 2012
+++
/map/map-impl/src/test/java/org/mobicents/protocols/ss7/map/functional/Client.java
Tue Aug 21 11:54:35 2012
@@ -40,6 +40,7 @@
import org.mobicents.protocols.ss7.map.api.primitives.IMSI;
import org.mobicents.protocols.ss7.map.api.primitives.ISDNAddressString;
import org.mobicents.protocols.ss7.map.api.primitives.LMSI;
+import
org.mobicents.protocols.ss7.map.api.primitives.MAPExtensionContainer;
import org.mobicents.protocols.ss7.map.api.primitives.NumberingPlan;
import org.mobicents.protocols.ss7.map.api.primitives.SubscriberIdentity;
import org.mobicents.protocols.ss7.map.api.primitives.USSDString;
@@ -52,6 +53,7 @@
import org.mobicents.protocols.ss7.map.api.service.lsm.MAPDialogLsm;
import
org.mobicents.protocols.ss7.map.api.service.mobility.MAPDialogMobility;
import
org.mobicents.protocols.ss7.map.api.service.mobility.authentication.RequestingNodeType;
+import
org.mobicents.protocols.ss7.map.api.service.mobility.imei.RequestedEquipmentInfo;
import
org.mobicents.protocols.ss7.map.api.service.mobility.locationManagement.ADDInfo;
import
org.mobicents.protocols.ss7.map.api.service.mobility.subscriberInformation.RequestedInfo;
import org.mobicents.protocols.ss7.map.api.service.sms.MAPDialogSms;
@@ -656,6 +658,44 @@
this.observerdEvents.add(TestEvent.createSentEvent(EventType.SendRoutingInfoForLCS,
null, sequence++));
clientDialogLsm.send();
}
+
+ public void sendCheckImei() throws Exception {
+
+ this.mapProvider.getMAPServiceMobility().acivate();
+
+ MAPApplicationContext appCnt = null;
+
+ appCnt =
MAPApplicationContext.getInstance(MAPApplicationContextName.equipmentMngtContext,
MAPApplicationContextVersion.version3);
+
+ clientDialogMobility =
this.mapProvider.getMAPServiceMobility().createNewDialog(appCnt,
this.thisAddress, null, this.remoteAddress, null);
+
+ IMEI imei =
this.mapParameterFactory.createIMEI("111111112222222");
+ RequestedEquipmentInfo requestedEquipmentInfo =
this.mapParameterFactory.createRequestedEquipmentInfo(true, false);
+ MAPExtensionContainer extensionContainer =
MAPExtensionContainerTest.GetTestExtensionContainer();
+
+ clientDialogMobility.addCheckImeiRequest(imei, requestedEquipmentInfo,
extensionContainer);
+
+ this.observerdEvents.add(TestEvent.createSentEvent(EventType.CheckImei,
null, sequence++));
+ clientDialogMobility.send();
+ }
+
+ public void sendCheckImei_V2() throws Exception {
+
+ this.mapProvider.getMAPServiceMobility().acivate();
+
+ MAPApplicationContext appCnt = null;
+
+ appCnt =
MAPApplicationContext.getInstance(MAPApplicationContextName.equipmentMngtContext,
MAPApplicationContextVersion.version2);
+
+ clientDialogMobility =
this.mapProvider.getMAPServiceMobility().createNewDialog(appCnt,
this.thisAddress, null, this.remoteAddress, null);
+
+ IMEI imei =
this.mapParameterFactory.createIMEI("333333334444444");
+
+ clientDialogMobility.addCheckImeiRequest(imei, null, null);
+
+ this.observerdEvents.add(TestEvent.createSentEvent(EventType.CheckImei,
null, sequence++));
+ clientDialogMobility.send();
+ }
public MAPDialog getMapDialog() {
return this.clientDialog;
=======================================
---
/map/map-impl/src/test/java/org/mobicents/protocols/ss7/map/functional/MAPFunctionalTest.java
Tue Aug 14 02:00:14 2012
+++
/map/map-impl/src/test/java/org/mobicents/protocols/ss7/map/functional/MAPFunctionalTest.java
Tue Aug 21 11:54:35 2012
@@ -24,8 +24,8 @@
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertTrue;
import static org.testng.Assert.assertNull;
+import static org.testng.Assert.assertTrue;
import static org.testng.Assert.fail;
import java.io.InputStream;
@@ -38,6 +38,7 @@
import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;
import org.mobicents.protocols.asn.AsnOutputStream;
+import org.mobicents.protocols.asn.BitSetStrictLength;
import org.mobicents.protocols.ss7.indicator.RoutingIndicator;
import org.mobicents.protocols.ss7.map.MAPProviderImpl;
import org.mobicents.protocols.ss7.map.MAPStackImpl;
@@ -88,6 +89,12 @@
import
org.mobicents.protocols.ss7.map.api.service.mobility.authentication.SendAuthenticationInfoRequest;
import
org.mobicents.protocols.ss7.map.api.service.mobility.authentication.SendAuthenticationInfoResponse;
import
org.mobicents.protocols.ss7.map.api.service.mobility.authentication.TripletList;
+import
org.mobicents.protocols.ss7.map.api.service.mobility.imei.CheckImeiRequest;
+import
org.mobicents.protocols.ss7.map.api.service.mobility.imei.CheckImeiResponse;
+import
org.mobicents.protocols.ss7.map.api.service.mobility.imei.EquipmentStatus;
+import org.mobicents.protocols.ss7.map.api.service.mobility.imei.UESBIIu;
+import org.mobicents.protocols.ss7.map.api.service.mobility.imei.UESBIIuA;
+import org.mobicents.protocols.ss7.map.api.service.mobility.imei.UESBIIuB;
import
org.mobicents.protocols.ss7.map.api.service.mobility.locationManagement.ADDInfo;
import
org.mobicents.protocols.ss7.map.api.service.mobility.locationManagement.UpdateLocationRequest;
import
org.mobicents.protocols.ss7.map.api.service.mobility.locationManagement.UpdateLocationResponse;
@@ -3838,9 +3845,200 @@
}
+ /**
+ * TC-BEGIN + checkImeiRequest
+ * TC-END + checkImeiResponse
+ */
+ @Test(groups = { "functional.flow", "dialog" })
+ public void testCheckImei() throws Exception {
+ Client client = new Client(stack1, this, peer1Address,
peer2Address) {
+ @Override
+ public void onCheckImeiResponse(CheckImeiResponse ind) {
+ super.onCheckImeiResponse(ind);
+
+
Assert.assertTrue(ind.getEquipmentStatus().equals(EquipmentStatus.blackListed));
+
Assert.assertTrue(ind.getBmuef().getUESBI_IuA().getData().get(0));
+
Assert.assertFalse(ind.getBmuef().getUESBI_IuB().getData().get(0));
+
Assert.assertTrue(MAPExtensionContainerTest.CheckTestExtensionContainer(ind.getExtensionContainer()));
+ };
+ };
+
+ Server server = new Server(this.stack2, this, peer2Address,
peer1Address) {
+ @Override
+ public void onCheckImeiRequest(CheckImeiRequest ind) {
+ super.onCheckImeiRequest(ind);
+
+ MAPDialogMobility d = ind.getMAPDialog();
+
+
Assert.assertTrue(ind.getIMEI().getIMEI().equals("111111112222222"));
+
Assert.assertTrue(ind.getRequestedEquipmentInfo().getEquipmentStatus());
+
Assert.assertFalse(ind.getRequestedEquipmentInfo().getBmuef());
+
Assert.assertTrue(MAPExtensionContainerTest.CheckTestExtensionContainer(ind.getExtensionContainer()));
+
+ BitSetStrictLength bsUESBIIuA = new
BitSetStrictLength(1);
+ bsUESBIIuA.set(0);
+ BitSetStrictLength bsUESBIIuB = new
BitSetStrictLength(1);
+
+ UESBIIuA uesbiIuA =
this.mapParameterFactory.createUESBIIuA(bsUESBIIuA);
+ UESBIIuB uesbiIuB =
this.mapParameterFactory.createUESBIIuB(bsUESBIIuB);
+ UESBIIu bmuef = this.mapParameterFactory.createUESBIIu(uesbiIuA,
uesbiIuB);
+
+ MAPExtensionContainer extensionContainer =
MAPExtensionContainerTest.GetTestExtensionContainer();
+ try {
+ d.addCheckImeiResponse(ind.getInvokeId(),
EquipmentStatus.blackListed, bmuef, extensionContainer);
+ } catch (MAPException e) {
+ this.error("Error while adding
CheckImeiResponse", e);
+ fail("Error while adding
CheckImeiResponse");
+ }
+ }
+
+ @Override
+ public void onDialogDelimiter(MAPDialog mapDialog) {
+ super.onDialogDelimiter(mapDialog);
+ try {
+
this.observerdEvents.add(TestEvent.createSentEvent(EventType.CheckImeiResp,
null, sequence++));
+ mapDialog.close(false);
+ } catch (MAPException e) {
+ this.error("Error while sending
close()", e);
+ fail("Error while sending close()");
+ }
+ }
+ };
+
+ long stamp = System.currentTimeMillis();
+ int count = 0;
+ // Client side events
+ List<TestEvent> clientExpectedEvents = new
ArrayList<TestEvent>();
+ TestEvent te = TestEvent.createSentEvent(EventType.CheckImei, null,
count++, stamp);
+ clientExpectedEvents.add(te);
+
+ te = TestEvent.createReceivedEvent(EventType.DialogAccept, null,
count++, (stamp + _TCAP_DIALOG_RELEASE_TIMEOUT));
+ clientExpectedEvents.add(te);
+
+ te = TestEvent.createReceivedEvent(EventType.CheckImeiResp, null,
count++, (stamp + _TCAP_DIALOG_RELEASE_TIMEOUT));
+ clientExpectedEvents.add(te);
+
+ te = TestEvent.createReceivedEvent(EventType.DialogClose, null, count++,
(stamp + _TCAP_DIALOG_RELEASE_TIMEOUT));
+ clientExpectedEvents.add(te);
+
+ te = TestEvent.createReceivedEvent(EventType.DialogRelease, null,
count++, (stamp + _TCAP_DIALOG_RELEASE_TIMEOUT));
+ clientExpectedEvents.add(te);
+
+ count = 0;
+ // Server side events
+ List<TestEvent> serverExpectedEvents = new
ArrayList<TestEvent>();
+ te = TestEvent.createReceivedEvent(EventType.DialogRequest, null,
count++, (stamp + _TCAP_DIALOG_RELEASE_TIMEOUT));
+ serverExpectedEvents.add(te);
+
+ te = TestEvent.createReceivedEvent(EventType.CheckImei, null, count++,
(stamp + _TCAP_DIALOG_RELEASE_TIMEOUT));
+ serverExpectedEvents.add(te);
+
+ te = TestEvent.createReceivedEvent(EventType.DialogDelimiter, null,
count++, (stamp + _TCAP_DIALOG_RELEASE_TIMEOUT));
+ serverExpectedEvents.add(te);
+
+ te = TestEvent.createSentEvent(EventType.CheckImeiResp, null, count++,
stamp);
+ serverExpectedEvents.add(te);
+
+ te = TestEvent.createReceivedEvent(EventType.DialogRelease, null,
count++, (stamp + _TCAP_DIALOG_RELEASE_TIMEOUT));
+ serverExpectedEvents.add(te);
+
+ client.sendCheckImei();
+ waitForEnd();
+ client.compareEvents(clientExpectedEvents);
+ server.compareEvents(serverExpectedEvents);
+ }
-
-
+ /**
+ * TC-BEGIN + checkImeiRequest_V2
+ * TC-END + checkImeiResponse_V2
+ */
+ @Test(groups = { "functional.flow", "dialog" })
+ public void testCheckImei_V2() throws Exception {
+ Client client = new Client(stack1, this, peer1Address,
peer2Address) {
+ @Override
+ public void onCheckImeiResponse(CheckImeiResponse ind) {
+ super.onCheckImeiResponse(ind);
+
+
Assert.assertTrue(ind.getEquipmentStatus().equals(EquipmentStatus.blackListed));
+ Assert.assertNull(ind.getBmuef());
+ Assert.assertNull(ind.getExtensionContainer());
+ };
+ };
+
+ Server server = new Server(this.stack2, this, peer2Address,
peer1Address) {
+ @Override
+ public void onCheckImeiRequest(CheckImeiRequest ind) {
+ super.onCheckImeiRequest(ind);
+
+ MAPDialogMobility d = ind.getMAPDialog();
+
+
Assert.assertTrue(ind.getIMEI().getIMEI().equals("333333334444444"));
+
Assert.assertNull(ind.getRequestedEquipmentInfo());
+ Assert.assertNull(ind.getExtensionContainer());
+
+ try {
+ d.addCheckImeiResponse(ind.getInvokeId(),
EquipmentStatus.blackListed, null, null);
+ } catch (MAPException e) {
+ this.error("Error while adding
CheckImeiResponse_V2", e);
+ fail("Error while adding
CheckImeiResponse_V2");
+ }
+ }
+
+ @Override
+ public void onDialogDelimiter(MAPDialog mapDialog) {
+ super.onDialogDelimiter(mapDialog);
+ try {
+
this.observerdEvents.add(TestEvent.createSentEvent(EventType.CheckImeiResp,
null, sequence++));
+ mapDialog.close(false);
+ } catch (MAPException e) {
+ this.error("Error while sending
close()", e);
+ fail("Error while sending close()");
+ }
+ }
+ };
+
+ long stamp = System.currentTimeMillis();
+ int count = 0;
+ // Client side events
+ List<TestEvent> clientExpectedEvents = new
ArrayList<TestEvent>();
+ TestEvent te = TestEvent.createSentEvent(EventType.CheckImei, null,
count++, stamp);
+ clientExpectedEvents.add(te);
+
+ te = TestEvent.createReceivedEvent(EventType.DialogAccept, null,
count++, (stamp + _TCAP_DIALOG_RELEASE_TIMEOUT));
+ clientExpectedEvents.add(te);
+
+ te = TestEvent.createReceivedEvent(EventType.CheckImeiResp, null,
count++, (stamp + _TCAP_DIALOG_RELEASE_TIMEOUT));
+ clientExpectedEvents.add(te);
+
+ te = TestEvent.createReceivedEvent(EventType.DialogClose, null, count++,
(stamp + _TCAP_DIALOG_RELEASE_TIMEOUT));
+ clientExpectedEvents.add(te);
+
+ te = TestEvent.createReceivedEvent(EventType.DialogRelease, null,
count++, (stamp + _TCAP_DIALOG_RELEASE_TIMEOUT));
+ clientExpectedEvents.add(te);
+
+ count = 0;
+ // Server side events
+ List<TestEvent> serverExpectedEvents = new
ArrayList<TestEvent>();
+ te = TestEvent.createReceivedEvent(EventType.DialogRequest, null,
count++, (stamp + _TCAP_DIALOG_RELEASE_TIMEOUT));
+ serverExpectedEvents.add(te);
+
+ te = TestEvent.createReceivedEvent(EventType.CheckImei, null, count++,
(stamp + _TCAP_DIALOG_RELEASE_TIMEOUT));
+ serverExpectedEvents.add(te);
+
+ te = TestEvent.createReceivedEvent(EventType.DialogDelimiter, null,
count++, (stamp + _TCAP_DIALOG_RELEASE_TIMEOUT));
+ serverExpectedEvents.add(te);
+
+ te = TestEvent.createSentEvent(EventType.CheckImeiResp, null, count++,
stamp);
+ serverExpectedEvents.add(te);
+
+ te = TestEvent.createReceivedEvent(EventType.DialogRelease, null,
count++, (stamp + _TCAP_DIALOG_RELEASE_TIMEOUT));
+ serverExpectedEvents.add(te);
+
+ client.sendCheckImei_V2();
+ waitForEnd();
+ client.compareEvents(clientExpectedEvents);
+ server.compareEvents(serverExpectedEvents);
+ }
private void waitForEnd() {
try {
=======================================
---
/map/map-impl/src/test/java/org/mobicents/protocols/ss7/map/service/mobility/imei/CheckImeiRequestTest.java
Mon Aug 20 09:42:53 2012
+++
/map/map-impl/src/test/java/org/mobicents/protocols/ss7/map/service/mobility/imei/CheckImeiRequestTest.java
Tue Aug 21 11:54:35 2012
@@ -29,7 +29,9 @@
import org.mobicents.protocols.asn.AsnInputStream;
import org.mobicents.protocols.asn.AsnOutputStream;
import org.mobicents.protocols.asn.Tag;
+import
org.mobicents.protocols.ss7.map.api.primitives.MAPExtensionContainer;
import org.mobicents.protocols.ss7.map.primitives.IMEIImpl;
+import
org.mobicents.protocols.ss7.map.primitives.MAPExtensionContainerTest;
import org.testng.annotations.Test;
/**
@@ -48,6 +50,12 @@
// TODO this is self generated trace. We need trace from
operator
return new byte[] { 48, 14, 4, 8, 83, 8, 25, 16, -122, 53, 85, -16, 3,
2, 6, -128 };
}
+
+ private byte[] getEncodedDataV3Full() {
+ // TODO this is self generated trace. We need trace from
operator
+ return new byte[] { 48, 55, 4, 8, 83, 8, 25, 16, -122, 53, 85, -16, 3,
2, 6, -128, 48, 39, -96, 32, 48, 10, 6, 3, 42, 3, 4, 11, 12, 13, 14, 15,
48, 5,
+ 6, 3, 42, 3, 6, 48, 11, 6, 3, 42, 3, 5, 21, 22, 23, 24, 25, 26, -95,
3, 31, 32, 33 };
+ }
@Test(groups = { "functional.decode", "imei" })
public void testDecode() throws Exception {
@@ -65,6 +73,21 @@
assertTrue(checkImeiImpl.getRequestedEquipmentInfo().getEquipmentStatus());
assertFalse(checkImeiImpl.getRequestedEquipmentInfo().getBmuef());
+ // Testing version 3 Full
+ rawData = getEncodedDataV3Full();
+ asnIS = new AsnInputStream(rawData);
+
+ tag = asnIS.readTag();
+ assertEquals(tag, Tag.SEQUENCE);
+
+ checkImeiImpl = new CheckImeiRequestImpl(3);
+ checkImeiImpl.decodeAll(asnIS);
+
+
assertTrue(checkImeiImpl.getIMEI().getIMEI().equals("358091016853550"));
+
assertTrue(checkImeiImpl.getRequestedEquipmentInfo().getEquipmentStatus());
+
assertFalse(checkImeiImpl.getRequestedEquipmentInfo().getBmuef());
+
assertTrue(MAPExtensionContainerTest.CheckTestExtensionContainer(checkImeiImpl.getExtensionContainer()));
+
// Testing version 1 and 2
rawData = getEncodedDataV2();
asnIS = new AsnInputStream(rawData);
@@ -91,6 +114,19 @@
byte[] rawData = getEncodedDataV3();
assertTrue(Arrays.equals(rawData, encodedData));
+ // Testing version 3 Full
+ imei = new IMEIImpl("358091016853550");
+ requestedEquipmentInfo = new RequestedEquipmentInfoImpl(true,
false);
+ MAPExtensionContainer extensionContainer =
MAPExtensionContainerTest.GetTestExtensionContainer();
+
+ checkImei = new CheckImeiRequestImpl(3, imei, requestedEquipmentInfo,
extensionContainer);
+ asnOS = new AsnOutputStream();
+ checkImei.encodeAll(asnOS);
+
+ encodedData = asnOS.toByteArray();
+ rawData = getEncodedDataV3Full();
+ assertTrue(Arrays.equals(rawData, encodedData));
+
// Testing version 1 and 2
imei = new IMEIImpl("358091016853550");
checkImei = new CheckImeiRequestImpl(2, imei, null, null);
=======================================
---
/map/map-impl/src/test/java/org/mobicents/protocols/ss7/map/service/mobility/imei/CheckImeiResponseTest.java
Mon Aug 20 09:42:53 2012
+++
/map/map-impl/src/test/java/org/mobicents/protocols/ss7/map/service/mobility/imei/CheckImeiResponseTest.java
Tue Aug 21 11:54:35 2012
@@ -30,7 +30,9 @@
import org.mobicents.protocols.asn.AsnOutputStream;
import org.mobicents.protocols.asn.BitSetStrictLength;
import org.mobicents.protocols.asn.Tag;
+import
org.mobicents.protocols.ss7.map.api.primitives.MAPExtensionContainer;
import
org.mobicents.protocols.ss7.map.api.service.mobility.imei.EquipmentStatus;
+import
org.mobicents.protocols.ss7.map.primitives.MAPExtensionContainerTest;
import org.testng.annotations.Test;
/**
@@ -49,6 +51,12 @@
// TODO this is self generated trace. We need trace from
operator
return new byte[] { 48, 13, 10, 1, 0, 48, 8, -128, 2, 7, -128, -127, 2,
7, 0 };
}
+
+ private byte[] getEncodedDataV3Full() {
+ // TODO this is self generated trace. We need trace from
operator
+ return new byte[] { 48, 54, 10, 1, 0, 48, 8, -128, 2, 7, -128, -127, 2,
7, 0, -96, 39, -96, 32, 48, 10, 6, 3, 42, 3, 4, 11, 12, 13, 14, 15, 48, 5,
6,
+ 3, 42, 3, 6, 48, 11, 6, 3, 42, 3, 5, 21, 22, 23, 24, 25, 26, -95, 3,
31, 32, 33 };
+ }
@Test(groups = { "functional.decode", "imei" })
public void testDecode() throws Exception {
@@ -66,6 +74,21 @@
assertTrue(checkImeiImpl.getBmuef().getUESBI_IuA().getData().get(0));
assertFalse(checkImeiImpl.getBmuef().getUESBI_IuB().getData().get(0));
+ // Testing version 3 Full
+ rawData = getEncodedDataV3Full();
+ asnIS = new AsnInputStream(rawData);
+
+ tag = asnIS.readTag();
+ assertEquals(tag, Tag.SEQUENCE);
+
+ checkImeiImpl = new CheckImeiResponseImpl(3);
+ checkImeiImpl.decodeAll(asnIS);
+
+ assertEquals(checkImeiImpl.getEquipmentStatus(),
EquipmentStatus.whiteListed);
+
assertTrue(checkImeiImpl.getBmuef().getUESBI_IuA().getData().get(0));
+
assertFalse(checkImeiImpl.getBmuef().getUESBI_IuB().getData().get(0));
+
assertTrue(MAPExtensionContainerTest.CheckTestExtensionContainer(checkImeiImpl.getExtensionContainer()));
+
// Testing version 1 and 2
rawData = getEncodedDataV2();
asnIS = new AsnInputStream(rawData);
@@ -98,6 +121,27 @@
byte[] rawData = getEncodedDataV3();
assertTrue(Arrays.equals(rawData, encodedData));
+ // Testing version 3 Full
+ bsUESBIIuA = new BitSetStrictLength(1);
+ bsUESBIIuA.set(0);
+ impUESBIIuA = new UESBIIuAImpl(bsUESBIIuA);
+
+ bsUESBIIuB = new BitSetStrictLength(1);
+ impUESBIIuB = new UESBIIuBImpl(bsUESBIIuB);
+
+ bmuef = new UESBIIuImpl(impUESBIIuA, impUESBIIuB);
+
+ MAPExtensionContainer extensionContainer =
MAPExtensionContainerTest.GetTestExtensionContainer();
+
+ checkImei = new CheckImeiResponseImpl(3, EquipmentStatus.whiteListed,
bmuef, extensionContainer);
+
+ asnOS = new AsnOutputStream();
+ checkImei.encodeAll(asnOS);
+
+ encodedData = asnOS.toByteArray();
+ rawData = getEncodedDataV3Full();
+ assertTrue(Arrays.equals(rawData, encodedData));
+
// Testing version 1 and 2
checkImei = new CheckImeiResponseImpl(2, EquipmentStatus.whiteListed,
null, null);