.datasetOutputPath(thisTargetPath.toString()).ancestorsOwnerAndPermission(CopyableFile .resolveReplicatedOwnerAndPermissionsRecursively(this.fs, file.getPath().getParent(), nonGlobSearchPath, configuration)).build(); copyableFile.setFsDatasets(this.fs, targetFs); copyableFiles.add(copyableFile);
private CopyableFile getTestCopyableFile(String resourcePath) throws IOException { String filePath = getClass().getClassLoader().getResource(resourcePath).getFile(); FileStatus status = new FileStatus(0l, false, 0, 0l, 0l, new Path(filePath)); Properties properties = new Properties(); properties.setProperty(ConfigurationKeys.DATA_PUBLISHER_FINAL_DIR, "/publisher"); return CopyableFile.fromOriginAndDestination(FileSystem.getLocal(new Configuration()), status, new Path("/destination"), CopyConfiguration.builder(FileSystem.getLocal(new Configuration()), properties) .preserve(PreserveAttributes.fromMnemonicString("")).build()).build(); } }
@Override public Collection<? extends CopyEntity> getCopyableFiles(FileSystem targetFs, CopyConfiguration configuration) throws IOException { List<CopyableFile> copyableFiles = Lists.newArrayList(); for (FileStatus fileStatus : this.files) { if (this.shouldAddToCopyableFiles(fileStatus)) { log.debug("Adding copyable file " + fileStatus.getPath() + "for " + identifier + " in " + this.rootPath); Path targetPath = this.getTargetPath(configuration.getPublishDir(), fileStatus.getPath(), this.identifier); copyableFiles.add(CopyableFile.fromOriginAndDestination(this.fs, fileStatus, targetPath, configuration) .destinationOwnerAndPermission(this.getDestinationOwnerAndPermission()).fileSet(this.fileSet(fileStatus)) .build()); } } return DatasetUtils.instantiateCopyableFileFilter(this.props, this.state, this) .filter(this.fs, targetFs, copyableFiles); }
.fileSet(PathUtils.getPathWithoutSchemeAndAuthority(copyTo.getDatasetPath()).toString()).build(); copyableFile.setFsDatasets(copyFromFs, copyToFs); copyableFiles.add(copyableFile);
CopyableFile fileEntity = builder.fileSet(fileSet).checksum(new byte[0]).datasetOutputPath(desiredTargetLocation.location.toString()) .build();
Optional.<Partition> absent())) { CopyableFile fileEntity = builder.fileSet(fileSet).datasetOutputPath(desiredTargetLocation.location.toString()).build(); fileEntity.setSourceData(this.helper.getSourceDataset()); fileEntity.setDestinationData(this.helper.getDestinationDataset());
.datasetOutputPath(thisTargetPath.toString()).ancestorsOwnerAndPermission(CopyableFile .resolveReplicatedOwnerAndPermissionsRecursively(this.fs, file.getPath().getParent(), nonGlobSearchPath, configuration)).build(); copyableFile.setFsDatasets(this.fs, targetFs); copyableFiles.add(copyableFile);
@Override public Collection<? extends CopyEntity> getCopyableFiles(FileSystem targetFs, CopyConfiguration configuration) throws IOException { List<CopyableFile> copyableFiles = Lists.newArrayList(); for (FileStatus fileStatus : this.files) { if (this.shouldAddToCopyableFiles(fileStatus)) { log.debug("Adding copyable file " + fileStatus.getPath() + "for " + identifier + " in " + this.rootPath); Path targetPath = this.getTargetPath(configuration.getPublishDir(), fileStatus.getPath(), this.identifier); copyableFiles.add(CopyableFile.fromOriginAndDestination(this.fs, fileStatus, targetPath, configuration) .destinationOwnerAndPermission(this.getDestinationOwnerAndPermission()).fileSet(this.fileSet(fileStatus)) .build()); } } return DatasetUtils.instantiateCopyableFileFilter(this.props, this.state, this) .filter(this.fs, targetFs, copyableFiles); }
@VisibleForTesting protected CopyableFile generateCopyableFile(FileStatus singleFile, Path targetPath, long timestampFromPath, Path locationToCopy) throws IOException { return CopyableFile.fromOriginAndDestination(srcFs, singleFile, targetPath, configuration) .originTimestamp(timestampFromPath).upstreamTimestamp(timestampFromPath) .fileSet(PathUtils.getPathWithoutSchemeAndAuthority(locationToCopy).toString()).build(); }
.destinationOwnerAndPermission(ownerAndPermission) .ancestorsOwnerAndPermission(ancestorOwnerAndPermissions) .build();
.fileSet(PathUtils.getPathWithoutSchemeAndAuthority(copyTo.getDatasetPath()).toString()).build(); copyableFile.setFsDatasets(copyFromFs, copyToFs); copyableFiles.add(copyableFile);
CopyableFile fileEntity = builder.fileSet(fileSet).checksum(new byte[0]).datasetOutputPath(desiredTargetLocation.location.toString()) .build();
Optional.<Partition> absent())) { CopyableFile fileEntity = builder.fileSet(fileSet).datasetOutputPath(desiredTargetLocation.location.toString()).build(); fileEntity.setSourceData(this.helper.getSourceDataset()); fileEntity.setDestinationData(this.helper.getDestinationDataset());
.destination(targetPath) .ancestorsOwnerAndPermission(Lists.<OwnerAndPermission>newArrayList()) .build();
.destination(targetPath) .build();
CopyConfiguration.builder(fs, state.getProperties()).preserve(PreserveAttributes.fromMnemonicString("")).build()).build();
public TestDatasetManager(Path testMethodTempPath, State state, String datasetTargetPath, List<String> relativeFilePaths) throws IOException { this.fs = FileSystem.getLocal(new Configuration()); this.copyableDataset = new TestCopyableDataset(new Path("origin")); this.metadata = new CopyableDatasetMetadata(this.copyableDataset); this.relativeFilePaths = relativeFilePaths; this.writerOutputPath = new Path(state.getProp(ConfigurationKeys.WRITER_OUTPUT_DIR)); this.targetPath = new Path(testMethodTempPath, datasetTargetPath); FileStatus file = new FileStatus(0, false, 0, 0, 0, new Path("/file")); FileSystem fs = FileSystem.getLocal(new Configuration()); this.copyEntity = CopyableFile.fromOriginAndDestination(fs, file, new Path("/destination"), CopyConfiguration.builder(fs, state.getProperties()).preserve(PreserveAttributes.fromMnemonicString("")) .build()).build(); fs.mkdirs(testMethodTempPath); log.info("Created a temp directory for test at " + testMethodTempPath); }
@Override public Collection<? extends CopyEntity> getCopyableFiles(FileSystem targetFs, CopyConfiguration configuration) throws IOException { List<CopyEntity> files = Lists.newArrayList(); for (int i = 0; i < FILE_COUNT; i++) { FileStatus origin = new FileStatus(10, false, 0, 0, 0, new Path(this.datasetRoot, Integer.toString(i))); CopyableFile.Builder builder = CopyableFile .builder(FileSystem.getLocal(new Configuration()), origin, datasetRoot(), configuration).destinationOwnerAndPermission(OWNER_AND_PERMISSION). ancestorsOwnerAndPermission(Lists.newArrayList(OWNER_AND_PERMISSION)).checksum("checksum".getBytes()); modifyCopyableFile(builder, origin); files.add(builder.build()); } return files; }
@VisibleForTesting protected CopyableFile generateCopyableFile(FileStatus singleFile, Path targetPath, long timestampFromPath, Path locationToCopy) throws IOException { return CopyableFile.fromOriginAndDestination(srcFs, singleFile, targetPath, configuration) .originTimestamp(timestampFromPath).upstreamTimestamp(timestampFromPath) .fileSet(PathUtils.getPathWithoutSchemeAndAuthority(locationToCopy).toString()).build(); }