View Javadoc
1   /*
2    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
3    * The software in this package is published under the terms of the CPAL v1.0
4    * license, a copy of which has been included with this distribution in the
5    * LICENSE.txt file.
6    */
7   package org.mule.transport.ftp;
8   
9   import org.mule.api.endpoint.EndpointURI;
10  import org.mule.endpoint.MuleEndpointURI;
11  import org.mule.tck.junit4.AbstractMuleContextTestCase;
12  
13  import org.junit.Test;
14  
15  import static org.junit.Assert.assertEquals;
16  import static org.junit.Assert.assertNull;
17  
18  public class FtpEndpointTestCase extends AbstractMuleContextTestCase
19  {
20  
21      @Test
22      public void testHostPortAndUserInfo() throws Exception
23      {
24          EndpointURI endpointUri = new MuleEndpointURI("ftp://admin:pwd@localhost:18080", muleContext);
25          endpointUri.initialise();
26          assertEquals("ftp", endpointUri.getScheme());
27          assertEquals("ftp://localhost:18080", endpointUri.getAddress());
28          assertNull(endpointUri.getEndpointName());
29          assertEquals(18080, endpointUri.getPort());
30          assertEquals("localhost", endpointUri.getHost());
31          assertEquals("ftp://localhost:18080", endpointUri.getAddress());
32          assertEquals(0, endpointUri.getParams().size());
33          assertEquals("admin:pwd", endpointUri.getUserInfo());
34          assertEquals("admin", endpointUri.getUser());
35          assertEquals("pwd", endpointUri.getPassword());
36          assertEquals("ftp://admin:****@localhost:18080", endpointUri.toString());
37      }
38  
39  }