View Javadoc

1   /*
2    * $Id: RmiConnectorTestCase.java 22377 2011-07-11 12:41:42Z 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.transport.rmi;
12  
13  import org.mule.api.transport.Connector;
14  import org.mule.transport.AbstractConnectorTestCase;
15  
16  import org.junit.Test;
17  
18  import static org.junit.Assert.assertEquals;
19  import static org.junit.Assert.assertNotNull;
20  
21  public class RmiConnectorTestCase extends AbstractConnectorTestCase
22  {
23  
24      @Override
25      public Connector createConnector() throws Exception
26      {
27          RmiConnector c = new RmiConnector(muleContext);
28          c.setName("RmiConnector");
29          c.setSecurityManager(null);
30          return c;
31      }
32  
33      public String getTestEndpointURI()
34      {
35          return "rmi://localhost:1099";
36      }
37  
38      public Object getValidMessage() throws Exception
39      {
40          return "Hello".getBytes();
41      }
42  
43      @Test
44      public void testProperties() throws Exception
45      {
46          RmiConnector c = (RmiConnector)getConnector();
47  
48          String securityPolicy = "rmi.policy";
49          String serverCodebase = "file:///E:/projects/MyTesting/JAVA/rmi/classes/";
50  
51          c.setSecurityPolicy(securityPolicy);
52          assertNotNull(c.getSecurityPolicy());
53          c.setServerCodebase(serverCodebase);
54          assertEquals(serverCodebase, c.getServerCodebase());
55      }
56  
57  }