api/src/test/java/edu/utexas/tacc/tapis/files/api/resources/ITestUtilsRoutes.java
private void addTestFilesToSystem(TapisSystem system, String fileName, int fileSize) throws Exception {
    InputStream inputStream = makeFakeFile(fileSize);
    File tempFile = File.createTempFile("tempfile", null);
    tempFile.deleteOnExit();
    FileOutputStream fos = new FileOutputStream(tempFile);
    fos.write(inputStream.readAllBytes());
    fos.close();
    FileDataBodyPart filePart = new FileDataBodyPart("file", tempFile);
    FormDataMultiPart form = new FormDataMultiPart();
    FormDataMultiPart multiPart = (FormDataMultiPart) form.bodyPart(filePart);
    when(permsService.isPermitted(any(), any(), any(), any(), any())).thenReturn(true);
    FileStringResponse response = target(String.format("%s/%s/%s", OPS_ROUTE, system.getId(), fileName))
            .request()
            .accept(MediaType.APPLICATION_JSON)
            .header("x-tapis-token", getJwtForUser(TENANT, TEST_USR1))
            .post(Entity.entity(multiPart, MediaType.MULTIPART_FORM_DATA_TYPE), FileStringResponse.class);
  }
/*
   * Add file to a system using specified file name and file size.
   * File is added under the root directory.
   */
Add file to a system using specified file name and file size.
File is added under the root directory.
Add file to a system using specified file name and file size . File is added under the root directory .
private void addTestFilesToSystem(TapisSystem system, String fileName, int fileSize) throws Exception {
    InputStream inputStream = makeFakeFile(fileSize);
    File tempFile = File.createTempFile("tempfile", null);
    tempFile.deleteOnExit();
    FileOutputStream fos = new FileOutputStream(tempFile);
    fos.write(inputStream.readAllBytes());
    fos.close();
    FileDataBodyPart filePart = new FileDataBodyPart("file", tempFile);
    FormDataMultiPart form = new FormDataMultiPart();
    FormDataMultiPart multiPart = (FormDataMultiPart) form.bodyPart(filePart);
    when(permsService.isPermitted(any(), any(), any(), any(), any())).thenReturn(true);
    FileStringResponse response = target(String.format("%s/%s/%s", OPS_ROUTE, system.getId(), fileName))
            .request()
            .accept(MediaType.APPLICATION_JSON)
            .header("x-tapis-token", getJwtForUser(TENANT, TEST_USR1))
            .post(Entity.entity(multiPart, MediaType.MULTIPART_FORM_DATA_TYPE), FileStringResponse.class);
  }
private void addTestFilesToSystem ( TapisSystem system , String fileName , int fileSize ) throws Exception { InputStream inputStream = makeFakeFile ( fileSize ) ; File tempFile = File . createTempFile ( "tempfile" , null ) ; tempFile . deleteOnExit ( ) ; FileOutputStream fos = new FileOutputStream ( tempFile ) ; fos . write ( inputStream . readAllBytes ( ) ) ; fos . close ( ) ; FileDataBodyPart filePart = new FileDataBodyPart ( "file" , tempFile ) ; FormDataMultiPart form = new FormDataMultiPart ( ) ; FormDataMultiPart multiPart = ( FormDataMultiPart ) form . bodyPart ( filePart ) ; when ( permsService . isPermitted ( any ( ) , any ( ) , any ( ) , any ( ) , any ( ) ) ) . thenReturn ( true ) ; FileStringResponse response = target ( String . format ( "%s/%s/%s" , OPS_ROUTE , system . getId ( ) , fileName ) ) . request ( ) . accept ( MediaType . APPLICATION_JSON ) . header ( "x-tapis-token" , getJwtForUser ( TENANT , TEST_USR1 ) ) . post ( Entity . entity ( multiPart , MediaType . MULTIPART_FORM_DATA_TYPE ) , FileStringResponse . class ) ; }
Add file to a system using specified file name and file size.
Add file to a system using specified file name and file size .