use of org.jdiameter.api.ApplicationId in project jain-slee.diameter by RestComm.
the class S6aFactoriesTest method testMessageFactoryApplicationIdChangeAIR.
@Test
public void testMessageFactoryApplicationIdChangeAIR() throws Exception {
long vendor = 10415L;
ApplicationId originalAppId = ((S6aMessageFactoryImpl) s6aMessageFactory).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 S6a is " + originalAppId.getVendorId());
// let's create a message and see how it comes...
AuthenticationInformationRequest originalAIR = s6aMessageFactory.createAuthenticationInformationRequest();
BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalAIR);
// now we switch..
originalAIR = null;
isVendor = !isVendor;
((S6aMessageFactoryImpl) s6aMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
// create a new message and see how it comes...
AuthenticationInformationRequest changedAIR = s6aMessageFactory.createAuthenticationInformationRequest();
BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedAIR);
// revert back to default
((S6aMessageFactoryImpl) s6aMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
use of org.jdiameter.api.ApplicationId in project jain-slee.diameter by RestComm.
the class S6aFactoriesTest method testMessageFactoryApplicationIdChangePUR.
@Test
public void testMessageFactoryApplicationIdChangePUR() throws Exception {
long vendor = 10415L;
ApplicationId originalAppId = ((S6aMessageFactoryImpl) s6aMessageFactory).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 S6a is " + originalAppId.getVendorId());
// let's create a message and see how it comes...
PurgeUERequest originalPUR = s6aMessageFactory.createPurgeUERequest();
BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalPUR);
// now we switch..
originalPUR = null;
isVendor = !isVendor;
((S6aMessageFactoryImpl) s6aMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
// create a new message and see how it comes...
PurgeUERequest changedPUR = s6aMessageFactory.createPurgeUERequest();
BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedPUR);
// revert back to default
((S6aMessageFactoryImpl) s6aMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
use of org.jdiameter.api.ApplicationId in project jain-slee.diameter by RestComm.
the class S6aFactoriesTest method testServerSessionApplicationIdChangeULA.
@Test
public void testServerSessionApplicationIdChangeULA() throws Exception {
long vendor = 10415L;
ApplicationId originalAppId = ((S6aMessageFactoryImpl) s6aMessageFactory).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 S6a is " + originalAppId.getVendorId());
// let's create a message and see how it comes...
UpdateLocationRequest ulr = s6aMessageFactory.createUpdateLocationRequest();
serverSession.fetchSessionData(ulr);
UpdateLocationAnswer originalULA = serverSession.createUpdateLocationAnswer();
BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalULA);
// now we switch..
originalULA = null;
isVendor = !isVendor;
((S6aMessageFactoryImpl) s6aMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
// create a new message and see how it comes...
UpdateLocationAnswer changedULA = serverSession.createUpdateLocationAnswer();
BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedULA);
// revert back to default
((S6aMessageFactoryImpl) s6aMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
use of org.jdiameter.api.ApplicationId in project jain-slee.diameter by RestComm.
the class S6aFactoriesTest method testClientSessionApplicationIdChangeDSA.
@Test
public void testClientSessionApplicationIdChangeDSA() throws Exception {
long vendor = 10415L;
ApplicationId originalAppId = ((S6aMessageFactoryImpl) s6aMessageFactory).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 S6a is " + originalAppId.getVendorId());
// let's create a message and see how it comes...
DeleteSubscriberDataRequest dsr = s6aMessageFactory.createDeleteSubscriberDataRequest();
clientSession.fetchSessionData(dsr);
DeleteSubscriberDataAnswer originalDSA = clientSession.createDeleteSubscriberDataAnswer();
BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalDSA);
// now we switch..
originalDSA = null;
isVendor = !isVendor;
((S6aMessageFactoryImpl) s6aMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
// create a new message and see how it comes...
DeleteSubscriberDataAnswer changedDSA = clientSession.createDeleteSubscriberDataAnswer();
BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedDSA);
// revert back to default
((S6aMessageFactoryImpl) s6aMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
use of org.jdiameter.api.ApplicationId in project jain-slee.diameter by RestComm.
the class DiameterGxResourceAdaptor method raActive.
/**
* {@inheritDoc}
*/
@Override
public void raActive() {
if (tracer.isFineEnabled()) {
tracer.fine("Diameter Gx RA :: raActive.");
}
try {
if (tracer.isInfoEnabled()) {
tracer.info("Activating Diameter Gx RA Entity");
}
this.diameterMultiplexerObjectName = new ObjectName("diameter.mobicents:service=DiameterStackMultiplexer");
Object object = null;
if (ManagementFactory.getPlatformMBeanServer().isRegistered(this.diameterMultiplexerObjectName)) {
// trying to get via MBeanServer
object = ManagementFactory.getPlatformMBeanServer().invoke(this.diameterMultiplexerObjectName, "getMultiplexerMBean", new Object[] {}, new String[] {});
if (tracer.isInfoEnabled()) {
tracer.info("Trying to get via Platform MBeanServer: " + this.diameterMultiplexerObjectName + ", object: " + object);
}
} else {
// trying to get via locateJBoss
object = MBeanServerLocator.locateJBoss().invoke(this.diameterMultiplexerObjectName, "getMultiplexerMBean", new Object[] {}, new String[] {});
if (tracer.isInfoEnabled()) {
tracer.info("Trying to get via JBoss MBeanServer: " + this.diameterMultiplexerObjectName + ", object: " + object);
}
}
if (object != null && object instanceof DiameterStackMultiplexerMBean) {
this.diameterMux = (DiameterStackMultiplexerMBean) object;
}
// Initialize the protocol stack
initStack();
// Initialize activities mgmt
initActivitiesMgmt();
// Initialize factories
this.baseAvpFactory = new DiameterAvpFactoryImpl();
this.baseMessageFactory = new DiameterMessageFactoryImpl(stack);
this.gxAvpFactory = new GxAvpFactoryImpl(baseAvpFactory);
this.gxMessageFactory = new GxMessageFactoryImpl(baseMessageFactory, null, stack);
// Set the first configured Application-Id as default for message factory
ApplicationId firstAppId = authApplicationIds.get(0);
((GxMessageFactoryImpl) this.gxMessageFactory).setApplicationId(firstAppId.getVendorId(), firstAppId.getAuthAppId());
this.sessionFactory = this.stack.getSessionFactory();
this.gxSessionFactory = new GxSessionFactory(this, sessionFactory, defaultDirectDebitingFailureHandling, defaultCreditControlFailureHandling, defaultValidityTime, defaultTxTimerValue);
// Register Gx App Session Factories
((ISessionFactory) sessionFactory).registerAppFacory(ServerGxSession.class, this.gxSessionFactory);
((ISessionFactory) sessionFactory).registerAppFacory(ClientGxSession.class, this.gxSessionFactory);
} catch (Exception e) {
tracer.severe("Error Activating Diameter Gx RA Entity", e);
}
}
Aggregations