use of org.jdiameter.api.ApplicationId in project jain-slee.diameter by RestComm.
the class DiameterRoResourceAdaptor method raActive.
public void raActive() {
if (tracer.isFineEnabled()) {
tracer.fine("Diameter Ro RA :: raActive.");
}
try {
if (tracer.isInfoEnabled()) {
tracer.info("Activating Diameter Ro 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;
}
// this.activities = new ConcurrentHashMap<ActivityHandle, DiameterActivity>();
// Initialize the protocol stack
initStack();
// Initialize activities mgmt
initActivitiesMgmt();
// Initialize factories
this.baseAvpFactory = new DiameterAvpFactoryImpl();
this.baseMessageFactory = new DiameterMessageFactoryImpl(stack);
this.roAvpFactory = new RoAvpFactoryImpl(baseAvpFactory);
this.roMessageFactory = new RoMessageFactoryImpl(baseMessageFactory, null, stack);
// Set the first configured Application-Id as default for message factory
ApplicationId firstAppId = authApplicationIds.get(0);
((RoMessageFactoryImpl) this.roMessageFactory).setApplicationId(firstAppId.getVendorId(), firstAppId.getAuthAppId());
this.sessionFactory = this.stack.getSessionFactory();
this.ccaSessionFactory = new RoSessionFactory(this, sessionFactory, defaultDirectDebitingFailureHandling, defaultCreditControlFailureHandling, defaultValidityTime, defaultTxTimerValue);
// Register CCA App Session Factories
((ISessionFactory) sessionFactory).registerAppFacory(ServerRoSession.class, this.ccaSessionFactory);
((ISessionFactory) sessionFactory).registerAppFacory(ClientRoSession.class, this.ccaSessionFactory);
} catch (Exception e) {
tracer.severe("Error Activating Diameter Ro RA Entity", e);
}
}
use of org.jdiameter.api.ApplicationId in project jain-slee.diameter by RestComm.
the class RxFactoriesTest method testMessageFactoryApplicationIdChangeSTA.
@Test
public void testMessageFactoryApplicationIdChangeSTA() throws Exception {
long vendor = 10415L;
ApplicationId originalAppId = ((RxMessageFactoryImpl) rxMessageFactory).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 Rx is " + originalAppId.getVendorId());
// let's create a message and see how it comes...
SessionTerminationAnswer originalSTA = rxMessageFactory.createSessionTerminationAnswer(rxMessageFactory.createSessionTerminationRequest());
BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalSTA);
// now we switch..
originalSTA = null;
isVendor = !isVendor;
((RxMessageFactoryImpl) rxMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
// create a new message and see how it comes...
SessionTerminationAnswer changedSTA = rxMessageFactory.createSessionTerminationAnswer(rxMessageFactory.createSessionTerminationRequest());
BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedSTA);
// revert back to default
((RxMessageFactoryImpl) rxMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
use of org.jdiameter.api.ApplicationId in project jain-slee.diameter by RestComm.
the class RxFactoriesTest method testServerSessionApplicationIdChangeSTA.
@Test
public void testServerSessionApplicationIdChangeSTA() throws Exception {
long vendor = 10415L;
ApplicationId originalAppId = ((RxMessageFactoryImpl) rxMessageFactory).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 Rx is " + originalAppId.getVendorId());
// let's create a message and see how it comes...
SessionTerminationRequest str = rxMessageFactory.createSessionTerminationRequest();
rxServerSession.fetchCurrentState(str);
SessionTerminationAnswer originalSTA = rxServerSession.createSessionTermAnswer();
BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalSTA);
// now we switch..
originalSTA = null;
isVendor = !isVendor;
((RxMessageFactoryImpl) rxMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
// create a new message and see how it comes...
SessionTerminationAnswer changedSTA = rxServerSession.createSessionTermAnswer();
BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedSTA);
// revert back to default
((RxMessageFactoryImpl) rxMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
use of org.jdiameter.api.ApplicationId in project jain-slee.diameter by RestComm.
the class RxFactoriesTest method testMessageFactoryApplicationIdChangeASR.
@Test
public void testMessageFactoryApplicationIdChangeASR() throws Exception {
long vendor = 10415L;
ApplicationId originalAppId = ((RxMessageFactoryImpl) rxMessageFactory).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 Rx is " + originalAppId.getVendorId());
// let's create a message and see how it comes...
AbortSessionRequest originalASR = rxMessageFactory.createAbortSessionRequest();
BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalASR);
// now we switch..
originalASR = null;
isVendor = !isVendor;
((RxMessageFactoryImpl) rxMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
// create a new message and see how it comes...
AbortSessionRequest changedASR = rxMessageFactory.createAbortSessionRequest();
BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedASR);
// revert back to default
((RxMessageFactoryImpl) rxMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
use of org.jdiameter.api.ApplicationId in project jain-slee.diameter by RestComm.
the class RxFactoriesTest method testMessageFactoryApplicationIdChangeRAA.
// @Test
// public void testServerSessionApplicationIdChangeRAR() throws Exception {
// long vendor = 10415L;
// ApplicationId originalAppId = ((RxMessageFactoryImpl)rxMessageFactory).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 Rx is " + originalAppId.getVendorId());
// // let's create a message and see how it comes...
// ReAuthRequest originalRAR = rxServerSession.createReAuthRequest();
// BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalRAR);
//
// // now we switch..
// originalRAR = null;
// isVendor = !isVendor;
// ((RxMessageFactoryImpl)rxMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ?
// originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
//
// // create a new message and see how it comes...
// ReAuthRequest changedRAR = rxServerSession.createReAuthRequest();
// BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedRAR);
//
// // revert back to default
// ((RxMessageFactoryImpl)rxMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ?
// originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
// }
@Test
public void testMessageFactoryApplicationIdChangeRAA() throws Exception {
long vendor = 10415L;
ApplicationId originalAppId = ((RxMessageFactoryImpl) rxMessageFactory).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 Rx is " + originalAppId.getVendorId());
// let's create a message and see how it comes...
ReAuthAnswer originalRAA = rxMessageFactory.createReAuthAnswer(rxMessageFactory.createReAuthRequest());
BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalRAA);
// now we switch..
originalRAA = null;
isVendor = !isVendor;
((RxMessageFactoryImpl) rxMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
// create a new message and see how it comes...
ReAuthAnswer changedRAA = rxMessageFactory.createReAuthAnswer(rxMessageFactory.createReAuthRequest());
BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedRAA);
// revert back to default
((RxMessageFactoryImpl) rxMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
Aggregations