Search in sources :

Example 6 with RemoteUrl

use of com.baidu.disconf.core.common.restful.core.RemoteUrl in project disconf by knightliao.

the class RestfulMgrTestCase method tetDownloadFromServer.

/**
     *
     */
@Test
public void tetDownloadFromServer() {
    try {
        RemoteUrl remoteUrl = new RemoteUrl(RemoteMockServer.FILE_URL, RemoteMockServer.LOCAL_HOST_LIST);
        String downloadFilePath = restfulMgr.downloadFromServer(remoteUrl, RemoteMockServer.FILE_NAME, RemoteMockServer.LOCAL_DOWNLOAD_DIR, RemoteMockServer.LOCAL_DOWNLOAD_DIR_TEMP, RemoteMockServer.LOCAL_TARGET_DOWNLOAD_DIR, true, 3, 3);
        File file = new File(downloadFilePath);
        String content = FileUtils.readFileToString(file);
        Assert.assertEquals(RemoteMockServer.FILE_CONTENT, content);
    } catch (Exception e) {
        e.printStackTrace();
        Assert.assertTrue(false);
    }
}
Also used : RemoteUrl(com.baidu.disconf.core.common.restful.core.RemoteUrl) File(java.io.File) Test(org.junit.Test)

Aggregations

RemoteUrl (com.baidu.disconf.core.common.restful.core.RemoteUrl)6 ValueVo (com.baidu.disconf.core.common.json.ValueVo)4 Test (org.junit.Test)4 File (java.io.File)1