Skip to content

Commit

Permalink
fix(info endpoint): returns number of columns in source table rather …
Browse files Browse the repository at this point in the history
…than link file
  • Loading branch information
marikaris committed May 3, 2024
1 parent 2882fe3 commit 57de814
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 57de814

Please sign in to comment.