-
Notifications
You must be signed in to change notification settings - Fork 2
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 #177 from marklogic/feature/preview-schema
Added --preview-schema
- Loading branch information
Showing
12 changed files
with
93 additions
and
85 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
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
61 changes: 61 additions & 0 deletions
61
flux-cli/src/test/java/com/marklogic/flux/impl/PreviewTest.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 |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
* Copyright © 2024 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved. | ||
*/ | ||
package com.marklogic.flux.impl; | ||
|
||
import com.marklogic.flux.AbstractTest; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.io.TempDir; | ||
|
||
import java.nio.file.Path; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
class PreviewTest extends AbstractTest { | ||
|
||
@Test | ||
void limitAndPreview() { | ||
run( | ||
"import-delimited-files", | ||
"--path", "src/test/resources/delimited-files/three-rows.csv", | ||
"--connection-string", makeConnectionString(), | ||
"--limit", "1", | ||
"--preview", "3", | ||
"--preview-vertical", | ||
"--collections", "sample" | ||
); | ||
|
||
// We have not had reliable success with capturing stdout and making assertions on it, so this just verifies | ||
// that nothing is written. | ||
assertCollectionSize("Verifying that nothing is written to the collection", "sample", 0); | ||
} | ||
|
||
@Test | ||
void preview() { | ||
run( | ||
"import-files", | ||
"--path", "src/test/resources/mixed-files", | ||
"--preview", "2", | ||
"--preview-drop", "content", "modificationTime", | ||
"--preview-vertical", | ||
"--collections", "sample" | ||
); | ||
|
||
assertCollectionSize("Verifying that nothing is written to the collection", "sample", 0); | ||
} | ||
|
||
@Test | ||
void previewSchema(@TempDir Path tempDir) { | ||
run( | ||
"export-parquet", | ||
"--path", tempDir.toFile().getAbsolutePath(), | ||
"--connection-string", makeConnectionString(), | ||
"--query", "op.fromView('Medical', 'Authors')", | ||
"--preview-schema" | ||
); | ||
|
||
assertEquals(0, tempDir.toFile().listFiles().length, | ||
"Verifying that nothing was exported since preview-schema was used, which should result in the Spark " + | ||
"dataset schema being logged at the INFO level (which we're not yet able to assert on)."); | ||
} | ||
} |
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
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