-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #728 from molgenis/feat/m10506-ui-link-file-view-edit
Feat: M10506 UI link file view
- Loading branch information
Showing
7 changed files
with
125 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 28 additions & 5 deletions
33
armadillo/src/test/java/org/molgenis/armadillo/storage/ParquetUtilsTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,57 @@ | ||
package org.molgenis.armadillo.storage; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
import java.io.FileNotFoundException; | ||
import java.io.IOException; | ||
import java.net.URISyntaxException; | ||
import java.nio.file.Path; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.Objects; | ||
import org.junit.jupiter.api.Test; | ||
|
||
public class ParquetUtilsTest { | ||
@Test | ||
public void testParquetPreview() throws IOException, URISyntaxException { | ||
Path path = Path.of(this.getClass().getClassLoader().getResource("patient.parquet").toURI()); | ||
List<Map<String, String>> preview = ParquetUtils.previewRecords(path, 10, 10); | ||
Path path = | ||
Path.of( | ||
Objects.requireNonNull(this.getClass().getClassLoader().getResource("patient.parquet")) | ||
.toURI()); | ||
List<Map<String, String>> preview = ParquetUtils.previewRecords(path, 10, 10, new String[0]); | ||
assertEquals("Patient1", preview.get(0).get("name")); | ||
assertEquals(preview.size(), 10); | ||
} | ||
|
||
@Test | ||
void testRetrieveDimensions() throws URISyntaxException, FileNotFoundException { | ||
Path path = Path.of(this.getClass().getClassLoader().getResource("patient.parquet").toURI()); | ||
Path path = | ||
Path.of( | ||
Objects.requireNonNull(this.getClass().getClassLoader().getResource("patient.parquet")) | ||
.toURI()); | ||
Map<String, String> dimensions = ParquetUtils.retrieveDimensions(path); | ||
assertEquals("3", dimensions.get("columns")); | ||
assertEquals("11", dimensions.get("rows")); | ||
} | ||
|
||
@Test | ||
void testGetColumns() throws URISyntaxException, IOException { | ||
Path path = Path.of(this.getClass().getClassLoader().getResource("patient.parquet").toURI()); | ||
Path path = | ||
Path.of( | ||
Objects.requireNonNull(this.getClass().getClassLoader().getResource("patient.parquet")) | ||
.toURI()); | ||
assertEquals(List.of("id", "age", "name"), ParquetUtils.getColumns(path)); | ||
} | ||
|
||
@Test | ||
void testPreviewWithVariables() throws URISyntaxException, IOException { | ||
Path path = | ||
Path.of( | ||
Objects.requireNonNull(this.getClass().getClassLoader().getResource("patient.parquet")) | ||
.toURI()); | ||
List<Map<String, String>> preview = | ||
ParquetUtils.previewRecords(path, 10, 10, new String[] {"age"}); | ||
assertEquals("24", preview.get(0).get("age")); | ||
assertNull(preview.get(0).get("name")); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters