Search in sources :

Example 1 with ServerShSession

use of org.jdiameter.api.sh.ServerShSession in project jain-slee.diameter by RestComm.

the class DiameterS6aResourceAdaptor method stateChanged.

/* (non-Javadoc)
   * @see org.mobicents.slee.resource.diameter.s6a.handlers.S6aSessionCreationListener#stateChanged(org.jdiameter.api.app.AppSession, java.lang.Enum, java.lang.Enum)
   */
public void stateChanged(AppSession source, Enum oldState, Enum newState) {
    DiameterActivityHandle dah = getActivityHandle(source.getSessionId());
    Object activity = getActivity(dah);
    if (activity != null) {
        if (source instanceof ServerShSession) {
            try {
                // damn, no common, do something unexpected
                StateChangeListener<AppSession> scl = (StateChangeListener<AppSession>) activity;
                scl.stateChanged(source, oldState, newState);
            } catch (Exception e) {
                tracer.warning("Failed to deliver state, for: " + dah + " on stateChanged( " + source + ", " + oldState + ", " + newState + " )", e);
            }
        }
    } else {
        tracer.warning("No activity for: " + dah + " on stateChanged( " + source + ", " + oldState + ", " + newState + " )");
    }
}
Also used : AppSession(org.jdiameter.api.app.AppSession) StateChangeListener(org.jdiameter.api.app.StateChangeListener) DiameterActivityHandle(org.mobicents.slee.resource.diameter.base.DiameterActivityHandle) AvpDataException(org.jdiameter.api.AvpDataException) InternalException(org.jdiameter.api.InternalException) IllegalDiameterStateException(org.jdiameter.api.IllegalDiameterStateException) CreateActivityException(net.java.slee.resource.diameter.base.CreateActivityException) OperationNotSupportedException(javax.naming.OperationNotSupportedException) InvalidConfigurationException(javax.slee.resource.InvalidConfigurationException) ServerShSession(org.jdiameter.api.sh.ServerShSession)

Example 2 with ServerShSession

use of org.jdiameter.api.sh.ServerShSession in project jain-slee.diameter by RestComm.

the class ShServerActivityAnswerCreationTest method testShServerActivityAnswerCreation.

@Test
public void testShServerActivityAnswerCreation() 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);
    ShServerActivityImpl activity = new ShServerActivityImpl(new ShServerMessageFactoryImpl(msgFactory, session.getSessions().get(0), stack, diameterShAvpFactory), diameterShAvpFactory, session, null, null);
    DiameterActivityAnswerCreationHelper.testAnswerCreation(activity, "stateMessages", list);
}
Also used : UserDataRequest(net.java.slee.resource.diameter.sh.events.UserDataRequest) ArrayList(java.util.ArrayList) DiameterMessage(net.java.slee.resource.diameter.base.events.DiameterMessage) ShServerActivityImpl(org.mobicents.slee.resource.diameter.sh.server.ShServerActivityImpl) ShClientMessageFactoryImpl(org.mobicents.slee.resource.diameter.sh.client.ShClientMessageFactoryImpl) ShServerSessionImpl(org.jdiameter.server.impl.app.sh.ShServerSessionImpl) DiameterMessageFactoryImpl(org.mobicents.slee.resource.diameter.base.DiameterMessageFactoryImpl) ShServerMessageFactoryImpl(org.mobicents.slee.resource.diameter.sh.server.ShServerMessageFactoryImpl) ServerShSession(org.jdiameter.api.sh.ServerShSession) ShServerSessionDataLocalImpl(org.jdiameter.server.impl.app.sh.ShServerSessionDataLocalImpl) Test(org.junit.Test) ShClientActivityAnswerCreationTest(org.mobicents.slee.resource.diameter.sh.client.tests.activities.ShClientActivityAnswerCreationTest)

Example 3 with ServerShSession

use of org.jdiameter.api.sh.ServerShSession in project jain-slee.diameter by RestComm.

the class DiameterS13ResourceAdaptor method stateChanged.

/* (non-Javadoc)
   * @see org.mobicents.slee.resource.diameter.s13.handlers.S13SessionCreationListener#stateChanged(org.jdiameter.api.app.AppSession, java.lang.Enum, java.lang.Enum)
   */
public void stateChanged(AppSession source, Enum oldState, Enum newState) {
    DiameterActivityHandle dah = getActivityHandle(source.getSessionId());
    Object activity = getActivity(dah);
    if (activity != null) {
        if (source instanceof ServerShSession) {
            try {
                // damn, no common, do something unexpected
                StateChangeListener<AppSession> scl = (StateChangeListener<AppSession>) activity;
                scl.stateChanged(source, oldState, newState);
            } catch (Exception e) {
                tracer.warning("Failed to deliver state, for: " + dah + " on stateChanged( " + source + ", " + oldState + ", " + newState + " )", e);
            }
        }
    } else {
        tracer.warning("No activity for: " + dah + " on stateChanged( " + source + ", " + oldState + ", " + newState + " )");
    }
}
Also used : AppSession(org.jdiameter.api.app.AppSession) StateChangeListener(org.jdiameter.api.app.StateChangeListener) DiameterActivityHandle(org.mobicents.slee.resource.diameter.base.DiameterActivityHandle) AvpDataException(org.jdiameter.api.AvpDataException) InternalException(org.jdiameter.api.InternalException) IllegalDiameterStateException(org.jdiameter.api.IllegalDiameterStateException) CreateActivityException(net.java.slee.resource.diameter.base.CreateActivityException) OperationNotSupportedException(javax.naming.OperationNotSupportedException) InvalidConfigurationException(javax.slee.resource.InvalidConfigurationException) ServerShSession(org.jdiameter.api.sh.ServerShSession)

