|
30 | 30 | import org.apache.sysds.runtime.frame.data.FrameBlock; |
31 | 31 | import org.apache.sysds.runtime.io.IOUtilFunctions; |
32 | 32 | import org.apache.sysds.runtime.matrix.data.MatrixBlock; |
| 33 | +import org.apache.sysds.runtime.util.HDFSTool; |
33 | 34 | import org.apache.sysds.test.AutomatedTestBase; |
34 | 35 | import org.junit.Assert; |
35 | 36 | import org.junit.Test; |
@@ -386,4 +387,44 @@ public void testConvertToFrame() { |
386 | 387 | throw new AssertionError(e); |
387 | 388 | } |
388 | 389 | } |
| 390 | + |
| 391 | + @Test |
| 392 | + public void testTransformMetaData1() { |
| 393 | + try (Connection conn = new Connection()) { |
| 394 | + FrameBlock frame = conn.readTransformMetaDataFromFile(SCRIPT_DIR + TEST_DIR + "tfmtd_example2/"); |
| 395 | + Assert.assertEquals("Hello", frame.get(0,0)); |
| 396 | + } catch (IOException e) { |
| 397 | + Assert.assertEquals("Missing transform specification.", e.getMessage()); |
| 398 | + } |
| 399 | + } |
| 400 | + |
| 401 | + @Test |
| 402 | + public void testTransformMetaData2() { |
| 403 | + try (Connection conn = new Connection()) { |
| 404 | + String spec = HDFSTool.readStringFromHDFSFile(SCRIPT_DIR + TEST_DIR+"tfmtd_example2/spec.json"); |
| 405 | + FrameBlock frame = conn.readTransformMetaDataFromFile(spec, SCRIPT_DIR + TEST_DIR + "tfmtd_example2/"); |
| 406 | + Assert.assertEquals("91312·1", frame.get(0,0)); |
| 407 | + } catch (IOException e) { |
| 408 | + throw new AssertionError(e); |
| 409 | + } |
| 410 | + } |
| 411 | + |
| 412 | + @Test |
| 413 | + public void testTransformMetaData3() { |
| 414 | + try (Connection conn = new Connection()) { |
| 415 | + conn.readTransformMetaDataFromPath(SCRIPT_DIR + TEST_DIR + "tfmtd_example2"); |
| 416 | + } catch (Exception e) { |
| 417 | + Assert.assertEquals("NullPointerException", e.getClass().getSimpleName()); |
| 418 | + } |
| 419 | + } |
| 420 | + |
| 421 | + @Test |
| 422 | + public void testTransformMetaData4() { |
| 423 | + try (Connection conn = new Connection()) { |
| 424 | + String spec = HDFSTool.readStringFromHDFSFile(SCRIPT_DIR + TEST_DIR+"tfmtd_example2/spec.json"); |
| 425 | + conn.readTransformMetaDataFromPath(spec,SCRIPT_DIR + TEST_DIR + "tfmtd_example2"); |
| 426 | + } catch (Exception e) { |
| 427 | + Assert.assertEquals("NullPointerException", e.getClass().getSimpleName()); |
| 428 | + } |
| 429 | + } |
389 | 430 | } |
0 commit comments