@Test public void testRunJolt() throws IOException { String path = System.getProperty( "user.dir" ); if ( path.endsWith( "cli" ) ) { path += " } else { path += " } Assert.assertTrue( JoltCli.runJolt( new String[] {"diffy", path + "input1.json", path + "input1.json", "-s"} ) ); Assert.assertFalse( JoltCli.runJolt( new String[] {"diffy", path + "input1.json", path + "input2.json", "-s"} ) ); Assert.assertTrue( JoltCli.runJolt( new String[] {"sort", path + "input1.json"} ) ); Assert.assertTrue( JoltCli.runJolt( new String[] {"transform", path + "spec.json", path + "transformInput.json"} ) ); }
protected static boolean runJolt( String[] args ) { ArgumentParser parser = ArgumentParsers.newArgumentParser( "jolt" ); Subparsers subparsers = parser.addSubparsers().help( "transform: given a Jolt transform spec, runs the specified transforms on the input data.\n" + "diffy: diff two JSON documents.\n" + "sort: sort a JSON document alphabetically for human readability." ); for ( Map.Entry<String, JoltCliProcessor> entry : JOLT_CLI_PROCESSOR_MAP.entrySet() ) { entry.getValue().intializeSubCommand( subparsers ); } Namespace ns; try { ns = parser.parseArgs( args ); } catch ( ArgumentParserException e ) { parser.handleError( e ); return false; } JoltCliProcessor joltToolProcessor = JOLT_CLI_PROCESSOR_MAP.get( args[0] ); if ( joltToolProcessor != null ) { return joltToolProcessor.process( ns ); } else { return false; } }
JoltCli { protected static boolean runJolt( String[] args ) { ArgumentParser parser = ArgumentParsers.newArgumentParser( "jolt" ); Subparsers subparsers = parser.addSubparsers().help( "transform: given a Jolt transform spec, runs the specified transforms on the input data.\n" + "diffy: diff two JSON documents.\n" + "sort: sort a JSON document alphabetically for human readability." ); for ( Map.Entry<String, JoltCliProcessor> entry : JOLT_CLI_PROCESSOR_MAP.entrySet() ) { entry.getValue().intializeSubCommand( subparsers ); } Namespace ns; try { ns = parser.parseArgs( args ); } catch ( ArgumentParserException e ) { parser.handleError( e ); return false; } JoltCliProcessor joltToolProcessor = JOLT_CLI_PROCESSOR_MAP.get( args[0] ); if ( joltToolProcessor != null ) { return joltToolProcessor.process( ns ); } else { return false; } } }
JoltCli { protected static boolean runJolt( String[] args ) { ArgumentParser parser = ArgumentParsers.newArgumentParser( "jolt" ); Subparsers subparsers = parser.addSubparsers().help( "transform: given a Jolt transform spec, runs the specified transforms on the input data.\n" + "diffy: diff two JSON documents.\n" + "sort: sort a JSON document alphabetically for human readability." ); for ( Map.Entry<String, JoltCliProcessor> entry : JOLT_CLI_PROCESSOR_MAP.entrySet() ) { entry.getValue().intializeSubCommand( subparsers ); } Namespace ns; try { ns = parser.parseArgs( args ); } catch ( ArgumentParserException e ) { parser.handleError( e ); return false; } JoltCliProcessor joltToolProcessor = JOLT_CLI_PROCESSOR_MAP.get( args[0] ); if ( joltToolProcessor != null ) { return joltToolProcessor.process( ns ); } else { return false; } }  }
JoltCli { protected static boolean runJolt( String[] args ) { ArgumentParser parser = ArgumentParsers.newArgumentParser( "jolt" ); Subparsers subparsers = parser.addSubparsers().help( "transform: given a Jolt transform spec, runs the specified transforms on the input data.\n" + "diffy: diff two JSON documents.\n" + "sort: sort a JSON document alphabetically for human readability." ); for ( Map.Entry<String, JoltCliProcessor> entry : JOLT_CLI_PROCESSOR_MAP.entrySet() ) { entry.getValue().intializeSubCommand( subparsers ); } Namespace ns; try { ns = parser.parseArgs( args ); } catch ( ArgumentParserException e ) { parser.handleError( e ); return false; } JoltCliProcessor joltToolProcessor = JOLT_CLI_PROCESSOR_MAP.get( args[0] ); if ( joltToolProcessor != null ) { return joltToolProcessor.process( ns ); } else { return false; } }  static void main( String[] args ); }
JoltCli { protected static boolean runJolt( String[] args ) { ArgumentParser parser = ArgumentParsers.newArgumentParser( "jolt" ); Subparsers subparsers = parser.addSubparsers().help( "transform: given a Jolt transform spec, runs the specified transforms on the input data.\n" + "diffy: diff two JSON documents.\n" + "sort: sort a JSON document alphabetically for human readability." ); for ( Map.Entry<String, JoltCliProcessor> entry : JOLT_CLI_PROCESSOR_MAP.entrySet() ) { entry.getValue().intializeSubCommand( subparsers ); } Namespace ns; try { ns = parser.parseArgs( args ); } catch ( ArgumentParserException e ) { parser.handleError( e ); return false; } JoltCliProcessor joltToolProcessor = JOLT_CLI_PROCESSOR_MAP.get( args[0] ); if ( joltToolProcessor != null ) { return joltToolProcessor.process( ns ); } else { return false; } }  static void main( String[] args );  }