From 087435f6b7bb9ad8f24fb5b2f6d7fc77d8cc0a2f Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 25 Aug 2016 17:32:18 -0300 Subject: [PATCH 01/17] Sy interface implementation - first commit + jdiameter-api/sy interfaces --- .../org/jdiameter/api/sy/ClientSySession.java | 75 +++++++++++++++++++ .../api/sy/ClientSySessionListener.java | 73 ++++++++++++++++++ .../org/jdiameter/api/sy/ServerSySession.java | 75 +++++++++++++++++++ .../api/sy/ServerSySessionListener.java | 73 ++++++++++++++++++ .../api/sy/events/SpendingLimitAnswer.java | 62 +++++++++++++++ .../api/sy/events/SpendingLimitRequest.java | 63 ++++++++++++++++ .../sy/events/SpendingNotificationAnswer.java | 62 +++++++++++++++ .../events/SpendingNotificationRequest.java | 62 +++++++++++++++ .../sy/events/SpendingTerminationAnswer.java | 62 +++++++++++++++ .../sy/events/SpendingTerminationRequest.java | 62 +++++++++++++++ core/jdiameter/impl/pom.xml | 10 +++ 11 files changed, 679 insertions(+) create mode 100644 core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ClientSySession.java create mode 100644 core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ClientSySessionListener.java create mode 100644 core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ServerSySession.java create mode 100644 core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ServerSySessionListener.java create mode 100644 core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingLimitAnswer.java create mode 100644 core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingLimitRequest.java create mode 100644 core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingNotificationAnswer.java create mode 100644 core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingNotificationRequest.java create mode 100644 core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingTerminationAnswer.java create mode 100644 core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingTerminationRequest.java diff --git a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ClientSySession.java b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ClientSySession.java new file mode 100644 index 000000000..c63000320 --- /dev/null +++ b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ClientSySession.java @@ -0,0 +1,75 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-2011, Red Hat, Inc. and individual contributors + * by the @authors tag. See the copyright.txt in the distribution for a + * full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ + +package org.jdiameter.api.sy; + + import org.jdiameter.api.IllegalDiameterStateException; + import org.jdiameter.api.InternalException; + import org.jdiameter.api.OverloadException; + import org.jdiameter.api.RouteException; + import org.jdiameter.api.app.AppSession; + import org.jdiameter.api.app.StateMachine; + import org.jdiameter.api.sy.events.*; + + /** + * Basic class for Sy Client Interface specific session. + * Listener must be injected from constructor of implementation class. + * + * @author Alejandro Ferreira Guido + * @author Alexandre Mendonca + * @author Bartosz Baranowski + */ + public interface ClientSySession extends AppSession, StateMachine { + + void sendInitialSpendingLimitReportRequest(SpendingLimitRequest request) + throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; + + void sendIntermediateSpendingLimitReportRequest(SpendingLimitRequest request) + throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; + + void sendFinalSpendingLimitReportRequest(SpendingTerminationRequest request) + throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; + + void sendSpendingLimitReportAnswer(SpendingNotificationAnswer answer) + throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; + + } diff --git a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ClientSySessionListener.java b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ClientSySessionListener.java new file mode 100644 index 000000000..48f766335 --- /dev/null +++ b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ClientSySessionListener.java @@ -0,0 +1,73 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-2011, Red Hat, Inc. and individual contributors + * by the @authors tag. See the copyright.txt in the distribution for a + * full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ + +package org.jdiameter.api.sy; + + import org.jdiameter.api.IllegalDiameterStateException; + import org.jdiameter.api.InternalException; + import org.jdiameter.api.OverloadException; + import org.jdiameter.api.RouteException; + import org.jdiameter.api.sy.events.*; + + /** + * This interface defines the possible actions for the different states in the client + * Sy Interface state machine. + * + * @author Alejandro Ferreira Guido + * @author Alexandre Mendonca + * @author Bartosz Baranowski + */ + public interface ClientSySessionListener { + + void doInitialSpendingLimitReportAnswer(ClientSySession session, SpendingLimitRequest request, SpendingLimitAnswer answer) + throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; + + void doIntermediateSpendingLimitReportAnswer(ClientSySession session, SpendingLimitRequest request, SpendingLimitAnswer answer) + throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; + + void doFinalSpendingLimitReportAnswer(ClientSySession session, SpendingTerminationRequest request, SpendingTerminationAnswer answer) + throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; + + void doSpendingLimitReportRequest(ClientSySession session, SpendingNotificationAnswer answer) + throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; + + } diff --git a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ServerSySession.java b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ServerSySession.java new file mode 100644 index 000000000..d9dad2ade --- /dev/null +++ b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ServerSySession.java @@ -0,0 +1,75 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-2011, Red Hat, Inc. and individual contributors + * by the @authors tag. See the copyright.txt in the distribution for a + * full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ + +package org.jdiameter.api.sy; + + import org.jdiameter.api.IllegalDiameterStateException; + import org.jdiameter.api.InternalException; + import org.jdiameter.api.OverloadException; + import org.jdiameter.api.RouteException; + import org.jdiameter.api.app.AppSession; + import org.jdiameter.api.app.StateMachine; + import org.jdiameter.api.sy.events.*; + + /** + * Basic class for Sy Server Interface specific session. + * Listener must be injected from constructor of implementation class + * + * @author Alejandro Ferreira Guido + * @author Alexandre Mendonca + * @author Bartosz Baranowski + */ + public interface ServerSySession extends AppSession, StateMachine { + + void sendInitialSpendingLimitReportAnswer(SpendingLimitAnswer answer) + throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; + + void sendIntermediateSpendingLimitReportAnswer(SpendingLimitAnswer request) + throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; + + void sendFinalSpendingLimitReportAnswer(SpendingTerminationRequest request) + throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; + + void sendSpendingLimitReportRequest(SpendingNotificationRequest request) + throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; + + } diff --git a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ServerSySessionListener.java b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ServerSySessionListener.java new file mode 100644 index 000000000..985500127 --- /dev/null +++ b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ServerSySessionListener.java @@ -0,0 +1,73 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-2011, Red Hat, Inc. and individual contributors + * by the @authors tag. See the copyright.txt in the distribution for a + * full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ + +package org.jdiameter.api.sy; + + import org.jdiameter.api.IllegalDiameterStateException; + import org.jdiameter.api.InternalException; + import org.jdiameter.api.OverloadException; + import org.jdiameter.api.RouteException; + import org.jdiameter.api.sy.events.*; + + /** + * This interface defines the possible actions for the different states in the server Sy + * Interface state machine. + * + * @author Alejandro Ferreira Guido + * @author Alexandre Mendonca + * @author Bartosz Baranowski + */ + public interface ServerSySessionListener { + + void doInitialSpendingLimitReportRequest(ClientSySession session, SpendingLimitRequest request, SpendingLimitAnswer answer) + throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; + + void doIntermediateSpendingLimitReportRequest(ClientSySession session, SpendingLimitRequest request, SpendingLimitAnswer answer) + throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; + + void doFinalSpendingLimitReportRequest(ClientSySession session, SpendingTerminationRequest request, SpendingTerminationAnswer answer) + throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; + + void doSpendingLimitReportAnswer(ClientSySession session, SpendingNotificationAnswer answer) + throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; + + } diff --git a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingLimitAnswer.java b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingLimitAnswer.java new file mode 100644 index 000000000..6aaf32080 --- /dev/null +++ b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingLimitAnswer.java @@ -0,0 +1,62 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-2011, Red Hat, Inc. and individual contributors + * by the @authors tag. See the copyright.txt in the distribution for a + * full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ + +package org.jdiameter.api.sy.events; + + import org.jdiameter.api.app.AppAnswerEvent; + + /** + * The Spending-Limit-Answer (SLA) message, indicated by the Command-Code field set to 8388635 is sent + * by the OCS to the PCRF as a response to SLR message. + * + * @author Alejandro Ferreira Guido + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ + public interface SpendingLimitAnswer extends AppAnswerEvent { + + String _SHORT_NAME = "SLA"; + String _LONG_NAME = "Spending-Limit-Answer"; + + int code = 8388635; + + } diff --git a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingLimitRequest.java b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingLimitRequest.java new file mode 100644 index 000000000..3833a70b0 --- /dev/null +++ b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingLimitRequest.java @@ -0,0 +1,63 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-2011, Red Hat, Inc. and individual contributors + * by the @authors tag. See the copyright.txt in the distribution for a + * full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ + +package org.jdiameter.api.sy.events; + + import org.jdiameter.api.app.AppRequestEvent; + + /** + * The Spending-Limit-Request (SLR) message, indicated by the Command-Code field set to 8388635 is sent + * by the PCRF ot the OCS to retrieve subscription information that indicates that policy decision depends + * on policy counters held on the OCS. + * + * @author Alejandro Ferreira Guido + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ + public interface SpendingLimitRequest extends AppRequestEvent { + + String _SHORT_NAME = "SLR"; + String _LONG_NAME = "Spending-Limit-Request"; + + int code = 8388635; + + } diff --git a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingNotificationAnswer.java b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingNotificationAnswer.java new file mode 100644 index 000000000..ae549d170 --- /dev/null +++ b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingNotificationAnswer.java @@ -0,0 +1,62 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-2011, Red Hat, Inc. and individual contributors + * by the @authors tag. See the copyright.txt in the distribution for a + * full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ + +package org.jdiameter.api.sy.events; + + import org.jdiameter.api.app.AppAnswerEvent; + + /** + * The Spending-Notification-Answer (SNA) message, indicated by the Command-Code field set to 8388636 is sent + * by the PCRF to the OCS in reply to the SNR message. + * + * @author Alejandro Ferreira Guido + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ + public interface SpendingNotificationAnswer extends AppAnswerEvent { + + String _SHORT_NAME = "SNA"; + String _LONG_NAME = "Spending-Notification-Answer"; + + int code = 8388636; + + } diff --git a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingNotificationRequest.java b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingNotificationRequest.java new file mode 100644 index 000000000..6dde36bd8 --- /dev/null +++ b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingNotificationRequest.java @@ -0,0 +1,62 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-2011, Red Hat, Inc. and individual contributors + * by the @authors tag. See the copyright.txt in the distribution for a + * full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ + +package org.jdiameter.api.sy.events; + + import org.jdiameter.api.app.AppAnswerEvent; + + /** + * The Spending-Notification-Request (SNR) message, indicated by the Command-Code field set to 8388636 is sent + * by the OCS to the PCRF when the OCS detects that status of a policy counter identifier(s) had changed. + * + * @author Alejandro Ferreira Guido + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ + public interface SpendingNotificationRequest extends AppAnswerEvent { + + String _SHORT_NAME = "SNR"; + String _LONG_NAME = "Spending-Notification-Request"; + + int code = 8388636; + + } diff --git a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingTerminationAnswer.java b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingTerminationAnswer.java new file mode 100644 index 000000000..d7d546f70 --- /dev/null +++ b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingTerminationAnswer.java @@ -0,0 +1,62 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-2011, Red Hat, Inc. and individual contributors + * by the @authors tag. See the copyright.txt in the distribution for a + * full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ + +package org.jdiameter.api.sy.events; + + import org.jdiameter.api.app.AppAnswerEvent; + + /** + * The Spending-Termination-Answer (STA) message, indicated by the Command-Code field set to 275 is sent + * by the OCS to the PCRF in reply to the STR message. + * + * @author Alejandro Ferreira Guido + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ + public interface SpendingTerminationAnswer extends AppAnswerEvent { + + String _SHORT_NAME = "STA"; + String _LONG_NAME = "Spending-Termination-Answer"; + + int code = 275; + + } diff --git a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingTerminationRequest.java b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingTerminationRequest.java new file mode 100644 index 000000000..2e5aa3dd1 --- /dev/null +++ b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingTerminationRequest.java @@ -0,0 +1,62 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-2011, Red Hat, Inc. and individual contributors + * by the @authors tag. See the copyright.txt in the distribution for a + * full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ + +package org.jdiameter.api.sy.events; + + import org.jdiameter.api.app.AppAnswerEvent; + + /** + * The Spending-Termination-Request (STR) message, indicated by the Command-Code field set to 275 is sent + * by the PCRF to the OCS when the PCRF decides that policy decisions no longer depends on policy counters. + * + * @author Alejandro Ferreira Guido + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ + public interface SpendingTerminationRequest extends AppAnswerEvent { + + String _SHORT_NAME = "STR"; + String _LONG_NAME = "Spending-Termination-Request"; + + int code = 275; + + } diff --git a/core/jdiameter/impl/pom.xml b/core/jdiameter/impl/pom.xml index d804db3e4..5b646d76c 100644 --- a/core/jdiameter/impl/pom.xml +++ b/core/jdiameter/impl/pom.xml @@ -67,6 +67,16 @@ true + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.6 + 1.6 + + + From cf1861bb5bd6afa0e2129727674e1c1157afb982 Mon Sep 17 00:00:00 2001 From: Alex Date: Sun, 28 Aug 2016 19:16:32 -0300 Subject: [PATCH 02/17] Sy interface implementation - first commit + jdiameter-api/sy interfaces --- .../org/jdiameter/api/sy/ClientSySession.java | 53 +++++---- .../api/sy/ClientSySessionListener.java | 51 ++++---- .../org/jdiameter/api/sy/ServerSySession.java | 54 +++++---- .../api/sy/ServerSySessionListener.java | 51 ++++---- .../api/sy/events/SpendingLimitAnswer.java | 28 ++--- .../api/sy/events/SpendingLimitRequest.java | 30 ++--- .../sy/events/SpendingNotificationAnswer.java | 110 +++++++++--------- .../events/SpendingNotificationRequest.java | 110 +++++++++--------- .../sy/events/SpendingTerminationAnswer.java | 110 +++++++++--------- .../sy/events/SpendingTerminationRequest.java | 110 +++++++++--------- 10 files changed, 362 insertions(+), 345 deletions(-) diff --git a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ClientSySession.java b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ClientSySession.java index c63000320..01b8b6389 100644 --- a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ClientSySession.java +++ b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ClientSySession.java @@ -42,34 +42,37 @@ package org.jdiameter.api.sy; - import org.jdiameter.api.IllegalDiameterStateException; - import org.jdiameter.api.InternalException; - import org.jdiameter.api.OverloadException; - import org.jdiameter.api.RouteException; - import org.jdiameter.api.app.AppSession; - import org.jdiameter.api.app.StateMachine; - import org.jdiameter.api.sy.events.*; +import org.jdiameter.api.IllegalDiameterStateException; +import org.jdiameter.api.InternalException; +import org.jdiameter.api.OverloadException; +import org.jdiameter.api.RouteException; +import org.jdiameter.api.app.AppSession; +import org.jdiameter.api.app.StateMachine; - /** - * Basic class for Sy Client Interface specific session. - * Listener must be injected from constructor of implementation class. - * - * @author Alejandro Ferreira Guido - * @author Alexandre Mendonca - * @author Bartosz Baranowski - */ - public interface ClientSySession extends AppSession, StateMachine { +import org.jdiameter.api.sy.events.SpendingLimitRequest; +import org.jdiameter.api.sy.events.SpendingTerminationRequest; +import org.jdiameter.api.sy.events.SpendingNotificationAnswer; + +/** + * Basic class for Sy Client Interface specific session. + * Listener must be injected from constructor of implementation class. + * + * @author Alejandro Ferreira Guido + * @author Alexandre Mendonca + * @author Bartosz Baranowski + */ +public interface ClientSySession extends AppSession, StateMachine { - void sendInitialSpendingLimitReportRequest(SpendingLimitRequest request) - throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; + void sendInitialSpendingLimitReportRequest(SpendingLimitRequest request) + throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; - void sendIntermediateSpendingLimitReportRequest(SpendingLimitRequest request) - throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; + void sendIntermediateSpendingLimitReportRequest(SpendingLimitRequest request) + throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; - void sendFinalSpendingLimitReportRequest(SpendingTerminationRequest request) - throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; + void sendFinalSpendingLimitReportRequest(SpendingTerminationRequest request) + throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; - void sendSpendingLimitReportAnswer(SpendingNotificationAnswer answer) - throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; + void sendSpendingLimitReportAnswer(SpendingNotificationAnswer answer) + throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; - } +} diff --git a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ClientSySessionListener.java b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ClientSySessionListener.java index 48f766335..458ed89f1 100644 --- a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ClientSySessionListener.java +++ b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ClientSySessionListener.java @@ -42,32 +42,37 @@ package org.jdiameter.api.sy; - import org.jdiameter.api.IllegalDiameterStateException; - import org.jdiameter.api.InternalException; - import org.jdiameter.api.OverloadException; - import org.jdiameter.api.RouteException; - import org.jdiameter.api.sy.events.*; +import org.jdiameter.api.IllegalDiameterStateException; +import org.jdiameter.api.InternalException; +import org.jdiameter.api.OverloadException; +import org.jdiameter.api.RouteException; - /** - * This interface defines the possible actions for the different states in the client - * Sy Interface state machine. - * - * @author Alejandro Ferreira Guido - * @author Alexandre Mendonca - * @author Bartosz Baranowski - */ - public interface ClientSySessionListener { +import org.jdiameter.api.sy.events.SpendingLimitRequest; +import org.jdiameter.api.sy.events.SpendingLimitAnswer; +import org.jdiameter.api.sy.events.SpendingTerminationRequest; +import org.jdiameter.api.sy.events.SpendingTerminationAnswer; +import org.jdiameter.api.sy.events.SpendingNotificationAnswer; + +/** +* This interface defines the possible actions for the different states in the client +* Sy Interface state machine. +* +* @author Alejandro Ferreira Guido +* @author Alexandre Mendonca +* @author Bartosz Baranowski +*/ +public interface ClientSySessionListener { - void doInitialSpendingLimitReportAnswer(ClientSySession session, SpendingLimitRequest request, SpendingLimitAnswer answer) - throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; + void doInitialSpendingLimitReportAnswer(ClientSySession session, SpendingLimitRequest request, SpendingLimitAnswer answer) + throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; - void doIntermediateSpendingLimitReportAnswer(ClientSySession session, SpendingLimitRequest request, SpendingLimitAnswer answer) - throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; + void doIntermediateSpendingLimitReportAnswer(ClientSySession session, SpendingLimitRequest request, SpendingLimitAnswer answer) + throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; - void doFinalSpendingLimitReportAnswer(ClientSySession session, SpendingTerminationRequest request, SpendingTerminationAnswer answer) - throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; + void doFinalSpendingLimitReportAnswer(ClientSySession session, SpendingTerminationRequest request, SpendingTerminationAnswer answer) + throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; - void doSpendingLimitReportRequest(ClientSySession session, SpendingNotificationAnswer answer) - throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; + void doSpendingLimitReportRequest(ClientSySession session, SpendingNotificationAnswer answer) + throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; - } +} diff --git a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ServerSySession.java b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ServerSySession.java index d9dad2ade..70acde8d3 100644 --- a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ServerSySession.java +++ b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ServerSySession.java @@ -42,34 +42,38 @@ package org.jdiameter.api.sy; - import org.jdiameter.api.IllegalDiameterStateException; - import org.jdiameter.api.InternalException; - import org.jdiameter.api.OverloadException; - import org.jdiameter.api.RouteException; - import org.jdiameter.api.app.AppSession; - import org.jdiameter.api.app.StateMachine; - import org.jdiameter.api.sy.events.*; +import org.jdiameter.api.IllegalDiameterStateException; +import org.jdiameter.api.InternalException; +import org.jdiameter.api.OverloadException; +import org.jdiameter.api.RouteException; +import org.jdiameter.api.app.AppSession; +import org.jdiameter.api.app.StateMachine; - /** - * Basic class for Sy Server Interface specific session. - * Listener must be injected from constructor of implementation class - * - * @author Alejandro Ferreira Guido - * @author Alexandre Mendonca - * @author Bartosz Baranowski - */ - public interface ServerSySession extends AppSession, StateMachine { +import org.jdiameter.api.sy.events.SpendingLimitAnswer; +import org.jdiameter.api.sy.events.SpendingTerminationRequest; +import org.jdiameter.api.sy.events.SpendingNotificationRequest; + +/** +* Basic class for Sy Server Interface specific session. +* Listener must be injected from constructor of implementation class +* +* @author Alejandro Ferreira Guido +* @author Alexandre Mendonca +* @author Bartosz Baranowski +*/ + +public interface ServerSySession extends AppSession, StateMachine { - void sendInitialSpendingLimitReportAnswer(SpendingLimitAnswer answer) - throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; + void sendInitialSpendingLimitReportAnswer(SpendingLimitAnswer answer) + throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; - void sendIntermediateSpendingLimitReportAnswer(SpendingLimitAnswer request) - throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; + void sendIntermediateSpendingLimitReportAnswer(SpendingLimitAnswer request) + throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; - void sendFinalSpendingLimitReportAnswer(SpendingTerminationRequest request) - throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; + void sendFinalSpendingLimitReportAnswer(SpendingTerminationRequest request) + throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; - void sendSpendingLimitReportRequest(SpendingNotificationRequest request) - throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; + void sendSpendingLimitReportRequest(SpendingNotificationRequest request) + throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; - } +} diff --git a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ServerSySessionListener.java b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ServerSySessionListener.java index 985500127..f9e820dfe 100644 --- a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ServerSySessionListener.java +++ b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ServerSySessionListener.java @@ -42,32 +42,37 @@ package org.jdiameter.api.sy; - import org.jdiameter.api.IllegalDiameterStateException; - import org.jdiameter.api.InternalException; - import org.jdiameter.api.OverloadException; - import org.jdiameter.api.RouteException; - import org.jdiameter.api.sy.events.*; +import org.jdiameter.api.IllegalDiameterStateException; +import org.jdiameter.api.InternalException; +import org.jdiameter.api.OverloadException; +import org.jdiameter.api.RouteException; - /** - * This interface defines the possible actions for the different states in the server Sy - * Interface state machine. - * - * @author Alejandro Ferreira Guido - * @author Alexandre Mendonca - * @author Bartosz Baranowski - */ - public interface ServerSySessionListener { +import org.jdiameter.api.sy.events.SpendingLimitAnswer; +import org.jdiameter.api.sy.events.SpendingLimitRequest; +import org.jdiameter.api.sy.events.SpendingTerminationRequest; +import org.jdiameter.api.sy.events.SpendingNotificationAnswer; +import org.jdiameter.api.sy.events.SpendingTerminationAnswer; + +/** +* This interface defines the possible actions for th;e different states in the server Sy +* Interface state machine. +* +* @author Alejandro Ferreira Guido +* @author Alexandre Mendonca +* @author Bartosz Baranowski +*/ +public interface ServerSySessionListener { - void doInitialSpendingLimitReportRequest(ClientSySession session, SpendingLimitRequest request, SpendingLimitAnswer answer) - throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; + void doInitialSpendingLimitReportRequest(ClientSySession session, SpendingLimitRequest request, SpendingLimitAnswer answer) + throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; - void doIntermediateSpendingLimitReportRequest(ClientSySession session, SpendingLimitRequest request, SpendingLimitAnswer answer) - throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; + void doIntermediateSpendingLimitReportRequest(ClientSySession session, SpendingLimitRequest request, SpendingLimitAnswer answer) + throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; - void doFinalSpendingLimitReportRequest(ClientSySession session, SpendingTerminationRequest request, SpendingTerminationAnswer answer) - throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; + void doFinalSpendingLimitReportRequest(ClientSySession session, SpendingTerminationRequest request, SpendingTerminationAnswer answer) + throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; - void doSpendingLimitReportAnswer(ClientSySession session, SpendingNotificationAnswer answer) - throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; + void doSpendingLimitReportAnswer(ClientSySession session, SpendingNotificationAnswer answer) + throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; - } +} \ No newline at end of file diff --git a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingLimitAnswer.java b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingLimitAnswer.java index 6aaf32080..3a3752f71 100644 --- a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingLimitAnswer.java +++ b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingLimitAnswer.java @@ -42,21 +42,21 @@ package org.jdiameter.api.sy.events; - import org.jdiameter.api.app.AppAnswerEvent; +import org.jdiameter.api.app.AppAnswerEvent; - /** - * The Spending-Limit-Answer (SLA) message, indicated by the Command-Code field set to 8388635 is sent - * by the OCS to the PCRF as a response to SLR message. - * - * @author Alejandro Ferreira Guido - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ - public interface SpendingLimitAnswer extends AppAnswerEvent { +/** +* The Spending-Limit-Answer (SLA) message, indicated by the Command-Code field set to 8388635 is sent +* by the OCS to the PCRF as a response to SLR message. +* +* @author Alejandro Ferreira Guido +* @author Bartosz Baranowski +* @author Alexandre Mendonca +*/ +public interface SpendingLimitAnswer extends AppAnswerEvent { - String _SHORT_NAME = "SLA"; - String _LONG_NAME = "Spending-Limit-Answer"; + String _SHORT_NAME = "SLA"; + String _LONG_NAME = "Spending-Limit-Answer"; - int code = 8388635; + int code = 8388635; - } +} diff --git a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingLimitRequest.java b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingLimitRequest.java index 3833a70b0..9b3f33df4 100644 --- a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingLimitRequest.java +++ b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingLimitRequest.java @@ -42,22 +42,22 @@ package org.jdiameter.api.sy.events; - import org.jdiameter.api.app.AppRequestEvent; +import org.jdiameter.api.app.AppRequestEvent; - /** - * The Spending-Limit-Request (SLR) message, indicated by the Command-Code field set to 8388635 is sent - * by the PCRF ot the OCS to retrieve subscription information that indicates that policy decision depends - * on policy counters held on the OCS. - * - * @author Alejandro Ferreira Guido - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ - public interface SpendingLimitRequest extends AppRequestEvent { +/** +* The Spending-Limit-Request (SLR) message, indicated by the Command-Code field set to 8388635 is sent +* by the PCRF ot the OCS to retrieve subscription information that indicates that policy decision depends +* on policy counters held on the OCS. +* +* @author Alejandro Ferreira Guido +* @author Bartosz Baranowski +* @author Alexandre Mendonca +*/ +public interface SpendingLimitRequest extends AppRequestEvent { - String _SHORT_NAME = "SLR"; - String _LONG_NAME = "Spending-Limit-Request"; + String _SHORT_NAME = "SLR"; + String _LONG_NAME = "Spending-Limit-Request"; - int code = 8388635; + int code = 8388635; - } +} diff --git a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingNotificationAnswer.java b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingNotificationAnswer.java index ae549d170..230aded67 100644 --- a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingNotificationAnswer.java +++ b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingNotificationAnswer.java @@ -1,62 +1,62 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-2011, Red Hat, Inc. and individual contributors - * by the @authors tag. See the copyright.txt in the distribution for a - * full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ +/* +* TeleStax, Open Source Cloud Communications +* Copyright 2011-2016, TeleStax Inc. and individual contributors +* by the @authors tag. +* +* This program is free software: you can redistribute it and/or modify +* under the terms of the GNU Affero General Public License as +* published by the Free Software Foundation; either version 3 of +* the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Affero General Public License for more details. +* +* You should have received a copy of the GNU Affero General Public License +* along with this program. If not, see +* +* This file incorporates work covered by the following copyright and +* permission notice: +* +* JBoss, Home of Professional Open Source +* Copyright 2007-2011, Red Hat, Inc. and individual contributors +* by the @authors tag. See the copyright.txt in the distribution for a +* full listing of individual contributors. +* +* This is free software; you can redistribute it and/or modify it +* under the terms of the GNU Lesser General Public License as +* published by the Free Software Foundation; either version 2.1 of +* the License, or (at your option) any later version. +* +* This software is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this software; if not, write to the Free +* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA +* 02110-1301 USA, or see the FSF site: http://www.fsf.org. +*/ package org.jdiameter.api.sy.events; - import org.jdiameter.api.app.AppAnswerEvent; +import org.jdiameter.api.app.AppAnswerEvent; - /** - * The Spending-Notification-Answer (SNA) message, indicated by the Command-Code field set to 8388636 is sent - * by the PCRF to the OCS in reply to the SNR message. - * - * @author Alejandro Ferreira Guido - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ - public interface SpendingNotificationAnswer extends AppAnswerEvent { +/** +* The Spending-Notification-Answer (SNA) message, indicated by the Command-Code field set to 8388636 is sent +* by the PCRF to the OCS in reply to the SNR message. +* +* @author Alejandro Ferreira Guido +* @author Bartosz Baranowski +* @author Alexandre Mendonca +*/ +public interface SpendingNotificationAnswer extends AppAnswerEvent { - String _SHORT_NAME = "SNA"; - String _LONG_NAME = "Spending-Notification-Answer"; + String _SHORT_NAME = "SNA"; + String _LONG_NAME = "Spending-Notification-Answer"; - int code = 8388636; + int code = 8388636; - } +} diff --git a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingNotificationRequest.java b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingNotificationRequest.java index 6dde36bd8..abae2d8fc 100644 --- a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingNotificationRequest.java +++ b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingNotificationRequest.java @@ -1,62 +1,62 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-2011, Red Hat, Inc. and individual contributors - * by the @authors tag. See the copyright.txt in the distribution for a - * full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ +/* +* TeleStax, Open Source Cloud Communications +* Copyright 2011-2016, TeleStax Inc. and individual contributors +* by the @authors tag. +* +* This program is free software: you can redistribute it and/or modify +* under the terms of the GNU Affero General Public License as +* published by the Free Software Foundation; either version 3 of +* the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Affero General Public License for more details. +* +* You should have received a copy of the GNU Affero General Public License +* along with this program. If not, see +* +* This file incorporates work covered by the following copyright and +* permission notice: +* +* JBoss, Home of Professional Open Source +* Copyright 2007-2011, Red Hat, Inc. and individual contributors +* by the @authors tag. See the copyright.txt in the distribution for a +* full listing of individual contributors. +* +* This is free software; you can redistribute it and/or modify it +* under the terms of the GNU Lesser General Public License as +* published by the Free Software Foundation; either version 2.1 of +* the License, or (at your option) any later version. +* +* This software is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this software; if not, write to the Free +* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA +* 02110-1301 USA, or see the FSF site: http://www.fsf.org. +*/ package org.jdiameter.api.sy.events; - import org.jdiameter.api.app.AppAnswerEvent; +import org.jdiameter.api.app.AppAnswerEvent; - /** - * The Spending-Notification-Request (SNR) message, indicated by the Command-Code field set to 8388636 is sent - * by the OCS to the PCRF when the OCS detects that status of a policy counter identifier(s) had changed. - * - * @author Alejandro Ferreira Guido - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ - public interface SpendingNotificationRequest extends AppAnswerEvent { +/** +* The Spending-Notification-Request (SNR) message, indicated by the Command-Code field set to 8388636 is sent +* by the OCS to the PCRF when the OCS detects that status of a policy counter identifier(s) had changed. +* +* @author Alejandro Ferreira Guido +* @author Bartosz Baranowski +* @author Alexandre Mendonca +*/ +public interface SpendingNotificationRequest extends AppAnswerEvent { - String _SHORT_NAME = "SNR"; - String _LONG_NAME = "Spending-Notification-Request"; + String _SHORT_NAME = "SNR"; + String _LONG_NAME = "Spending-Notification-Request"; - int code = 8388636; + int code = 8388636; - } +} diff --git a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingTerminationAnswer.java b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingTerminationAnswer.java index d7d546f70..e70876786 100644 --- a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingTerminationAnswer.java +++ b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingTerminationAnswer.java @@ -1,62 +1,62 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-2011, Red Hat, Inc. and individual contributors - * by the @authors tag. See the copyright.txt in the distribution for a - * full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ +/* +* TeleStax, Open Source Cloud Communications +* Copyright 2011-2016, TeleStax Inc. and individual contributors +* by the @authors tag. +* +* This program is free software: you can redistribute it and/or modify +* under the terms of the GNU Affero General Public License as +* published by the Free Software Foundation; either version 3 of +* the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Affero General Public License for more details. +* +* You should have received a copy of the GNU Affero General Public License +* along with this program. If not, see +* +* This file incorporates work covered by the following copyright and +* permission notice: +* +* JBoss, Home of Professional Open Source +* Copyright 2007-2011, Red Hat, Inc. and individual contributors +* by the @authors tag. See the copyright.txt in the distribution for a +* full listing of individual contributors. +* +* This is free software; you can redistribute it and/or modify it +* under the terms of the GNU Lesser General Public License as +* published by the Free Software Foundation; either version 2.1 of +* the License, or (at your option) any later version. +* +* This software is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this software; if not, write to the Free +* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA +* 02110-1301 USA, or see the FSF site: http://www.fsf.org. +*/ package org.jdiameter.api.sy.events; - import org.jdiameter.api.app.AppAnswerEvent; +import org.jdiameter.api.app.AppAnswerEvent; - /** - * The Spending-Termination-Answer (STA) message, indicated by the Command-Code field set to 275 is sent - * by the OCS to the PCRF in reply to the STR message. - * - * @author Alejandro Ferreira Guido - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ - public interface SpendingTerminationAnswer extends AppAnswerEvent { +/** +* The Spending-Termination-Answer (STA) message, indicated by the Command-Code field set to 275 is sent +* by the OCS to the PCRF in reply to the STR message. +* +* @author Alejandro Ferreira Guido +* @author Bartosz Baranowski +* @author Alexandre Mendonca +*/ +public interface SpendingTerminationAnswer extends AppAnswerEvent { - String _SHORT_NAME = "STA"; - String _LONG_NAME = "Spending-Termination-Answer"; + String _SHORT_NAME = "STA"; + String _LONG_NAME = "Spending-Termination-Answer"; - int code = 275; + int code = 275; - } +} diff --git a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingTerminationRequest.java b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingTerminationRequest.java index 2e5aa3dd1..7bb5a1a4c 100644 --- a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingTerminationRequest.java +++ b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingTerminationRequest.java @@ -1,62 +1,62 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-2011, Red Hat, Inc. and individual contributors - * by the @authors tag. See the copyright.txt in the distribution for a - * full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ +/* +* TeleStax, Open Source Cloud Communications +* Copyright 2011-2016, TeleStax Inc. and individual contributors +* by the @authors tag. +* +* This program is free software: you can redistribute it and/or modify +* under the terms of the GNU Affero General Public License as +* published by the Free Software Foundation; either version 3 of +* the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Affero General Public License for more details. +* +* You should have received a copy of the GNU Affero General Public License +* along with this program. If not, see +* +* This file incorporates work covered by the following copyright and +* permission notice: +* +* JBoss, Home of Professional Open Source +* Copyright 2007-2011, Red Hat, Inc. and individual contributors +* by the @authors tag. See the copyright.txt in the distribution for a +* full listing of individual contributors. +* +* This is free software; you can redistribute it and/or modify it +* under the terms of the GNU Lesser General Public License as +* published by the Free Software Foundation; either version 2.1 of +* the License, or (at your option) any later version. +* +* This software is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this software; if not, write to the Free +* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA +* 02110-1301 USA, or see the FSF site: http://www.fsf.org. +*/ package org.jdiameter.api.sy.events; - import org.jdiameter.api.app.AppAnswerEvent; +import org.jdiameter.api.app.AppAnswerEvent; - /** - * The Spending-Termination-Request (STR) message, indicated by the Command-Code field set to 275 is sent - * by the PCRF to the OCS when the PCRF decides that policy decisions no longer depends on policy counters. - * - * @author Alejandro Ferreira Guido - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ - public interface SpendingTerminationRequest extends AppAnswerEvent { +/** +* The Spending-Termination-Request (STR) message, indicated by the Command-Code field set to 275 is sent +* by the PCRF to the OCS when the PCRF decides that policy decisions no longer depends on policy counters. +* +* @author Alejandro Ferreira Guido +* @author Bartosz Baranowski +* @author Alexandre Mendonca +*/ +public interface SpendingTerminationRequest extends AppAnswerEvent { - String _SHORT_NAME = "STR"; - String _LONG_NAME = "Spending-Termination-Request"; + String _SHORT_NAME = "STR"; + String _LONG_NAME = "Spending-Termination-Request"; - int code = 275; + int code = 275; - } +} From 89614b564f9a8cc0ebc0c35382e7ebd522e379aa Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 6 Sep 2016 11:01:31 -0300 Subject: [PATCH 03/17] Sy interface implementation - fixed some AVP definitions + jdiameter-parent/examples/resources/dictionary.xml + defined OC-Supported-Features codes + added AVP definitions --- ...wer.java => SessionTerminationAnswer.java} | 4 +- ...st.java => SessionTerminationRequest.java} | 4 +- ... => SpendingStatusNotificationAnswer.java} | 4 +- ...=> SpendingStatusNotificationRequest.java} | 4 +- .../src/main/resources/dictionary.xml | 98 ++++++++++++++++++- 5 files changed, 102 insertions(+), 12 deletions(-) rename core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/{SpendingTerminationAnswer.java => SessionTerminationAnswer.java} (95%) rename core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/{SpendingTerminationRequest.java => SessionTerminationRequest.java} (95%) rename core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/{SpendingNotificationAnswer.java => SpendingStatusNotificationAnswer.java} (94%) rename core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/{SpendingNotificationRequest.java => SpendingStatusNotificationRequest.java} (94%) diff --git a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingTerminationAnswer.java b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SessionTerminationAnswer.java similarity index 95% rename from core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingTerminationAnswer.java rename to core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SessionTerminationAnswer.java index e70876786..5ebf43ff3 100644 --- a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingTerminationAnswer.java +++ b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SessionTerminationAnswer.java @@ -52,10 +52,10 @@ * @author Bartosz Baranowski * @author Alexandre Mendonca */ -public interface SpendingTerminationAnswer extends AppAnswerEvent { +public interface SessionTerminationAnswer extends AppAnswerEvent { String _SHORT_NAME = "STA"; - String _LONG_NAME = "Spending-Termination-Answer"; + String _LONG_NAME = "Session-Termination-Answer"; int code = 275; diff --git a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingTerminationRequest.java b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SessionTerminationRequest.java similarity index 95% rename from core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingTerminationRequest.java rename to core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SessionTerminationRequest.java index 7bb5a1a4c..67093ca49 100644 --- a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingTerminationRequest.java +++ b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SessionTerminationRequest.java @@ -52,10 +52,10 @@ * @author Bartosz Baranowski * @author Alexandre Mendonca */ -public interface SpendingTerminationRequest extends AppAnswerEvent { +public interface SessionTerminationRequest extends AppAnswerEvent { String _SHORT_NAME = "STR"; - String _LONG_NAME = "Spending-Termination-Request"; + String _LONG_NAME = "Session-Termination-Request"; int code = 275; diff --git a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingNotificationAnswer.java b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingStatusNotificationAnswer.java similarity index 94% rename from core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingNotificationAnswer.java rename to core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingStatusNotificationAnswer.java index 230aded67..a37adfcd4 100644 --- a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingNotificationAnswer.java +++ b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingStatusNotificationAnswer.java @@ -52,10 +52,10 @@ * @author Bartosz Baranowski * @author Alexandre Mendonca */ -public interface SpendingNotificationAnswer extends AppAnswerEvent { +public interface SpendingStatusNotificationAnswer extends AppAnswerEvent { String _SHORT_NAME = "SNA"; - String _LONG_NAME = "Spending-Notification-Answer"; + String _LONG_NAME = "Spending-Status-Notification-Answer"; int code = 8388636; diff --git a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingNotificationRequest.java b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingStatusNotificationRequest.java similarity index 94% rename from core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingNotificationRequest.java rename to core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingStatusNotificationRequest.java index abae2d8fc..0853792bd 100644 --- a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingNotificationRequest.java +++ b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingStatusNotificationRequest.java @@ -52,10 +52,10 @@ * @author Bartosz Baranowski * @author Alexandre Mendonca */ -public interface SpendingNotificationRequest extends AppAnswerEvent { +public interface SpendingStatusNotificationRequest extends AppAnswerEvent { String _SHORT_NAME = "SNR"; - String _LONG_NAME = "Spending-Notification-Request"; + String _LONG_NAME = "Spending-Status-Notification-Request"; int code = 8388636; diff --git a/examples/charging-server-simulator/src/main/resources/dictionary.xml b/examples/charging-server-simulator/src/main/resources/dictionary.xml index 91bf1acf5..5f7da45b2 100644 --- a/examples/charging-server-simulator/src/main/resources/dictionary.xml +++ b/examples/charging-server-simulator/src/main/resources/dictionary.xml @@ -6668,16 +6668,15 @@ - + @@ -7616,4 +7615,95 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 18131d8f0076569f53e6773f42185056435a3839 Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 6 Sep 2016 11:07:02 -0300 Subject: [PATCH 04/17] Sy interface implementation - fixed some AVP definitions + jdiameter-parent/examples/resources/dictionary.xml + defined OC-Supported-Features codes + added AVP definitions --- .../src/main/resources/dictionary.xml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/examples/charging-server-simulator/src/main/resources/dictionary.xml b/examples/charging-server-simulator/src/main/resources/dictionary.xml index 5f7da45b2..73d35390d 100644 --- a/examples/charging-server-simulator/src/main/resources/dictionary.xml +++ b/examples/charging-server-simulator/src/main/resources/dictionary.xml @@ -7649,6 +7649,10 @@ + + + + @@ -7663,8 +7667,8 @@ - - + + From b265d07b609b5afc16c06b78c99cf255f2c39744 Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 8 Sep 2016 12:24:34 -0300 Subject: [PATCH 05/17] Sy interface implementation - api & defs - Impl missing + jdiameter-parent/examples/resources/dictionary.xml + fixed OC-Supported-Features codes + added AVP definitions for Sy + added DRMP --- .../impl/validation/DictionaryImpl.java | 2 +- .../src/main/resources/dictionary.xml | 127 +++++++++++++----- 2 files changed, 98 insertions(+), 31 deletions(-) diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/common/impl/validation/DictionaryImpl.java b/core/jdiameter/impl/src/main/java/org/jdiameter/common/impl/validation/DictionaryImpl.java index 1dd02f414..8333fd912 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/common/impl/validation/DictionaryImpl.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/common/impl/validation/DictionaryImpl.java @@ -298,7 +298,7 @@ protected void parseTypeDefs(Document doc) { } /** - * Parses the attributes from a Dictionary XML Document + * Parses the attributes from a Dictionary XML Document * * @param doc the DOM object representing the XML Document with the Dictionary definitions */ diff --git a/examples/charging-server-simulator/src/main/resources/dictionary.xml b/examples/charging-server-simulator/src/main/resources/dictionary.xml index 73d35390d..b0f3db34a 100644 --- a/examples/charging-server-simulator/src/main/resources/dictionary.xml +++ b/examples/charging-server-simulator/src/main/resources/dictionary.xml @@ -7617,6 +7617,27 @@ + + + + + + + + + + + + + + + + + + + + + @@ -7653,57 +7674,103 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - - + + - + - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 5da6b3bb71c5cd7ff5111ffbe88124fc16efa605 Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 8 Sep 2016 13:05:43 -0300 Subject: [PATCH 06/17] Sy interface implementation - api & defs - Impl missing + jdiameter-parent/examples/resources/dictionary.xml + fixed OC-Supported-Features codes + added AVP definitions for Sy + added DRMP --- .../src/main/resources/dictionary.xml | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/examples/charging-server-simulator/src/main/resources/dictionary.xml b/examples/charging-server-simulator/src/main/resources/dictionary.xml index b0f3db34a..0abc1b72e 100644 --- a/examples/charging-server-simulator/src/main/resources/dictionary.xml +++ b/examples/charging-server-simulator/src/main/resources/dictionary.xml @@ -7773,6 +7773,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 67bae637277e476137d3e37b6f51ae6966ebad84 Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 9 Sep 2016 08:11:12 -0300 Subject: [PATCH 07/17] Sy interface implementation - api & defs - Impl missing + jdiameter-parent/examples/resources/dictionary.xml + fixed OC-Supported-Features codes + added AVP definitions for Sy + added DRMP issue #44 --- .../src/main/resources/dictionary.xml | 78 +++++++++---------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/examples/charging-server-simulator/src/main/resources/dictionary.xml b/examples/charging-server-simulator/src/main/resources/dictionary.xml index 0abc1b72e..49ded98c3 100644 --- a/examples/charging-server-simulator/src/main/resources/dictionary.xml +++ b/examples/charging-server-simulator/src/main/resources/dictionary.xml @@ -4327,19 +4327,19 @@ - + - - - - + + + + - - + + - + @@ -4347,8 +4347,8 @@ - - + + @@ -4358,11 +4358,11 @@ - + - - + + @@ -6668,14 +6668,14 @@ - + @@ -7617,7 +7617,7 @@ - + @@ -7674,7 +7674,7 @@ - + - + - + @@ -7720,14 +7720,14 @@ - + - - + + @@ -7741,14 +7741,14 @@ - + - + @@ -7756,14 +7756,14 @@ - + - - + + @@ -7775,14 +7775,14 @@ - + - + @@ -7790,7 +7790,7 @@ - + @@ -7798,8 +7798,8 @@ - - + + From 16f5125d3113c357ee75dac7394bb3ef6516cd50 Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 9 Sep 2016 08:44:36 -0300 Subject: [PATCH 08/17] Sy interface implementation - api & defs - Impl missing + jdiameter-parent/examples/resources/dictionary.xml + fixed OC-Supported-Features codes + added AVP definitions for Sy + added DRMP issue #44 --- .../src/main/resources/dictionary.xml | 52 +++++++++---------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/examples/charging-server-simulator/src/main/resources/dictionary.xml b/examples/charging-server-simulator/src/main/resources/dictionary.xml index 49ded98c3..4335ef457 100644 --- a/examples/charging-server-simulator/src/main/resources/dictionary.xml +++ b/examples/charging-server-simulator/src/main/resources/dictionary.xml @@ -6668,14 +6668,14 @@ - + @@ -7617,7 +7617,7 @@ - + @@ -7674,7 +7674,7 @@ - + - + - + @@ -7720,14 +7720,14 @@ - + - - + + @@ -7741,14 +7741,14 @@ - + - + @@ -7756,14 +7756,14 @@ - + - - + + @@ -7775,14 +7775,14 @@ - + - + @@ -7790,7 +7790,7 @@ - + @@ -7798,8 +7798,8 @@ - - + + From cafeaacac3adfe9650f71abad7ce77883b016e40 Mon Sep 17 00:00:00 2001 From: Alex Date: Sat, 24 Sep 2016 21:34:29 -0300 Subject: [PATCH 09/17] Sy interface implementation - api & defs - Impl missing + fixed according fo @brainslog comments #issue 44 --- .../org/jdiameter/api/sy/ClientSySession.java | 73 ++++++------------ .../api/sy/ClientSySessionListener.java | 75 ++++++------------ .../org/jdiameter/api/sy/ServerSySession.java | 73 ++++++------------ .../api/sy/ServerSySessionListener.java | 76 ++++++------------- .../sy/events/SessionTerminationAnswer.java | 62 --------------- .../sy/events/SessionTerminationRequest.java | 62 --------------- .../api/sy/events/SpendingLimitAnswer.java | 59 +++++--------- .../api/sy/events/SpendingLimitRequest.java | 59 +++++--------- .../SpendingStatusNotificationAnswer.java | 57 +++++--------- .../SpendingStatusNotificationRequest.java | 57 +++++--------- 10 files changed, 168 insertions(+), 485 deletions(-) delete mode 100644 core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SessionTerminationAnswer.java delete mode 100644 core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SessionTerminationRequest.java diff --git a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ClientSySession.java b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ClientSySession.java index 01b8b6389..98506ba8d 100644 --- a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ClientSySession.java +++ b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ClientSySession.java @@ -1,44 +1,21 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-2011, Red Hat, Inc. and individual contributors - * by the @authors tag. See the copyright.txt in the distribution for a - * full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ +/* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, Telestax Inc and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + */ package org.jdiameter.api.sy; @@ -49,9 +26,10 @@ import org.jdiameter.api.app.AppSession; import org.jdiameter.api.app.StateMachine; +import org.jdiameter.api.auth.events.SessionTermRequest; + import org.jdiameter.api.sy.events.SpendingLimitRequest; -import org.jdiameter.api.sy.events.SpendingTerminationRequest; -import org.jdiameter.api.sy.events.SpendingNotificationAnswer; +import org.jdiameter.api.sy.events.SpendingStatusNotificationAnswer; /** * Basic class for Sy Client Interface specific session. @@ -63,16 +41,13 @@ */ public interface ClientSySession extends AppSession, StateMachine { - void sendInitialSpendingLimitReportRequest(SpendingLimitRequest request) - throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; - - void sendIntermediateSpendingLimitReportRequest(SpendingLimitRequest request) + void sendSpendingLimitRequest(SpendingLimitRequest request) throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; - void sendFinalSpendingLimitReportRequest(SpendingTerminationRequest request) + void sendFinalSpendingLimitRequest(SessionTermRequest request) throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; - void sendSpendingLimitReportAnswer(SpendingNotificationAnswer answer) + void sendSpendingStatusNotificationAnswer(SpendingStatusNotificationAnswer answer) throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; } diff --git a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ClientSySessionListener.java b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ClientSySessionListener.java index 458ed89f1..1523ffe5e 100644 --- a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ClientSySessionListener.java +++ b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ClientSySessionListener.java @@ -1,44 +1,21 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-2011, Red Hat, Inc. and individual contributors - * by the @authors tag. See the copyright.txt in the distribution for a - * full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ +/* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, Telestax Inc and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + */ package org.jdiameter.api.sy; @@ -47,11 +24,12 @@ import org.jdiameter.api.OverloadException; import org.jdiameter.api.RouteException; +import org.jdiameter.api.auth.events.SessionTermAnswer; +import org.jdiameter.api.auth.events.SessionTermRequest; + import org.jdiameter.api.sy.events.SpendingLimitRequest; import org.jdiameter.api.sy.events.SpendingLimitAnswer; -import org.jdiameter.api.sy.events.SpendingTerminationRequest; -import org.jdiameter.api.sy.events.SpendingTerminationAnswer; -import org.jdiameter.api.sy.events.SpendingNotificationAnswer; +import org.jdiameter.api.sy.events.SpendingStatusNotificationRequest; /** * This interface defines the possible actions for the different states in the client @@ -63,16 +41,13 @@ */ public interface ClientSySessionListener { - void doInitialSpendingLimitReportAnswer(ClientSySession session, SpendingLimitRequest request, SpendingLimitAnswer answer) - throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; - - void doIntermediateSpendingLimitReportAnswer(ClientSySession session, SpendingLimitRequest request, SpendingLimitAnswer answer) + void doSpendingLimitAnswer(ClientSySession session, SpendingLimitRequest request, SpendingLimitAnswer answer) throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; - void doFinalSpendingLimitReportAnswer(ClientSySession session, SpendingTerminationRequest request, SpendingTerminationAnswer answer) + void doFinalSpendingLimitAnswer(ClientSySession session, SessionTermRequest request, SessionTermAnswer answer) throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; - void doSpendingLimitReportRequest(ClientSySession session, SpendingNotificationAnswer answer) + void doSpendingStatusNotificationRequest(ClientSySession session, SpendingStatusNotificationRequest request) throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; } diff --git a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ServerSySession.java b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ServerSySession.java index 70acde8d3..53ebb762a 100644 --- a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ServerSySession.java +++ b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ServerSySession.java @@ -1,44 +1,21 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-2011, Red Hat, Inc. and individual contributors - * by the @authors tag. See the copyright.txt in the distribution for a - * full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ +/* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, Telestax Inc and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + */ package org.jdiameter.api.sy; @@ -49,9 +26,10 @@ import org.jdiameter.api.app.AppSession; import org.jdiameter.api.app.StateMachine; +import org.jdiameter.api.auth.events.SessionTermAnswer; + import org.jdiameter.api.sy.events.SpendingLimitAnswer; -import org.jdiameter.api.sy.events.SpendingTerminationRequest; -import org.jdiameter.api.sy.events.SpendingNotificationRequest; +import org.jdiameter.api.sy.events.SpendingStatusNotificationRequest; /** * Basic class for Sy Server Interface specific session. @@ -64,16 +42,13 @@ public interface ServerSySession extends AppSession, StateMachine { - void sendInitialSpendingLimitReportAnswer(SpendingLimitAnswer answer) - throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; - - void sendIntermediateSpendingLimitReportAnswer(SpendingLimitAnswer request) + void sendSpendingLimitAnswer(SpendingLimitAnswer answer) throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; - void sendFinalSpendingLimitReportAnswer(SpendingTerminationRequest request) + void sendFinalSpendingLimitAnswer(SessionTermAnswer answer) throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; - void sendSpendingLimitReportRequest(SpendingNotificationRequest request) + void sendSpendingStatusNotificationRequest(SpendingStatusNotificationRequest request) throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; } diff --git a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ServerSySessionListener.java b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ServerSySessionListener.java index f9e820dfe..489fc4b78 100644 --- a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ServerSySessionListener.java +++ b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ServerSySessionListener.java @@ -1,44 +1,21 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-2011, Red Hat, Inc. and individual contributors - * by the @authors tag. See the copyright.txt in the distribution for a - * full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ +/* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, Telestax Inc and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + */ package org.jdiameter.api.sy; @@ -47,11 +24,11 @@ import org.jdiameter.api.OverloadException; import org.jdiameter.api.RouteException; -import org.jdiameter.api.sy.events.SpendingLimitAnswer; +import org.jdiameter.api.auth.events.SessionTermRequest; + import org.jdiameter.api.sy.events.SpendingLimitRequest; -import org.jdiameter.api.sy.events.SpendingTerminationRequest; -import org.jdiameter.api.sy.events.SpendingNotificationAnswer; -import org.jdiameter.api.sy.events.SpendingTerminationAnswer; +import org.jdiameter.api.sy.events.SpendingStatusNotificationAnswer; +import org.jdiameter.api.sy.events.SpendingStatusNotificationRequest; /** * This interface defines the possible actions for th;e different states in the server Sy @@ -63,16 +40,13 @@ */ public interface ServerSySessionListener { - void doInitialSpendingLimitReportRequest(ClientSySession session, SpendingLimitRequest request, SpendingLimitAnswer answer) - throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; - - void doIntermediateSpendingLimitReportRequest(ClientSySession session, SpendingLimitRequest request, SpendingLimitAnswer answer) + void doSpendingLimitRequest(ClientSySession session, SpendingLimitRequest request) throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; - void doFinalSpendingLimitReportRequest(ClientSySession session, SpendingTerminationRequest request, SpendingTerminationAnswer answer) + void doFinalSpendingLimitRequest(ClientSySession session, SessionTermRequest request) throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; - void doSpendingLimitReportAnswer(ClientSySession session, SpendingNotificationAnswer answer) + void doSpendingStatusNotificationAnswer(ClientSySession session, SpendingStatusNotificationRequest request, SpendingStatusNotificationAnswer answer) throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; } \ No newline at end of file diff --git a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SessionTerminationAnswer.java b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SessionTerminationAnswer.java deleted file mode 100644 index 5ebf43ff3..000000000 --- a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SessionTerminationAnswer.java +++ /dev/null @@ -1,62 +0,0 @@ -/* -* TeleStax, Open Source Cloud Communications -* Copyright 2011-2016, TeleStax Inc. and individual contributors -* by the @authors tag. -* -* This program is free software: you can redistribute it and/or modify -* under the terms of the GNU Affero General Public License as -* published by the Free Software Foundation; either version 3 of -* the License, or (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU Affero General Public License for more details. -* -* You should have received a copy of the GNU Affero General Public License -* along with this program. If not, see -* -* This file incorporates work covered by the following copyright and -* permission notice: -* -* JBoss, Home of Professional Open Source -* Copyright 2007-2011, Red Hat, Inc. and individual contributors -* by the @authors tag. See the copyright.txt in the distribution for a -* full listing of individual contributors. -* -* This is free software; you can redistribute it and/or modify it -* under the terms of the GNU Lesser General Public License as -* published by the Free Software Foundation; either version 2.1 of -* the License, or (at your option) any later version. -* -* This software is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -* Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public -* License along with this software; if not, write to the Free -* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -* 02110-1301 USA, or see the FSF site: http://www.fsf.org. -*/ - -package org.jdiameter.api.sy.events; - -import org.jdiameter.api.app.AppAnswerEvent; - -/** -* The Spending-Termination-Answer (STA) message, indicated by the Command-Code field set to 275 is sent -* by the OCS to the PCRF in reply to the STR message. -* -* @author Alejandro Ferreira Guido -* @author Bartosz Baranowski -* @author Alexandre Mendonca -*/ -public interface SessionTerminationAnswer extends AppAnswerEvent { - - String _SHORT_NAME = "STA"; - String _LONG_NAME = "Session-Termination-Answer"; - - int code = 275; - -} diff --git a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SessionTerminationRequest.java b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SessionTerminationRequest.java deleted file mode 100644 index 67093ca49..000000000 --- a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SessionTerminationRequest.java +++ /dev/null @@ -1,62 +0,0 @@ -/* -* TeleStax, Open Source Cloud Communications -* Copyright 2011-2016, TeleStax Inc. and individual contributors -* by the @authors tag. -* -* This program is free software: you can redistribute it and/or modify -* under the terms of the GNU Affero General Public License as -* published by the Free Software Foundation; either version 3 of -* the License, or (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU Affero General Public License for more details. -* -* You should have received a copy of the GNU Affero General Public License -* along with this program. If not, see -* -* This file incorporates work covered by the following copyright and -* permission notice: -* -* JBoss, Home of Professional Open Source -* Copyright 2007-2011, Red Hat, Inc. and individual contributors -* by the @authors tag. See the copyright.txt in the distribution for a -* full listing of individual contributors. -* -* This is free software; you can redistribute it and/or modify it -* under the terms of the GNU Lesser General Public License as -* published by the Free Software Foundation; either version 2.1 of -* the License, or (at your option) any later version. -* -* This software is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -* Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public -* License along with this software; if not, write to the Free -* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -* 02110-1301 USA, or see the FSF site: http://www.fsf.org. -*/ - -package org.jdiameter.api.sy.events; - -import org.jdiameter.api.app.AppAnswerEvent; - -/** -* The Spending-Termination-Request (STR) message, indicated by the Command-Code field set to 275 is sent -* by the PCRF to the OCS when the PCRF decides that policy decisions no longer depends on policy counters. -* -* @author Alejandro Ferreira Guido -* @author Bartosz Baranowski -* @author Alexandre Mendonca -*/ -public interface SessionTerminationRequest extends AppAnswerEvent { - - String _SHORT_NAME = "STR"; - String _LONG_NAME = "Session-Termination-Request"; - - int code = 275; - -} diff --git a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingLimitAnswer.java b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingLimitAnswer.java index 3a3752f71..595f0f8e2 100644 --- a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingLimitAnswer.java +++ b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingLimitAnswer.java @@ -1,44 +1,21 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-2011, Red Hat, Inc. and individual contributors - * by the @authors tag. See the copyright.txt in the distribution for a - * full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ +/* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, Telestax Inc and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + */ package org.jdiameter.api.sy.events; diff --git a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingLimitRequest.java b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingLimitRequest.java index 9b3f33df4..bca914878 100644 --- a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingLimitRequest.java +++ b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingLimitRequest.java @@ -1,44 +1,21 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-2011, Red Hat, Inc. and individual contributors - * by the @authors tag. See the copyright.txt in the distribution for a - * full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ +/* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, Telestax Inc and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + */ package org.jdiameter.api.sy.events; diff --git a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingStatusNotificationAnswer.java b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingStatusNotificationAnswer.java index a37adfcd4..e9db62249 100644 --- a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingStatusNotificationAnswer.java +++ b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingStatusNotificationAnswer.java @@ -1,44 +1,21 @@ /* -* TeleStax, Open Source Cloud Communications -* Copyright 2011-2016, TeleStax Inc. and individual contributors -* by the @authors tag. -* -* This program is free software: you can redistribute it and/or modify -* under the terms of the GNU Affero General Public License as -* published by the Free Software Foundation; either version 3 of -* the License, or (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU Affero General Public License for more details. -* -* You should have received a copy of the GNU Affero General Public License -* along with this program. If not, see -* -* This file incorporates work covered by the following copyright and -* permission notice: -* -* JBoss, Home of Professional Open Source -* Copyright 2007-2011, Red Hat, Inc. and individual contributors -* by the @authors tag. See the copyright.txt in the distribution for a -* full listing of individual contributors. -* -* This is free software; you can redistribute it and/or modify it -* under the terms of the GNU Lesser General Public License as -* published by the Free Software Foundation; either version 2.1 of -* the License, or (at your option) any later version. -* -* This software is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -* Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public -* License along with this software; if not, write to the Free -* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -* 02110-1301 USA, or see the FSF site: http://www.fsf.org. -*/ + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, Telestax Inc and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + */ package org.jdiameter.api.sy.events; diff --git a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingStatusNotificationRequest.java b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingStatusNotificationRequest.java index 0853792bd..054f0703a 100644 --- a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingStatusNotificationRequest.java +++ b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingStatusNotificationRequest.java @@ -1,44 +1,21 @@ /* -* TeleStax, Open Source Cloud Communications -* Copyright 2011-2016, TeleStax Inc. and individual contributors -* by the @authors tag. -* -* This program is free software: you can redistribute it and/or modify -* under the terms of the GNU Affero General Public License as -* published by the Free Software Foundation; either version 3 of -* the License, or (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU Affero General Public License for more details. -* -* You should have received a copy of the GNU Affero General Public License -* along with this program. If not, see -* -* This file incorporates work covered by the following copyright and -* permission notice: -* -* JBoss, Home of Professional Open Source -* Copyright 2007-2011, Red Hat, Inc. and individual contributors -* by the @authors tag. See the copyright.txt in the distribution for a -* full listing of individual contributors. -* -* This is free software; you can redistribute it and/or modify it -* under the terms of the GNU Lesser General Public License as -* published by the Free Software Foundation; either version 2.1 of -* the License, or (at your option) any later version. -* -* This software is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -* Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public -* License along with this software; if not, write to the Free -* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -* 02110-1301 USA, or see the FSF site: http://www.fsf.org. -*/ + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, Telestax Inc and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + */ package org.jdiameter.api.sy.events; From c832b63e4e8052ee3afbb72106db3c216b89b03a Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 26 Sep 2016 22:39:10 -0300 Subject: [PATCH 10/17] Sy Impl - first release issue #44 --- .../org/jdiameter/api/sy/ClientSySession.java | 3 +- .../api/sy/ClientSySessionListener.java | 13 +- .../org/jdiameter/api/sy/ServerSySession.java | 12 +- .../api/sy/ServerSySessionListener.java | 13 +- .../api/sy/events/SpendingLimitAnswer.java | 13 +- .../api/sy/events/SpendingLimitRequest.java | 15 +- .../SpendingStatusNotificationAnswer.java | 13 +- .../SpendingStatusNotificationRequest.java | 13 +- .../server/impl/sy/ServerSySessionImpl.java | 152 ++++++++++++++++++ .../charging/ChargingServerSimulator.java | 23 ++- 10 files changed, 215 insertions(+), 55 deletions(-) create mode 100644 core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/sy/ServerSySessionImpl.java diff --git a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ClientSySession.java b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ClientSySession.java index 98506ba8d..e0d67328c 100644 --- a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ClientSySession.java +++ b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ClientSySession.java @@ -36,9 +36,8 @@ * Listener must be injected from constructor of implementation class. * * @author Alejandro Ferreira Guido - * @author Alexandre Mendonca - * @author Bartosz Baranowski */ + public interface ClientSySession extends AppSession, StateMachine { void sendSpendingLimitRequest(SpendingLimitRequest request) diff --git a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ClientSySessionListener.java b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ClientSySessionListener.java index 1523ffe5e..cd4337966 100644 --- a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ClientSySessionListener.java +++ b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ClientSySessionListener.java @@ -32,13 +32,12 @@ import org.jdiameter.api.sy.events.SpendingStatusNotificationRequest; /** -* This interface defines the possible actions for the different states in the client -* Sy Interface state machine. -* -* @author Alejandro Ferreira Guido -* @author Alexandre Mendonca -* @author Bartosz Baranowski -*/ + * This interface defines the possible actions for the different states in the client + * Sy Interface state machine. + * + * @author Alejandro Ferreira Guido + */ + public interface ClientSySessionListener { void doSpendingLimitAnswer(ClientSySession session, SpendingLimitRequest request, SpendingLimitAnswer answer) diff --git a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ServerSySession.java b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ServerSySession.java index 53ebb762a..b23946814 100644 --- a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ServerSySession.java +++ b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ServerSySession.java @@ -32,13 +32,11 @@ import org.jdiameter.api.sy.events.SpendingStatusNotificationRequest; /** -* Basic class for Sy Server Interface specific session. -* Listener must be injected from constructor of implementation class -* -* @author Alejandro Ferreira Guido -* @author Alexandre Mendonca -* @author Bartosz Baranowski -*/ + * Basic class for Sy Server Interface specific session. + * Listener must be injected from constructor of implementation class + * + * @author Alejandro Ferreira Guido + */ public interface ServerSySession extends AppSession, StateMachine { diff --git a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ServerSySessionListener.java b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ServerSySessionListener.java index 489fc4b78..f905577bd 100644 --- a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ServerSySessionListener.java +++ b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ServerSySessionListener.java @@ -31,13 +31,12 @@ import org.jdiameter.api.sy.events.SpendingStatusNotificationRequest; /** -* This interface defines the possible actions for th;e different states in the server Sy -* Interface state machine. -* -* @author Alejandro Ferreira Guido -* @author Alexandre Mendonca -* @author Bartosz Baranowski -*/ + * This interface defines the possible actions for th;e different states in the server Sy + * Interface state machine. + * + * @author Alejandro Ferreira Guido + */ + public interface ServerSySessionListener { void doSpendingLimitRequest(ClientSySession session, SpendingLimitRequest request) diff --git a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingLimitAnswer.java b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingLimitAnswer.java index 595f0f8e2..fc398ab1d 100644 --- a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingLimitAnswer.java +++ b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingLimitAnswer.java @@ -22,13 +22,12 @@ import org.jdiameter.api.app.AppAnswerEvent; /** -* The Spending-Limit-Answer (SLA) message, indicated by the Command-Code field set to 8388635 is sent -* by the OCS to the PCRF as a response to SLR message. -* -* @author Alejandro Ferreira Guido -* @author Bartosz Baranowski -* @author Alexandre Mendonca -*/ + * The Spending-Limit-Answer (SLA) message, indicated by the Command-Code field set to 8388635 is sent + * by the OCS to the PCRF as a response to SLR message. + * + * @author Alejandro Ferreira Guido + */ + public interface SpendingLimitAnswer extends AppAnswerEvent { String _SHORT_NAME = "SLA"; diff --git a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingLimitRequest.java b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingLimitRequest.java index bca914878..a8ea8c49d 100644 --- a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingLimitRequest.java +++ b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingLimitRequest.java @@ -22,14 +22,13 @@ import org.jdiameter.api.app.AppRequestEvent; /** -* The Spending-Limit-Request (SLR) message, indicated by the Command-Code field set to 8388635 is sent -* by the PCRF ot the OCS to retrieve subscription information that indicates that policy decision depends -* on policy counters held on the OCS. -* -* @author Alejandro Ferreira Guido -* @author Bartosz Baranowski -* @author Alexandre Mendonca -*/ + * The Spending-Limit-Request (SLR) message, indicated by the Command-Code field set to 8388635 is sent + * by the PCRF ot the OCS to retrieve subscription information that indicates that policy decision depends + * on policy counters held on the OCS. + * + * @author Alejandro Ferreira Guido + */ + public interface SpendingLimitRequest extends AppRequestEvent { String _SHORT_NAME = "SLR"; diff --git a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingStatusNotificationAnswer.java b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingStatusNotificationAnswer.java index e9db62249..32c6c7ea9 100644 --- a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingStatusNotificationAnswer.java +++ b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingStatusNotificationAnswer.java @@ -22,13 +22,12 @@ import org.jdiameter.api.app.AppAnswerEvent; /** -* The Spending-Notification-Answer (SNA) message, indicated by the Command-Code field set to 8388636 is sent -* by the PCRF to the OCS in reply to the SNR message. -* -* @author Alejandro Ferreira Guido -* @author Bartosz Baranowski -* @author Alexandre Mendonca -*/ + * The Spending-Notification-Answer (SNA) message, indicated by the Command-Code field set to 8388636 is sent + * by the PCRF to the OCS in reply to the SNR message. + * + * @author Alejandro Ferreira Guido + */ + public interface SpendingStatusNotificationAnswer extends AppAnswerEvent { String _SHORT_NAME = "SNA"; diff --git a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingStatusNotificationRequest.java b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingStatusNotificationRequest.java index 054f0703a..26bb2799c 100644 --- a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingStatusNotificationRequest.java +++ b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingStatusNotificationRequest.java @@ -22,13 +22,12 @@ import org.jdiameter.api.app.AppAnswerEvent; /** -* The Spending-Notification-Request (SNR) message, indicated by the Command-Code field set to 8388636 is sent -* by the OCS to the PCRF when the OCS detects that status of a policy counter identifier(s) had changed. -* -* @author Alejandro Ferreira Guido -* @author Bartosz Baranowski -* @author Alexandre Mendonca -*/ + * The Spending-Notification-Request (SNR) message, indicated by the Command-Code field set to 8388636 is sent + * by the OCS to the PCRF when the OCS detects that status of a policy counter identifier(s) had changed. + * + * @author Alejandro Ferreira Guido + */ + public interface SpendingStatusNotificationRequest extends AppAnswerEvent { String _SHORT_NAME = "SNR"; diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/sy/ServerSySessionImpl.java b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/sy/ServerSySessionImpl.java new file mode 100644 index 000000000..999dbfe7e --- /dev/null +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/sy/ServerSySessionImpl.java @@ -0,0 +1,152 @@ +/* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, Telestax Inc and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + */ + +package org.jdiameter.server.impl.sy; + +import org.jdiameter.api.ApplicationId; +import org.jdiameter.api.Session; +import org.jdiameter.api.Request; +import org.jdiameter.api.Answer; +import org.jdiameter.api.NetworkReqListener; +import org.jdiameter.api.EventListener; +import org.jdiameter.api.IllegalDiameterStateException; +import org.jdiameter.api.InternalException; +import org.jdiameter.api.OverloadException; +import org.jdiameter.api.RouteException; +import org.jdiameter.api.app.StateChangeListener; +import org.jdiameter.api.app.StateEvent; +import org.jdiameter.api.auth.events.SessionTermAnswer; +import org.jdiameter.api.sy.ServerSySession; +import org.jdiameter.api.sy.events.SpendingLimitAnswer; +import org.jdiameter.api.sy.events.SpendingStatusNotificationRequest; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.List; + +/** + * Policy Control Application Server session implementation + * + * @author Alejandro Ferreira Guido + */ + +public class ServerSySessionImpl implements ServerSySession, NetworkReqListener, EventListener { + + private static final Logger logger = LoggerFactory.getLogger(ServerSySessionImpl.class); + + @Override + public Answer processRequest(Request request) { + return null; + } + + @Override + public void sendSpendingLimitAnswer(SpendingLimitAnswer answer) throws InternalException, IllegalDiameterStateException, RouteException, OverloadException { + + } + + @Override + public void sendFinalSpendingLimitAnswer(SessionTermAnswer answer) throws InternalException, IllegalDiameterStateException, RouteException, OverloadException { + + } + + @Override + public void sendSpendingStatusNotificationRequest(SpendingStatusNotificationRequest request) throws InternalException, IllegalDiameterStateException, RouteException, OverloadException { + + } + + @Override + public void receivedSuccessMessage(Request request, Answer answer) { + + } + + @Override + public void timeoutExpired(Request request) { + + } + + @Override + public boolean isStateless() { + return false; + } + + @Override + public ApplicationId getSessionAppId() { + return null; + } + + @Override + public List getSessions() { + return null; + } + + @Override + public void addStateChangeNotification(StateChangeListener listener) { + + } + + @Override + public void removeStateChangeNotification(StateChangeListener listener) { + + } + + @Override + public boolean handleEvent(StateEvent event) throws InternalException, OverloadException { + return false; + } + + @Override + public E getState(Class stateType) { + return null; + } + + @Override + public long getCreationTime() { + return 0; + } + + @Override + public long getLastAccessedTime() { + return 0; + } + + @Override + public boolean isValid() { + return false; + } + + @Override + public void release() { + + } + + @Override + public boolean isAppSession() { + return false; + } + + @Override + public boolean isReplicable() { + return false; + } + + @Override + public String getSessionId() { + return null; + } +} diff --git a/examples/charging-server-simulator/src/main/java/org/mobicents/servers/diameter/charging/ChargingServerSimulator.java b/examples/charging-server-simulator/src/main/java/org/mobicents/servers/diameter/charging/ChargingServerSimulator.java index aaa30633f..551069815 100644 --- a/examples/charging-server-simulator/src/main/java/org/mobicents/servers/diameter/charging/ChargingServerSimulator.java +++ b/examples/charging-server-simulator/src/main/java/org/mobicents/servers/diameter/charging/ChargingServerSimulator.java @@ -28,6 +28,8 @@ import org.jdiameter.api.cca.ServerCCASession; import org.jdiameter.api.cca.events.JCreditControlAnswer; import org.jdiameter.api.cca.events.JCreditControlRequest; +import org.jdiameter.api.sy.ClientSySession; +import org.jdiameter.api.sy.ServerSySession; import org.jdiameter.client.api.ISessionFactory; import org.jdiameter.common.impl.app.cca.CCASessionFactoryImpl; import org.jdiameter.common.impl.app.cca.JCreditControlAnswerImpl; @@ -50,6 +52,7 @@ public class ChargingServerSimulator extends CCASessionFactoryImpl implements Ne private static final Object[] EMPTY_ARRAY = new Object[]{}; private ApplicationId roAppId = ApplicationId.createByAuthAppId(10415L, 4L); + private ApplicationId syAppId = ApplicationId.createByAuthAppId(10415L, 16777302L); private HashMap accounts = new HashMap(); private HashMap reserved = new HashMap(); @@ -77,6 +80,8 @@ public ChargingServerSimulator() throws Exception { network.addNetworkReqListener(this, roAppId); network.addNetworkReqListener(this, ApplicationId.createByAuthAppId(0, 4)); + network.addNetworkReqListener(this, syAppId); + this.stackCreator.start(Mode.ALL_PEERS, 30000, TimeUnit.MILLISECONDS); printLogo(); @@ -87,6 +92,9 @@ public ChargingServerSimulator() throws Exception { sessionFactory.registerAppFacory(ServerCCASession.class, this); sessionFactory.registerAppFacory(ClientCCASession.class, this); + sessionFactory.registerAppFacory(ServerSySession.class, this); + sessionFactory.registerAppFacory(ClientSySession.class, this); + // Read users from properties file Properties properties = new Properties(); try { @@ -143,9 +151,18 @@ public Answer processRequest(Request request) { logger.info("<< Received Request [" + request + "]"); } try { - ServerCCASessionImpl session = - (sessionFactory).getNewAppSession(request.getSessionId(), ApplicationId.createByAuthAppId(0, 4), ServerCCASession.class, EMPTY_ARRAY); - session.processRequest(request); + long applicationId = request.getApplicationId(); + if (applicationId == 4L) { + ServerCCASessionImpl session = (sessionFactory).getNewAppSession(request.getSessionId(), + ApplicationId.createByAuthAppId(0, 4), ServerCCASession.class, EMPTY_ARRAY); + session.processRequest(request); + } else if (applicationId == 16777302L) { + ServerSySessionImpl session = (sessionFactory).getNewAppSession(request.getSessionId(), + ApplicationId.createByAuthAppId(0, 16777302), ServerSySession.class, EMPTY_ARRAY); + session.processRequest(request); + } else { + logger.error(">< Failure handling received request, no appId!"); + } } catch (InternalException e) { logger.error(">< Failure handling received request.", e); From 6abef3ca92e7990c0459ef6e39f689ee7ce0c70f Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 27 Sep 2016 20:06:58 -0300 Subject: [PATCH 11/17] Sy Impl - night build #001 issue #44 --- .../common/api/app/sy/ISyMessageFactory.java | 38 +++++++++ .../api/app/sy/ServerSySessionState.java | 60 ++++++++++++++ .../jdiameter/server/impl/app/cca/Event.java | 2 +- .../org/jdiameter/server/impl/sy/Event.java | 80 +++++++++++++++++++ .../server/impl/sy/ServerSySessionImpl.java | 69 +++++++++++++++- examples/charging-server-simulator/pom.xml | 8 ++ .../charging/ChargingServerSimulator.java | 9 ++- 7 files changed, 261 insertions(+), 5 deletions(-) create mode 100644 core/jdiameter/impl/src/main/java/org/jdiameter/common/api/app/sy/ISyMessageFactory.java create mode 100644 core/jdiameter/impl/src/main/java/org/jdiameter/common/api/app/sy/ServerSySessionState.java create mode 100644 core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/sy/Event.java diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/common/api/app/sy/ISyMessageFactory.java b/core/jdiameter/impl/src/main/java/org/jdiameter/common/api/app/sy/ISyMessageFactory.java new file mode 100644 index 000000000..27368edb9 --- /dev/null +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/common/api/app/sy/ISyMessageFactory.java @@ -0,0 +1,38 @@ +/* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, Telestax Inc and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + */ + +package org.jdiameter.common.api.app.sy; + +import org.jdiameter.api.Request; +import org.jdiameter.api.sy.events.SpendingLimitRequest; +import org.jdiameter.api.sy.events.SpendingStatusNotificationRequest; + +/** + * Policy and charging control - Sy session implementation + * + * @author Alejandro Ferreira Guido + */ + +public interface ISyMessageFactory { + + SpendingLimitRequest createSpendingLimitRequest(Request request); + + SpendingStatusNotificationRequest createSpendingStatusNotificationRequest(Request request); + +} diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/common/api/app/sy/ServerSySessionState.java b/core/jdiameter/impl/src/main/java/org/jdiameter/common/api/app/sy/ServerSySessionState.java new file mode 100644 index 000000000..63bc5af4f --- /dev/null +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/common/api/app/sy/ServerSySessionState.java @@ -0,0 +1,60 @@ +/* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, Telestax Inc and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + */ + +package org.jdiameter.common.api.app.sy; + +import org.jdiameter.common.api.app.IAppSessionState; + +/** + * Policy and charging control - Sy session implementation + * + * @author Alejandro Ferreira Guido + */ + + public enum ServerSySessionState implements IAppSessionState { + + IDLE(0), + OPEN(1); + + private int stateRepresentation = -1; + + ServerSySessionState(int v) { + this.stateRepresentation = v; + } + + @Override + public ServerSySessionState fromInt(int v) throws IllegalArgumentException { + switch (v) { + case 0: + return IDLE; + + case 1: + return OPEN; + + default: + throw new IllegalArgumentException("Illegal value of int representation!!!!"); + } + } + + @Override + public int getValue() { + return stateRepresentation; + } + + } diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/app/cca/Event.java b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/app/cca/Event.java index 4bcb55bd3..c9bc87d95 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/app/cca/Event.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/app/cca/Event.java @@ -67,7 +67,7 @@ public enum Type { SENT_TERMINATE_RESPONSE, // These have no transition, no state resources, timers SENT_RAR, - RECEIVED_RAA; + RECEIVED_RAA } Type type; diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/sy/Event.java b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/sy/Event.java new file mode 100644 index 000000000..f2a36e5d1 --- /dev/null +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/sy/Event.java @@ -0,0 +1,80 @@ +/* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, Telestax Inc and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + */ + +package org.jdiameter.server.impl.sy; + +import org.jdiameter.api.app.AppAnswerEvent; +import org.jdiameter.api.app.AppRequestEvent; +import org.jdiameter.api.app.StateEvent; +import org.jdiameter.api.sy.events.SpendingLimitAnswer; +import org.jdiameter.api.sy.events.SpendingLimitRequest; + +/** + * Policy and charging control, Spending Limit Report - Sy session implementation + * + * @author Alejandro Ferreira Guido + */ + +public class Event implements StateEvent { + + public enum Type { + RECEIVED_INITIAL, + RECEIVED_INTERMEDIATE, + RECEIVED_TERMINATION + } + + Type type; + AppRequestEvent request; + AppAnswerEvent answer; + + public Event(boolean isRequest, SpendingLimitRequest request, SpendingLimitAnswer answer) { + + this.request = request; + this.answer = answer; + + if (isRequest) { + } else { + } + } + + @Override + public E encodeType(Class enumType) { + return null; + } + + @Override + public Enum getType() { + return null; + } + + @Override + public void setData(Object data) { + + } + + @Override + public Object getData() { + return null; + } + + @Override + public int compareTo(Object o) { + return 0; + } +} diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/sy/ServerSySessionImpl.java b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/sy/ServerSySessionImpl.java index 999dbfe7e..4a72d2d18 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/sy/ServerSySessionImpl.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/sy/ServerSySessionImpl.java @@ -34,14 +34,17 @@ import org.jdiameter.api.auth.events.SessionTermAnswer; import org.jdiameter.api.sy.ServerSySession; import org.jdiameter.api.sy.events.SpendingLimitAnswer; +import org.jdiameter.api.sy.events.SpendingLimitRequest; import org.jdiameter.api.sy.events.SpendingStatusNotificationRequest; +import org.jdiameter.common.api.app.sy.ISyMessageFactory; +import org.jdiameter.common.api.app.sy.ServerSySessionState; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.List; /** - * Policy Control Application Server session implementation + * Policy and charging control, Spending Limit Report - Sy session implementation * * @author Alejandro Ferreira Guido */ @@ -50,8 +53,14 @@ public class ServerSySessionImpl implements ServerSySession, NetworkReqListener, private static final Logger logger = LoggerFactory.getLogger(ServerSySessionImpl.class); + protected transient ISyMessageFactory factory = null; + @Override public Answer processRequest(Request request) { + RequestDelivery rd = new RequestDelivery(); + rd.session = this; + rd.request = request; + //super.scheduler.execute(rd); return null; } @@ -107,6 +116,15 @@ public void removeStateChangeNotification(StateChangeListener listener) { @Override public boolean handleEvent(StateEvent event) throws InternalException, OverloadException { + + ServerSySessionState state = null; //this.sessionData.getServerSySessionState(); + + switch(state) { + case IDLE: + break; + case OPEN: + break; + } return false; } @@ -149,4 +167,53 @@ public boolean isReplicable() { public String getSessionId() { return null; } + + private class RequestDelivery implements Runnable { + ServerSySession session; + Request request; + + @Override + public void run() { + try { + switch (request.getCommandCode()) { + case SpendingLimitRequest.code: + handleEvent(new Event(true, factory.createSpendingLimitRequest(request), null)); + break; + default: + //listener.doOtherEvent(session, new AppRequestEventImpl(request), null); + break; + } + } + catch (Exception e) { + logger.debug("Failed to process request message", e); + } + } + } + + private class AnswerDelivery implements Runnable { + ServerSySession session; + Answer answer; + Request request; + + @Override + public void run() { + try { + // FIXME: baranowb: add message validation here!!! + // We handle CCR, STR, ACR, ASR other go into extension + switch (request.getCommandCode()) { + /*case ReAuthRequest.code: + handleEvent(new Event(Event.Type.RECEIVED_RAA, factory.createReAuthRequest(request), factory.createReAuthAnswer(answer))); + break;*/ + default: + //listener.doOtherEvent(session, new AppRequestEventImpl(request), new AppAnswerEventImpl(answer)); + break; + } + + } + catch (Exception e) { + logger.debug("Failed to process success message", e); + } + } + } + } diff --git a/examples/charging-server-simulator/pom.xml b/examples/charging-server-simulator/pom.xml index 320084553..2a2eca1c0 100644 --- a/examples/charging-server-simulator/pom.xml +++ b/examples/charging-server-simulator/pom.xml @@ -168,6 +168,14 @@ false + + org.apache.maven.plugins + maven-compiler-plugin + + 1.6 + 1.6 + + diff --git a/examples/charging-server-simulator/src/main/java/org/mobicents/servers/diameter/charging/ChargingServerSimulator.java b/examples/charging-server-simulator/src/main/java/org/mobicents/servers/diameter/charging/ChargingServerSimulator.java index 551069815..8d1f3cb38 100644 --- a/examples/charging-server-simulator/src/main/java/org/mobicents/servers/diameter/charging/ChargingServerSimulator.java +++ b/examples/charging-server-simulator/src/main/java/org/mobicents/servers/diameter/charging/ChargingServerSimulator.java @@ -34,6 +34,7 @@ import org.jdiameter.common.impl.app.cca.CCASessionFactoryImpl; import org.jdiameter.common.impl.app.cca.JCreditControlAnswerImpl; import org.jdiameter.server.impl.app.cca.ServerCCASessionImpl; +import org.jdiameter.server.impl.sy.ServerSySessionImpl; import org.mobicents.diameter.dictionary.AvpDictionary; import org.mobicents.servers.diameter.utils.DiameterUtilities; import org.mobicents.servers.diameter.utils.StackCreator; @@ -135,7 +136,7 @@ private void printLogo() { logger.info("==============================================================================="); logger.info(""); - logger.info("== Mobicents Diameter Ro/Rf Server Simulator (" + osLine + ")" ); + logger.info("== Mobicents Diameter Ro/Rf +Sy Server Simulator (" + osLine + ")" ); logger.info(""); logger.info("== " + javaLine); logger.info(""); @@ -153,11 +154,13 @@ public Answer processRequest(Request request) { try { long applicationId = request.getApplicationId(); if (applicationId == 4L) { - ServerCCASessionImpl session = (sessionFactory).getNewAppSession(request.getSessionId(), + // CCA session + ServerCCASessionImpl session = sessionFactory.getNewAppSession(request.getSessionId(), ApplicationId.createByAuthAppId(0, 4), ServerCCASession.class, EMPTY_ARRAY); session.processRequest(request); } else if (applicationId == 16777302L) { - ServerSySessionImpl session = (sessionFactory).getNewAppSession(request.getSessionId(), + // Sy session + ServerSySessionImpl session = sessionFactory.getNewAppSession(request.getSessionId(), ApplicationId.createByAuthAppId(0, 16777302), ServerSySession.class, EMPTY_ARRAY); session.processRequest(request); } else { From c3b51248b863c34c2351059f9d14b04dd90f2264 Mon Sep 17 00:00:00 2001 From: Alex Date: Wed, 28 Sep 2016 12:08:00 -0300 Subject: [PATCH 12/17] Sy Impl - night build #002 issue #44 --- .../api/sy/events/SpendingLimitRequest.java | 1 + .../common/api/app/sy/ISyMessageFactory.java | 3 +++ .../org/jdiameter/server/impl/sy/Event.java | 22 +++++++++++++++++++ .../server/impl/sy/ServerSySessionImpl.java | 6 ++++- 4 files changed, 31 insertions(+), 1 deletion(-) diff --git a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingLimitRequest.java b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingLimitRequest.java index a8ea8c49d..276f6efa2 100644 --- a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingLimitRequest.java +++ b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingLimitRequest.java @@ -36,4 +36,5 @@ public interface SpendingLimitRequest extends AppRequestEvent { int code = 8388635; + int getSLRequestTypeAVPValue(); } diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/common/api/app/sy/ISyMessageFactory.java b/core/jdiameter/impl/src/main/java/org/jdiameter/common/api/app/sy/ISyMessageFactory.java index 27368edb9..5fda682ff 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/common/api/app/sy/ISyMessageFactory.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/common/api/app/sy/ISyMessageFactory.java @@ -20,6 +20,7 @@ package org.jdiameter.common.api.app.sy; import org.jdiameter.api.Request; +import org.jdiameter.api.auth.events.SessionTermRequest; import org.jdiameter.api.sy.events.SpendingLimitRequest; import org.jdiameter.api.sy.events.SpendingStatusNotificationRequest; @@ -33,6 +34,8 @@ public interface ISyMessageFactory { SpendingLimitRequest createSpendingLimitRequest(Request request); + SessionTermRequest createSessionTerminationRequest(Request request); + SpendingStatusNotificationRequest createSpendingStatusNotificationRequest(Request request); } diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/sy/Event.java b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/sy/Event.java index f2a36e5d1..16dbbbdba 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/sy/Event.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/sy/Event.java @@ -22,6 +22,8 @@ import org.jdiameter.api.app.AppAnswerEvent; import org.jdiameter.api.app.AppRequestEvent; import org.jdiameter.api.app.StateEvent; +import org.jdiameter.api.auth.events.SessionTermAnswer; +import org.jdiameter.api.auth.events.SessionTermRequest; import org.jdiameter.api.sy.events.SpendingLimitAnswer; import org.jdiameter.api.sy.events.SpendingLimitRequest; @@ -43,12 +45,32 @@ public enum Type { AppRequestEvent request; AppAnswerEvent answer; + public Event(boolean isRequest, SessionTermRequest request, SessionTermAnswer answer) { + + this.request = request; + this.answer = answer; + + if (isRequest) { + type = Type.RECEIVED_TERMINATION; + } else { + } + } + public Event(boolean isRequest, SpendingLimitRequest request, SpendingLimitAnswer answer) { this.request = request; this.answer = answer; + int slRequestTypeAvpValue = request.getSLRequestTypeAVPValue(); if (isRequest) { + switch (slRequestTypeAvpValue) { + case 0: + type = Type.RECEIVED_INITIAL; + break; + case 1: + type = Type.RECEIVED_INTERMEDIATE; + break; + } } else { } } diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/sy/ServerSySessionImpl.java b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/sy/ServerSySessionImpl.java index 4a72d2d18..55d31bf8b 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/sy/ServerSySessionImpl.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/sy/ServerSySessionImpl.java @@ -32,6 +32,7 @@ import org.jdiameter.api.app.StateChangeListener; import org.jdiameter.api.app.StateEvent; import org.jdiameter.api.auth.events.SessionTermAnswer; +import org.jdiameter.api.auth.events.SessionTermRequest; import org.jdiameter.api.sy.ServerSySession; import org.jdiameter.api.sy.events.SpendingLimitAnswer; import org.jdiameter.api.sy.events.SpendingLimitRequest; @@ -179,8 +180,11 @@ public void run() { case SpendingLimitRequest.code: handleEvent(new Event(true, factory.createSpendingLimitRequest(request), null)); break; + case SessionTermRequest.code: + handleEvent(new Event(true, factory.createSessionTerminationRequest(request), null)); + break; default: - //listener.doOtherEvent(session, new AppRequestEventImpl(request), null); + logger.debug("Unexpected request received on Sy channel", request); break; } } From 207e692484f3c3533c305ebed19f81473a331d6a Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 29 Sep 2016 19:20:51 -0300 Subject: [PATCH 13/17] Sy Impl - night build #003 issue #44 --- .../java/org/jdiameter/api/sy/SySession.java | 33 +++++++++ .../common/api/app/sy/ISySessionData.java | 29 ++++++++ .../common/impl/app/sy/AppSySessionImpl.java | 67 +++++++++++++++++++ .../server/impl/sy/IServerSySessionData.java | 34 ++++++++++ .../server/impl/sy/ServerSySessionImpl.java | 41 ++++++++++-- 5 files changed, 200 insertions(+), 4 deletions(-) create mode 100644 core/jdiameter/api/src/main/java/org/jdiameter/api/sy/SySession.java create mode 100644 core/jdiameter/impl/src/main/java/org/jdiameter/common/api/app/sy/ISySessionData.java create mode 100644 core/jdiameter/impl/src/main/java/org/jdiameter/common/impl/app/sy/AppSySessionImpl.java create mode 100644 core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/sy/IServerSySessionData.java diff --git a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/SySession.java b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/SySession.java new file mode 100644 index 000000000..09c1b8948 --- /dev/null +++ b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/SySession.java @@ -0,0 +1,33 @@ +/* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, Telestax Inc and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + */ + +package org.jdiameter.api.sy; + +/** + * This interface defines the Sy Session marker class + * + * @author Alejandro Ferreira Guido + */ + +import org.jdiameter.api.app.AppSession; +import org.jdiameter.api.app.StateMachine; + +public interface SySession extends AppSession, StateMachine { + // simple marker interface. +} diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/common/api/app/sy/ISySessionData.java b/core/jdiameter/impl/src/main/java/org/jdiameter/common/api/app/sy/ISySessionData.java new file mode 100644 index 000000000..6a5d4b072 --- /dev/null +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/common/api/app/sy/ISySessionData.java @@ -0,0 +1,29 @@ +/* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, Telestax Inc and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + */ + +package org.jdiameter.common.api.app.sy; + +/** + * Policy and charging control - Sy session implementation + * + * @author Alejandro Ferreira Guido + */ + +public interface ISySessionData { +} diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/common/impl/app/sy/AppSySessionImpl.java b/core/jdiameter/impl/src/main/java/org/jdiameter/common/impl/app/sy/AppSySessionImpl.java new file mode 100644 index 000000000..3b800e021 --- /dev/null +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/common/impl/app/sy/AppSySessionImpl.java @@ -0,0 +1,67 @@ +/* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, Telestax Inc and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + */ + +package org.jdiameter.common.impl.app.sy; + +import org.jdiameter.api.NetworkReqListener; +import org.jdiameter.api.app.StateChangeListener; +import org.jdiameter.api.sy.SySession; +import org.jdiameter.client.api.ISessionFactory; +import org.jdiameter.common.api.app.IAppSessionData; +import org.jdiameter.common.impl.app.AppSessionImpl; + +import java.util.List; +import java.util.concurrent.CopyOnWriteArrayList; +import java.util.concurrent.locks.Lock; +import java.util.concurrent.locks.ReentrantLock; + +/** + * Policy and charging control, Spending Limit Report - Sy session implementation + * + * @author Alejandro Ferreira Guido + */ + +public abstract class AppSySessionImpl extends AppSessionImpl implements SySession, NetworkReqListener { + + protected Lock sendAndStateLock = new ReentrantLock(); + + protected List stateListeners = new CopyOnWriteArrayList(); + + public AppSySessionImpl(ISessionFactory sf, IAppSessionData appSessionData) { + super(sf, appSessionData); + } + + @Override + public void addStateChangeNotification(StateChangeListener listener) { + if (!stateListeners.contains(listener)) { + stateListeners.add(listener); + } + } + + @Override + public void removeStateChangeNotification(StateChangeListener listener) { + stateListeners.remove(listener); + } + + @Override + public void release() { + //stateListeners.clear(); + super.release(); + } +} diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/sy/IServerSySessionData.java b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/sy/IServerSySessionData.java new file mode 100644 index 000000000..1a0e4f346 --- /dev/null +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/sy/IServerSySessionData.java @@ -0,0 +1,34 @@ +/* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, Telestax Inc and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + */ + +package org.jdiameter.server.impl.sy; + +import org.jdiameter.common.api.app.sy.ISySessionData; +import org.jdiameter.common.api.app.sy.ServerSySessionState; + +/** + * Policy and charging control, Spending Limit Report - Sy session implementation + * + * @author Alejandro Ferreira Guido + */ + +public interface IServerSySessionData extends ISySessionData { + + ServerSySessionState getServerSySessionState(); +} diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/sy/ServerSySessionImpl.java b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/sy/ServerSySessionImpl.java index 55d31bf8b..508053fba 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/sy/ServerSySessionImpl.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/sy/ServerSySessionImpl.java @@ -37,8 +37,11 @@ import org.jdiameter.api.sy.events.SpendingLimitAnswer; import org.jdiameter.api.sy.events.SpendingLimitRequest; import org.jdiameter.api.sy.events.SpendingStatusNotificationRequest; +import org.jdiameter.client.api.ISessionFactory; +import org.jdiameter.common.api.app.IAppSessionData; import org.jdiameter.common.api.app.sy.ISyMessageFactory; import org.jdiameter.common.api.app.sy.ServerSySessionState; +import org.jdiameter.common.impl.app.sy.AppSySessionImpl; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -50,18 +53,26 @@ * @author Alejandro Ferreira Guido */ -public class ServerSySessionImpl implements ServerSySession, NetworkReqListener, EventListener { +public class ServerSySessionImpl extends AppSySessionImpl implements ServerSySession, NetworkReqListener, EventListener { private static final Logger logger = LoggerFactory.getLogger(ServerSySessionImpl.class); + protected IServerSySessionData sessionData; + protected transient ISyMessageFactory factory = null; + public ServerSySessionImpl(IServerSySessionData data, ISessionFactory sf, IAppSessionData appSessionData) { + super(sf, appSessionData); + + this.sessionData = data; + } + @Override public Answer processRequest(Request request) { RequestDelivery rd = new RequestDelivery(); rd.session = this; rd.request = request; - //super.scheduler.execute(rd); + super.scheduler.execute(rd); return null; } @@ -82,7 +93,11 @@ public void sendSpendingStatusNotificationRequest(SpendingStatusNotificationRequ @Override public void receivedSuccessMessage(Request request, Answer answer) { - + AnswerDelivery ad = new AnswerDelivery(); + ad.session = this; + ad.request = request; + ad.answer = answer; + super.scheduler.execute(ad); } @Override @@ -118,12 +133,25 @@ public void removeStateChangeNotification(StateChangeListener listener) { @Override public boolean handleEvent(StateEvent event) throws InternalException, OverloadException { - ServerSySessionState state = null; //this.sessionData.getServerSySessionState(); + ServerSySessionState state = this.sessionData.getServerSySessionState(); + Event.Type eventType = (Event.Type) event.getType(); switch(state) { case IDLE: + switch(eventType) { + case RECEIVED_INITIAL: + break; + case RECEIVED_INTERMEDIATE: + break; + } break; case OPEN: + switch(eventType) { + case RECEIVED_INTERMEDIATE: + break; + case RECEIVED_TERMINATION: + break; + } break; } return false; @@ -164,6 +192,11 @@ public boolean isReplicable() { return false; } + @Override + public void onTimer(String timerName) { + + } + @Override public String getSessionId() { return null; From ab0e1443c37b6269a613fd8b23720ce89d04a5a6 Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 29 Sep 2016 21:05:04 -0300 Subject: [PATCH 14/17] Sy Impl - night build #003 issue #44 --- .../api/sy/ServerSySessionListener.java | 6 +- .../SpendingStatusNotificationRequest.java | 3 +- .../org/jdiameter/server/impl/sy/Event.java | 36 ++++++- .../server/impl/sy/IServerSySessionData.java | 2 + .../server/impl/sy/ServerSySessionImpl.java | 100 +++++++++++++----- 5 files changed, 116 insertions(+), 31 deletions(-) diff --git a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ServerSySessionListener.java b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ServerSySessionListener.java index f905577bd..4dea364ab 100644 --- a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ServerSySessionListener.java +++ b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ServerSySessionListener.java @@ -39,13 +39,13 @@ public interface ServerSySessionListener { - void doSpendingLimitRequest(ClientSySession session, SpendingLimitRequest request) + void doSpendingLimitRequest(ServerSySession session, SpendingLimitRequest request) throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; - void doFinalSpendingLimitRequest(ClientSySession session, SessionTermRequest request) + void doFinalSpendingLimitRequest(ServerSySession session, SessionTermRequest request) throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; - void doSpendingStatusNotificationAnswer(ClientSySession session, SpendingStatusNotificationRequest request, SpendingStatusNotificationAnswer answer) + void doSpendingStatusNotificationAnswer(ServerSySession session, SpendingStatusNotificationRequest request, SpendingStatusNotificationAnswer answer) throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; } \ No newline at end of file diff --git a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingStatusNotificationRequest.java b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingStatusNotificationRequest.java index 26bb2799c..28eea0f91 100644 --- a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingStatusNotificationRequest.java +++ b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingStatusNotificationRequest.java @@ -20,6 +20,7 @@ package org.jdiameter.api.sy.events; import org.jdiameter.api.app.AppAnswerEvent; +import org.jdiameter.api.app.AppRequestEvent; /** * The Spending-Notification-Request (SNR) message, indicated by the Command-Code field set to 8388636 is sent @@ -28,7 +29,7 @@ * @author Alejandro Ferreira Guido */ -public interface SpendingStatusNotificationRequest extends AppAnswerEvent { +public interface SpendingStatusNotificationRequest extends AppRequestEvent { String _SHORT_NAME = "SNR"; String _LONG_NAME = "Spending-Status-Notification-Request"; diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/sy/Event.java b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/sy/Event.java index 16dbbbdba..5974722f3 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/sy/Event.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/sy/Event.java @@ -20,12 +20,15 @@ package org.jdiameter.server.impl.sy; import org.jdiameter.api.app.AppAnswerEvent; +import org.jdiameter.api.app.AppEvent; import org.jdiameter.api.app.AppRequestEvent; import org.jdiameter.api.app.StateEvent; import org.jdiameter.api.auth.events.SessionTermAnswer; import org.jdiameter.api.auth.events.SessionTermRequest; import org.jdiameter.api.sy.events.SpendingLimitAnswer; import org.jdiameter.api.sy.events.SpendingLimitRequest; +import org.jdiameter.api.sy.events.SpendingStatusNotificationAnswer; +import org.jdiameter.api.sy.events.SpendingStatusNotificationRequest; /** * Policy and charging control, Spending Limit Report - Sy session implementation @@ -37,11 +40,17 @@ public class Event implements StateEvent { public enum Type { RECEIVED_INITIAL, + SENT_INITIAL_RESPONSE, RECEIVED_INTERMEDIATE, - RECEIVED_TERMINATION + SENT_INTERMEDIATE_RESPONSE, + RECEIVED_TERMINATION, + SENT_TERMINATION_RESPONSE, + RECEIVED_STATUS_NOTIFICATION, + SENT_STATUS_NOTIFICATION_RESPONSE } Type type; + AppRequestEvent request; AppAnswerEvent answer; @@ -53,6 +62,7 @@ public Event(boolean isRequest, SessionTermRequest request, SessionTermAnswer an if (isRequest) { type = Type.RECEIVED_TERMINATION; } else { + type = Type.SENT_TERMINATION_RESPONSE; } } @@ -72,6 +82,26 @@ public Event(boolean isRequest, SpendingLimitRequest request, SpendingLimitAnswe break; } } else { + switch (slRequestTypeAvpValue) { + case 0: + type = Type.SENT_INITIAL_RESPONSE; + break; + case 1: + type = Type.SENT_INTERMEDIATE_RESPONSE; + break; + } + } + } + + public Event(boolean isRequest, SpendingStatusNotificationRequest request, SpendingStatusNotificationAnswer answer) { + + this.request = request; + this.answer = answer; + + if (isRequest) { + type = Type.RECEIVED_STATUS_NOTIFICATION; + } else { + type = Type.SENT_STATUS_NOTIFICATION_RESPONSE; } } @@ -99,4 +129,8 @@ public Object getData() { public int compareTo(Object o) { return 0; } + + public AppEvent getRequest() { + return request; + } } diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/sy/IServerSySessionData.java b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/sy/IServerSySessionData.java index 1a0e4f346..1cb7fd27b 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/sy/IServerSySessionData.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/sy/IServerSySessionData.java @@ -31,4 +31,6 @@ public interface IServerSySessionData extends ISySessionData { ServerSySessionState getServerSySessionState(); + + void setServerSySessionState(ServerSySessionState newState); } diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/sy/ServerSySessionImpl.java b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/sy/ServerSySessionImpl.java index 508053fba..85e2e7254 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/sy/ServerSySessionImpl.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/sy/ServerSySessionImpl.java @@ -29,16 +29,19 @@ import org.jdiameter.api.InternalException; import org.jdiameter.api.OverloadException; import org.jdiameter.api.RouteException; +import org.jdiameter.api.app.AppEvent; import org.jdiameter.api.app.StateChangeListener; import org.jdiameter.api.app.StateEvent; import org.jdiameter.api.auth.events.SessionTermAnswer; import org.jdiameter.api.auth.events.SessionTermRequest; import org.jdiameter.api.sy.ServerSySession; +import org.jdiameter.api.sy.ServerSySessionListener; import org.jdiameter.api.sy.events.SpendingLimitAnswer; import org.jdiameter.api.sy.events.SpendingLimitRequest; import org.jdiameter.api.sy.events.SpendingStatusNotificationRequest; import org.jdiameter.client.api.ISessionFactory; import org.jdiameter.common.api.app.IAppSessionData; +import org.jdiameter.common.api.app.IAppSessionState; import org.jdiameter.common.api.app.sy.ISyMessageFactory; import org.jdiameter.common.api.app.sy.ServerSySessionState; import org.jdiameter.common.impl.app.sy.AppSySessionImpl; @@ -46,6 +49,8 @@ import org.slf4j.LoggerFactory; import java.util.List; +import java.util.concurrent.locks.Lock; +import java.util.concurrent.locks.ReentrantLock; /** * Policy and charging control, Spending Limit Report - Sy session implementation @@ -58,13 +63,17 @@ public class ServerSySessionImpl extends AppSySessionImpl implements ServerSySes private static final Logger logger = LoggerFactory.getLogger(ServerSySessionImpl.class); protected IServerSySessionData sessionData; + // Session State Handling --------------------------------------------------- + protected Lock sendAndStateLock = new ReentrantLock(); protected transient ISyMessageFactory factory = null; + protected transient ServerSySessionListener listener = null; - public ServerSySessionImpl(IServerSySessionData data, ISessionFactory sf, IAppSessionData appSessionData) { + public ServerSySessionImpl(IServerSySessionData data, ISessionFactory sf, ServerSySessionListener lst, IAppSessionData appSessionData) { super(sf, appSessionData); this.sessionData = data; + this.listener = lst; } @Override @@ -78,17 +87,17 @@ public Answer processRequest(Request request) { @Override public void sendSpendingLimitAnswer(SpendingLimitAnswer answer) throws InternalException, IllegalDiameterStateException, RouteException, OverloadException { - + handleEvent(new Event(false, null, answer)); } @Override public void sendFinalSpendingLimitAnswer(SessionTermAnswer answer) throws InternalException, IllegalDiameterStateException, RouteException, OverloadException { - + handleEvent(new Event(false, null, answer)); } @Override public void sendSpendingStatusNotificationRequest(SpendingStatusNotificationRequest request) throws InternalException, IllegalDiameterStateException, RouteException, OverloadException { - + handleEvent(new Event(true, request, null)); } @Override @@ -132,29 +141,48 @@ public void removeStateChangeNotification(StateChangeListener listener) { @Override public boolean handleEvent(StateEvent event) throws InternalException, OverloadException { - - ServerSySessionState state = this.sessionData.getServerSySessionState(); - - Event.Type eventType = (Event.Type) event.getType(); - switch(state) { - case IDLE: - switch(eventType) { - case RECEIVED_INITIAL: - break; - case RECEIVED_INTERMEDIATE: - break; - } - break; - case OPEN: - switch(eventType) { - case RECEIVED_INTERMEDIATE: - break; - case RECEIVED_TERMINATION: - break; - } - break; + ServerSySessionState newState = null; + + try { + ServerSySessionState state = this.sessionData.getServerSySessionState(); + + Event localEvent = (Event) event; + + Event.Type eventType = (Event.Type) event.getType(); + + switch(state) { + case IDLE: + switch(eventType) { + case RECEIVED_INITIAL: + listener.doSpendingLimitRequest(this, (SpendingLimitRequest) localEvent.getRequest()); + break; + case SENT_INITIAL_RESPONSE: + newState = ServerSySessionState.OPEN; + // dispatchEvent() + session.send(((AppEvent)localEvent).getMessage()); + setState(newState); + break; + } + break; + case OPEN: + switch(eventType) { + case RECEIVED_INTERMEDIATE: + listener.doSpendingLimitRequest(this, (SpendingLimitRequest) localEvent.getRequest()); + break; + case RECEIVED_TERMINATION: + listener.doFinalSpendingLimitRequest(this, (SessionTermRequest) localEvent.getRequest()); + break; + } + break; + } + return false; + } + catch (Exception e) { + throw new InternalException(e); + } + finally { + sendAndStateLock.unlock(); } - return false; } @Override @@ -177,6 +205,26 @@ public boolean isValid() { return false; } + protected void setState(ServerSySessionState newState) { + setState(newState, true); + } + + protected void setState(ServerSySessionState newState, boolean release) { + IAppSessionState oldState = this.sessionData.getServerSySessionState(); + this.sessionData.setServerSySessionState(newState); + + for (StateChangeListener i : stateListeners) { + i.stateChanged(this, (Enum) oldState, (Enum) newState); + } + if (newState == ServerSySessionState.IDLE) { + // do EVERYTHING before this! + //stopTcc(false); + if (release) { + this.release(); + } + } + } + @Override public void release() { From 17401cda578c1238fd4f205ce0a84773a6483494 Mon Sep 17 00:00:00 2001 From: Alex Date: Sat, 1 Oct 2016 19:01:08 -0300 Subject: [PATCH 15/17] Sy Impl - night build #004 +renamed jdiameter/client/api/ISessionFactory.registerAppFacory() issue #44 --- .../jdiameter/client/api/ISessionFactory.java | 4 +- .../client/impl/SessionFactoryImpl.java | 4 +- .../common/api/app/sy/ISySessionFactory.java | 31 +++++ .../impl/app/cca/CCASessionFactoryImpl.java | 2 +- .../impl/app/sy/SpendingLimitAnswerImpl.java | 37 ++++++ .../impl/app/sy/SpendingLimitRequestImpl.java | 42 +++++++ .../SpendingStatusNotificationAnswerImpl.java | 37 ++++++ ...SpendingStatusNotificationRequestImpl.java | 37 ++++++ .../impl/app/sy/SySessionFactoryImpl.java | 116 ++++++++++++++++++ .../server/impl/sy/ServerSySessionImpl.java | 2 + .../charging/ChargingServerSimulator.java | 8 +- 11 files changed, 311 insertions(+), 9 deletions(-) create mode 100644 core/jdiameter/impl/src/main/java/org/jdiameter/common/api/app/sy/ISySessionFactory.java create mode 100644 core/jdiameter/impl/src/main/java/org/jdiameter/common/impl/app/sy/SpendingLimitAnswerImpl.java create mode 100644 core/jdiameter/impl/src/main/java/org/jdiameter/common/impl/app/sy/SpendingLimitRequestImpl.java create mode 100644 core/jdiameter/impl/src/main/java/org/jdiameter/common/impl/app/sy/SpendingStatusNotificationAnswerImpl.java create mode 100644 core/jdiameter/impl/src/main/java/org/jdiameter/common/impl/app/sy/SpendingStatusNotificationRequestImpl.java create mode 100644 core/jdiameter/impl/src/main/java/org/jdiameter/common/impl/app/sy/SySessionFactoryImpl.java diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/client/api/ISessionFactory.java b/core/jdiameter/impl/src/main/java/org/jdiameter/client/api/ISessionFactory.java index 5be96d93d..3df119927 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/client/api/ISessionFactory.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/client/api/ISessionFactory.java @@ -79,14 +79,14 @@ T getNewAppSession(String sessionId, ApplicationId applic * @param sessionClass the class of the objects being generated by the factory * @param factory the factory to generate app sessions */ - void registerAppFacory(Class sessionClass, IAppSessionFactory factory); + void registerAppFactory(Class sessionClass, IAppSessionFactory factory); /** * Unregisters an existing App Session factory. * * @param sessionClass the class identifier for this factory */ - void unRegisterAppFacory(Class sessionClass); + void unRegisterAppFactory(Class sessionClass); /** * Retrieves the app session factory associated with an app session class diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/SessionFactoryImpl.java b/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/SessionFactoryImpl.java index 12b4e4c1a..037b02d67 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/SessionFactoryImpl.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/SessionFactoryImpl.java @@ -162,12 +162,12 @@ public T getNewAppSession(String sessionId, ApplicationId } @Override - public void registerAppFacory(Class sessionClass, IAppSessionFactory factory) { + public void registerAppFactory(Class sessionClass, IAppSessionFactory factory) { appFactories.put(sessionClass, factory); } @Override - public void unRegisterAppFacory(Class sessionClass) { + public void unRegisterAppFactory(Class sessionClass) { appFactories.remove(sessionClass); } diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/common/api/app/sy/ISySessionFactory.java b/core/jdiameter/impl/src/main/java/org/jdiameter/common/api/app/sy/ISySessionFactory.java new file mode 100644 index 000000000..bf30bbc07 --- /dev/null +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/common/api/app/sy/ISySessionFactory.java @@ -0,0 +1,31 @@ +/* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, Telestax Inc and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + */ + +package org.jdiameter.common.api.app.sy; + +import org.jdiameter.common.api.app.IAppSessionFactory; + +/** + * Policy and charging control - Sy session implementation + * + * @author Alejandro Ferreira Guido + */ + +public interface ISySessionFactory extends IAppSessionFactory { +} diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/common/impl/app/cca/CCASessionFactoryImpl.java b/core/jdiameter/impl/src/main/java/org/jdiameter/common/impl/app/cca/CCASessionFactoryImpl.java index d8bf0d2f7..a8b1eeffb 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/common/impl/app/cca/CCASessionFactoryImpl.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/common/impl/app/cca/CCASessionFactoryImpl.java @@ -94,7 +94,7 @@ public CCASessionFactoryImpl(SessionFactory sessionFactory) { } /** - * @param sessionFactory2 + * @param sessionFactory */ public void init(SessionFactory sessionFactory) { this.sessionFactory = (ISessionFactory) sessionFactory; diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/common/impl/app/sy/SpendingLimitAnswerImpl.java b/core/jdiameter/impl/src/main/java/org/jdiameter/common/impl/app/sy/SpendingLimitAnswerImpl.java new file mode 100644 index 000000000..196525664 --- /dev/null +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/common/impl/app/sy/SpendingLimitAnswerImpl.java @@ -0,0 +1,37 @@ +/* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, Telestax Inc and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + */ + +package org.jdiameter.common.impl.app.sy; + +import org.jdiameter.api.Request; +import org.jdiameter.api.sy.events.SpendingLimitAnswer; +import org.jdiameter.common.impl.app.AppAnswerEventImpl; + +/** + * Policy and charging control - Sy session implementation + * + * @author Alejandro Ferreira Guido + */ + +public class SpendingLimitAnswerImpl extends AppAnswerEventImpl implements SpendingLimitAnswer { + + public SpendingLimitAnswerImpl(Request request, long resultCode) { + super(request, resultCode); + } +} diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/common/impl/app/sy/SpendingLimitRequestImpl.java b/core/jdiameter/impl/src/main/java/org/jdiameter/common/impl/app/sy/SpendingLimitRequestImpl.java new file mode 100644 index 000000000..f4fceda4d --- /dev/null +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/common/impl/app/sy/SpendingLimitRequestImpl.java @@ -0,0 +1,42 @@ +/* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, Telestax Inc and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + */ + +package org.jdiameter.common.impl.app.sy; + +import org.jdiameter.api.Message; +import org.jdiameter.api.sy.events.SpendingLimitRequest; +import org.jdiameter.common.impl.app.AppRequestEventImpl; + +/** + * Policy and charging control - Sy session implementation + * + * @author Alejandro Ferreira Guido + */ + +public class SpendingLimitRequestImpl extends AppRequestEventImpl implements SpendingLimitRequest { + + public SpendingLimitRequestImpl(Message message) { + super(message); + } + + @Override + public int getSLRequestTypeAVPValue() { + return 0; + } +} diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/common/impl/app/sy/SpendingStatusNotificationAnswerImpl.java b/core/jdiameter/impl/src/main/java/org/jdiameter/common/impl/app/sy/SpendingStatusNotificationAnswerImpl.java new file mode 100644 index 000000000..285b1969b --- /dev/null +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/common/impl/app/sy/SpendingStatusNotificationAnswerImpl.java @@ -0,0 +1,37 @@ +/* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, Telestax Inc and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + */ + +package org.jdiameter.common.impl.app.sy; + +import org.jdiameter.api.Request; +import org.jdiameter.api.sy.events.SpendingStatusNotificationAnswer; +import org.jdiameter.common.impl.app.AppAnswerEventImpl; + +/** + * Policy and charging control - Sy session implementation + * + * @author Alejandro Ferreira Guido + */ + +public class SpendingStatusNotificationAnswerImpl extends AppAnswerEventImpl implements SpendingStatusNotificationAnswer { + + public SpendingStatusNotificationAnswerImpl(Request request, long resultCode) { + super(request, resultCode); + } +} diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/common/impl/app/sy/SpendingStatusNotificationRequestImpl.java b/core/jdiameter/impl/src/main/java/org/jdiameter/common/impl/app/sy/SpendingStatusNotificationRequestImpl.java new file mode 100644 index 000000000..cb985c808 --- /dev/null +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/common/impl/app/sy/SpendingStatusNotificationRequestImpl.java @@ -0,0 +1,37 @@ +/* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, Telestax Inc and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + */ + +package org.jdiameter.common.impl.app.sy; + +import org.jdiameter.api.Message; +import org.jdiameter.api.sy.events.SpendingStatusNotificationRequest; +import org.jdiameter.common.impl.app.AppRequestEventImpl; + +/** + * Policy and charging control - Sy session implementation + * + * @author Alejandro Ferreira Guido + */ + +public class SpendingStatusNotificationRequestImpl extends AppRequestEventImpl implements SpendingStatusNotificationRequest { + + public SpendingStatusNotificationRequestImpl(Message message) { + super(message); + } +} diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/common/impl/app/sy/SySessionFactoryImpl.java b/core/jdiameter/impl/src/main/java/org/jdiameter/common/impl/app/sy/SySessionFactoryImpl.java new file mode 100644 index 000000000..b799e6bfb --- /dev/null +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/common/impl/app/sy/SySessionFactoryImpl.java @@ -0,0 +1,116 @@ +/* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, Telestax Inc and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + */ + +package org.jdiameter.common.impl.app.sy; + +import org.jdiameter.api.ApplicationId; +import org.jdiameter.api.IllegalDiameterStateException; +import org.jdiameter.api.InternalException; +import org.jdiameter.api.Request; +import org.jdiameter.api.OverloadException; +import org.jdiameter.api.RouteException; +import org.jdiameter.api.app.AppSession; +import org.jdiameter.api.app.StateChangeListener; +import org.jdiameter.api.auth.events.SessionTermAnswer; +import org.jdiameter.api.auth.events.SessionTermRequest; +import org.jdiameter.api.sy.ClientSySession; +import org.jdiameter.api.sy.ClientSySessionListener; +import org.jdiameter.api.sy.ServerSySession; +import org.jdiameter.api.sy.ServerSySessionListener; +import org.jdiameter.api.sy.events.SpendingLimitAnswer; +import org.jdiameter.api.sy.events.SpendingLimitRequest; +import org.jdiameter.api.sy.events.SpendingStatusNotificationAnswer; +import org.jdiameter.api.sy.events.SpendingStatusNotificationRequest; +import org.jdiameter.common.api.app.sy.ISyMessageFactory; +import org.jdiameter.common.api.app.sy.ISySessionFactory; + +/** + * Policy and charging control - Sy session implementation + * + * @author Alejandro Ferreira Guido + */ + +public class SySessionFactoryImpl implements ISySessionFactory, ClientSySessionListener, ServerSySessionListener, StateChangeListener, + ISyMessageFactory { + + @Override + public SpendingLimitRequest createSpendingLimitRequest(Request request) { + return null; + } + + @Override + public SessionTermRequest createSessionTerminationRequest(Request request) { + return null; + } + + @Override + public SpendingStatusNotificationRequest createSpendingStatusNotificationRequest(Request request) { + return null; + } + + @Override + public void doSpendingLimitRequest(ServerSySession session, SpendingLimitRequest request) throws InternalException, IllegalDiameterStateException, RouteException, OverloadException { + + } + + @Override + public void doFinalSpendingLimitRequest(ServerSySession session, SessionTermRequest request) throws InternalException, IllegalDiameterStateException, RouteException, OverloadException { + + } + + @Override + public void doSpendingStatusNotificationAnswer(ServerSySession session, SpendingStatusNotificationRequest request, SpendingStatusNotificationAnswer answer) throws InternalException, IllegalDiameterStateException, RouteException, OverloadException { + + } + + @Override + public void doSpendingLimitAnswer(ClientSySession session, SpendingLimitRequest request, SpendingLimitAnswer answer) throws InternalException, IllegalDiameterStateException, RouteException, OverloadException { + + } + + @Override + public void doFinalSpendingLimitAnswer(ClientSySession session, SessionTermRequest request, SessionTermAnswer answer) throws InternalException, IllegalDiameterStateException, RouteException, OverloadException { + + } + + @Override + public void doSpendingStatusNotificationRequest(ClientSySession session, SpendingStatusNotificationRequest request) throws InternalException, IllegalDiameterStateException, RouteException, OverloadException { + + } + + @Override + public AppSession getNewSession(String sessionId, Class aClass, ApplicationId applicationId, Object[] args) { + return null; + } + + @Override + public AppSession getSession(String sessionId, Class aClass) { + return null; + } + + @Override + public void stateChanged(Enum oldState, Enum newState) { + + } + + @Override + public void stateChanged(AppSession source, Enum oldState, Enum newState) { + + } +} diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/sy/ServerSySessionImpl.java b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/sy/ServerSySessionImpl.java index 85e2e7254..6c704e95b 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/sy/ServerSySessionImpl.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/sy/ServerSySessionImpl.java @@ -158,8 +158,10 @@ public boolean handleEvent(StateEvent event) throws InternalException, OverloadE break; case SENT_INITIAL_RESPONSE: newState = ServerSySessionState.OPEN; + // dispatchEvent() session.send(((AppEvent)localEvent).getMessage()); + setState(newState); break; } diff --git a/examples/charging-server-simulator/src/main/java/org/mobicents/servers/diameter/charging/ChargingServerSimulator.java b/examples/charging-server-simulator/src/main/java/org/mobicents/servers/diameter/charging/ChargingServerSimulator.java index 8d1f3cb38..5b12cf97b 100644 --- a/examples/charging-server-simulator/src/main/java/org/mobicents/servers/diameter/charging/ChargingServerSimulator.java +++ b/examples/charging-server-simulator/src/main/java/org/mobicents/servers/diameter/charging/ChargingServerSimulator.java @@ -90,11 +90,11 @@ public ChargingServerSimulator() throws Exception { sessionFactory = (ISessionFactory) stackCreator.getSessionFactory(); init(sessionFactory); // damn.. this doesn't looks good - sessionFactory.registerAppFacory(ServerCCASession.class, this); - sessionFactory.registerAppFacory(ClientCCASession.class, this); + sessionFactory.registerAppFactory(ServerCCASession.class, this); + sessionFactory.registerAppFactory(ClientCCASession.class, this); - sessionFactory.registerAppFacory(ServerSySession.class, this); - sessionFactory.registerAppFacory(ClientSySession.class, this); + sessionFactory.registerAppFactory(ServerSySession.class, this); + sessionFactory.registerAppFactory(ClientSySession.class, this); // Read users from properties file Properties properties = new Properties(); From 43468908012763045b394b4d26c20eccf29da734 Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 17 Oct 2016 21:21:52 -0300 Subject: [PATCH 16/17] Sy Impl - night build #006 added testsuite/tests/sy/... revert example/charging-server-simulator issue #44 added AVP's for Ro messages issue #43 --- .../api/sy/ClientSySessionListener.java | 2 +- .../api/sy/events/SpendingLimitAnswer.java | 2 + .../api/app/sy/ClientSySessionState.java | 57 ++ .../impl/app/sy/SySessionFactoryImpl.java | 5 + examples/charging-server-simulator/pom.xml | 8 - .../charging/ChargingServerSimulator.java | 28 +- .../src/main/resources/dictionary.xml | 228 +------ testsuite/tests/pom.xml | 12 + .../stack/functional/acc/AbstractClient.java | 4 +- .../stack/functional/acc/AbstractServer.java | 4 +- .../stack/functional/cca/AbstractClient.java | 4 +- .../stack/functional/cca/AbstractServer.java | 4 +- .../stack/functional/cxdx/AbstractClient.java | 4 +- .../stack/functional/cxdx/AbstractServer.java | 4 +- .../stack/functional/cxdx/base/ClientPPR.java | 4 +- .../stack/functional/cxdx/base/ClientRTR.java | 4 +- .../stack/functional/cxdx/base/ServerPPR.java | 4 +- .../stack/functional/cxdx/base/ServerRTR.java | 4 +- .../stack/functional/gx/AbstractClient.java | 4 +- .../stack/functional/gx/AbstractServer.java | 4 +- .../stack/functional/ro/AbstractClient.java | 4 +- .../stack/functional/ro/AbstractServer.java | 4 +- .../stack/functional/s13/AbstractClient.java | 4 +- .../stack/functional/s13/AbstractServer.java | 4 +- .../stack/functional/sh/AbstractClient.java | 4 +- .../stack/functional/sh/AbstractServer.java | 4 +- .../stack/functional/sh/base/ClientPNR.java | 4 +- .../stack/functional/sy/AbstractClient.java | 134 +++++ .../stack/functional/sy/AbstractServer.java | 142 +++++ .../stack/functional/sy/base/Client.java | 164 ++++++ .../stack/functional/sy/base/Server.java | 185 ++++++ .../sy/base/SySessionBasicFlowTest.java | 229 ++++++++ .../sy/base/SySessionFTFlowTest.java | 277 +++++++++ .../stack/sessions/SessionsWithAppIdTest.java | 40 +- .../functional-sy/config-client.xml | 56 ++ .../functional-sy/config-server.xml | 57 ++ .../tests/src/test/resources/dictionary.xml | 556 +++++++++++++++++- 37 files changed, 1946 insertions(+), 312 deletions(-) create mode 100644 core/jdiameter/impl/src/main/java/org/jdiameter/common/api/app/sy/ClientSySessionState.java create mode 100644 testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/sy/AbstractClient.java create mode 100644 testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/sy/AbstractServer.java create mode 100644 testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/sy/base/Client.java create mode 100644 testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/sy/base/Server.java create mode 100644 testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/sy/base/SySessionBasicFlowTest.java create mode 100644 testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/sy/base/SySessionFTFlowTest.java create mode 100644 testsuite/tests/src/test/resources/configurations/functional-sy/config-client.xml create mode 100644 testsuite/tests/src/test/resources/configurations/functional-sy/config-server.xml diff --git a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ClientSySessionListener.java b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ClientSySessionListener.java index cd4337966..104cf7054 100644 --- a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ClientSySessionListener.java +++ b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ClientSySessionListener.java @@ -49,4 +49,4 @@ void doFinalSpendingLimitAnswer(ClientSySession session, SessionTermRequest requ void doSpendingStatusNotificationRequest(ClientSySession session, SpendingStatusNotificationRequest request) throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; -} +} \ No newline at end of file diff --git a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingLimitAnswer.java b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingLimitAnswer.java index fc398ab1d..83ad7f4ce 100644 --- a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingLimitAnswer.java +++ b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingLimitAnswer.java @@ -35,4 +35,6 @@ public interface SpendingLimitAnswer extends AppAnswerEvent { int code = 8388635; + int getRequestSLTypeAVPValue(); + } diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/common/api/app/sy/ClientSySessionState.java b/core/jdiameter/impl/src/main/java/org/jdiameter/common/api/app/sy/ClientSySessionState.java new file mode 100644 index 000000000..fe9a5baba --- /dev/null +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/common/api/app/sy/ClientSySessionState.java @@ -0,0 +1,57 @@ +/* +* TeleStax, Open Source Cloud Communications +* Copyright 2011-2016, Telestax Inc and individual contributors +* by the @authors tag. +* +* This program is free software: you can redistribute it and/or modify +* under the terms of the GNU Affero General Public License as +* published by the Free Software Foundation; either version 3 of +* the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Affero General Public License for more details. +* +* You should have received a copy of the GNU Affero General Public License +* along with this program. If not, see +*/ + +package org.jdiameter.common.api.app.sy; + +import org.jdiameter.common.api.app.IAppSessionState; + +/** +* Policy and charging control - Sy session implementation +* +* @author Alejandro Ferreira Guido +*/ + +public enum ClientSySessionState implements IAppSessionState { + + IDLE(0), + OPEN(1); + + private int stateValue = -1; + + ClientSySessionState(int stateV) { + this.stateValue = stateV; + } + + @Override + public ClientSySessionState fromInt(int v) throws IllegalArgumentException { + switch (v) { + case 0: + return IDLE; + case 1: + return OPEN; + default: + throw new IllegalArgumentException("Illegal value of int representation!!!!"); + } + } + + @Override + public int getValue() { + return stateValue; + } + } diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/common/impl/app/sy/SySessionFactoryImpl.java b/core/jdiameter/impl/src/main/java/org/jdiameter/common/impl/app/sy/SySessionFactoryImpl.java index b799e6bfb..3d1cd7d97 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/common/impl/app/sy/SySessionFactoryImpl.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/common/impl/app/sy/SySessionFactoryImpl.java @@ -37,6 +37,7 @@ import org.jdiameter.api.sy.events.SpendingLimitRequest; import org.jdiameter.api.sy.events.SpendingStatusNotificationAnswer; import org.jdiameter.api.sy.events.SpendingStatusNotificationRequest; +import org.jdiameter.client.api.ISessionFactory; import org.jdiameter.common.api.app.sy.ISyMessageFactory; import org.jdiameter.common.api.app.sy.ISySessionFactory; @@ -49,6 +50,10 @@ public class SySessionFactoryImpl implements ISySessionFactory, ClientSySessionListener, ServerSySessionListener, StateChangeListener, ISyMessageFactory { + public SySessionFactoryImpl(ISessionFactory sessionFactory) { + + } + @Override public SpendingLimitRequest createSpendingLimitRequest(Request request) { return null; diff --git a/examples/charging-server-simulator/pom.xml b/examples/charging-server-simulator/pom.xml index 2a2eca1c0..320084553 100644 --- a/examples/charging-server-simulator/pom.xml +++ b/examples/charging-server-simulator/pom.xml @@ -168,14 +168,6 @@ false - - org.apache.maven.plugins - maven-compiler-plugin - - 1.6 - 1.6 - - diff --git a/examples/charging-server-simulator/src/main/java/org/mobicents/servers/diameter/charging/ChargingServerSimulator.java b/examples/charging-server-simulator/src/main/java/org/mobicents/servers/diameter/charging/ChargingServerSimulator.java index 5b12cf97b..9bdfe8930 100644 --- a/examples/charging-server-simulator/src/main/java/org/mobicents/servers/diameter/charging/ChargingServerSimulator.java +++ b/examples/charging-server-simulator/src/main/java/org/mobicents/servers/diameter/charging/ChargingServerSimulator.java @@ -28,13 +28,10 @@ import org.jdiameter.api.cca.ServerCCASession; import org.jdiameter.api.cca.events.JCreditControlAnswer; import org.jdiameter.api.cca.events.JCreditControlRequest; -import org.jdiameter.api.sy.ClientSySession; -import org.jdiameter.api.sy.ServerSySession; import org.jdiameter.client.api.ISessionFactory; import org.jdiameter.common.impl.app.cca.CCASessionFactoryImpl; import org.jdiameter.common.impl.app.cca.JCreditControlAnswerImpl; import org.jdiameter.server.impl.app.cca.ServerCCASessionImpl; -import org.jdiameter.server.impl.sy.ServerSySessionImpl; import org.mobicents.diameter.dictionary.AvpDictionary; import org.mobicents.servers.diameter.utils.DiameterUtilities; import org.mobicents.servers.diameter.utils.StackCreator; @@ -53,7 +50,6 @@ public class ChargingServerSimulator extends CCASessionFactoryImpl implements Ne private static final Object[] EMPTY_ARRAY = new Object[]{}; private ApplicationId roAppId = ApplicationId.createByAuthAppId(10415L, 4L); - private ApplicationId syAppId = ApplicationId.createByAuthAppId(10415L, 16777302L); private HashMap accounts = new HashMap(); private HashMap reserved = new HashMap(); @@ -81,8 +77,6 @@ public ChargingServerSimulator() throws Exception { network.addNetworkReqListener(this, roAppId); network.addNetworkReqListener(this, ApplicationId.createByAuthAppId(0, 4)); - network.addNetworkReqListener(this, syAppId); - this.stackCreator.start(Mode.ALL_PEERS, 30000, TimeUnit.MILLISECONDS); printLogo(); @@ -93,9 +87,6 @@ public ChargingServerSimulator() throws Exception { sessionFactory.registerAppFactory(ServerCCASession.class, this); sessionFactory.registerAppFactory(ClientCCASession.class, this); - sessionFactory.registerAppFactory(ServerSySession.class, this); - sessionFactory.registerAppFactory(ClientSySession.class, this); - // Read users from properties file Properties properties = new Properties(); try { @@ -136,7 +127,7 @@ private void printLogo() { logger.info("==============================================================================="); logger.info(""); - logger.info("== Mobicents Diameter Ro/Rf +Sy Server Simulator (" + osLine + ")" ); + logger.info("== Mobicents Diameter Ro/Rf Server Simulator (" + osLine + ")" ); logger.info(""); logger.info("== " + javaLine); logger.info(""); @@ -152,20 +143,9 @@ public Answer processRequest(Request request) { logger.info("<< Received Request [" + request + "]"); } try { - long applicationId = request.getApplicationId(); - if (applicationId == 4L) { - // CCA session - ServerCCASessionImpl session = sessionFactory.getNewAppSession(request.getSessionId(), - ApplicationId.createByAuthAppId(0, 4), ServerCCASession.class, EMPTY_ARRAY); - session.processRequest(request); - } else if (applicationId == 16777302L) { - // Sy session - ServerSySessionImpl session = sessionFactory.getNewAppSession(request.getSessionId(), - ApplicationId.createByAuthAppId(0, 16777302), ServerSySession.class, EMPTY_ARRAY); - session.processRequest(request); - } else { - logger.error(">< Failure handling received request, no appId!"); - } + ServerCCASessionImpl session = + (sessionFactory).getNewAppSession(request.getSessionId(), ApplicationId.createByAuthAppId(0, 4), ServerCCASession.class, EMPTY_ARRAY); + session.processRequest(request); } catch (InternalException e) { logger.error(">< Failure handling received request.", e); diff --git a/examples/charging-server-simulator/src/main/resources/dictionary.xml b/examples/charging-server-simulator/src/main/resources/dictionary.xml index 4335ef457..91bf1acf5 100644 --- a/examples/charging-server-simulator/src/main/resources/dictionary.xml +++ b/examples/charging-server-simulator/src/main/resources/dictionary.xml @@ -4327,19 +4327,19 @@ - + - - - - + + + + - - + + - + @@ -4347,8 +4347,8 @@ - - + + @@ -4358,11 +4358,11 @@ - + - - + + @@ -6668,15 +6668,16 @@ - + @@ -7615,199 +7616,4 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/testsuite/tests/pom.xml b/testsuite/tests/pom.xml index 91d6b4520..c9e8a34c3 100644 --- a/testsuite/tests/pom.xml +++ b/testsuite/tests/pom.xml @@ -1,5 +1,17 @@ 4.0.0 + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.6 + 1.6 + + + + org.mobicents.diameter.testsuite diff --git a/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/acc/AbstractClient.java b/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/acc/AbstractClient.java index 365f949ee..72dd20588 100644 --- a/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/acc/AbstractClient.java +++ b/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/acc/AbstractClient.java @@ -69,8 +69,8 @@ public void init(InputStream configStream, String clientID) throws Exception { try { super.init(configStream, clientID, ApplicationId.createByAccAppId(0, 300)); AccSessionFactoryImpl creditControlSessionFactory = new AccSessionFactoryImpl(this.sessionFactory); - sessionFactory.registerAppFacory(ServerAccSession.class, creditControlSessionFactory); - sessionFactory.registerAppFacory(ClientAccSession.class, creditControlSessionFactory); + sessionFactory.registerAppFactory(ServerAccSession.class, creditControlSessionFactory); + sessionFactory.registerAppFactory(ClientAccSession.class, creditControlSessionFactory); creditControlSessionFactory.setStateListener(this); creditControlSessionFactory.setClientSessionListener(this); diff --git a/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/acc/AbstractServer.java b/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/acc/AbstractServer.java index 050a44991..ed6501303 100644 --- a/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/acc/AbstractServer.java +++ b/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/acc/AbstractServer.java @@ -64,8 +64,8 @@ public void init(InputStream configStream, String clientID) throws Exception { try { super.init(configStream, clientID, ApplicationId.createByAccAppId(0, 300)); AccSessionFactoryImpl creditControlSessionFactory = new AccSessionFactoryImpl(this.sessionFactory); - sessionFactory.registerAppFacory(ServerAccSession.class, creditControlSessionFactory); - sessionFactory.registerAppFacory(ClientAccSession.class, creditControlSessionFactory); + sessionFactory.registerAppFactory(ServerAccSession.class, creditControlSessionFactory); + sessionFactory.registerAppFactory(ClientAccSession.class, creditControlSessionFactory); creditControlSessionFactory.setStateListener(this); creditControlSessionFactory.setServerSessionListener(this); diff --git a/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/cca/AbstractClient.java b/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/cca/AbstractClient.java index 1c03fabb4..59922fd6e 100644 --- a/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/cca/AbstractClient.java +++ b/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/cca/AbstractClient.java @@ -65,8 +65,8 @@ public void init(InputStream configStream, String clientID) throws Exception { try { super.init(configStream, clientID, ApplicationId.createByAuthAppId(0, 4)); CCASessionFactoryImpl creditControlSessionFactory = new CCASessionFactoryImpl(this.sessionFactory); - sessionFactory.registerAppFacory(ServerCCASession.class, creditControlSessionFactory); - sessionFactory.registerAppFacory(ClientCCASession.class, creditControlSessionFactory); + sessionFactory.registerAppFactory(ServerCCASession.class, creditControlSessionFactory); + sessionFactory.registerAppFactory(ClientCCASession.class, creditControlSessionFactory); creditControlSessionFactory.setStateListener(this); creditControlSessionFactory.setClientSessionListener(this); diff --git a/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/cca/AbstractServer.java b/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/cca/AbstractServer.java index 454d9371b..ed6aff7bb 100644 --- a/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/cca/AbstractServer.java +++ b/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/cca/AbstractServer.java @@ -59,8 +59,8 @@ public void init(InputStream configStream, String clientID) throws Exception { try { super.init(configStream, clientID, ApplicationId.createByAuthAppId(0, 4)); CCASessionFactoryImpl creditControlSessionFactory = new CCASessionFactoryImpl(this.sessionFactory); - sessionFactory.registerAppFacory(ServerCCASession.class, creditControlSessionFactory); - sessionFactory.registerAppFacory(ClientCCASession.class, creditControlSessionFactory); + sessionFactory.registerAppFactory(ServerCCASession.class, creditControlSessionFactory); + sessionFactory.registerAppFactory(ClientCCASession.class, creditControlSessionFactory); creditControlSessionFactory.setStateListener(this); creditControlSessionFactory.setServerSessionListener(this); diff --git a/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/cxdx/AbstractClient.java b/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/cxdx/AbstractClient.java index 9417ff594..e240af5c4 100644 --- a/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/cxdx/AbstractClient.java +++ b/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/cxdx/AbstractClient.java @@ -67,8 +67,8 @@ public void init(InputStream configStream, String clientID) throws Exception { try { super.init(configStream, clientID, ApplicationId.createByAuthAppId(10415, 16777216)); CxDxSessionFactoryImpl shSessionFactory = new CxDxSessionFactoryImpl(this.sessionFactory); - sessionFactory.registerAppFacory(ServerCxDxSession.class, shSessionFactory); - sessionFactory.registerAppFacory(ClientCxDxSession.class, shSessionFactory); + sessionFactory.registerAppFactory(ServerCxDxSession.class, shSessionFactory); + sessionFactory.registerAppFactory(ClientCxDxSession.class, shSessionFactory); shSessionFactory.setClientSessionListener(this); diff --git a/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/cxdx/AbstractServer.java b/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/cxdx/AbstractServer.java index 55c2a887f..4236362ff 100644 --- a/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/cxdx/AbstractServer.java +++ b/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/cxdx/AbstractServer.java @@ -65,8 +65,8 @@ public void init(InputStream configStream, String clientID) throws Exception { try { super.init(configStream, clientID, ApplicationId.createByAuthAppId(10415, 16777216)); CxDxSessionFactoryImpl cxDxSessionFactory = new CxDxSessionFactoryImpl(this.sessionFactory); - sessionFactory.registerAppFacory(ServerCxDxSession.class, cxDxSessionFactory); - sessionFactory.registerAppFacory(ClientCxDxSession.class, cxDxSessionFactory); + sessionFactory.registerAppFactory(ServerCxDxSession.class, cxDxSessionFactory); + sessionFactory.registerAppFactory(ClientCxDxSession.class, cxDxSessionFactory); cxDxSessionFactory.setServerSessionListener(this); } finally { diff --git a/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/cxdx/base/ClientPPR.java b/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/cxdx/base/ClientPPR.java index 1365299d2..a22c0dc43 100644 --- a/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/cxdx/base/ClientPPR.java +++ b/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/cxdx/base/ClientPPR.java @@ -65,8 +65,8 @@ public void init(InputStream configStream, String clientID) throws Exception { try { super.init(configStream, clientID, ApplicationId.createByAuthAppId(10415, 16777216)); CxDxSessionFactoryImpl cxdxSessionFactory = new CxDxSessionFactoryImpl(this.sessionFactory); - sessionFactory.registerAppFacory(ServerCxDxSession.class, cxdxSessionFactory); - sessionFactory.registerAppFacory(ClientCxDxSession.class, cxdxSessionFactory); + sessionFactory.registerAppFactory(ServerCxDxSession.class, cxdxSessionFactory); + sessionFactory.registerAppFactory(ClientCxDxSession.class, cxdxSessionFactory); cxdxSessionFactory.setClientSessionListener(this); } finally { diff --git a/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/cxdx/base/ClientRTR.java b/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/cxdx/base/ClientRTR.java index 731ff202c..a970ff8c2 100644 --- a/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/cxdx/base/ClientRTR.java +++ b/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/cxdx/base/ClientRTR.java @@ -65,8 +65,8 @@ public void init(InputStream configStream, String clientID) throws Exception { try { super.init(configStream, clientID, ApplicationId.createByAuthAppId(10415, 16777216)); CxDxSessionFactoryImpl cxdxSessionFactory = new CxDxSessionFactoryImpl(this.sessionFactory); - sessionFactory.registerAppFacory(ServerCxDxSession.class, cxdxSessionFactory); - sessionFactory.registerAppFacory(ClientCxDxSession.class, cxdxSessionFactory); + sessionFactory.registerAppFactory(ServerCxDxSession.class, cxdxSessionFactory); + sessionFactory.registerAppFactory(ClientCxDxSession.class, cxdxSessionFactory); cxdxSessionFactory.setClientSessionListener(this); } finally { diff --git a/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/cxdx/base/ServerPPR.java b/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/cxdx/base/ServerPPR.java index 5ef740451..bf7f5ee52 100644 --- a/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/cxdx/base/ServerPPR.java +++ b/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/cxdx/base/ServerPPR.java @@ -60,8 +60,8 @@ public void init(InputStream configStream, String clientID) throws Exception { try { super.init(configStream, clientID, ApplicationId.createByAuthAppId(10415, 16777216)); CxDxSessionFactoryImpl cxDxSessionFactory = new CxDxSessionFactoryImpl(this.sessionFactory); - sessionFactory.registerAppFacory(ServerCxDxSession.class, cxDxSessionFactory); - sessionFactory.registerAppFacory(ClientCxDxSession.class, cxDxSessionFactory); + sessionFactory.registerAppFactory(ServerCxDxSession.class, cxDxSessionFactory); + sessionFactory.registerAppFactory(ClientCxDxSession.class, cxDxSessionFactory); cxDxSessionFactory.setServerSessionListener(this); this.serverCxDxSession = sessionFactory.getNewAppSession(getApplicationId(), ServerCxDxSession.class); } diff --git a/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/cxdx/base/ServerRTR.java b/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/cxdx/base/ServerRTR.java index 710f0b7fd..ad096db90 100644 --- a/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/cxdx/base/ServerRTR.java +++ b/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/cxdx/base/ServerRTR.java @@ -60,8 +60,8 @@ public void init(InputStream configStream, String clientID) throws Exception { try { super.init(configStream, clientID, ApplicationId.createByAuthAppId(10415, 16777216)); CxDxSessionFactoryImpl cxDxSessionFactory = new CxDxSessionFactoryImpl(this.sessionFactory); - sessionFactory.registerAppFacory(ServerCxDxSession.class, cxDxSessionFactory); - sessionFactory.registerAppFacory(ClientCxDxSession.class, cxDxSessionFactory); + sessionFactory.registerAppFactory(ServerCxDxSession.class, cxDxSessionFactory); + sessionFactory.registerAppFactory(ClientCxDxSession.class, cxDxSessionFactory); cxDxSessionFactory.setServerSessionListener(this); this.serverCxDxSession = sessionFactory.getNewAppSession(getApplicationId(), ServerCxDxSession.class); } diff --git a/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/gx/AbstractClient.java b/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/gx/AbstractClient.java index d2d1d4643..6437aab42 100644 --- a/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/gx/AbstractClient.java +++ b/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/gx/AbstractClient.java @@ -68,8 +68,8 @@ public void init(InputStream configStream, String clientID) throws Exception { try { super.init(configStream, clientID, ApplicationId.createByAuthAppId(10415, 16777224)); GxSessionFactoryImpl creditControlSessionFactory = new GxSessionFactoryImpl(this.sessionFactory); - sessionFactory.registerAppFacory(ServerGxSession.class, creditControlSessionFactory); - sessionFactory.registerAppFacory(ClientGxSession.class, creditControlSessionFactory); + sessionFactory.registerAppFactory(ServerGxSession.class, creditControlSessionFactory); + sessionFactory.registerAppFactory(ClientGxSession.class, creditControlSessionFactory); creditControlSessionFactory.setStateListener(this); creditControlSessionFactory.setClientSessionListener(this); diff --git a/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/gx/AbstractServer.java b/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/gx/AbstractServer.java index 2b5a8eca6..86c2eca4e 100644 --- a/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/gx/AbstractServer.java +++ b/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/gx/AbstractServer.java @@ -69,8 +69,8 @@ public void init(InputStream configStream, String clientID) throws Exception { try { super.init(configStream, clientID, ApplicationId.createByAuthAppId(10415, 16777224)); GxSessionFactoryImpl creditControlSessionFactory = new GxSessionFactoryImpl(this.sessionFactory); - sessionFactory.registerAppFacory(ServerGxSession.class, creditControlSessionFactory); - sessionFactory.registerAppFacory(ClientGxSession.class, creditControlSessionFactory); + sessionFactory.registerAppFactory(ServerGxSession.class, creditControlSessionFactory); + sessionFactory.registerAppFactory(ClientGxSession.class, creditControlSessionFactory); creditControlSessionFactory.setStateListener(this); creditControlSessionFactory.setServerSessionListener(this); diff --git a/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/ro/AbstractClient.java b/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/ro/AbstractClient.java index f6b03eca0..4037c4b0b 100644 --- a/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/ro/AbstractClient.java +++ b/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/ro/AbstractClient.java @@ -68,8 +68,8 @@ public void init(InputStream configStream, String clientID) throws Exception { try { super.init(configStream, clientID, ApplicationId.createByAuthAppId(0, 4)); RoSessionFactoryImpl creditControlSessionFactory = new RoSessionFactoryImpl(this.sessionFactory); - sessionFactory.registerAppFacory(ServerRoSession.class, creditControlSessionFactory); - sessionFactory.registerAppFacory(ClientRoSession.class, creditControlSessionFactory); + sessionFactory.registerAppFactory(ServerRoSession.class, creditControlSessionFactory); + sessionFactory.registerAppFactory(ClientRoSession.class, creditControlSessionFactory); creditControlSessionFactory.setStateListener(this); creditControlSessionFactory.setClientSessionListener(this); diff --git a/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/ro/AbstractServer.java b/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/ro/AbstractServer.java index 80c3f6b96..e5ac21789 100644 --- a/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/ro/AbstractServer.java +++ b/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/ro/AbstractServer.java @@ -64,8 +64,8 @@ public void init(InputStream configStream, String clientID) throws Exception { try { super.init(configStream, clientID, ApplicationId.createByAuthAppId(0, 4)); RoSessionFactoryImpl creditControlSessionFactory = new RoSessionFactoryImpl(this.sessionFactory); - sessionFactory.registerAppFacory(ServerRoSession.class, creditControlSessionFactory); - sessionFactory.registerAppFacory(ClientRoSession.class, creditControlSessionFactory); + sessionFactory.registerAppFactory(ServerRoSession.class, creditControlSessionFactory); + sessionFactory.registerAppFactory(ClientRoSession.class, creditControlSessionFactory); creditControlSessionFactory.setStateListener(this); creditControlSessionFactory.setServerSessionListener(this); diff --git a/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/s13/AbstractClient.java b/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/s13/AbstractClient.java index e7b2aef01..0c3c7a655 100644 --- a/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/s13/AbstractClient.java +++ b/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/s13/AbstractClient.java @@ -57,8 +57,8 @@ public void init(InputStream configStream, String clientID) throws Exception { try { super.init(configStream, clientID, ApplicationId.createByAuthAppId(10415, 16777252)); S13SessionFactoryImpl s13SessionFactory = new S13SessionFactoryImpl(this.sessionFactory); - sessionFactory.registerAppFacory(ServerS13Session.class, s13SessionFactory); - sessionFactory.registerAppFacory(ClientS13Session.class, s13SessionFactory); + sessionFactory.registerAppFactory(ServerS13Session.class, s13SessionFactory); + sessionFactory.registerAppFactory(ClientS13Session.class, s13SessionFactory); s13SessionFactory.setClientSessionListener(this); diff --git a/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/s13/AbstractServer.java b/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/s13/AbstractServer.java index c4de90c0e..0f6327ed3 100644 --- a/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/s13/AbstractServer.java +++ b/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/s13/AbstractServer.java @@ -58,8 +58,8 @@ public void init(InputStream configStream, String clientID) throws Exception { try { super.init(configStream, clientID, ApplicationId.createByAuthAppId(10415, 16777252)); S13SessionFactoryImpl s13SessionFactory = new S13SessionFactoryImpl(this.sessionFactory); - sessionFactory.registerAppFacory(ServerS13Session.class, s13SessionFactory); - sessionFactory.registerAppFacory(ClientS13Session.class, s13SessionFactory); + sessionFactory.registerAppFactory(ServerS13Session.class, s13SessionFactory); + sessionFactory.registerAppFactory(ClientS13Session.class, s13SessionFactory); s13SessionFactory.setServerSessionListener(this); } finally { diff --git a/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/sh/AbstractClient.java b/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/sh/AbstractClient.java index e9f37cb7f..c5c56ed00 100644 --- a/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/sh/AbstractClient.java +++ b/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/sh/AbstractClient.java @@ -50,8 +50,8 @@ public void init(InputStream configStream, String clientID) throws Exception { try { super.init(configStream, clientID, ApplicationId.createByAuthAppId(10415, 16777217)); ShSessionFactoryImpl shSessionFactory = new ShSessionFactoryImpl(this.sessionFactory); - sessionFactory.registerAppFacory(ServerShSession.class, shSessionFactory); - sessionFactory.registerAppFacory(ClientShSession.class, shSessionFactory); + sessionFactory.registerAppFactory(ServerShSession.class, shSessionFactory); + sessionFactory.registerAppFactory(ClientShSession.class, shSessionFactory); shSessionFactory.setClientShSessionListener(this); diff --git a/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/sh/AbstractServer.java b/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/sh/AbstractServer.java index 796d5493d..12894af48 100644 --- a/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/sh/AbstractServer.java +++ b/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/sh/AbstractServer.java @@ -50,8 +50,8 @@ public void init(InputStream configStream, String clientID) throws Exception { try { super.init(configStream, clientID, ApplicationId.createByAuthAppId(10415, 16777217)); ShSessionFactoryImpl shSessionFactory = new ShSessionFactoryImpl(this.sessionFactory); - sessionFactory.registerAppFacory(ServerShSession.class, shSessionFactory); - sessionFactory.registerAppFacory(ClientShSession.class, shSessionFactory); + sessionFactory.registerAppFactory(ServerShSession.class, shSessionFactory); + sessionFactory.registerAppFactory(ClientShSession.class, shSessionFactory); shSessionFactory.setServerShSessionListener(this); } finally { diff --git a/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/sh/base/ClientPNR.java b/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/sh/base/ClientPNR.java index 138dc3081..a021f9a8e 100644 --- a/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/sh/base/ClientPNR.java +++ b/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/sh/base/ClientPNR.java @@ -82,8 +82,8 @@ public void init(InputStream configStream, String clientID) throws Exception { try { super.init(configStream, clientID, ApplicationId.createByAuthAppId(10415, 16777217)); ShSessionFactoryImpl shSessionFactory = new ShSessionFactoryImpl(this.sessionFactory); - sessionFactory.registerAppFacory(ServerShSession.class, shSessionFactory); - sessionFactory.registerAppFacory(ClientShSession.class, shSessionFactory); + sessionFactory.registerAppFactory(ServerShSession.class, shSessionFactory); + sessionFactory.registerAppFactory(ClientShSession.class, shSessionFactory); shSessionFactory.setClientShSessionListener(this); } finally { diff --git a/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/sy/AbstractClient.java b/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/sy/AbstractClient.java new file mode 100644 index 000000000..e75b44507 --- /dev/null +++ b/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/sy/AbstractClient.java @@ -0,0 +1,134 @@ +/* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, Telestax Inc and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + */ + +package org.mobicents.diameter.stack.functional.sy; + +import org.jdiameter.api.*; +import org.jdiameter.api.sy.ClientSySession; +import org.jdiameter.api.sy.ClientSySessionListener; +import org.jdiameter.api.sy.ServerSySession; +import org.jdiameter.api.sy.events.SpendingLimitRequest; +import org.jdiameter.api.sy.events.SpendingStatusNotificationAnswer; +import org.jdiameter.common.api.app.sy.ClientSySessionState; +import org.jdiameter.common.impl.app.sy.SySessionFactoryImpl; +import org.mobicents.diameter.stack.functional.StateChange; +import org.mobicents.diameter.stack.functional.TBase; + +import java.io.InputStream; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.TimeUnit; + +/** + * Policy and charging control, Spending Limit Report - Sy tests + * + * @author Alejandro Ferreira Guido + */ + +public abstract class AbstractClient extends TBase implements ClientSySessionListener { + + protected static final int SL_REQUEST_TYPE_INITIAL = 0; + protected static final int SL_REQUEST_TYPE_INTERMEDIATE = 1; + + protected ClientSySession clientSySession; + protected int slRequestNumber = 0; + protected List> stateChanges = new ArrayList>(); // state changes + + public void init(InputStream configStream, String clientID) throws Exception { + try { + super.init(configStream, clientID, ApplicationId.createByAuthAppId(10415, 16777302)); + + SySessionFactoryImpl spendingLimitSessionFactory = new SySessionFactoryImpl(this.sessionFactory); + sessionFactory.registerAppFactory(ServerSySession.class, spendingLimitSessionFactory); + sessionFactory.registerAppFactory(ClientSySession.class, spendingLimitSessionFactory); + + /*spendingLimitSessionFactory.setStateListener(this); + spendingLimitSessionFactory.setClientSessionListener(this); + spendingLimitSessionFactory.setClientContextListener(this);*/ + this.clientSySession = this.sessionFactory.getNewAppSession(this.sessionFactory.getSessionId("xxTESTxx"), + getApplicationId(), ClientSySession.class, (Object) null); + } finally { + try { + configStream.close(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + } + + // ----------- delegate methods so + + public void start() throws IllegalDiameterStateException, InternalException { + stack.start(); + } + + public void start(Mode mode, long timeOut, TimeUnit timeUnit) throws IllegalDiameterStateException, InternalException { + stack.start(mode, timeOut, timeUnit); + } + + public void stop(long timeOut, TimeUnit timeUnit, int disconnectCause) throws IllegalDiameterStateException, InternalException { + stack.stop(timeOut, timeUnit, disconnectCause); + } + + public void stop(int disconnectCause) { + stack.stop(disconnectCause); + } + + @Override + public void receivedSuccessMessage(Request request, Answer answer) { + fail("Received \"SuccessMessage\" event, request[" + request + "], answer[" + answer + "]", null); + + } + + @Override + public Answer processRequest(Request request) { + fail("Received \"Request\" event, request[" + request + "]", null); + return null; + } + + protected SpendingLimitRequest createSLR(int slRequestType, int requestNumber, ClientSySession sySession) throws Exception { + SpendingLimitRequest slr = null; // new SpendingLimitRequestImpl(sySession.getSessions().get(0).createRequest(SpendingLimitRequest.code, getApplicationId(), getServerRealmName())); + + return slr; + } + + protected SpendingStatusNotificationAnswer createSNR(int requestNumber, ClientSySession sySession) throws Exception { + SpendingStatusNotificationAnswer sna = null; // new SpendingStatusNotificationAnswerImpl(sySession.getSessions().get(0).createRequest(StatusNotificationSpendingLimitRequestAnswer.code, getApplicationId(), getServerRealmName())); + + return sna; + } + + public String getSessionId() { + return this.clientSySession.getSessionId(); + } + + public void fetchSession(String sessionId) throws InternalException { + this.clientSySession = stack.getSession(sessionId, ClientSySession.class); + } + + public ClientSySession getSession() { + return this.clientSySession; + } + + public List> getStateChanges() { + return stateChanges; + } + +} diff --git a/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/sy/AbstractServer.java b/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/sy/AbstractServer.java new file mode 100644 index 000000000..ed35815f9 --- /dev/null +++ b/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/sy/AbstractServer.java @@ -0,0 +1,142 @@ +/* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, Telestax Inc and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + */ + +package org.mobicents.diameter.stack.functional.sy; + +import org.jdiameter.api.ApplicationId; +import org.jdiameter.api.IllegalDiameterStateException; +import org.jdiameter.api.InternalException; +import org.jdiameter.api.Mode; +import org.jdiameter.api.sy.ClientSySession; +import org.jdiameter.api.sy.ServerSySession; +import org.jdiameter.api.sy.ServerSySessionListener; +import org.jdiameter.common.api.app.sy.ServerSySessionState; +import org.jdiameter.common.impl.app.sy.SySessionFactoryImpl; +import org.mobicents.diameter.stack.functional.StateChange; +import org.mobicents.diameter.stack.functional.TBase; + +import java.io.InputStream; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.ScheduledFuture; +import java.util.concurrent.TimeUnit; + +/** + * Policy and charging control, Spending Limit Report - Sy tests + * + * @author Alejandro Ferreira Guido + */ + +public abstract class AbstractServer extends TBase implements ServerSySessionListener { + + // NOTE: implementing NetworkReqListener since its required for stack to + // know we support it... ech. + + protected static final int SL_REQUEST_TYPE_INITIAL = 0; + protected static final int SL_REQUEST_TYPE_INTERMEDIATE = 1; + + protected ServerSySession serverSySession; + protected int ccRequestNumber = 0; + + protected List> stateChanges = new ArrayList>(); // state changes + + public void init(InputStream configStream, String clientID) throws Exception { + try { + super.init(configStream, clientID, ApplicationId.createByAuthAppId(0, 4)); + SySessionFactoryImpl creditControlSessionFactory = new SySessionFactoryImpl(this.sessionFactory); + sessionFactory.registerAppFactory(ServerSySession.class, creditControlSessionFactory); + sessionFactory.registerAppFactory(ClientSySession.class, creditControlSessionFactory); + + /*creditControlSessionFactory.setStateListener(this); + creditControlSessionFactory.setServerSessionListener(this); + creditControlSessionFactory.setServerContextListener(this);*/ + + } + finally { + try { + configStream.close(); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + } + + // ----------- delegate methods so + + public void start() throws IllegalDiameterStateException, InternalException { + stack.start(); + } + + public void start(Mode mode, long timeOut, TimeUnit timeUnit) throws IllegalDiameterStateException, InternalException { + stack.start(mode, timeOut, timeUnit); + } + + public void stop(long timeOut, TimeUnit timeUnit, int disconnectCause) throws IllegalDiameterStateException, InternalException { + stack.stop(timeOut, timeUnit, disconnectCause); + } + + public void stop(int disconnectCause) { + stack.stop(disconnectCause); + } + + // ----------- conf parts + + /*@Override + public void sessionSupervisionTimerExpired(ServerCCASession session) { + // NOP + } + + @Override + public void sessionSupervisionTimerStarted(ServerCCASession session, ScheduledFuture future) { + // NOP + } + + @Override + public void sessionSupervisionTimerReStarted(ServerCCASession session, ScheduledFuture future) { + // NOP + } + + @Override + public void sessionSupervisionTimerStopped(ServerCCASession session, ScheduledFuture future) { + // NOP + } + + @Override + public long getDefaultValidityTime() { + return 120; + } + + public String getSessionId() { + return this.serverCCASession.getSessionId(); + } + + public void fetchSession(String sessionId) throws InternalException { + this.serverCCASession = stack.getSession(sessionId, ServerCCASession.class); + } + + public ServerCCASession getSession() { + return this.serverCCASession; + } + + public List> getStateChanges() { + return stateChanges; + }*/ +} diff --git a/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/sy/base/Client.java b/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/sy/base/Client.java new file mode 100644 index 000000000..be7795810 --- /dev/null +++ b/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/sy/base/Client.java @@ -0,0 +1,164 @@ +/* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, Telestax Inc and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + */ + +package org.mobicents.diameter.stack.functional.sy.base; + +import org.jdiameter.api.*; +import org.jdiameter.api.auth.events.SessionTermAnswer; +import org.jdiameter.api.auth.events.SessionTermRequest; +import org.jdiameter.api.sy.ClientSySession; +import org.jdiameter.api.sy.events.SpendingLimitAnswer; +import org.jdiameter.api.sy.events.SpendingLimitRequest; +import org.jdiameter.api.sy.events.SpendingStatusNotificationAnswer; +import org.jdiameter.api.sy.events.SpendingStatusNotificationRequest; +import org.jdiameter.common.impl.app.auth.SessionTermRequestImpl; +import org.mobicents.diameter.stack.functional.Utils; +import org.mobicents.diameter.stack.functional.sy.AbstractClient; + +/** + * Policy and charging control, Spending Limit Report - Sy tests + * + * @author Alejandro Ferreira Guido + */ + +public class Client extends AbstractClient { + + protected boolean sentINITIAL; + protected boolean sentINTERMEDIATE; + protected boolean sentSTATUSNOTIFICATION; + protected boolean sentTERMINATE; + protected boolean receivedINITIAL; + protected boolean receivedINTERMEDIATE; + protected boolean receivedSTATUSNOTIFICATION; + protected boolean receivedTERMINATE; + + public Client() { + } + + public void sendInitial() throws Exception { + SpendingLimitRequest initialRequest = super.createSLR(SL_REQUEST_TYPE_INITIAL, this.slRequestNumber, super.clientSySession); + this.slRequestNumber++; + super.clientSySession.sendSpendingLimitRequest(initialRequest); + Utils.printMessage(log, super.stack.getDictionary(), initialRequest.getMessage(), true); + + this.sentINITIAL = true; + } + + public void sendIntermediate() throws Exception { + if (!receivedINITIAL) { + throw new Exception(); + } + + SpendingLimitRequest initialRequest = super.createSLR(SL_REQUEST_TYPE_INTERMEDIATE, this.slRequestNumber, super.clientSySession); + this.slRequestNumber++; + super.clientSySession.sendSpendingLimitRequest(initialRequest); + Utils.printMessage(log, super.stack.getDictionary(), initialRequest.getMessage(), true); + + this.sentINTERMEDIATE = true; + } + + public void sendTerminate() throws Exception { + if (!receivedINTERMEDIATE) { + throw new Exception(); + } + + SessionTermRequest terminateRequest = new SessionTermRequestImpl(null, 0, "realm.com", "realm.com"); + this.slRequestNumber++; + super.clientSySession.sendFinalSpendingLimitRequest(terminateRequest); + Utils.printMessage(log, super.stack.getDictionary(), terminateRequest.getMessage(), true); + + this.sentTERMINATE = true; + } + + public void sendStatusNotification() throws Exception { + SpendingStatusNotificationAnswer statusNotificationAnswer = super.createSNR(this.slRequestNumber, super.clientSySession); + this.slRequestNumber++; + super.clientSySession.sendSpendingStatusNotificationAnswer(null); + Utils.printMessage(log, super.stack.getDictionary(), statusNotificationAnswer.getMessage(), true); + + this.sentSTATUSNOTIFICATION = true; + } + + public boolean isSentINITIAL() { + return sentINITIAL; + } + + public boolean isSentINTERMEDIATE() { + return sentINTERMEDIATE; + } + + public boolean isSentTERMINATE() { + return sentTERMINATE; + } + + public boolean isReceivedINITIAL() { + return receivedINITIAL; + } + + public boolean isReceivedINTERMEDIATE() { + return receivedINTERMEDIATE; + } + + public boolean isReceivedTERMINATE() { + return receivedTERMINATE; + } + + @Override + public void doSpendingLimitAnswer(ClientSySession session, SpendingLimitRequest request, SpendingLimitAnswer answer) throws InternalException, IllegalDiameterStateException, RouteException, OverloadException { + try { + Utils.printMessage(log, super.stack.getDictionary(), answer.getMessage(), false); + switch (answer.getRequestSLTypeAVPValue()) { + case SL_REQUEST_TYPE_INITIAL: + if (receivedINITIAL) { + fail("Received INITIAL more than once!", null); + } + receivedINITIAL = true; + break; + + case SL_REQUEST_TYPE_INTERMEDIATE: + if (receivedINTERMEDIATE) { + fail("Received INTERIM more than once!", null); + } + receivedINTERMEDIATE = true; + break; + + default: + } + + } + catch (Exception e) { + e.printStackTrace(); + } + } + + @Override + public void doFinalSpendingLimitAnswer(ClientSySession session, SessionTermRequest request, SessionTermAnswer answer) throws InternalException, IllegalDiameterStateException, RouteException, OverloadException { + Utils.printMessage(log, super.stack.getDictionary(), answer.getMessage(), false); + if (receivedTERMINATE) { + fail("Received TERMINATE more than once!", null); + } + receivedTERMINATE = true; + } + + @Override + public void doSpendingStatusNotificationRequest(ClientSySession session, SpendingStatusNotificationRequest request) throws InternalException, IllegalDiameterStateException, RouteException, OverloadException { + Utils.printMessage(log, super.stack.getDictionary(), request.getMessage(), false); + receivedSTATUSNOTIFICATION = true; + } +} diff --git a/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/sy/base/Server.java b/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/sy/base/Server.java new file mode 100644 index 000000000..6a43b423a --- /dev/null +++ b/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/sy/base/Server.java @@ -0,0 +1,185 @@ +/* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, Telestax Inc and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + */ + +package org.mobicents.diameter.stack.functional.sy.base; + +import org.jdiameter.api.*; +import org.jdiameter.api.auth.events.SessionTermAnswer; +import org.jdiameter.api.auth.events.SessionTermRequest; +import org.jdiameter.api.sy.ServerSySession; +import org.jdiameter.api.sy.events.SpendingLimitAnswer; +import org.jdiameter.api.sy.events.SpendingLimitRequest; + +import org.jdiameter.api.sy.events.SpendingStatusNotificationAnswer; +import org.jdiameter.api.sy.events.SpendingStatusNotificationRequest; +import org.jdiameter.common.impl.app.auth.SessionTermAnswerImpl; +import org.jdiameter.common.impl.app.sy.SpendingLimitAnswerImpl; +import org.mobicents.diameter.stack.functional.Utils; +import org.mobicents.diameter.stack.functional.sy.AbstractServer; + +/** + * Policy and charging control, Spending Limit Report - Sy tests + * + * @author Alejandro Ferreira Guido + */ + +public class Server extends AbstractServer { + + protected boolean sentINITIAL; + protected boolean sentINTERMEDIATE; + protected boolean sentTERMINATE; + protected boolean receiveINITIAL; + protected boolean receiveINTERMEDIATE; + protected boolean receiveTERMINATE; + + protected SpendingLimitRequest request; + + public void sendInitial() throws Exception { + if (!this.receiveINITIAL || this.request == null) { + fail("Did not receive INITIAL or answer already sent.", null); + throw new Exception("Request: " + this.request); + } + + SpendingLimitAnswer answer = new SpendingLimitAnswerImpl((Request) request.getMessage(), 2001); + /*AvpSet reqSet = request.getMessage().getAvps(); + AvpSet set = answer.getMessage().getAvps(); + set.removeAvp(Avp.DESTINATION_HOST); + set.removeAvp(Avp.DESTINATION_REALM); + set.addAvp(reqSet.getAvp(Avp.CC_REQUEST_TYPE), reqSet.getAvp(Avp.CC_REQUEST_NUMBER), reqSet.getAvp(Avp.AUTH_APPLICATION_ID));*/ + + super.serverSySession.sendSpendingLimitAnswer(answer); + + sentINITIAL = true; + request = null; + Utils.printMessage(log, super.stack.getDictionary(), answer.getMessage(), true); + } + + public void sendIntermediate() throws Exception { + if (!this.receiveINTERMEDIATE || this.request == null) { + fail("Did not receive INTERIM or answer already sent.", null); + throw new Exception("Request: " + this.request); + } + + SpendingLimitAnswer answer = new SpendingLimitAnswerImpl((Request) request.getMessage(), 2001); + + /*AvpSet reqSet = request.getMessage().getAvps(); + AvpSet set = answer.getMessage().getAvps(); + set.removeAvp(Avp.DESTINATION_HOST); + set.removeAvp(Avp.DESTINATION_REALM); + set.addAvp(reqSet.getAvp(Avp.CC_REQUEST_TYPE), reqSet.getAvp(Avp.CC_REQUEST_NUMBER), reqSet.getAvp(Avp.AUTH_APPLICATION_ID));*/ + + super.serverSySession.sendSpendingLimitAnswer(answer); + sentINTERMEDIATE = true; + request = null; + Utils.printMessage(log, super.stack.getDictionary(), answer.getMessage(), true); + } + + public void sendTerminate() throws Exception { + if (!this.receiveTERMINATE || this.request == null) { + fail("Did not receive TERMINATE or answer already sent.", null); + throw new Exception("Request: " + this.request); + } + + SessionTermAnswer answer = new SessionTermAnswerImpl((Request) request.getMessage(), 2001); + + /*AvpSet reqSet = request.getMessage().getAvps(); + AvpSet set = answer.getMessage().getAvps(); + set.removeAvp(Avp.DESTINATION_HOST); + set.removeAvp(Avp.DESTINATION_REALM); + set.addAvp(reqSet.getAvp(Avp.CC_REQUEST_TYPE), reqSet.getAvp(Avp.CC_REQUEST_NUMBER), reqSet.getAvp(Avp.AUTH_APPLICATION_ID));*/ + + super.serverSySession.sendFinalSpendingLimitAnswer(answer); + + sentTERMINATE = true; + request = null; + Utils.printMessage(log, super.stack.getDictionary(), answer.getMessage(), true); + } + + @Override + public Answer processRequest(Request request) { + int commandCode = request.getCommandCode(); + switch(commandCode) { + case 8388635: + case 8388636: + case 275: + break; + default: + fail("Received Request with code not equal 272!. Code[" + request.getCommandCode() + "]", null); + return null; + } + + if (super.serverSySession == null) { + try { + super.serverSySession = this.sessionFactory.getNewAppSession(request.getSessionId(), getApplicationId(), ServerSySession.class, (Object) null); + ((NetworkReqListener) this.serverSySession).processRequest(request); + } + catch (Exception e) { + fail(null, e); + } + } else { + // do fail? + fail("Received Request in base listener, not in app specific!", null); + } + + return null; + } + + public boolean isSentINITIAL() { + return sentINITIAL; + } + + public boolean isSentINTERMEDIATE() { + return sentINTERMEDIATE; + } + + public boolean isSentTERMINATE() { + return sentTERMINATE; + } + + public boolean isReceiveINITIAL() { + return receiveINITIAL; + } + + public boolean isReceiveINTERMEDIATE() { + return receiveINTERMEDIATE; + } + + public boolean isReceiveTERMINATE() { + return receiveTERMINATE; + } + + public SpendingLimitRequest getRequest() { + return request; + } + + @Override + public void doSpendingLimitRequest(ServerSySession session, SpendingLimitRequest request) throws InternalException, IllegalDiameterStateException, RouteException, OverloadException { + + } + + @Override + public void doFinalSpendingLimitRequest(ServerSySession session, SessionTermRequest request) throws InternalException, IllegalDiameterStateException, RouteException, OverloadException { + + } + + @Override + public void doSpendingStatusNotificationAnswer(ServerSySession session, SpendingStatusNotificationRequest request, SpendingStatusNotificationAnswer answer) throws InternalException, IllegalDiameterStateException, RouteException, OverloadException { + + } +} diff --git a/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/sy/base/SySessionBasicFlowTest.java b/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/sy/base/SySessionBasicFlowTest.java new file mode 100644 index 000000000..3e88ed377 --- /dev/null +++ b/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/sy/base/SySessionBasicFlowTest.java @@ -0,0 +1,229 @@ +/* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, Telestax Inc and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + */ + +package org.mobicents.diameter.stack.functional.sy.base; + +import org.jdiameter.api.*; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; + +import java.io.File; +import java.io.FileInputStream; +import java.net.URI; +import java.util.Arrays; +import java.util.Collection; +import java.util.List; +import java.util.concurrent.TimeUnit; + +import static org.junit.Assert.fail; + +/** + * Policy and charging control, Spending Limit Report - Sy tests + * + * @author Alejandro Ferreira Guido + */ + +@RunWith(Parameterized.class) +public class SySessionBasicFlowTest { + + private URI clientConfigUri; + private URI serverConfigUri; + + private Client clientNode; + private Server serverNode; + + /** + * @param clientConfigUri + * @param serverConfigUri + */ + public SySessionBasicFlowTest(String clientConfigUri, String serverConfigUri) throws Exception { + super(); + + this.clientConfigUri = new URI(clientConfigUri); + this.serverConfigUri = new URI(serverConfigUri); + } + + @Before + public void setUp() throws Exception { + try { + this.clientNode = new Client(); + this.serverNode = new Server(); + + this.serverNode.init(new FileInputStream(new File(this.serverConfigUri)), "SERVER-SY"); + this.serverNode.start(); + + this.clientNode.init(new FileInputStream(new File(this.clientConfigUri)), "CLIENT-SY"); + this.clientNode.start(Mode.ANY_PEER, 10, TimeUnit.SECONDS); + Stack stack = this.clientNode.getStack(); + + List peers = stack.unwrap(PeerTable.class).getPeerTable(); + if (peers.size() == 1) { + // ok + } else if (peers.size() > 1) { + // works better with replicated, since disconnected peers are also listed + boolean foundConnected = false; + for (Peer p : peers) { + if (p.getState(PeerState.class).equals(PeerState.OKAY)) { + if (foundConnected) { + throw new Exception("Wrong number of connected peers: " + peers); + } + foundConnected = true; + } + } + } + else { + throw new Exception("Wrong number of connected peers: " + peers); + } + } + catch (Throwable e) { + e.printStackTrace(); + } + } + + @After + public void tearDown() { + if (this.serverNode != null) { + try { + this.serverNode.stop(DisconnectCause.REBOOTING); + } + catch (Exception e) { + } + this.serverNode = null; + } + + if (this.clientNode != null) { + try { + this.clientNode.stop(DisconnectCause.REBOOTING); + } + catch (Exception e) { + } + this.clientNode = null; + } + } + + @Test + public void testBasicFlow() throws Exception { + try { + // pain of parameter tests :) ? + clientNode.sendInitial(); + waitForMessage(); + + serverNode.sendInitial(); + waitForMessage(); + + clientNode.sendIntermediate(); + waitForMessage(); + + serverNode.sendIntermediate(); + waitForMessage(); + + clientNode.sendTerminate(); + waitForMessage(); + + serverNode.sendTerminate(); + waitForMessage(); + } + catch (Exception e) { + e.printStackTrace(); + fail(e.toString()); + } + + if (!clientNode.isReceivedINITIAL()) { + StringBuilder sb = new StringBuilder("Did not receive INITIAL! "); + sb.append("Client ER:\n").append(clientNode.createErrorReport(this.clientNode.getErrors())); + + fail(sb.toString()); + } + if (!clientNode.isReceivedINTERMEDIATE()) { + StringBuilder sb = new StringBuilder("Did not receive INTERIM! "); + sb.append("Client ER:\n").append(clientNode.createErrorReport(this.clientNode.getErrors())); + + fail(sb.toString()); + } + if (!clientNode.isReceivedTERMINATE()) { + StringBuilder sb = new StringBuilder("Did not receive TERMINATE! "); + sb.append("Client ER:\n").append(clientNode.createErrorReport(this.clientNode.getErrors())); + + fail(sb.toString()); + } + if (!clientNode.isPassed()) { + StringBuilder sb = new StringBuilder(); + sb.append("Client ER:\n").append(clientNode.createErrorReport(this.clientNode.getErrors())); + + fail(sb.toString()); + } + + if (!serverNode.isReceiveINITIAL()) { + StringBuilder sb = new StringBuilder("Did not receive INITIAL! "); + sb.append("Server ER:\n").append(serverNode.createErrorReport(this.serverNode.getErrors())); + + fail(sb.toString()); + } + else if (!serverNode.isReceiveINTERMEDIATE()) { + StringBuilder sb = new StringBuilder("Did not receive INTERIM! "); + sb.append("Server ER:\n").append(serverNode.createErrorReport(this.serverNode.getErrors())); + + fail(sb.toString()); + } + else if (!serverNode.isReceiveTERMINATE()) { + StringBuilder sb = new StringBuilder("Did not receive TERMINATE! "); + sb.append("Server ER:\n").append(serverNode.createErrorReport(this.serverNode.getErrors())); + + fail(sb.toString()); + } + if (!serverNode.isPassed()) { + StringBuilder sb = new StringBuilder(); + sb.append("Server ER:\n").append(serverNode.createErrorReport(this.serverNode.getErrors())); + + fail(sb.toString()); + } + } + + @Parameters + public static Collection data() { + String client = "configurations/functional-sy/config-client.xml"; + String server = "configurations/functional-sy/config-server.xml"; + + //String replicatedClient = "configurations/functional-sy/replicated-config-client.xml"; + //String replicatedServer = "configurations/functional-sy/replicated-config-server.xml"; + + Class t = SySessionBasicFlowTest.class; + client = t.getClassLoader().getResource(client).toString(); + server = t.getClassLoader().getResource(server).toString(); + //replicatedClient = t.getClassLoader().getResource(replicatedClient).toString(); + //replicatedServer = t.getClassLoader().getResource(replicatedServer).toString(); + + // return Arrays.asList(new Object[][] { { client, server }, { replicatedClient, replicatedServer } }); + return Arrays.asList(new Object[][] { { client, server } }); + } + + private void waitForMessage() { + try { + Thread.sleep(2000); + } + catch (InterruptedException e) { + e.printStackTrace(); + } + } + +} diff --git a/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/sy/base/SySessionFTFlowTest.java b/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/sy/base/SySessionFTFlowTest.java new file mode 100644 index 000000000..494f40ec7 --- /dev/null +++ b/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/sy/base/SySessionFTFlowTest.java @@ -0,0 +1,277 @@ +/* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, Telestax Inc and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + */ + +package org.mobicents.diameter.stack.functional.sy.base; + +import org.jdiameter.api.*; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; + +import java.io.File; +import java.io.FileInputStream; +import java.net.URI; +import java.util.Arrays; +import java.util.Collection; +import java.util.List; +import java.util.concurrent.TimeUnit; + +import static org.junit.Assert.fail; + +/** + * Policy and charging control, Spending Limit Report - Sy tests + * + * @author Alejandro Ferreira Guido + */ + +@RunWith(Parameterized.class) +public class SySessionFTFlowTest { + + private Client clientNode; + private Server serverNode1; + private Server serverNode2; + private URI clientConfigUri; + private URI serverNode1ConfigUri; + private URI serverNode2ConfigUri; + + /** + * + */ + public SySessionFTFlowTest(String clientConfigUri, String serverNode1ConfigUri, String serverNode2ConfigUri) throws Exception { + super(); + this.clientConfigUri = new URI(clientConfigUri); + this.serverNode1ConfigUri = new URI(serverNode1ConfigUri); + if (!serverNode2ConfigUri.equals("")) { + this.serverNode2ConfigUri = new URI(serverNode2ConfigUri); + } + } + + @Before + public void setUp() throws Exception { + try { + this.clientNode = new Client(); + this.serverNode1 = new Server(); + + if (this.serverNode2ConfigUri != null) { + this.serverNode2 = new Server(); + this.serverNode2.init(new FileInputStream(new File(this.serverNode2ConfigUri)), "SERVER2"); + this.serverNode2.start(); + } + + this.serverNode1.init(new FileInputStream(new File(this.serverNode1ConfigUri)), "SERVER1"); + this.serverNode1.start(); + + this.clientNode.init(new FileInputStream(new File(this.clientConfigUri)), "CLIENT"); + this.clientNode.start(Mode.ALL_PEERS, 10, TimeUnit.SECONDS); + + Stack stack = this.clientNode.getStack(); + List peers = stack.unwrap(PeerTable.class).getPeerTable(); + if (this.serverNode2 == null && peers.size() == 1) { + // ok + } + else if (this.serverNode2 != null && peers.size() == 2) { + // ok + } + else { + throw new Exception("Wrong number of connected peers: " + peers); + } + // give a wait time for cluster, it should be up and running without that, but... :) + // ammendonca: commented, was throwing java.lang.IllegalMonitorStateException + // Thread.currentThread().wait(15000); + } + catch (Throwable e) { + e.printStackTrace(); + } + } + + @After + public void tearDown() { + if (this.serverNode2 != null) { + try { + this.serverNode2.stop(DisconnectCause.REBOOTING); + } + catch (Exception e) { + + } + this.serverNode2 = null; + } + + if (this.serverNode1 != null) { + try { + this.serverNode1.stop(DisconnectCause.REBOOTING); + } + catch (Exception e) { + + } + this.serverNode1 = null; + } + + if (this.clientNode != null) { + try { + this.clientNode.stop(DisconnectCause.REBOOTING); + } + catch (Exception e) { + + } + this.clientNode = null; + } + } + + @Test + public void testBasicFlow() throws Exception { + Server backupServer = null; // server which we will use. + Server serverToKill = null; + try { + + clientNode.sendInitial(); + waitForMessage(); + + // now lets check which server node got the msg. + if (serverNode1.isReceiveINITIAL()) { + backupServer = serverNode2; + serverToKill = serverNode1; + } + else { + backupServer = serverNode1; + serverToKill = serverNode2; + } + + serverToKill.sendInitial(); + waitForMessage(); + + // kill + serverToKill.stop(15, TimeUnit.SECONDS, DisconnectCause.REBOOTING); + + // now we have to update second server, so it gets session; + //backupServer.fetchSession(clientNode.getSessionId()); + + clientNode.sendIntermediate(); + waitForMessage(); + + clientNode.sendTerminate(); + waitForMessage(); + + backupServer.sendTerminate(); + waitForMessage(); + } + catch (Exception e) { + e.printStackTrace(); + fail(e.toString()); + } + + if (!clientNode.isReceivedINITIAL()) { + StringBuilder sb = new StringBuilder("Did not receive INITIAL! "); + sb.append("Client ER:\n").append(clientNode.createErrorReport(this.clientNode.getErrors())); + + fail(sb.toString()); + } + if (!clientNode.isReceivedINTERMEDIATE()) { + StringBuilder sb = new StringBuilder("Did not receive INTERIM! "); + sb.append("Client ER:\n").append(clientNode.createErrorReport(this.clientNode.getErrors())); + + fail(sb.toString()); + } + if (!clientNode.isReceivedTERMINATE()) { + StringBuilder sb = new StringBuilder("Did not receive TERMINATE! "); + sb.append("Client ER:\n").append(clientNode.createErrorReport(this.clientNode.getErrors())); + + fail(sb.toString()); + } + if (!clientNode.isPassed()) { + StringBuilder sb = new StringBuilder(); + sb.append("Client ER:\n").append(clientNode.createErrorReport(this.clientNode.getErrors())); + + fail(sb.toString()); + } + + if (backupServer != null) { + if (backupServer.isReceiveINITIAL()) { + StringBuilder sb = new StringBuilder("Received INITIAL! "); + sb.append("Server ER:\n").append(backupServer.createErrorReport(backupServer.getErrors())); + + fail(sb.toString()); + } + + if (!backupServer.isReceiveTERMINATE()) { + StringBuilder sb = new StringBuilder("Did not receive TERMINATE! "); + sb.append("Server ER:\n").append(backupServer.createErrorReport(backupServer.getErrors())); + + fail(sb.toString()); + } + + if (!backupServer.isPassed()) { + StringBuilder sb = new StringBuilder(); + sb.append("Server ER:\n").append(backupServer.createErrorReport(backupServer.getErrors())); + + fail(sb.toString()); + } + + } + if (serverToKill != null) { + if (!serverToKill.isReceiveINITIAL()) { + StringBuilder sb = new StringBuilder("Did not receive INITIAL! "); + sb.append("Server ER:\n").append(serverToKill.createErrorReport(serverToKill.getErrors())); + + fail(sb.toString()); + } + + if (serverToKill.isReceiveTERMINATE()) { + StringBuilder sb = new StringBuilder("Received TERMINATE! "); + sb.append("Server ER:\n").append(serverToKill.createErrorReport(serverToKill.getErrors())); + + fail(sb.toString()); + } + + if (!serverToKill.isPassed()) { + StringBuilder sb = new StringBuilder(); + sb.append("Server ER:\n").append(serverToKill.createErrorReport(backupServer.getErrors())); + + fail(sb.toString()); + } + } + } + + @Parameters + public static Collection data() { + String replicatedClient = "configurations/functional-sy/replicated-config-client.xml"; + String replicatedServer1 = "configurations/functional-sy/replicated-config-server-node1.xml"; + String replicatedServer2 = "configurations/functional-sy/replicated-config-server-node2.xml"; + + Class t = SySessionFTFlowTest.class; + + replicatedClient = t.getClassLoader().getResource(replicatedClient).toString(); + replicatedServer1 = t.getClassLoader().getResource(replicatedServer1).toString(); + replicatedServer2 = t.getClassLoader().getResource(replicatedServer2).toString(); + + return Arrays.asList(new Object[][] { { replicatedClient, replicatedServer1, replicatedServer2 } }); + } + + private void waitForMessage() { + try { + Thread.sleep(2000); + } + catch (InterruptedException e) { + e.printStackTrace(); + } + } + +} diff --git a/testsuite/tests/src/test/java/org/mobicents/diameter/stack/sessions/SessionsWithAppIdTest.java b/testsuite/tests/src/test/java/org/mobicents/diameter/stack/sessions/SessionsWithAppIdTest.java index 33b8150eb..a33c5f684 100644 --- a/testsuite/tests/src/test/java/org/mobicents/diameter/stack/sessions/SessionsWithAppIdTest.java +++ b/testsuite/tests/src/test/java/org/mobicents/diameter/stack/sessions/SessionsWithAppIdTest.java @@ -110,7 +110,7 @@ public class SessionsWithAppIdTest { @Test public void testAccountingClientSessionHasAppId() throws Exception { - ((ISessionFactory) sessionFactory).registerAppFacory(ClientAccSession.class, new AccSessionFactoryImpl(sessionFactory)); + ((ISessionFactory) sessionFactory).registerAppFactory(ClientAccSession.class, new AccSessionFactoryImpl(sessionFactory)); ClientAccSession session = sessionFactory.getNewAppSession("accesspoint7.acme.com;1876543210;" + lowSessionId++, BASE_ACCT_APPID, ClientAccSession.class); ApplicationId sessionAppId = session.getSessionAppId(); @@ -119,7 +119,7 @@ public void testAccountingClientSessionHasAppId() throws Exception { @Test public void testAccountingServerSessionHasAppId() throws Exception { - ((ISessionFactory) sessionFactory).registerAppFacory(ServerAccSession.class, new AccSessionFactoryImpl(sessionFactory)); + ((ISessionFactory) sessionFactory).registerAppFactory(ServerAccSession.class, new AccSessionFactoryImpl(sessionFactory)); ServerAccSession session = sessionFactory.getNewAppSession("accesspoint7.acme.com;1876543210;" + lowSessionId++, BASE_ACCT_APPID, ServerAccSession.class); ApplicationId sessionAppId = session.getSessionAppId(); @@ -128,7 +128,7 @@ public void testAccountingServerSessionHasAppId() throws Exception { @Test public void tesAuthClientSessionHasAppId() throws Exception { - ((ISessionFactory) sessionFactory).registerAppFacory(ClientAuthSession.class, new AuthSessionFactoryImpl(sessionFactory)); + ((ISessionFactory) sessionFactory).registerAppFactory(ClientAuthSession.class, new AuthSessionFactoryImpl(sessionFactory)); ClientAuthSession session = sessionFactory.getNewAppSession("accesspoint7.acme.com;1876543210;" + lowSessionId++, BASE_AUTH_APPID, ClientAuthSession.class); ApplicationId sessionAppId = session.getSessionAppId(); @@ -137,7 +137,7 @@ public void tesAuthClientSessionHasAppId() throws Exception { @Test public void testAuthServerSessionHasAppId() throws Exception { - ((ISessionFactory) sessionFactory).registerAppFacory(ServerAuthSession.class, new AuthSessionFactoryImpl(sessionFactory)); + ((ISessionFactory) sessionFactory).registerAppFactory(ServerAuthSession.class, new AuthSessionFactoryImpl(sessionFactory)); ServerAuthSession session = sessionFactory.getNewAppSession("accesspoint7.acme.com;1876543210;" + lowSessionId++, BASE_AUTH_APPID, ServerAuthSession.class); ApplicationId sessionAppId = session.getSessionAppId(); @@ -146,7 +146,7 @@ public void testAuthServerSessionHasAppId() throws Exception { @Test public void testCCAClientSessionHasAppId() throws Exception { - ((ISessionFactory) sessionFactory).registerAppFacory(ClientCCASession.class, new CCASessionFactoryImpl(sessionFactory)); + ((ISessionFactory) sessionFactory).registerAppFactory(ClientCCASession.class, new CCASessionFactoryImpl(sessionFactory)); ClientCCASession session = sessionFactory.getNewAppSession("accesspoint7.acme.com;1876543210;" + lowSessionId++, CCA_APPID, ClientCCASession.class); ApplicationId sessionAppId = session.getSessionAppId(); @@ -155,7 +155,7 @@ public void testCCAClientSessionHasAppId() throws Exception { @Test public void testCCAServerSessionHasAppId() throws Exception { - ((ISessionFactory) sessionFactory).registerAppFacory(ServerCCASession.class, new CCASessionFactoryImpl(sessionFactory)); + ((ISessionFactory) sessionFactory).registerAppFactory(ServerCCASession.class, new CCASessionFactoryImpl(sessionFactory)); ServerCCASession session = sessionFactory.getNewAppSession("accesspoint7.acme.com;1876543210;" + lowSessionId++, CCA_APPID, ServerCCASession.class); ApplicationId sessionAppId = session.getSessionAppId(); @@ -164,7 +164,7 @@ public void testCCAServerSessionHasAppId() throws Exception { @Test public void testRoClientSessionHasAppId() throws Exception { - ((ISessionFactory) sessionFactory).registerAppFacory(ClientRoSession.class, new RoSessionFactoryImpl(sessionFactory)); + ((ISessionFactory) sessionFactory).registerAppFactory(ClientRoSession.class, new RoSessionFactoryImpl(sessionFactory)); ClientRoSession session = sessionFactory.getNewAppSession("accesspoint7.acme.com;1876543210;" + lowSessionId++, RO_APPID, ClientRoSession.class); ApplicationId sessionAppId = session.getSessionAppId(); @@ -173,7 +173,7 @@ public void testRoClientSessionHasAppId() throws Exception { @Test public void testRoServerSessionHasAppId() throws Exception { - ((ISessionFactory) sessionFactory).registerAppFacory(ServerRoSession.class, new RoSessionFactoryImpl(sessionFactory)); + ((ISessionFactory) sessionFactory).registerAppFactory(ServerRoSession.class, new RoSessionFactoryImpl(sessionFactory)); ServerRoSession session = sessionFactory.getNewAppSession("accesspoint7.acme.com;1876543210;" + lowSessionId++, RO_APPID, ServerRoSession.class); ApplicationId sessionAppId = session.getSessionAppId(); @@ -182,7 +182,7 @@ public void testRoServerSessionHasAppId() throws Exception { @Test public void testRfClientSessionHasAppId() throws Exception { - ((ISessionFactory) sessionFactory).registerAppFacory(ClientRfSession.class, new RfSessionFactoryImpl(sessionFactory)); + ((ISessionFactory) sessionFactory).registerAppFactory(ClientRfSession.class, new RfSessionFactoryImpl(sessionFactory)); ClientRfSession session = sessionFactory.getNewAppSession("accesspoint7.acme.com;1876543210;" + lowSessionId++, RF_APPID, ClientRfSession.class); ApplicationId sessionAppId = session.getSessionAppId(); @@ -191,7 +191,7 @@ public void testRfClientSessionHasAppId() throws Exception { @Test public void testRfServerSessionHasAppId() throws Exception { - ((ISessionFactory) sessionFactory).registerAppFacory(ServerRfSession.class, new RfSessionFactoryImpl(sessionFactory)); + ((ISessionFactory) sessionFactory).registerAppFactory(ServerRfSession.class, new RfSessionFactoryImpl(sessionFactory)); ServerRfSession session = sessionFactory.getNewAppSession("accesspoint7.acme.com;1876543210;" + lowSessionId++, RF_APPID, ServerRfSession.class); ApplicationId sessionAppId = session.getSessionAppId(); @@ -200,7 +200,7 @@ public void testRfServerSessionHasAppId() throws Exception { @Test public void testShClientSessionHasAppId() throws Exception { - ((ISessionFactory) sessionFactory).registerAppFacory(ClientShSession.class, new ShSessionFactoryImpl(sessionFactory)); + ((ISessionFactory) sessionFactory).registerAppFactory(ClientShSession.class, new ShSessionFactoryImpl(sessionFactory)); ClientShSession session = sessionFactory.getNewAppSession("accesspoint7.acme.com;1876543210;" + lowSessionId++, SH_APPID, ClientShSession.class); ApplicationId sessionAppId = session.getSessionAppId(); @@ -209,7 +209,7 @@ public void testShClientSessionHasAppId() throws Exception { @Test public void testShServerSessionHasAppId() throws Exception { - ((ISessionFactory) sessionFactory).registerAppFacory(ServerShSession.class, new ShSessionFactoryImpl(sessionFactory)); + ((ISessionFactory) sessionFactory).registerAppFactory(ServerShSession.class, new ShSessionFactoryImpl(sessionFactory)); ServerShSession session = sessionFactory.getNewAppSession("accesspoint7.acme.com;1876543210;" + lowSessionId++, SH_APPID, ServerShSession.class); ApplicationId sessionAppId = session.getSessionAppId(); @@ -218,7 +218,7 @@ public void testShServerSessionHasAppId() throws Exception { @Test public void testCxDxClientSessionHasAppId() throws Exception { - ((ISessionFactory) sessionFactory).registerAppFacory(ClientCxDxSession.class, new CxDxSessionFactoryImpl(sessionFactory)); + ((ISessionFactory) sessionFactory).registerAppFactory(ClientCxDxSession.class, new CxDxSessionFactoryImpl(sessionFactory)); ClientCxDxSession session = sessionFactory.getNewAppSession("accesspoint7.acme.com;1876543210;" + lowSessionId++, CXDX_APPID, ClientCxDxSession.class); ApplicationId sessionAppId = session.getSessionAppId(); @@ -227,7 +227,7 @@ public void testCxDxClientSessionHasAppId() throws Exception { @Test public void testCxDxServerSessionHasAppId() throws Exception { - ((ISessionFactory) sessionFactory).registerAppFacory(ServerCxDxSession.class, new CxDxSessionFactoryImpl(sessionFactory)); + ((ISessionFactory) sessionFactory).registerAppFactory(ServerCxDxSession.class, new CxDxSessionFactoryImpl(sessionFactory)); ServerCxDxSession session = sessionFactory.getNewAppSession("accesspoint7.acme.com;1876543210;" + lowSessionId++, CXDX_APPID, ServerCxDxSession.class); ApplicationId sessionAppId = session.getSessionAppId(); @@ -236,7 +236,7 @@ public void testCxDxServerSessionHasAppId() throws Exception { @Test public void testGqClientSessionHasAppId() throws Exception { - ((ISessionFactory) sessionFactory).registerAppFacory(GqClientSession.class, new GqSessionFactoryImpl(sessionFactory)); + ((ISessionFactory) sessionFactory).registerAppFactory(GqClientSession.class, new GqSessionFactoryImpl(sessionFactory)); GqClientSession session = sessionFactory.getNewAppSession("accesspoint7.acme.com;1876543210;" + lowSessionId++, GQ_APPID, GqClientSession.class); ApplicationId sessionAppId = session.getSessionAppId(); @@ -245,7 +245,7 @@ public void testGqClientSessionHasAppId() throws Exception { @Test public void testGqServerSessionHasAppId() throws Exception { - ((ISessionFactory) sessionFactory).registerAppFacory(GqServerSession.class, new GqSessionFactoryImpl(sessionFactory)); + ((ISessionFactory) sessionFactory).registerAppFactory(GqServerSession.class, new GqSessionFactoryImpl(sessionFactory)); GqServerSession session = sessionFactory.getNewAppSession("accesspoint7.acme.com;1876543210;" + lowSessionId++, GQ_APPID, GqServerSession.class); ApplicationId sessionAppId = session.getSessionAppId(); @@ -254,7 +254,7 @@ public void testGqServerSessionHasAppId() throws Exception { @Test public void testGxClientSessionHasAppId() throws Exception { - ((ISessionFactory) sessionFactory).registerAppFacory(ClientGxSession.class, new GxSessionFactoryImpl(sessionFactory)); + ((ISessionFactory) sessionFactory).registerAppFactory(ClientGxSession.class, new GxSessionFactoryImpl(sessionFactory)); ClientGxSession session = sessionFactory.getNewAppSession("accesspoint7.acme.com;1876543210;" + lowSessionId++, GX_APPID, ClientGxSession.class); ApplicationId sessionAppId = session.getSessionAppId(); @@ -263,7 +263,7 @@ public void testGxClientSessionHasAppId() throws Exception { @Test public void testGxServerSessionHasAppId() throws Exception { - ((ISessionFactory) sessionFactory).registerAppFacory(ServerGxSession.class, new GxSessionFactoryImpl(sessionFactory)); + ((ISessionFactory) sessionFactory).registerAppFactory(ServerGxSession.class, new GxSessionFactoryImpl(sessionFactory)); ServerGxSession session = sessionFactory.getNewAppSession("accesspoint7.acme.com;1876543210;" + lowSessionId++, GX_APPID, ServerGxSession.class); ApplicationId sessionAppId = session.getSessionAppId(); @@ -272,7 +272,7 @@ public void testGxServerSessionHasAppId() throws Exception { @Test public void testS13ClientSessionHasAppId() throws Exception { - ((ISessionFactory) sessionFactory).registerAppFacory(ClientS13Session.class, new S13SessionFactoryImpl(sessionFactory)); + ((ISessionFactory) sessionFactory).registerAppFactory(ClientS13Session.class, new S13SessionFactoryImpl(sessionFactory)); ClientS13Session session = sessionFactory.getNewAppSession("accesspoint7.acme.com;1876543210;" + lowSessionId++, S13_APPID, ClientS13Session.class); ApplicationId sessionAppId = session.getSessionAppId(); @@ -281,7 +281,7 @@ public void testS13ClientSessionHasAppId() throws Exception { @Test public void testS13ServerSessionHasAppId() throws Exception { - ((ISessionFactory) sessionFactory).registerAppFacory(ServerS13Session.class, new S13SessionFactoryImpl(sessionFactory)); + ((ISessionFactory) sessionFactory).registerAppFactory(ServerS13Session.class, new S13SessionFactoryImpl(sessionFactory)); ServerS13Session session = sessionFactory.getNewAppSession("accesspoint7.acme.com;1876543210;" + lowSessionId++, S13_APPID, ServerS13Session.class); ApplicationId sessionAppId = session.getSessionAppId(); diff --git a/testsuite/tests/src/test/resources/configurations/functional-sy/config-client.xml b/testsuite/tests/src/test/resources/configurations/functional-sy/config-client.xml new file mode 100644 index 000000000..3c8d96c28 --- /dev/null +++ b/testsuite/tests/src/test/resources/configurations/functional-sy/config-client.xml @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/testsuite/tests/src/test/resources/configurations/functional-sy/config-server.xml b/testsuite/tests/src/test/resources/configurations/functional-sy/config-server.xml new file mode 100644 index 000000000..33d74aa33 --- /dev/null +++ b/testsuite/tests/src/test/resources/configurations/functional-sy/config-server.xml @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/testsuite/tests/src/test/resources/dictionary.xml b/testsuite/tests/src/test/resources/dictionary.xml index 91bf1acf5..d12d46474 100644 --- a/testsuite/tests/src/test/resources/dictionary.xml +++ b/testsuite/tests/src/test/resources/dictionary.xml @@ -3469,8 +3469,10 @@ - + + + @@ -3649,8 +3651,349 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - --> + + @@ -5724,8 +6067,6 @@ - - @@ -6668,16 +7009,15 @@ - + @@ -7616,4 +7956,200 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 920b07f8a1448e25ca9ee867e2f12f0065ed458a Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 24 Mar 2017 09:24:01 -0300 Subject: [PATCH 17/17] Sy Impl - night build #006 added testsuite/tests/sy/... revert example/charging-server-simulator issue #44 added AVP's for Ro messages issue #43 --- .../src/main/java/org/jdiameter/api/sy/ClientSySession.java | 2 +- .../java/org/jdiameter/api/sy/ClientSySessionListener.java | 2 +- .../src/main/java/org/jdiameter/api/sy/ServerSySession.java | 2 +- .../java/org/jdiameter/api/sy/ServerSySessionListener.java | 2 +- .../java/org/jdiameter/api/sy/events/SpendingLimitAnswer.java | 2 -- .../org/jdiameter/api/sy/events/SpendingLimitRequest.java | 2 +- .../src/main/java/org/jdiameter/server/impl/sy/Event.java | 2 +- .../org/jdiameter/server/impl/sy/ServerSySessionImpl.java | 4 ++-- .../stack/functional/sy/base/SySessionFTFlowTest.java | 2 +- 9 files changed, 9 insertions(+), 11 deletions(-) diff --git a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ClientSySession.java b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ClientSySession.java index e0d67328c..8fd20039b 100644 --- a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ClientSySession.java +++ b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ClientSySession.java @@ -43,7 +43,7 @@ public interface ClientSySession extends AppSession, StateMachine { void sendSpendingLimitRequest(SpendingLimitRequest request) throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; - void sendFinalSpendingLimitRequest(SessionTermRequest request) + void sendSessionTerminationRequest(SessionTermRequest request) throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; void sendSpendingStatusNotificationAnswer(SpendingStatusNotificationAnswer answer) diff --git a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ClientSySessionListener.java b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ClientSySessionListener.java index 104cf7054..dd76f46e2 100644 --- a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ClientSySessionListener.java +++ b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ClientSySessionListener.java @@ -43,7 +43,7 @@ public interface ClientSySessionListener { void doSpendingLimitAnswer(ClientSySession session, SpendingLimitRequest request, SpendingLimitAnswer answer) throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; - void doFinalSpendingLimitAnswer(ClientSySession session, SessionTermRequest request, SessionTermAnswer answer) + void doSessionTerminationAnswer(ClientSySession session, SessionTermRequest request, SessionTermAnswer answer) throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; void doSpendingStatusNotificationRequest(ClientSySession session, SpendingStatusNotificationRequest request) diff --git a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ServerSySession.java b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ServerSySession.java index b23946814..c2f2f44f1 100644 --- a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ServerSySession.java +++ b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ServerSySession.java @@ -43,7 +43,7 @@ public interface ServerSySession extends AppSession, StateMachine { void sendSpendingLimitAnswer(SpendingLimitAnswer answer) throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; - void sendFinalSpendingLimitAnswer(SessionTermAnswer answer) + void sendSessionTerminationAnswer(SessionTermAnswer answer) throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; void sendSpendingStatusNotificationRequest(SpendingStatusNotificationRequest request) diff --git a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ServerSySessionListener.java b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ServerSySessionListener.java index 4dea364ab..1386b9a9f 100644 --- a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ServerSySessionListener.java +++ b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/ServerSySessionListener.java @@ -42,7 +42,7 @@ public interface ServerSySessionListener { void doSpendingLimitRequest(ServerSySession session, SpendingLimitRequest request) throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; - void doFinalSpendingLimitRequest(ServerSySession session, SessionTermRequest request) + void doSessionTerminationRequest(ServerSySession session, SessionTermRequest request) throws InternalException, IllegalDiameterStateException, RouteException, OverloadException; void doSpendingStatusNotificationAnswer(ServerSySession session, SpendingStatusNotificationRequest request, SpendingStatusNotificationAnswer answer) diff --git a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingLimitAnswer.java b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingLimitAnswer.java index 83ad7f4ce..fc398ab1d 100644 --- a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingLimitAnswer.java +++ b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingLimitAnswer.java @@ -35,6 +35,4 @@ public interface SpendingLimitAnswer extends AppAnswerEvent { int code = 8388635; - int getRequestSLTypeAVPValue(); - } diff --git a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingLimitRequest.java b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingLimitRequest.java index 276f6efa2..8b934b927 100644 --- a/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingLimitRequest.java +++ b/core/jdiameter/api/src/main/java/org/jdiameter/api/sy/events/SpendingLimitRequest.java @@ -36,5 +36,5 @@ public interface SpendingLimitRequest extends AppRequestEvent { int code = 8388635; - int getSLRequestTypeAVPValue(); + int getSLRequestType(); } diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/sy/Event.java b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/sy/Event.java index 5974722f3..90d7b7e0b 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/sy/Event.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/sy/Event.java @@ -71,7 +71,7 @@ public Event(boolean isRequest, SpendingLimitRequest request, SpendingLimitAnswe this.request = request; this.answer = answer; - int slRequestTypeAvpValue = request.getSLRequestTypeAVPValue(); + int slRequestTypeAvpValue = request.getSLRequestType(); if (isRequest) { switch (slRequestTypeAvpValue) { case 0: diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/sy/ServerSySessionImpl.java b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/sy/ServerSySessionImpl.java index 6c704e95b..2eb33d11b 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/sy/ServerSySessionImpl.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/sy/ServerSySessionImpl.java @@ -91,7 +91,7 @@ public void sendSpendingLimitAnswer(SpendingLimitAnswer answer) throws InternalE } @Override - public void sendFinalSpendingLimitAnswer(SessionTermAnswer answer) throws InternalException, IllegalDiameterStateException, RouteException, OverloadException { + public void sendSessionTerminationAnswer(SessionTermAnswer answer) throws InternalException, IllegalDiameterStateException, RouteException, OverloadException { handleEvent(new Event(false, null, answer)); } @@ -172,7 +172,7 @@ public boolean handleEvent(StateEvent event) throws InternalException, OverloadE listener.doSpendingLimitRequest(this, (SpendingLimitRequest) localEvent.getRequest()); break; case RECEIVED_TERMINATION: - listener.doFinalSpendingLimitRequest(this, (SessionTermRequest) localEvent.getRequest()); + listener.doSessionTerminationRequest(this, (SessionTermRequest) localEvent.getRequest()); break; } break; diff --git a/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/sy/base/SySessionFTFlowTest.java b/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/sy/base/SySessionFTFlowTest.java index 494f40ec7..0e7bb55b8 100644 --- a/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/sy/base/SySessionFTFlowTest.java +++ b/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/sy/base/SySessionFTFlowTest.java @@ -185,7 +185,7 @@ public void testBasicFlow() throws Exception { fail(sb.toString()); } if (!clientNode.isReceivedINTERMEDIATE()) { - StringBuilder sb = new StringBuilder("Did not receive INTERIM! "); + StringBuilder sb = new StringBuilder("Did not receive INTERMEDIATE! "); sb.append("Client ER:\n").append(clientNode.createErrorReport(this.clientNode.getErrors())); fail(sb.toString());