/** * Sets the owner/group and permission for the file in the task staging directory */ protected void setFilePermissions(CopyableFile file) throws IOException { setRecursivePermission(getStagingFilePath(file), file.getDestinationOwnerAndPermission()); }
@Test public void testCopySource() throws Exception { SourceState state = new SourceState(); state.setProp(ConfigurationKeys.SOURCE_FILEBASED_FS_URI, "file:///"); state.setProp(ConfigurationKeys.WRITER_FILE_SYSTEM_URI, "file:///"); state.setProp(ConfigurationKeys.DATA_PUBLISHER_FINAL_DIR, "/target/dir"); state.setProp(DatasetUtils.DATASET_PROFILE_CLASS_KEY, TestCopyableDatasetFinder.class.getName()); CopySource source = new CopySource(); List<WorkUnit> workunits = source.getWorkunits(state); workunits = JobLauncherUtils.flattenWorkUnits(workunits); Assert.assertEquals(workunits.size(), TestCopyableDataset.FILE_COUNT); Extract extract = workunits.get(0).getExtract(); for (WorkUnit workUnit : workunits) { CopyableFile file = (CopyableFile) CopySource.deserializeCopyEntity(workUnit); Assert.assertTrue(file.getOrigin().getPath().toString().startsWith(TestCopyableDataset.ORIGIN_PREFIX)); Assert.assertEquals(file.getDestinationOwnerAndPermission(), TestCopyableDataset.OWNER_AND_PERMISSION); Assert.assertEquals(workUnit.getExtract(), extract); } }
Assert.assertEquals(copyableFile.getDestinationOwnerAndPermission().getGroup(), origin.getGroup()); Assert.assertEquals(copyableFile.getDestinationOwnerAndPermission().getOwner(), origin.getOwner()); Assert.assertEquals(copyableFile.getDestinationOwnerAndPermission().getFsPermission(), origin.getPermission());
CopyableFile copyableFile = (CopyableFile) CopySource.deserializeCopyEntity(workUnit); Assert.assertTrue(copyableFile.getOrigin().getPath().toString().startsWith(TestCopyableDataset.ORIGIN_PREFIX)); Assert.assertEquals(copyableFile.getDestinationOwnerAndPermission(), TestCopyableDataset.OWNER_AND_PERMISSION);
Assert.assertEquals(copyableFile.getDestinationOwnerAndPermission().getGroup(), ownerAndPermission.getGroup()); Assert.assertEquals(copyableFile.getDestinationOwnerAndPermission().getOwner(), ownerAndPermission.getOwner()); Assert.assertEquals(copyableFile.getDestinationOwnerAndPermission().getFsPermission(), ownerAndPermission.getFsPermission());
/** * Sets the owner/group and permission for the file in the task staging directory */ protected void setFilePermissions(CopyableFile file) throws IOException { setRecursivePermission(getStagingFilePath(file), file.getDestinationOwnerAndPermission()); }