Search in sources :

Example 1 with SftpUrlConnection

use of org.opennms.protocols.sftp.SftpUrlConnection in project opennms by OpenNMS.

the class UrlFactoryTest method testUrlFactory.

/**
     * Test time parser.
     *
     * @throws Exception the exception
     */
@Test
public void testUrlFactory() throws Exception {
    URL url = UrlFactory.getUrl("https://www.google.com", null);
    Assert.assertEquals(HttpsUrlHandler.HTTPS, url.getProtocol());
    Assert.assertTrue(url.openConnection() instanceof HttpUrlConnection);
    url = UrlFactory.getUrl("HTTP://www.opennms.org", null);
    Assert.assertEquals(HttpUrlHandler.HTTP, url.getProtocol());
    Assert.assertTrue(url.openConnection() instanceof HttpUrlConnection);
    url = UrlFactory.getUrl("sftp://www.opennms.org", null);
    Assert.assertEquals(SftpUrlHandler.PROTOCOL, url.getProtocol());
    Assert.assertTrue(url.openConnection() instanceof SftpUrlConnection);
    url = UrlFactory.getUrl("sftp.3GPP://junier-router.local/opt/3gpp/data", null);
    Assert.assertEquals(Sftp3gppUrlHandler.PROTOCOL, url.getProtocol());
    Assert.assertTrue(url.openConnection() instanceof Sftp3gppUrlConnection);
}
Also used : HttpUrlConnection(org.opennms.protocols.http.HttpUrlConnection) SftpUrlConnection(org.opennms.protocols.sftp.SftpUrlConnection) Sftp3gppUrlConnection(org.opennms.protocols.sftp.Sftp3gppUrlConnection) URL(java.net.URL) Test(org.junit.Test)

Aggregations

URL (java.net.URL)1 Test (org.junit.Test)1 HttpUrlConnection (org.opennms.protocols.http.HttpUrlConnection)1 Sftp3gppUrlConnection (org.opennms.protocols.sftp.Sftp3gppUrlConnection)1 SftpUrlConnection (org.opennms.protocols.sftp.SftpUrlConnection)1