Example 4 with ServerShSession

use of org.jdiameter.api.sh.ServerShSession in project jain-slee.diameter by RestComm.

the class DiameterCxDxResourceAdaptor method stateChanged.

/* (non-Javadoc)
   * @see org.mobicents.slee.resource.diameter.cxdx.handlers.CxDxSessionCreationListener#stateChanged(org.jdiameter.api.app.AppSession, java.lang.Enum, java.lang.Enum)
   */
public void stateChanged(AppSession source, Enum oldState, Enum newState) {
    DiameterActivityHandle dah = getActivityHandle(source.getSessionId());
    Object activity = getActivity(dah);
    if (activity != null) {
        if (source instanceof ServerShSession) {
            try {
                // damn, no common, do something unexpected
                StateChangeListener<AppSession> scl = (StateChangeListener<AppSession>) activity;
                scl.stateChanged(source, oldState, newState);
            } catch (Exception e) {
                tracer.warning("Failed to deliver state, for: " + dah + " on stateChanged( " + source + ", " + oldState + ", " + newState + " )", e);
            }
        }
    } else {
        tracer.warning("No activity for: " + dah + " on stateChanged( " + source + ", " + oldState + ", " + newState + " )");
    }
}
Also used : AppSession(org.jdiameter.api.app.AppSession) StateChangeListener(org.jdiameter.api.app.StateChangeListener) DiameterActivityHandle(org.mobicents.slee.resource.diameter.base.DiameterActivityHandle) AvpDataException(org.jdiameter.api.AvpDataException) InternalException(org.jdiameter.api.InternalException) IllegalDiameterStateException(org.jdiameter.api.IllegalDiameterStateException) CreateActivityException(net.java.slee.resource.diameter.base.CreateActivityException) OperationNotSupportedException(javax.naming.OperationNotSupportedException) InvalidConfigurationException(javax.slee.resource.InvalidConfigurationException) ServerShSession(org.jdiameter.api.sh.ServerShSession)

Example 5 with ServerShSession

use of org.jdiameter.api.sh.ServerShSession 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);
}
Also used : ShServerSubscriptionActivityImpl(org.mobicents.slee.resource.diameter.sh.server.ShServerSubscriptionActivityImpl) UserDataRequest(net.java.slee.resource.diameter.sh.events.UserDataRequest) ArrayList(java.util.ArrayList) DiameterMessage(net.java.slee.resource.diameter.base.events.DiameterMessage) ShClientMessageFactoryImpl(org.mobicents.slee.resource.diameter.sh.client.ShClientMessageFactoryImpl) ShServerSessionImpl(org.jdiameter.server.impl.app.sh.ShServerSessionImpl) DiameterMessageFactoryImpl(org.mobicents.slee.resource.diameter.base.DiameterMessageFactoryImpl) ShServerMessageFactoryImpl(org.mobicents.slee.resource.diameter.sh.server.ShServerMessageFactoryImpl) ServerShSession(org.jdiameter.api.sh.ServerShSession) ShServerSessionDataLocalImpl(org.jdiameter.server.impl.app.sh.ShServerSessionDataLocalImpl) Test(org.junit.Test) ShClientActivityAnswerCreationTest(org.mobicents.slee.resource.diameter.sh.client.tests.activities.ShClientActivityAnswerCreationTest)

Aggregations

ServerShSession (org.jdiameter.api.sh.ServerShSession)5 OperationNotSupportedException (javax.naming.OperationNotSupportedException)3 InvalidConfigurationException (javax.slee.resource.InvalidConfigurationException)3 CreateActivityException (net.java.slee.resource.diameter.base.CreateActivityException)3 AvpDataException (org.jdiameter.api.AvpDataException)3 IllegalDiameterStateException (org.jdiameter.api.IllegalDiameterStateException)3 InternalException (org.jdiameter.api.InternalException)3 AppSession (org.jdiameter.api.app.AppSession)3 StateChangeListener (org.jdiameter.api.app.StateChangeListener)3 DiameterActivityHandle (org.mobicents.slee.resource.diameter.base.DiameterActivityHandle)3 ArrayList (java.util.ArrayList)2 DiameterMessage (net.java.slee.resource.diameter.base.events.DiameterMessage)2 UserDataRequest (net.java.slee.resource.diameter.sh.events.UserDataRequest)2 ShServerSessionDataLocalImpl (org.jdiameter.server.impl.app.sh.ShServerSessionDataLocalImpl)2 ShServerSessionImpl (org.jdiameter.server.impl.app.sh.ShServerSessionImpl)2 Test (org.junit.Test)2 DiameterMessageFactoryImpl (org.mobicents.slee.resource.diameter.base.DiameterMessageFactoryImpl)2 ShClientMessageFactoryImpl (org.mobicents.slee.resource.diameter.sh.client.ShClientMessageFactoryImpl)2 ShClientActivityAnswerCreationTest (org.mobicents.slee.resource.diameter.sh.client.tests.activities.ShClientActivityAnswerCreationTest)2 ShServerMessageFactoryImpl (org.mobicents.slee.resource.diameter.sh.server.ShServerMessageFactoryImpl)2