lib/src/test/java/edu/utexas/tacc/tapis/files/lib/transfers/ITestTransfers.java
@Test(dataProvider = "testSystemsDataProvider")
    public void testDoesTransfer(Pair<TapisSystem, TapisSystem> systemsPair) throws Exception {
        TapisSystem sourceSystem = systemsPair.getLeft();
        TapisSystem destSystem = systemsPair.getRight();
        log.info(sourceSystem.getId());
        log.info(destSystem.getId());
        when(systemsCache.getSystem(any(), eq("sourceSystem"), any())).thenReturn(sourceSystem);
        when(systemsCache.getSystem(any(), eq("destSystem"), any())).thenReturn(destSystem);
        when(permsService.isPermitted(any(), any(), any(), any(), any())).thenReturn(true);

        IRemoteDataClient sourceClient = remoteDataClientFactory.getRemoteDataClient(oboTenant, oboUser, sourceSystem, "testuser");
        IRemoteDataClient destClient = remoteDataClientFactory.getRemoteDataClient(oboTenant, oboUser, destSystem, "testuser");
        // Double check that the files really are in the destination
        //wipe out the dest folder just in case
        fileOpsService.delete(destClient, "/");


        //Add some files to transfer
        int FILESIZE = 10 * 1024;
        fileOpsService.insert(sourceClient, "a/1.txt", Utils.makeFakeFile(FILESIZE));
        fileOpsService.insert(sourceClient, "a/2.txt", Utils.makeFakeFile(FILESIZE));

        TransferTaskRequestElement element = new TransferTaskRequestElement();
        element.setSourceURI("tapis://sourceSystem/a/");
        element.setDestinationURI("tapis://destSystem/b/");
        List<TransferTaskRequestElement> elements = new ArrayList<>();
        elements.add(element);
        TransferTask t1 = transfersService.createTransfer(
            "testuser",
            "dev",
            "tag",
            elements
        );

        Flux<TransferTaskParent> tasks = parentTaskTransferService.runPipeline();
        tasks.subscribe();
        Flux<TransferTaskChild> stream = childTaskTransferService.runPipeline();
        StepVerifier
            .create(stream)
            .assertNext(k->{
                Assert.assertEquals(k.getStatus(), TransferTaskStatus.COMPLETED);
                Assert.assertEquals(k.getBytesTransferred(), FILESIZE);
                Assert.assertNotNull(k.getStartTime());
                Assert.assertNotNull(k.getEndTime());
            })
            .assertNext(k->{
                Assert.assertEquals(k.getStatus(), TransferTaskStatus.COMPLETED);
                Assert.assertEquals(k.getBytesTransferred(), FILESIZE);
                Assert.assertNotNull(k.getStartTime());
                Assert.assertNotNull(k.getEndTime());
            })
            .thenCancel()
            .verify(Duration.ofSeconds(5));

        t1 = transfersService.getTransferTaskByUUID(t1.getUuid());
        Assert.assertEquals(t1.getStatus(), TransferTaskStatus.COMPLETED);
        Assert.assertNotNull(t1.getStartTime());
        Assert.assertNotNull(t1.getEndTime());

        //Check for parent Task properties too
        TransferTaskParent parent = t1.getParentTasks().get(0);
        Assert.assertEquals(parent.getStatus(), TransferTaskStatus.COMPLETED);
        Assert.assertNotNull(parent.getEndTime());
        Assert.assertNotNull(parent.getStartTime());
        Assert.assertTrue(parent.getBytesTransferred() > 0);

        List<FileInfo> listing = fileOpsService.ls(destClient, "/b");
        Assert.assertEquals(listing.size(), 2);
    }
/**
     * This test is important, basically testing a simple but complete transfer. We check the entries in the database
     * as well as the files at the destination to make sure it actually completed. If this test fails, something needs to
     * be fixed.
     * @throws Exception
     */
