use of com.google.api.services.dataflow.model.DataflowPackage in project beam by apache.
the class PackageUtilTest method testFileWithExtensionPackageNamingAndSize.
@Test
public void testFileWithExtensionPackageNamingAndSize() throws Exception {
String contents = "This is a test!";
File tmpFile = makeFileWithContents("file.txt", contents);
PackageAttributes attr = makePackageAttributes(tmpFile, null);
DataflowPackage target = attr.getDataflowPackage();
assertThat(target.getName(), RegexMatcher.matches("file-" + HASH_PATTERN + ".txt"));
assertThat(target.getLocation(), equalTo(STAGING_PATH + target.getName()));
assertThat(attr.getSize(), equalTo((long) contents.length()));
}
use of com.google.api.services.dataflow.model.DataflowPackage in project beam by apache.
the class PackageUtilTest method testPackageNamingWithFilesHavingSameContentsAndSameNames.
@Test
public void testPackageNamingWithFilesHavingSameContentsAndSameNames() throws Exception {
File tmpDirectory1 = tmpFolder.newFolder("folder1", "folderA");
makeFileWithContents("folder1/folderA/sameName", "This is a test!");
DataflowPackage target1 = makePackageAttributes(tmpDirectory1, null).getDataflowPackage();
File tmpDirectory2 = tmpFolder.newFolder("folder2", "folderA");
makeFileWithContents("folder2/folderA/sameName", "This is a test!");
DataflowPackage target2 = makePackageAttributes(tmpDirectory2, null).getDataflowPackage();
assertEquals(target1.getName(), target2.getName());
assertEquals(target1.getLocation(), target2.getLocation());
}
use of com.google.api.services.dataflow.model.DataflowPackage in project beam by apache.
the class PackageUtilTest method testPackageNamingWithFileNoExtension.
@Test
public void testPackageNamingWithFileNoExtension() throws Exception {
File tmpFile = makeFileWithContents("file", "This is a test!");
DataflowPackage target = makePackageAttributes(tmpFile, null).getDataflowPackage();
assertThat(target.getName(), RegexMatcher.matches("file-" + HASH_PATTERN));
assertThat(target.getLocation(), equalTo(STAGING_PATH + target.getName()));
}
use of com.google.api.services.dataflow.model.DataflowPackage in project beam by apache.
the class PackageUtilTest method testPackageNamingWithDirectoriesHavingSameContentsButDifferentNames.
@Test
public void testPackageNamingWithDirectoriesHavingSameContentsButDifferentNames() throws Exception {
File tmpDirectory1 = tmpFolder.newFolder("folder1", "folderA");
tmpFolder.newFolder("folder1", "folderA", "uniqueName1");
DataflowPackage target1 = makePackageAttributes(tmpDirectory1, null).getDataflowPackage();
File tmpDirectory2 = tmpFolder.newFolder("folder2", "folderA");
tmpFolder.newFolder("folder2", "folderA", "uniqueName2");
DataflowPackage target2 = makePackageAttributes(tmpDirectory2, null).getDataflowPackage();
assertNotEquals(target1.getName(), target2.getName());
assertNotEquals(target1.getLocation(), target2.getLocation());
}
Aggregations