3 import static org.junit.Assert.assertNotNull;
4 import static org.junit.Assert.assertTrue;
5 import static org.junit.Assert.fail;
7 import java.net.InetAddress;
8 import java.net.UnknownHostException;
10 import org.pcmm.PCMMGlobalConfig;
11 import org.junit.AfterClass;
12 import org.junit.BeforeClass;
13 import org.junit.Test;
14 import org.pcmm.rcd.ICMTS;
15 import org.pcmm.rcd.IPCMMPolicyServer;
16 import org.pcmm.rcd.IPCMMPolicyServer.IPSCMTSClient;
17 import org.pcmm.rcd.impl.CMTS;
18 import org.pcmm.rcd.impl.PCMMPolicyServer;
20 public class PCMMWorkflowTest {
23 * CMTS emulator, when testing with a real CMTS this should be set to null
24 * and shoudln't be started
26 private static ICMTS cmts;
28 * CMTS host address, when testing with a real CMTS this should be CMTS
31 private static InetAddress host;
33 private static IPCMMPolicyServer server;
34 private static IPSCMTSClient client;
36 private static boolean real_cmts = false;
39 public static void setUpBeforeClass() throws Exception {
40 // comment this when using real CMTS
41 // ###################################
42 if (real_cmts == true) {
48 // ###################################
50 server = new PCMMPolicyServer();
52 if (real_cmts == true) {
53 // this should be set to the cmts host ex :
54 host = InetAddress.getByName(PCMMGlobalConfig.DefaultCMTS);
55 host = InetAddress.getByName("10.200.90.3");
56 // InetAddress.getByName("my-cmts-host-name");
58 host = InetAddress.getLocalHost();
61 } catch (UnknownHostException uhe) {
62 fail("could not get host address ");
68 public static void tearDownAfterClass() throws Exception {
75 public static void setupConnection() {
76 client = server.requestCMTSConnection(host);
77 assertNotNull(client);
78 //System.out.println("MM minor version = MM major version :: CMTS exhausted all protocol selection attempts Major = " + client.getVersionInfo().getMajorVersionNB() + " Minor = " + client.getVersionInfo().getMinorVersionNB());
82 public static void tearDown() throws Exception {
83 assertNotNull(client);
84 assertTrue("Client disconnection failed", client.disconnect());
89 public void testGateSet() {
90 assertNotNull(client);
91 assertTrue("Gate-Set failed", client.gateSet());
95 public void testGateDelete() {
96 assertNotNull(client);
97 assertTrue("Gate-Delete failed", client.gateDelete());
102 public void testGateInfo() {
103 assertNotNull(client);
104 assertTrue("Gate-Info failed", client.gateInfo());
108 public void testGateSynchronize() {
109 assertNotNull(client);
110 assertTrue("Gate-Synchronize failed", client.gateSynchronize());