This test is important, basically testing a simple but complete transfer. We check the entries in the database
as well as the files at the destination to make sure it actually completed. If this test fails, something needs to
be fixed.
@throws Exception
This test is important basically testing a simple but complete transfer . We check the entries in the database as well as the files at the destination to make sure it actually completed . If this test fails something needs to be fixed . @throws Exception
@Test(dataProvider = "testSystemsDataProvider")
    public void testDoesTransfer(Pair<TapisSystem, TapisSystem> systemsPair) throws Exception {
        TapisSystem sourceSystem = systemsPair.getLeft();
        TapisSystem destSystem = systemsPair.getRight();
        log.info(sourceSystem.getId());
        log.info(destSystem.getId());
        when(systemsCache.getSystem(any(), eq("sourceSystem"), any())).thenReturn(sourceSystem);
        when(systemsCache.getSystem(any(), eq("destSystem"), any())).thenReturn(destSystem);
        when(permsService.isPermitted(any(), any(), any(), any(), any())).thenReturn(true);
        IRemoteDataClient sourceClient = remoteDataClientFactory.getRemoteDataClient(oboTenant, oboUser, sourceSystem, "testuser");
        IRemoteDataClient destClient = remoteDataClientFactory.getRemoteDataClient(oboTenant, oboUser, destSystem, "testuser");
        fileOpsService.delete(destClient, "/");
        int FILESIZE = 10 * 1024;
        fileOpsService.insert(sourceClient, "a/1.txt", Utils.makeFakeFile(FILESIZE));
        fileOpsService.insert(sourceClient, "a/2.txt", Utils.makeFakeFile(FILESIZE));
        TransferTaskRequestElement element = new TransferTaskRequestElement();
        element.setSourceURI("tapis://sourceSystem/a/");
        element.setDestinationURI("tapis://destSystem/b/");
        List<TransferTaskRequestElement> elements = new ArrayList<>();
        elements.add(element);
        TransferTask t1 = transfersService.createTransfer(
            "testuser",
            "dev",
            "tag",
            elements
        );
        Flux<TransferTaskParent> tasks = parentTaskTransferService.runPipeline();
        tasks.subscribe();
        Flux<TransferTaskChild> stream = childTaskTransferService.runPipeline();
        StepVerifier
            .create(stream)
            .assertNext(k->{
                Assert.assertEquals(k.getStatus(), TransferTaskStatus.COMPLETED);
                Assert.assertEquals(k.getBytesTransferred(), FILESIZE);
                Assert.assertNotNull(k.getStartTime());
                Assert.assertNotNull(k.getEndTime());
            })
            .assertNext(k->{
                Assert.assertEquals(k.getStatus(), TransferTaskStatus.COMPLETED);
                Assert.assertEquals(k.getBytesTransferred(), FILESIZE);
                Assert.assertNotNull(k.getStartTime());
                Assert.assertNotNull(k.getEndTime());
            })
            .thenCancel()
            .verify(Duration.ofSeconds(5));
        t1 = transfersService.getTransferTaskByUUID(t1.getUuid());
        Assert.assertEquals(t1.getStatus(), TransferTaskStatus.COMPLETED);
        Assert.assertNotNull(t1.getStartTime());
        Assert.assertNotNull(t1.getEndTime());
        TransferTaskParent parent = t1.getParentTasks().get(0);
        Assert.assertEquals(parent.getStatus(), TransferTaskStatus.COMPLETED);
        Assert.assertNotNull(parent.getEndTime());
        Assert.assertNotNull(parent.getStartTime());
        Assert.assertTrue(parent.getBytesTransferred() > 0);
        List<FileInfo> listing = fileOpsService.ls(destClient, "/b");
        Assert.assertEquals(listing.size(), 2);
    }
