/protocols/ss7/m3ua/impl/src/test/java/org/mobicents/protocols/ss7/m3ua/impl/sg/ServerM3UAManagementTest.java

http://mobicents.googlecode.com/ · Java · 95 lines · 47 code · 17 blank · 31 comment · 0 complexity · 1b8e2efc1fff5deac9d62a5b03eae80b MD5 · raw file

  1. /*
  2. * JBoss, Home of Professional Open Source
  3. * Copyright 2011, Red Hat, Inc. and individual contributors
  4. * by the @authors tag. See the copyright.txt in the distribution for a
  5. * full listing of individual contributors.
  6. *
  7. * This is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU Lesser General Public License as
  9. * published by the Free Software Foundation; either version 2.1 of
  10. * the License, or (at your option) any later version.
  11. *
  12. * This software is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with this software; if not, write to the Free
  19. * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  20. * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  21. */
  22. package org.mobicents.protocols.ss7.m3ua.impl.sg;
  23. import static org.junit.Assert.assertEquals;
  24. import static org.junit.Assert.assertNotNull;
  25. import java.io.IOException;
  26. import org.junit.After;
  27. import org.junit.AfterClass;
  28. import org.junit.Before;
  29. import org.junit.BeforeClass;
  30. import org.junit.Test;
  31. import org.mobicents.protocols.ss7.m3ua.impl.As;
  32. import org.mobicents.protocols.ss7.m3ua.impl.AspFactory;
  33. /**
  34. * Test the serialization/de-serialization
  35. *
  36. * @author amit bhayani
  37. *
  38. */
  39. public class ServerM3UAManagementTest {
  40. private ServerM3UAManagement serverM3uaMgmt = new ServerM3UAManagement();
  41. /**
  42. *
  43. */
  44. public ServerM3UAManagementTest() {
  45. // TODO Auto-generated constructor stub
  46. }
  47. @BeforeClass
  48. public static void setUpClass() throws Exception {
  49. }
  50. @AfterClass
  51. public static void tearDownClass() throws Exception {
  52. }
  53. @Before
  54. public void setUp() throws Exception {
  55. serverM3uaMgmt.start();
  56. }
  57. @After
  58. public void tearDown() throws IOException {
  59. serverM3uaMgmt.getAppServers().clear();
  60. serverM3uaMgmt.getAspfactories().clear();
  61. serverM3uaMgmt.stop();
  62. }
  63. @Test
  64. public void testSerialization() throws Exception {
  65. As as = serverM3uaMgmt
  66. .createAppServer("m3ua ras create rc 100 rk dpc 123 opc 456 si 3 traffic-mode loadshare RAS1"
  67. .split(" "));
  68. AspFactory aspFactory = serverM3uaMgmt.createAspFactory("m3ua rasp create ip 127.0.0.1 port 2345 RASP1"
  69. .split(" "));
  70. serverM3uaMgmt.assignAspToAs("RAS1", "RASP1");
  71. serverM3uaMgmt.stop();
  72. ServerM3UAManagement serverM3uaMgmt1 = new ServerM3UAManagement();
  73. serverM3uaMgmt1.start();
  74. assertEquals(1, serverM3uaMgmt1.getAppServers().size());
  75. assertEquals(1, serverM3uaMgmt1.getAspfactories().size());
  76. assertNotNull(serverM3uaMgmt1.m3uaRouter.getAs(123, 456, (short) 3));
  77. }
  78. }