use of net.java.slee.resource.diameter.base.events.AccountingRequest in project jain-slee.diameter by RestComm.
the class BaseFactoriesTest method isRequestACR.
@Test
public void isRequestACR() throws Exception {
AccountingRequest acr = messageFactory.createAccountingRequest();
assertTrue("Request Flag in Accounting-Request is not set.", acr.getHeader().isRequest());
}
use of net.java.slee.resource.diameter.base.events.AccountingRequest in project jain-slee.diameter by RestComm.
the class BaseFactoriesTest method hasTFlagSetACA.
@Test
public void hasTFlagSetACA() throws Exception {
AccountingRequest acr = messageFactory.createAccountingRequest();
((DiameterMessageImpl) acr).getGenericData().setReTransmitted(true);
assertTrue("The 'T' flag should be set in Accounting-Request", acr.getHeader().isPotentiallyRetransmitted());
AccountingAnswer aca = messageFactory.createAccountingAnswer(acr);
assertFalse("The 'T' flag should not be set in Accounting-Answer", aca.getHeader().isPotentiallyRetransmitted());
}
use of net.java.slee.resource.diameter.base.events.AccountingRequest in project jain-slee.diameter by RestComm.
the class DiameterMessageFactoryImpl method createAccountingRequest.
public AccountingRequest createAccountingRequest(DiameterAvp[] avps) throws AvpNotAllowedException {
ApplicationId appId = getApplicationId(avps);
AccountingRequest msg = (AccountingRequest) this.createDiameterMessage(null, avps, Message.ACCOUNTING_REQUEST, appId != null ? appId : BASE_ACCT_APP_ID);
// Add Session-Id AVP if not present
addSessionIdAvp(msg);
return msg;
}
use of net.java.slee.resource.diameter.base.events.AccountingRequest in project jain-slee.diameter by RestComm.
the class AccountingClientSessionActivityImpl method createAccountingRequest.
public AccountingRequest createAccountingRequest(AccountingRecordType accountingRecordType) {
AccountingRequest acr = messageFactory.createAccountingRequest();
// Set Acct-Application-Id to 3 as specified
acr.setAcctApplicationId(3L);
acr.setAccountingRecordType(accountingRecordType);
return acr;
}
use of net.java.slee.resource.diameter.base.events.AccountingRequest 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());
}
}
Aggregations