View Javadoc

1   /*
2    * $Id: RmiRegistryAgentTestCase.java 22387 2011-07-12 03:53:36Z dirk.olmes $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.management.agents;
12  
13  import org.mule.module.management.agent.RmiRegistryAgent;
14  import org.mule.tck.junit4.AbstractMuleTestCase;
15  
16  import org.junit.Test;
17  
18  import static org.junit.Assert.assertEquals;
19  
20  public class RmiRegistryAgentTestCase extends AbstractMuleTestCase
21  {
22  
23      @Test
24      public void testHostSetOnly() throws Exception
25      {
26          RmiRegistryAgent agent = new RmiRegistryAgent();
27          agent.setHost("www.example.com");
28          agent.initialise();
29          assertEquals("rmi://www.example.com:1099", agent.getServerUri());
30      }
31  
32      @Test
33      public void testPortSetOnly() throws Exception
34      {
35          RmiRegistryAgent agent = new RmiRegistryAgent();
36          agent.setPort("1095");
37          agent.initialise();
38          assertEquals("rmi://localhost:1095", agent.getServerUri());
39      }
40  
41      @Test
42      public void testHostAndPortSet() throws Exception
43      {
44          RmiRegistryAgent agent = new RmiRegistryAgent();
45          agent.setPort("1095");
46          agent.setHost("www.example.com");
47          agent.initialise();
48          assertEquals("rmi://www.example.com:1095", agent.getServerUri());
49      }
50    
51      @Test
52      public void testStart() throws Exception
53      {
54          RmiRegistryAgent agent = new RmiRegistryAgent();
55          agent.initialise();
56          agent.start();
57      }
58  
59  }