Package org.apache.ace.agent

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


       
        Future<DownloadResult> future = addTestMock(Future.class);
        expect(future.get()).andReturn(downloadResult).anyTimes();

        DownloadHandle downloadHandle = addTestMock(DownloadHandle.class);
        expect(downloadHandle.start(isNull(DownloadProgressListener.class))).andReturn(future).anyTimes();

        DeploymentHandler deploymentHandler = addTestMock(DeploymentHandler.class);
        expect(deploymentHandler.getInstalledVersion()).andReturn(m_version2).anyTimes();
        expect(deploymentHandler.getAvailableVersions()).andReturn(m_availableVersions).anyTimes();
        expect(deploymentHandler.getDownloadHandle(eq(m_version3), eq(true))).andReturn(downloadHandle).once();
View Full Code Here


        Version highest = m_agentControl.getDeploymentHandler().getAvailableVersions().last();

        if (highest.compareTo(current) > 0) {
            DownloadHandle handle = m_agentControl.getDeploymentHandler().getDownloadHandle(highest, true);

            Future<DownloadResult> future = handle.start(null);
            DownloadResult result = future.get();
           
            if (result.isComplete()) {
                InputStream inputStream = result.getInputStream();
                try {
View Full Code Here

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

        DownloadHandle handle = downloadHandler.getHandle(m_404url);
        Future<DownloadResult> future = handle.start(null);

        assertIOException(future);
    }

    @Test
View Full Code Here

    public void testFailed503_noresume_result() throws Exception {
        DownloadHandler downloadHandler = m_agentContext.getHandler(DownloadHandler.class);

        DownloadHandle handle = downloadHandler.getHandle(m_503url);

        assertRetryException(handle.start(null));

        assertRetryException(handle.start(null));
    }

    @Test
View Full Code Here

        DownloadHandle handle = downloadHandler.getHandle(m_503url);

        assertRetryException(handle.start(null));

        assertRetryException(handle.start(null));
    }

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

        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);
    }

    @Test
View Full Code Here

        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

                Thread.currentThread().interrupt();
            }
        });

        assertStopped(future);
        assertSuccessful(handle.start(null), m_200digest);
    }

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

        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());
        assertEquals(m_200digest, getDigest(result.getInputStream()));
View Full Code Here

        DownloadResult result = future.get();
        assertNotNull(result);
        assertTrue(result.isComplete());
        assertEquals(m_200digest, getDigest(result.getInputStream()));

        Future<DownloadResult> future2 = handle.start(null);
        DownloadResult result2 = future2.get();
        assertNotNull(result2);
        assertTrue(result2.isComplete());
        assertEquals(m_200digest, getDigest(result2.getInputStream()));
    }
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.