1   /*
2    * $Id: RmiRegistryAgentTestCase.java 11517 2008-03-31 21:34:19Z dirk.olmes $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.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.AbstractMuleTestCase;
15  
16  public class RmiRegistryAgentTestCase extends AbstractMuleTestCase
17  {
18  
19      public void testHostSetOnly() throws Exception
20      {
21          RmiRegistryAgent agent = new RmiRegistryAgent();
22          agent.setHost("www.example.com");
23          agent.initialise();
24          assertEquals("rmi://www.example.com:1099", agent.getServerUri());
25      }
26  
27      public void testPortSetOnly() throws Exception
28      {
29          RmiRegistryAgent agent = new RmiRegistryAgent();
30          agent.setPort("1095");
31          agent.initialise();
32          assertEquals("rmi://localhost:1095", agent.getServerUri());
33      }
34  
35      public void testHostAndPortSet() throws Exception
36      {
37          RmiRegistryAgent agent = new RmiRegistryAgent();
38          agent.setPort("1095");
39          agent.setHost("www.example.com");
40          agent.initialise();
41          assertEquals("rmi://www.example.com:1095", agent.getServerUri());
42      }
43    
44      public void testStart() throws Exception
45      {
46          RmiRegistryAgent agent = new RmiRegistryAgent();
47          agent.initialise();
48          agent.start();
49      }
50  
51  }