javamanager/javainstaller/installer/tsrc/javasrc/com/nokia/mj/impl/installer/downloader/DownloaderTest.java
equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
35 /** |
35 /** |
36 * Downloader unit tests. |
36 * Downloader unit tests. |
37 */ |
37 */ |
38 public class DownloaderTest extends TestCase implements InstallerMain |
38 public class DownloaderTest extends TestCase implements InstallerMain |
39 { |
39 { |
40 private static final String TEST_URL = "/installertest/HelloWorld.jar"; |
40 private static final String TEST_URL = "http://195.134.231.83:7070/java-server/resources/DS_Snow.jar"; |
41 private static final int TEST_URL_SIZE = 1511; // test data file size |
41 private static final int TEST_URL_SIZE = 10241; // test data file size |
42 |
42 |
43 // Begin j2meunit test framework setup |
43 // Begin j2meunit test framework setup |
44 |
44 |
45 public void installerMain(String[] args) |
45 public void installerMain(String[] args) |
46 { |
46 { |
170 * Test a basic download case with given Downloader. |
170 * Test a basic download case with given Downloader. |
171 */ |
171 */ |
172 public void testBasicDownload(Downloader downloader, |
172 public void testBasicDownload(Downloader downloader, |
173 TestDlListener listener) |
173 TestDlListener listener) |
174 { |
174 { |
175 String server = System.getProperty( |
|
176 "com.nokia.mj.impl.installer.test.server"); |
|
177 assertNotNull("-server=<address>:<port> argument required.", server); |
|
178 |
|
179 try |
175 try |
180 { |
176 { |
181 String filename = "test.dat"; |
177 String filename = "test.dat"; |
182 DownloadInfo dlInfo = new DownloadInfo("http://" + server |
178 DownloadInfo dlInfo = new DownloadInfo(TEST_URL, filename); |
183 + TEST_URL, filename); |
|
184 downloader.start(dlInfo); |
179 downloader.start(dlInfo); |
185 downloader.waitForCompletion(); |
180 downloader.waitForCompletion(); |
186 assertTrue("Result DlInfo is null", |
181 assertTrue("Result DlInfo is null", |
187 listener.getDownloadInfo() != null); |
182 listener.getDownloadInfo() != null); |
188 assertTrue("Result DlInfo has an exception: " + |
183 assertTrue("Result DlInfo has an exception: " + |