Skip to content

Commit

Permalink
Merge pull request #733 from molgenis/fix/linkfile-nr-of-columns-info
Browse files Browse the repository at this point in the history
fix: info endpoint returns incorrect number of columns for linkfile
  • Loading branch information
marikaris committed May 3, 2024
2 parents 2882fe3 + 57de814 commit f6a6a84
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ public String getProject() {
return this.project;
}

public Integer getNumberOfVariables() {
return getVariables().split(",").length;
}

public JsonObject loadFromStream(InputStream inputStream) {
return JsonParser.parseReader(new InputStreamReader(inputStream)).getAsJsonObject();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ private FileInfo getFileInfoForLinkFile(
objectName,
fileSizeWithUnit,
tableDimensions.get("rows"),
tableDimensions.get("columns"),
String.valueOf(linkFile.getNumberOfVariables()),
linkFile.getSourceProject() + "/" + linkFile.getSourceObject(),
linkFile.getVariables().split(","));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ public void testGetFileName() {
assertEquals("folder/link-obj.alf", actual);
}

@Test
public void testGetNumberOfVariables() {
Integer actual = alf.getNumberOfVariables();
assertEquals(3, actual);
}

@Test
public void testLoadFromStream() {
InputStream inputStream = new ByteArrayInputStream(testData.getBytes());
Expand Down

0 comments on commit f6a6a84

Please sign in to comment.