Search in sources :

Example 1 with PackageAttributes

use of org.apache.beam.runners.dataflow.util.PackageUtil.PackageAttributes 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()));
}
Also used : Matchers.anyString(org.mockito.Matchers.anyString) File(java.io.File) PackageAttributes(org.apache.beam.runners.dataflow.util.PackageUtil.PackageAttributes) DataflowPackage(com.google.api.services.dataflow.model.DataflowPackage) Test(org.junit.Test)

Aggregations

DataflowPackage (com.google.api.services.dataflow.model.DataflowPackage)1 File (java.io.File)1 PackageAttributes (org.apache.beam.runners.dataflow.util.PackageUtil.PackageAttributes)1 Test (org.junit.Test)1 Matchers.anyString (org.mockito.Matchers.anyString)1