-
Notifications
You must be signed in to change notification settings - Fork 596
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
1,937 additions
and
8 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
28 changes: 28 additions & 0 deletions
28
src/main/java/org/broadinstitute/hellbender/CommandLineArgumentValidatorMain.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,28 @@ | ||
package org.broadinstitute.hellbender; | ||
|
||
import org.broadinstitute.hellbender.cmdline.CommandLineProgram; | ||
import org.broadinstitute.hellbender.cmdline.CommandLineArgumentValidator; | ||
|
||
import java.util.Arrays; | ||
|
||
/** | ||
* Main class to be used as an alternative entry point to {@code org.broadinstitute.hellbender.Main} for performing | ||
* command line validation only rather than executing the tool. Used only for testing. Failures manifest as exceptions. | ||
*/ | ||
public class CommandLineArgumentValidatorMain extends Main { | ||
|
||
// The main entry point to run GATK tools in command line validation mode only. | ||
public static void main(final String[] argv) { | ||
new CommandLineArgumentValidatorMain().validateCommandLine(argv); | ||
} | ||
|
||
/** | ||
* Call the command line program (specified in the input arguments) in command line validation mode only. | ||
* @param argv the raw arguments, including the name of the target tool, to run in command line validation mode | ||
*/ | ||
public void validateCommandLine(final String[] argv) { | ||
final CommandLineProgram program = setupConfigAndExtractProgram(argv, getPackageList(), getClassList(), getCommandLineName()); | ||
final String[] mainArgs = Arrays.copyOfRange(argv, 1, argv.length); | ||
new CommandLineArgumentValidator(program).instanceMain(mainArgs); | ||
} | ||
} |
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
37 changes: 37 additions & 0 deletions
37
src/main/java/org/broadinstitute/hellbender/cmdline/CommandLineArgumentValidator.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,37 @@ | ||
package org.broadinstitute.hellbender.cmdline; | ||
|
||
import org.broadinstitute.hellbender.exceptions.GATKException; | ||
|
||
/** | ||
* Adapter shim/alternate GATK entry point for use by GATK tests to run tools in command line argument | ||
* validation mode. This class does not actually tools, it only validates that the command line arguments | ||
* are legal for a given invocation. | ||
* | ||
* Note that this class does not have it's own CommandLineProgramProperties annotation. | ||
*/ | ||
public class CommandLineArgumentValidator extends CommandLineProgram { | ||
|
||
// Our target command line program, to which we delegate arg parsing calls. | ||
final private CommandLineProgram targetCommandLineProgram; | ||
|
||
public CommandLineArgumentValidator(final CommandLineProgram targetCommandLineProgram) { | ||
this.targetCommandLineProgram = targetCommandLineProgram; | ||
} | ||
|
||
/** | ||
* Entry point to run command line argument validation only. | ||
*/ | ||
@Override | ||
public Object instanceMain(final String[] argv) { | ||
// just call parseArgs and then return | ||
return targetCommandLineProgram.parseArgs(argv); | ||
} | ||
|
||
@Override | ||
protected Object doWork() { | ||
// This method should never be called directly. Call instanceMain instead. | ||
throw new GATKException.ShouldNeverReachHereException( | ||
String.format("Attempt to call the doWork method on the validator test tool \"%s\" directly.", | ||
targetCommandLineProgram.getClass().getName())); | ||
} | ||
} |
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
Oops, something went wrong.