use of net.java.slee.resource.diameter.base.events.avp.VendorSpecificApplicationIdAvp in project jain-slee.diameter by RestComm.
the class DiameterAvpFactoryImpl method createVendorSpecificApplicationId.
/*
* (non-Javadoc)
* @see net.java.slee.resource.diameter.base.DiameterAvpFactory#createVendorSpecificApplicationId(long)
*/
public VendorSpecificApplicationIdAvp createVendorSpecificApplicationId(long vendorId) {
VendorSpecificApplicationIdAvp vsaidAvp = createVendorSpecificApplicationId();
vsaidAvp.setVendorIdAvp(vendorId);
return vsaidAvp;
}
use of net.java.slee.resource.diameter.base.events.avp.VendorSpecificApplicationIdAvp in project jain-slee.diameter by RestComm.
the class BaseFactoriesTest method testMessageCreationVendorSpecificApplicationIdAvp.
@Test
public void testMessageCreationVendorSpecificApplicationIdAvp() {
// Relates to Issue #1555 (http://code.google.com/p/mobicents/issues/detail?id=1555)
List<DiameterAvp> avps = new ArrayList<DiameterAvp>();
try {
long vendorId = 2312L;
long acctApplicationId = 23121L;
DiameterAvp avpVendorId = avpFactory.createAvp(DiameterAvpCodes.VENDOR_ID, vendorId);
DiameterAvp avpAcctApplicationId = avpFactory.createAvp(DiameterAvpCodes.ACCT_APPLICATION_ID, acctApplicationId);
avps.add(avpFactory.createAvp(DiameterAvpCodes.VENDOR_SPECIFIC_APPLICATION_ID, new DiameterAvp[] { avpVendorId, avpAcctApplicationId }));
DiameterAvp[] avpArray = new DiameterAvp[avps.size()];
avpArray = avps.toArray(avpArray);
AccountingRequest acr = messageFactory.createAccountingRequest(avpArray);
VendorSpecificApplicationIdAvp vsaidAvp = acr.getVendorSpecificApplicationId();
assertNotNull("Vendor-Specific-Application-Id should be present in message.", vsaidAvp);
// hack: vendor id is Avp vendor-id value, need to do this way.
long msgAppVendorId = vsaidAvp.getVendorIdsAvp()[0];
assertTrue("Vendor-Specific-Application-Id / Vendor-Id should be [" + vendorId + "] it is [" + msgAppVendorId + "]", vendorId == msgAppVendorId);
long msgAppId = vsaidAvp.getAcctApplicationId();
assertTrue("Vendor-Specific-Application-Id / Acct-Application-Id should be [" + acctApplicationId + "] it is [" + msgAppId + "]", acctApplicationId == msgAppId);
} catch (Exception e) {
e.printStackTrace();
fail(e.getLocalizedMessage());
}
}
use of net.java.slee.resource.diameter.base.events.avp.VendorSpecificApplicationIdAvp in project jain-slee.diameter by RestComm.
the class BaseFactoriesTest method testMessageCreationApplicationIdAvp.
@Test
public void testMessageCreationApplicationIdAvp() {
// Relates to Issue #1555 (http://code.google.com/p/mobicents/issues/detail?id=1555)
List<DiameterAvp> avps = new ArrayList<DiameterAvp>();
try {
long acctApplicationId = 23121L;
DiameterAvp avpAcctApplicationId = avpFactory.createAvp(DiameterAvpCodes.ACCT_APPLICATION_ID, acctApplicationId);
avps.add(avpAcctApplicationId);
DiameterAvp[] avpArray = new DiameterAvp[avps.size()];
avpArray = avps.toArray(avpArray);
AccountingRequest acr = messageFactory.createAccountingRequest(avpArray);
VendorSpecificApplicationIdAvp vsaidAvp = acr.getVendorSpecificApplicationId();
assertNull("Vendor-Specific-Application-Id should not be present in message.", vsaidAvp);
long msgAppId = acr.getAcctApplicationId();
assertTrue("Acct-Application-Id should be [" + acctApplicationId + "] it is [" + msgAppId + "]", acctApplicationId == msgAppId);
} catch (Exception e) {
e.printStackTrace();
fail(e.getLocalizedMessage());
}
}
use of net.java.slee.resource.diameter.base.events.avp.VendorSpecificApplicationIdAvp in project jain-slee.diameter by RestComm.
the class BaseFactoriesTest method testAvpFactoryCreateVendorSpecificApplicationId.
@Test
public void testAvpFactoryCreateVendorSpecificApplicationId() {
VendorSpecificApplicationIdAvp vsaidAvp1 = avpFactory.createVendorSpecificApplicationId(10609L);
Assert.assertNotNull("Created Vendor-Specific-Application-Id AVP from objects should not be null.", vsaidAvp1);
VendorSpecificApplicationIdAvp vsaidAvp2 = avpFactory.createVendorSpecificApplicationId(vsaidAvp1.getExtensionAvps());
Assert.assertEquals("Created Vendor-Specific-Application-Id AVP from extension avps should be equal to original.", vsaidAvp1, vsaidAvp2);
VendorSpecificApplicationIdAvp vsaidAvp3 = avpFactory.createVendorSpecificApplicationId(vsaidAvp2.getVendorIdsAvp()[0]);
Assert.assertEquals("Created Vendor-Specific-Application-Id AVP from getters should be equal to original.", vsaidAvp1, vsaidAvp3);
}
Aggregations