use of net.java.slee.resource.diameter.gq.events.GqAARequest in project jain-slee.diameter by RestComm.
the class GqFactoriesTest method isProxiableCopiedAAA.
@Test
public void isProxiableCopiedAAA() throws Exception {
GqAARequest aar = gqMessageFactory.createGqAARequest();
GqAAAnswer aaa = gqMessageFactory.createGqAAAnswer(aar);
assertEquals("The 'P' bit is not copied from request in Gq' AA-Answer, it should. [RFC3588/6.2]", aar.getHeader().isProxiable(), aaa.getHeader().isProxiable());
// Reverse 'P' bit ...
((DiameterMessageImpl) aar).getGenericData().setProxiable(!aar.getHeader().isProxiable());
assertTrue("The 'P' bit was not modified in Gq' AA-Request, it should.", aar.getHeader().isProxiable() != aaa.getHeader().isProxiable());
aaa = gqMessageFactory.createGqAAAnswer(aar);
assertEquals("The 'P' bit is not copied from request in Gq' AA-Answer, it should. [RFC3588/6.2]", aar.getHeader().isProxiable(), aaa.getHeader().isProxiable());
}
use of net.java.slee.resource.diameter.gq.events.GqAARequest in project jain-slee.diameter by RestComm.
the class GqFactoriesTest method testMessageFactoryApplicationIdChangeAAR.
@Test
public void testMessageFactoryApplicationIdChangeAAR() throws Exception {
long vendor = 10415L;
ApplicationId originalAppId = ((GqMessageFactoryImpl) gqMessageFactory).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 Gq is " + originalAppId.getVendorId());
// let's create a message and see how it comes...
GqAARequest originalAAR = gqMessageFactory.createGqAARequest();
BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalAAR);
// now we switch..
originalAAR = null;
isVendor = !isVendor;
((GqMessageFactoryImpl) gqMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
// create a new message and see how it comes...
GqAARequest changedAAR = gqMessageFactory.createGqAARequest();
BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedAAR);
// revert back to default
((GqMessageFactoryImpl) gqMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
use of net.java.slee.resource.diameter.gq.events.GqAARequest in project jain-slee.diameter by RestComm.
the class GqMessageFactoryImpl method createGqAARequest.
@Override
public GqAARequest createGqAARequest(String sessionId) {
Message raw = createRequest(GqAARequest.COMMAND_CODE, new DiameterAvp[] {});
GqAARequest aar = new GqAARequestImpl(raw);
aar.setSessionId(sessionId);
addOrigin(aar);
return aar;
}
use of net.java.slee.resource.diameter.gq.events.GqAARequest in project jain-slee.diameter by RestComm.
the class GqMessageFactoryImpl method createGqAARequest.
@Override
public GqAARequest createGqAARequest() {
Message raw = createRequest(GqAARequest.COMMAND_CODE, new DiameterAvp[] {});
GqAARequest aar = new GqAARequestImpl(raw);
if (sessionId != null) {
aar.setSessionId(sessionId);
}
addOrigin(aar);
return aar;
}
Aggregations