use of org.mobicents.slee.resource.diameter.base.DiameterMessageFactoryImpl in project jain-slee.diameter by RestComm.
the class ShServerActivityAnswerCreationTest method testShServerSubscriptionActivityAnswerCreation.
@Test
public void testShServerSubscriptionActivityAnswerCreation() throws Exception {
ServerShSession session = new ShServerSessionImpl(new ShServerSessionDataLocalImpl(), new IShMessageFactoryImpl(), (ISessionFactory) stack.getSessionFactory(), new ServerShSessionListenerImpl());
DiameterMessageFactoryImpl msgFactory = new DiameterMessageFactoryImpl(session.getSessions().get(0), stack, null, null);
ShClientMessageFactoryImpl factory = new ShClientMessageFactoryImpl(session.getSessions().get(0), stack);
UserDataRequest udr = factory.createUserDataRequest();
net.java.slee.resource.diameter.sh.events.ProfileUpdateRequest pur = factory.createProfileUpdateRequest();
net.java.slee.resource.diameter.sh.events.SubscribeNotificationsRequest snr = factory.createSubscribeNotificationsRequest();
ArrayList<DiameterMessage> list = new ArrayList<DiameterMessage>();
list.add(udr);
list.add(pur);
list.add(snr);
ShServerSubscriptionActivityImpl activity = new ShServerSubscriptionActivityImpl(new ShServerMessageFactoryImpl(msgFactory, session.getSessions().get(0), stack, diameterShAvpFactory), diameterShAvpFactory, session, null, null);
DiameterActivityAnswerCreationHelper.testAnswerCreation(activity, "stateMessages", list);
}
use of org.mobicents.slee.resource.diameter.base.DiameterMessageFactoryImpl 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);
}
}
use of org.mobicents.slee.resource.diameter.base.DiameterMessageFactoryImpl in project jain-slee.diameter by RestComm.
the class DiameterGqResourceAdaptor method raActive.
@Override
public void raActive() {
if (tracer.isFineEnabled()) {
tracer.fine("Diameter Gq RA :: raActive.");
}
try {
if (tracer.isInfoEnabled()) {
tracer.info("Activating Diameter Gq 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.gqAvpFactory = new GqAvpFactoryImpl(baseAvpFactory);
this.gqMessageFactory = new GqMessageFactoryImpl(baseMessageFactory, null, stack);
// Set the first configured Application-Id as default for message factory
ApplicationId firstAppId = authApplicationIds.get(0);
((GqMessageFactoryImpl) this.gqMessageFactory).setApplicationId(firstAppId.getVendorId(), firstAppId.getAuthAppId());
this.sessionFactory = this.stack.getSessionFactory();
this.gqSessionFactory = new GqSessionFactory(this, sessionFactory);
// Register Gq App Session Factories
((ISessionFactory) sessionFactory).registerAppFacory(GqServerSession.class, this.gqSessionFactory);
((ISessionFactory) sessionFactory).registerAppFacory(GqClientSession.class, this.gqSessionFactory);
} catch (Exception e) {
tracer.severe("Error Activating Diameter Gq RA Entity", e);
}
}
use of org.mobicents.slee.resource.diameter.base.DiameterMessageFactoryImpl in project jain-slee.diameter by RestComm.
the class DiameterGqResourceAdaptor method sessionCreated.
// Gq/Auth Session Creation Listener --------------------------------------
public void sessionCreated(GqClientSession clientSession) {
// Make sure it's a new session and there's no activity created yet.
if (this.getActivity(getActivityHandle(clientSession.getSessions().get(0).getSessionId())) != null) {
tracer.warning("Activity found for created Gq Client Session. Shouldn't exist. Aborting.");
return;
}
// Get Message Factories (for Base and Gq)
DiameterMessageFactoryImpl baseMsgFactory = new DiameterMessageFactoryImpl(clientSession.getSessions().get(0), this.stack);
// RoMessageFactoryImpl ccaMsgFactory = new RoMessageFactoryImpl(baseMsgFactory, ccClientSession.getSessionId(), this.stack);
// Create Client Activity
GqClientSessionActivityImpl activity = new GqClientSessionActivityImpl(baseMsgFactory, this.baseAvpFactory, clientSession, null, null, stack);
// Update Session Activity FSM to allow correct requests/responses
clientSession.addStateChangeNotification(activity);
activity.setSessionListener(this);
addActivity(activity, false);
}
Aggregations