/protocols/ss7/m3ua/impl/src/test/java/org/mobicents/protocols/ss7/m3ua/impl/as/ClientM3UAManagementTest.java

http://mobicents.googlecode.com/ · Java · 94 lines · 46 code · 17 blank · 31 comment · 0 complexity · 9e8fe947d2d05e2c01ad840eabd569b5 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.as;
  23. import static org.junit.Assert.assertEquals;
  24. import java.io.IOException;
  25. import org.junit.After;
  26. import org.junit.AfterClass;
  27. import org.junit.Before;
  28. import org.junit.BeforeClass;
  29. import org.junit.Test;
  30. import org.mobicents.protocols.ss7.m3ua.impl.As;
  31. import org.mobicents.protocols.ss7.m3ua.impl.AspFactory;
  32. /**
  33. * Test the serialization/de-serialization
  34. *
  35. * @author amit bhayani
  36. *
  37. */
  38. public class ClientM3UAManagementTest {
  39. private ClientM3UAManagement clientM3UAMgmt = new ClientM3UAManagement();
  40. /**
  41. *
  42. */
  43. public ClientM3UAManagementTest() {
  44. // TODO Auto-generated constructor stub
  45. }
  46. @BeforeClass
  47. public static void setUpClass() throws Exception {
  48. }
  49. @AfterClass
  50. public static void tearDownClass() throws Exception {
  51. }
  52. @Before
  53. public void setUp() throws Exception {
  54. clientM3UAMgmt.start();
  55. }
  56. @After
  57. public void tearDown() throws IOException {
  58. clientM3UAMgmt.getAppServers().clear();
  59. clientM3UAMgmt.getAspfactories().clear();
  60. clientM3UAMgmt.getDpcVsAsName().clear();
  61. clientM3UAMgmt.stop();
  62. }
  63. @Test
  64. public void testSerialization() throws Exception {
  65. As as = clientM3UAMgmt.createAppServer("m3ua as create rc 100 AS1".split(" "));
  66. AspFactory aspFactory = clientM3UAMgmt
  67. .createAspFactory("m3ua asp create ip 127.0.0.1 port 1111 remip 127.0.0.1 remport 1112 ASP1".split(" "));
  68. clientM3UAMgmt.assignAspToAs("AS1", "ASP1");
  69. clientM3UAMgmt.addRouteAsForDpc(123, "AS1");
  70. clientM3UAMgmt.stop();
  71. ClientM3UAManagement clientM3UAMgmt1 = new ClientM3UAManagement();
  72. clientM3UAMgmt1.start();
  73. assertEquals(1, clientM3UAMgmt1.getAppServers().size());
  74. assertEquals(1, clientM3UAMgmt1.getAspfactories().size());
  75. assertEquals(1, clientM3UAMgmt1.getDpcVsAsName().size());
  76. }
  77. }