FlowPreparer { @VisibleForTesting File downloadProjectIfNotExists(final ProjectDirectoryMetadata proj, final int execId) throws IOException { final String projectDir = generateProjectDirName(proj); if (proj.getInstalledDir() == null) { proj.setInstalledDir(new File(this.projectCacheDir, projectDir)); } if (proj.getInstalledDir().exists()) { LOGGER.info("Project {} already cached. Skipping download. ExecId: {}", proj, execId); this.projectCacheHitRatio.markHit(); updateLastModifiedTime( Paths.get(proj.getInstalledDir().getPath(), PROJECT_DIR_SIZE_FILE_NAME)); return null; } this.projectCacheHitRatio.markMiss(); final File tempDir = createTempDir(proj); downloadAndUnzipProject(proj, execId, tempDir); return tempDir; } FlowPreparer(final ProjectStorageManager projectStorageManager, final DependencyTransferManager dependencyTransferManager,
      final File projectsDir, final ProjectCacheCleaner cleaner, final ProjectCacheHitRatio projectCacheHitRatio,
      final File executionsDir); void shutdown();  }
@Test public void testProjectDirSizeIsSet() throws Exception { final ProjectDirectoryMetadata proj = new ProjectDirectoryMetadata(FAT_PROJECT_ID, 34, new File(this.projectsDir, SAMPLE_FLOW_01)); final File tmp = this.instance.downloadProjectIfNotExists(proj, 123); final long actualDirSize = 1048835; assertThat(proj.getDirSizeInByte()).isEqualTo(actualDirSize); assertThat(FileIOUtils.readNumberFromFile( Paths.get(tmp.getPath(), FlowPreparer.PROJECT_DIR_SIZE_FILE_NAME))) .isEqualTo(actualDirSize); }