PageRenderTime 25ms CodeModel.GetById 8ms app.highlight 12ms RepoModel.GetById 1ms app.codeStats 0ms

/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
23package org.mobicents.protocols.ss7.m3ua.impl.sg;
24
25import static org.junit.Assert.assertEquals;
26import static org.junit.Assert.assertNotNull;
27
28import java.io.IOException;
29
30import org.junit.After;
31import org.junit.AfterClass;
32import org.junit.Before;
33import org.junit.BeforeClass;
34import org.junit.Test;
35import org.mobicents.protocols.ss7.m3ua.impl.As;
36import org.mobicents.protocols.ss7.m3ua.impl.AspFactory;
37
38/**
39 * Test the serialization/de-serialization
40 * 
41 * @author amit bhayani
42 * 
43 */
44public class ServerM3UAManagementTest {
45
46	private ServerM3UAManagement serverM3uaMgmt = new ServerM3UAManagement();
47
48	/**
49	 * 
50	 */
51	public ServerM3UAManagementTest() {
52		// TODO Auto-generated constructor stub
53	}
54
55	@BeforeClass
56	public static void setUpClass() throws Exception {
57	}
58
59	@AfterClass
60	public static void tearDownClass() throws Exception {
61	}
62
63	@Before
64	public void setUp() throws Exception {
65		serverM3uaMgmt.start();
66	}
67
68	@After
69	public void tearDown() throws IOException {
70		serverM3uaMgmt.getAppServers().clear();
71		serverM3uaMgmt.getAspfactories().clear();
72		serverM3uaMgmt.stop();
73	}
74
75	@Test
76	public void testSerialization() throws Exception {
77		As as = serverM3uaMgmt
78				.createAppServer("m3ua ras create rc 100 rk dpc 123 opc 456 si 3 traffic-mode loadshare RAS1"
79						.split(" "));
80		AspFactory aspFactory = serverM3uaMgmt.createAspFactory("m3ua rasp create ip 127.0.0.1 port 2345 RASP1"
81				.split(" "));
82		serverM3uaMgmt.assignAspToAs("RAS1", "RASP1");
83
84		serverM3uaMgmt.stop();
85		
86		ServerM3UAManagement serverM3uaMgmt1 = new ServerM3UAManagement(); 
87		serverM3uaMgmt1.start();
88
89		assertEquals(1, serverM3uaMgmt1.getAppServers().size());
90		assertEquals(1, serverM3uaMgmt1.getAspfactories().size());
91		assertNotNull(serverM3uaMgmt1.m3uaRouter.getAs(123, 456, (short) 3));
92
93	}
94
95}