Search in sources :

Example 1 with VendorSpecificApplicationIdAvp

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

Example 2 with VendorSpecificApplicationIdAvp

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());
    }
}
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)

Example 3 with VendorSpecificApplicationIdAvp

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());
    }
}
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)

Example 4 with VendorSpecificApplicationIdAvp

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

Aggregations

VendorSpecificApplicationIdAvp (net.java.slee.resource.diameter.base.events.avp.VendorSpecificApplicationIdAvp)4 Test (org.junit.Test)3 ArrayList (java.util.ArrayList)2 AccountingRequest (net.java.slee.resource.diameter.base.events.AccountingRequest)2 DiameterAvp (net.java.slee.resource.diameter.base.events.avp.DiameterAvp)2