Package org.apache.ace.agent

Examples of org.apache.ace.agent.DownloadHandle.discard()


    @Test
    public void testSuccessful_noresume_result() throws Exception {
        DownloadHandler downloadHandler = m_agentContext.getHandler(DownloadHandler.class);

        DownloadHandle handle = downloadHandler.getHandle(m_200url);
        handle.discard();

        Future<DownloadResult> result = handle.start(null);

        assertSuccessful(result, m_200digest);
    }
View Full Code Here


    @Test
    public void testSuccessful_resume_result() throws Exception {
        DownloadHandler downloadHandler = m_agentContext.getHandler(DownloadHandler.class);

        final DownloadHandle handle = downloadHandler.getHandle(m_200url);
        handle.discard();

        Future<DownloadResult> future = handle.start(new DownloadProgressListener() {
            @Override
            public void progress(long read) {
                Thread.currentThread().interrupt();
View Full Code Here

    @Test
    public void testSuccessfulResumeAfterCompleteDownload() throws Exception {
        DownloadHandler downloadHandler = m_agentContext.getHandler(DownloadHandler.class);

        final DownloadHandle handle = downloadHandler.getHandle(m_200url);
        handle.discard();

        Future<DownloadResult> future = handle.start(null);
        DownloadResult result = future.get();
        assertNotNull(result);
        assertTrue(result.isComplete());
View Full Code Here

        File file = ((DownloadHandleImpl) handle).getDownloadFile();
        long fileLength = file.length();

        // Discard the result...
        handle.discard();

        // Restart & finish the download...
        DownloadHandle handle2 = downloadHandler.getHandle(m_testContentURL);
        future = handle2.start(null);
View Full Code Here

                        delegate.install(downloadResult.getInputStream());

                        installationSuccess(updateInfo);

                        // Clean up any temporary files...
                        downloadHandle.discard();
                    }
                }
                catch (InterruptedException exception) {
                    controller.logInfo("Download of %s update is INTERRUPTED. Resuming download later on...", m_type);
                }
View Full Code Here

                        // We've confirmation that we can install this update...
                        updateHandler.install(result.getInputStream());
                    }

                    // Throw away downloaded packages...
                    downloadHandle.discard();
                }
            }
            catch (Exception exception) {
                System.out.printf("%s update failed with %s.%n", updateType, exception.getMessage());
                exception.printStackTrace(System.out);
View Full Code Here

                        // We've confirmation that we can install this update...
                        updateHandler.install(result.getInputStream());
                    }

                    // Throw away downloaded packages...
                    downloadHandle.discard();
                }
            }
            catch (Exception exception) {
                logWarning("%s update failed with %s.", exception, updateType, exception.getMessage());
                exception.printStackTrace(System.out);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.