@Test public void testWriteRead() throws IOException, DatasetManagementException { FileSet fileSet1 = createFileset(testFileSetInstance1); FileSet fileSet2 = createFileset(testFileSetInstance2); Location fileSet1Output = fileSet1.getOutputLocation(); Location fileSet2Output = fileSet2.getOutputLocation(); Location fileSet1NsDir = Locations.getParent(Locations.getParent(Locations.getParent(fileSet1Output))); Location fileSet2NsDir = Locations.getParent(Locations.getParent(Locations.getParent(fileSet2Output))); Assert.assertNotNull(fileSet1NsDir); Assert.assertNotNull(fileSet2NsDir); Assert.assertEquals(fileSet1NsDir.getName(), DatasetFrameworkTestUtil.NAMESPACE_ID.getNamespace()); Assert.assertEquals(fileSet2NsDir.getName(), OTHER_NAMESPACE.getNamespace()); Assert.assertNotEquals(fileSet1.getInputLocations().get(0).toURI().getPath(), fileSet2.getInputLocations().get(0).toURI().getPath()); Assert.assertNotEquals(fileSet1Output.toURI().getPath(), fileSet2Output.toURI().getPath()); try (OutputStream out = fileSet1.getOutputLocation().getOutputStream()) { out.write(42); } try (OutputStream out = fileSet2.getOutputLocation().getOutputStream()) { out.write(54); } try (InputStream in = fileSet1.getInputLocations().get(0).getInputStream()) { Assert.assertEquals(42, in.read()); } try (InputStream in = fileSet2.getInputLocations().get(0).getInputStream()) { Assert.assertEquals(54, in.read()); } }
Location input = fileSet.getInputLocations().iterator().next(); InputStream in = input.getInputStream(); in.close();
long sum = 0L, count = 1; long inputRecords = 0; for (Location inputLocation : input.getInputLocations()) { final PrintWriter writer = new PrintWriter(inputLocation.getOutputStream()); for (long value : values) {