lib/src/test/java/edu/utexas/tacc/tapis/files/lib/transfers/ITestTransfers.java
@Test(dataProvider = "testSystemsDataProvider")
    public void testHttpInputs(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");

        //wipe out the dest folder just in case
        fileOpsService.delete(destClient, "/");

        TransferTaskRequestElement element = new TransferTaskRequestElement();
        element.setSourceURI("https://google.com");
        element.setDestinationURI("tapis://destSystem/b/input.html");
        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.assertTrue(k.getBytesTransferred() > 0);
                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(), 1);
    }
/**
     * 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 testHttpInputs(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, "/");
        TransferTaskRequestElement element = new TransferTaskRequestElement();
        element.setSourceURI("https://google.com");
        element.setDestinationURI("tapis://destSystem/b/input.html");
        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.assertTrue(k.getBytesTransferred() > 0);
                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(), 1);
    }
@ Test ( dataProvider = "testSystemsDataProvider" ) public void testHttpInputs ( 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 , "/" ) ; TransferTaskRequestElement element = new TransferTaskRequestElement ( ) ; element . setSourceURI ( "https://google.com" ) ; element . setDestinationURI ( "tapis://destSystem/b/input.html" ) ; 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 . assertTrue ( k . getBytesTransferred ( ) > 0 ) ; 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 ( ) , 1 ) ; }
This test is important, basically testing a simple but complete transfer.
This test is important basically testing a simple but complete transfer .
//wipe out the dest folder just in case //Check for parent Task properties too