Search in sources :

Example 1 with AccountingRequest

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());
}
Also used : AccountingRequest(net.java.slee.resource.diameter.base.events.AccountingRequest) Test(org.junit.Test)

Example 2 with AccountingRequest

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());
}
Also used : AccountingRequest(net.java.slee.resource.diameter.base.events.AccountingRequest) AccountingAnswer(net.java.slee.resource.diameter.base.events.AccountingAnswer) Test(org.junit.Test)

Example 3 with AccountingRequest

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;
}
Also used : AccountingRequest(net.java.slee.resource.diameter.base.events.AccountingRequest) ApplicationId(org.jdiameter.api.ApplicationId)

Example 4 with AccountingRequest

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;
}
Also used : AccountingRequest(net.java.slee.resource.diameter.base.events.AccountingRequest)

Example 5 with AccountingRequest

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());
    }
}
Also used : VendorSpecificApplicationIdAvp(net.java.slee.resource.diameter.base.events.avp.VendorSpecificApplicationIdAvp) AccountingRequest(net.java.slee.resource.diameter.base.events.AccountingRequest) DiameterAvp(net.java.slee.resource.diameter.base.events.avp.DiameterAvp) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Aggregations

AccountingRequest (net.java.slee.resource.diameter.base.events.AccountingRequest)10 Test (org.junit.Test)8 ArrayList (java.util.ArrayList)3 DiameterAvp (net.java.slee.resource.diameter.base.events.avp.DiameterAvp)3 AccountingAnswer (net.java.slee.resource.diameter.base.events.AccountingAnswer)2 VendorSpecificApplicationIdAvp (net.java.slee.resource.diameter.base.events.avp.VendorSpecificApplicationIdAvp)2 ApplicationId (org.jdiameter.api.ApplicationId)1 DiameterMessageImpl (org.mobicents.slee.resource.diameter.base.events.DiameterMessageImpl)1