Search in sources :

Example 6 with RfAccountingRequest

use of net.java.slee.resource.diameter.rf.events.RfAccountingRequest in project jain-slee.diameter by RestComm.

the class RfFactoriesTest method isRequestACR.

@Test
public void isRequestACR() throws Exception {
    RfAccountingRequest acr = rfMessageFactory.createRfAccountingRequest(AccountingRecordType.EVENT_RECORD);
    assertTrue("Request Flag in Accounting-Request is not set.", acr.getHeader().isRequest());
}
Also used : RfAccountingRequest(net.java.slee.resource.diameter.rf.events.RfAccountingRequest) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 7 with RfAccountingRequest

use of net.java.slee.resource.diameter.rf.events.RfAccountingRequest in project jain-slee.diameter by RestComm.

the class RfFactoriesTest method testServerSessionApplicationIdChangeACA.

@Test
public void testServerSessionApplicationIdChangeACA() throws Exception {
    long vendor = 10415L;
    ApplicationId originalAppId = ((RfMessageFactoryImpl) rfMessageFactory).getApplicationId();
    boolean isAuth = originalAppId.getAuthAppId() != org.jdiameter.api.ApplicationId.UNDEFINED_VALUE;
    boolean isAcct = originalAppId.getAcctAppId() != org.jdiameter.api.ApplicationId.UNDEFINED_VALUE;
    boolean isVendor = originalAppId.getVendorId() != 0L;
    assertTrue("Invalid Application-Id (" + originalAppId + "). Should only, and at least, contain either Auth or Acct value.", (isAuth && !isAcct) || (!isAuth && isAcct));
    System.out.println("Default VENDOR-ID for Rf is " + originalAppId.getVendorId());
    // let's create a message and see how it comes...
    RfAccountingRequest acr = rfMessageFactory.createRfAccountingRequest(AccountingRecordType.EVENT_RECORD);
    ((RfServerSessionActivityImpl) rfServerSession).fetchSessionData(acr, true);
    RfAccountingAnswer originalACA = rfServerSession.createRfAccountingAnswer();
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalACA);
    // now we switch..
    originalACA = null;
    isVendor = !isVendor;
    ((RfMessageFactoryImpl) rfMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
    // create a new message and see how it comes...
    RfAccountingAnswer changedACA = rfServerSession.createRfAccountingAnswer();
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedACA);
    changedACA = rfServerSession.createRfAccountingAnswer(acr);
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedACA);
    // revert back to default
    ((RfMessageFactoryImpl) rfMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
Also used : RfServerSessionActivityImpl(org.mobicents.slee.resource.diameter.rf.RfServerSessionActivityImpl) RfMessageFactoryImpl(org.mobicents.slee.resource.diameter.rf.RfMessageFactoryImpl) RfAccountingAnswer(net.java.slee.resource.diameter.rf.events.RfAccountingAnswer) RfAccountingRequest(net.java.slee.resource.diameter.rf.events.RfAccountingRequest) ApplicationId(org.jdiameter.api.ApplicationId) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 8 with RfAccountingRequest

use of net.java.slee.resource.diameter.rf.events.RfAccountingRequest in project jain-slee.diameter by RestComm.

the class RfFactoriesTest method testGettersAndSettersACR.

@Test
public void testGettersAndSettersACR() throws Exception {
    RfAccountingRequest acr = rfMessageFactory.createRfAccountingRequest(AccountingRecordType.EVENT_RECORD);
    int nFailures = RfAvpAssistant.INSTANCE.testMethods(acr, RfAccountingRequest.class);
    assertEquals("Some methods have failed. See logs for more details.", 0, nFailures);
}
Also used : RfAccountingRequest(net.java.slee.resource.diameter.rf.events.RfAccountingRequest) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 9 with RfAccountingRequest

use of net.java.slee.resource.diameter.rf.events.RfAccountingRequest in project jain-slee.diameter by RestComm.

the class RfFactoriesTest method isProxiableACR.

@Test
public void isProxiableACR() throws Exception {
    RfAccountingRequest acr = rfMessageFactory.createRfAccountingRequest(AccountingRecordType.EVENT_RECORD);
    assertTrue("The 'P' bit is not set by default in Accounting-Request, it should.", acr.getHeader().isProxiable());
}
Also used : RfAccountingRequest(net.java.slee.resource.diameter.rf.events.RfAccountingRequest) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 10 with RfAccountingRequest

use of net.java.slee.resource.diameter.rf.events.RfAccountingRequest in project jain-slee.diameter by RestComm.

the class RfFactoriesTest method hasRfApplicationIdACR.

@Test
public void hasRfApplicationIdACR() throws Exception {
    RfAccountingRequest acr = rfMessageFactory.createRfAccountingRequest(AccountingRecordType.EVENT_RECORD);
    assertTrue("Acct-Application-Id AVP in Rf ACR must be 3, it is " + acr.getAcctApplicationId(), acr.getAcctApplicationId() == 3);
}
Also used : RfAccountingRequest(net.java.slee.resource.diameter.rf.events.RfAccountingRequest) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Aggregations

RfAccountingRequest (net.java.slee.resource.diameter.rf.events.RfAccountingRequest)12 Test (org.junit.Test)8 BaseFactoriesTest (org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)8 RfAccountingAnswer (net.java.slee.resource.diameter.rf.events.RfAccountingAnswer)4 ApplicationId (org.jdiameter.api.ApplicationId)2 RfMessageFactoryImpl (org.mobicents.slee.resource.diameter.rf.RfMessageFactoryImpl)2 OperationNotSupportedException (javax.naming.OperationNotSupportedException)1 InvalidConfigurationException (javax.slee.resource.InvalidConfigurationException)1 Transaction (javax.transaction.Transaction)1 CreateActivityException (net.java.slee.resource.diameter.base.CreateActivityException)1 DiameterAvp (net.java.slee.resource.diameter.base.events.avp.DiameterAvp)1 AvpDataException (org.jdiameter.api.AvpDataException)1 IllegalDiameterStateException (org.jdiameter.api.IllegalDiameterStateException)1 InternalException (org.jdiameter.api.InternalException)1 DiameterMessageImpl (org.mobicents.slee.resource.diameter.base.events.DiameterMessageImpl)1 RfServerSessionActivityImpl (org.mobicents.slee.resource.diameter.rf.RfServerSessionActivityImpl)1