@ Test ( dataProvider = "testSystemsDataProvider" ) public void testDoesTransfer ( Pair < TapisSystem , TapisSystem > systemsPair ) throws Exception { TapisSystem sourceSystem = systemsPair . getLeft ( ) ; TapisSystem destSystem = systemsPair . getRight ( ) ; log . info ( sourceSystem . getId ( ) ) ; log . info ( destSystem . getId ( ) ) ; when ( systemsCache . getSystem ( any ( ) , eq ( "sourceSystem" ) , any ( ) ) ) . thenReturn ( sourceSystem ) ; when ( systemsCache . getSystem ( any ( ) , eq ( "destSystem" ) , any ( ) ) ) . thenReturn ( destSystem ) ; when ( permsService . isPermitted ( any ( ) , any ( ) , any ( ) , any ( ) , any ( ) ) ) . thenReturn ( true ) ; IRemoteDataClient sourceClient = remoteDataClientFactory . getRemoteDataClient ( oboTenant , oboUser , sourceSystem , "testuser" ) ; IRemoteDataClient destClient = remoteDataClientFactory . getRemoteDataClient ( oboTenant , oboUser , destSystem , "testuser" ) ; fileOpsService . delete ( destClient , "/" ) ; int FILESIZE = 10 * 1024 ; fileOpsService . insert ( sourceClient , "a/1.txt" , Utils . makeFakeFile ( FILESIZE ) ) ; fileOpsService . insert ( sourceClient , "a/2.txt" , Utils . makeFakeFile ( FILESIZE ) ) ; TransferTaskRequestElement element = new TransferTaskRequestElement ( ) ; element . setSourceURI ( "tapis://sourceSystem/a/" ) ; element . setDestinationURI ( "tapis://destSystem/b/" ) ; List < TransferTaskRequestElement > elements = new ArrayList < > ( ) ; elements . add ( element ) ; TransferTask t1 = transfersService . createTransfer ( "testuser" , "dev" , "tag" , elements ) ; Flux < TransferTaskParent > tasks = parentTaskTransferService . runPipeline ( ) ; tasks . subscribe ( ) ; Flux < TransferTaskChild > stream = childTaskTransferService . runPipeline ( ) ; StepVerifier . create ( stream ) . assertNext ( k -> { Assert . assertEquals ( k . getStatus ( ) , TransferTaskStatus . COMPLETED ) ; Assert . assertEquals ( k . getBytesTransferred ( ) , FILESIZE ) ; Assert . assertNotNull ( k . getStartTime ( ) ) ; Assert . assertNotNull ( k . getEndTime ( ) ) ; } ) . assertNext ( k -> { Assert . assertEquals ( k . getStatus ( ) , TransferTaskStatus . COMPLETED ) ; Assert . assertEquals ( k . getBytesTransferred ( ) , FILESIZE ) ; Assert . assertNotNull ( k . getStartTime ( ) ) ; Assert . assertNotNull ( k . getEndTime ( ) ) ; } ) . thenCancel ( ) . verify ( Duration . ofSeconds ( 5 ) ) ; t1 = transfersService . getTransferTaskByUUID ( t1 . getUuid ( ) ) ; Assert . assertEquals ( t1 . getStatus ( ) , TransferTaskStatus . COMPLETED ) ; Assert . assertNotNull ( t1 . getStartTime ( ) ) ; Assert . assertNotNull ( t1 . getEndTime ( ) ) ; TransferTaskParent parent = t1 . getParentTasks ( ) . get ( 0 ) ; Assert . assertEquals ( parent . getStatus ( ) , TransferTaskStatus . COMPLETED ) ; Assert . assertNotNull ( parent . getEndTime ( ) ) ; Assert . assertNotNull ( parent . getStartTime ( ) ) ; Assert . assertTrue ( parent . getBytesTransferred ( ) > 0 ) ; List < FileInfo > listing = fileOpsService . ls ( destClient , "/b" ) ; Assert . assertEquals ( listing . size ( ) , 2 ) ; }
This test is important, basically testing a simple but complete transfer.
This test is important basically testing a simple but complete transfer .
// Double check that the files really are in the destination //wipe out the dest folder just in case //Add some files to transfer //Check for parent Task properties too