@Test public void testMain() throws IOException { String pathToGoldenWadl = "src/test/resources/domain_SLI.wadl"; String pathToGeneratedWadl = "src/test/resources/scaffold_eapplication.wadl"; String pathToReportFile = "WadlComparatorOutput.txt"; WadlComparator.main(new String[]{pathToGoldenWadl, pathToGeneratedWadl, pathToReportFile}); File file = new File(pathToReportFile); assertTrue(file.exists()); file.delete(); }
public static void main(String[] args) throws IOException { if (args.length < 3 || args[0].toLowerCase().equals("h") || args[0].equals("?")) { STDOUT.println("Usage:"); STDOUT.println("java WadlComparator pathToGoldenWadl pathToGenerateWadl pathToReportFile"); System.exit(1); } pathToGoldenWadl = args[0]; pathToGeneratedWadl = args[1]; pathToReportFile = new PrintStream(new File(args[2])); OutputStream goldenStream = new ByteArrayOutputStream(); System.setOut(new PrintStream(goldenStream)); walkWadl(pathToGoldenWadl); List<String> golden = Arrays.asList(goldenStream.toString().split("\n")); goldenStream.close(); OutputStream generatedStream = new ByteArrayOutputStream(); System.setOut(new PrintStream(generatedStream)); walkWadl(pathToGeneratedWadl); List<String> generated = Arrays.asList(generatedStream.toString().split("\n")); generatedStream.close(); Map<String, Boolean> uniqueGoldenMap = new HashMap<String, Boolean>(); for (String s : golden) { uniqueGoldenMap.put(s, true); } List<String> uniqueGenerated = new ArrayList<String>(); for (String s : generated) { if (uniqueGoldenMap.containsKey(s)) { uniqueGoldenMap.remove(s); } else { uniqueGenerated.add(s); } } List<String> uniqueGolden = new ArrayList<String>(uniqueGoldenMap.keySet()); Collections.sort(uniqueGolden); Collections.sort(uniqueGenerated); System.setOut(pathToReportFile); LOG.info("Unique to Golden Wadl:"); for (String s : uniqueGolden) { LOG.info("\t" + s); } LOG.info("\nUnique to Generated Wadl:"); for (String s : uniqueGenerated) { LOG.info("\t" + s); } System.setOut(STDOUT); }
WadlComparator { public static void main(String[] args) throws IOException { if (args.length < 3 || args[0].toLowerCase().equals("h") || args[0].equals("?")) { STDOUT.println("Usage:"); STDOUT.println("java WadlComparator pathToGoldenWadl pathToGenerateWadl pathToReportFile"); System.exit(1); } pathToGoldenWadl = args[0]; pathToGeneratedWadl = args[1]; pathToReportFile = new PrintStream(new File(args[2])); OutputStream goldenStream = new ByteArrayOutputStream(); System.setOut(new PrintStream(goldenStream)); walkWadl(pathToGoldenWadl); List<String> golden = Arrays.asList(goldenStream.toString().split("\n")); goldenStream.close(); OutputStream generatedStream = new ByteArrayOutputStream(); System.setOut(new PrintStream(generatedStream)); walkWadl(pathToGeneratedWadl); List<String> generated = Arrays.asList(generatedStream.toString().split("\n")); generatedStream.close(); Map<String, Boolean> uniqueGoldenMap = new HashMap<String, Boolean>(); for (String s : golden) { uniqueGoldenMap.put(s, true); } List<String> uniqueGenerated = new ArrayList<String>(); for (String s : generated) { if (uniqueGoldenMap.containsKey(s)) { uniqueGoldenMap.remove(s); } else { uniqueGenerated.add(s); } } List<String> uniqueGolden = new ArrayList<String>(uniqueGoldenMap.keySet()); Collections.sort(uniqueGolden); Collections.sort(uniqueGenerated); System.setOut(pathToReportFile); LOG.info("Unique to Golden Wadl:"); for (String s : uniqueGolden) { LOG.info("\t" + s); } LOG.info("\nUnique to Generated Wadl:"); for (String s : uniqueGenerated) { LOG.info("\t" + s); } System.setOut(STDOUT); } }
WadlComparator { public static void main(String[] args) throws IOException { if (args.length < 3 || args[0].toLowerCase().equals("h") || args[0].equals("?")) { STDOUT.println("Usage:"); STDOUT.println("java WadlComparator pathToGoldenWadl pathToGenerateWadl pathToReportFile"); System.exit(1); } pathToGoldenWadl = args[0]; pathToGeneratedWadl = args[1]; pathToReportFile = new PrintStream(new File(args[2])); OutputStream goldenStream = new ByteArrayOutputStream(); System.setOut(new PrintStream(goldenStream)); walkWadl(pathToGoldenWadl); List<String> golden = Arrays.asList(goldenStream.toString().split("\n")); goldenStream.close(); OutputStream generatedStream = new ByteArrayOutputStream(); System.setOut(new PrintStream(generatedStream)); walkWadl(pathToGeneratedWadl); List<String> generated = Arrays.asList(generatedStream.toString().split("\n")); generatedStream.close(); Map<String, Boolean> uniqueGoldenMap = new HashMap<String, Boolean>(); for (String s : golden) { uniqueGoldenMap.put(s, true); } List<String> uniqueGenerated = new ArrayList<String>(); for (String s : generated) { if (uniqueGoldenMap.containsKey(s)) { uniqueGoldenMap.remove(s); } else { uniqueGenerated.add(s); } } List<String> uniqueGolden = new ArrayList<String>(uniqueGoldenMap.keySet()); Collections.sort(uniqueGolden); Collections.sort(uniqueGenerated); System.setOut(pathToReportFile); LOG.info("Unique to Golden Wadl:"); for (String s : uniqueGolden) { LOG.info("\t" + s); } LOG.info("\nUnique to Generated Wadl:"); for (String s : uniqueGenerated) { LOG.info("\t" + s); } System.setOut(STDOUT); } WadlComparator(); }
WadlComparator { public static void main(String[] args) throws IOException { if (args.length < 3 || args[0].toLowerCase().equals("h") || args[0].equals("?")) { STDOUT.println("Usage:"); STDOUT.println("java WadlComparator pathToGoldenWadl pathToGenerateWadl pathToReportFile"); System.exit(1); } pathToGoldenWadl = args[0]; pathToGeneratedWadl = args[1]; pathToReportFile = new PrintStream(new File(args[2])); OutputStream goldenStream = new ByteArrayOutputStream(); System.setOut(new PrintStream(goldenStream)); walkWadl(pathToGoldenWadl); List<String> golden = Arrays.asList(goldenStream.toString().split("\n")); goldenStream.close(); OutputStream generatedStream = new ByteArrayOutputStream(); System.setOut(new PrintStream(generatedStream)); walkWadl(pathToGeneratedWadl); List<String> generated = Arrays.asList(generatedStream.toString().split("\n")); generatedStream.close(); Map<String, Boolean> uniqueGoldenMap = new HashMap<String, Boolean>(); for (String s : golden) { uniqueGoldenMap.put(s, true); } List<String> uniqueGenerated = new ArrayList<String>(); for (String s : generated) { if (uniqueGoldenMap.containsKey(s)) { uniqueGoldenMap.remove(s); } else { uniqueGenerated.add(s); } } List<String> uniqueGolden = new ArrayList<String>(uniqueGoldenMap.keySet()); Collections.sort(uniqueGolden); Collections.sort(uniqueGenerated); System.setOut(pathToReportFile); LOG.info("Unique to Golden Wadl:"); for (String s : uniqueGolden) { LOG.info("\t" + s); } LOG.info("\nUnique to Generated Wadl:"); for (String s : uniqueGenerated) { LOG.info("\t" + s); } System.setOut(STDOUT); } WadlComparator(); static void main(String[] args); }
WadlComparator { public static void main(String[] args) throws IOException { if (args.length < 3 || args[0].toLowerCase().equals("h") || args[0].equals("?")) { STDOUT.println("Usage:"); STDOUT.println("java WadlComparator pathToGoldenWadl pathToGenerateWadl pathToReportFile"); System.exit(1); } pathToGoldenWadl = args[0]; pathToGeneratedWadl = args[1]; pathToReportFile = new PrintStream(new File(args[2])); OutputStream goldenStream = new ByteArrayOutputStream(); System.setOut(new PrintStream(goldenStream)); walkWadl(pathToGoldenWadl); List<String> golden = Arrays.asList(goldenStream.toString().split("\n")); goldenStream.close(); OutputStream generatedStream = new ByteArrayOutputStream(); System.setOut(new PrintStream(generatedStream)); walkWadl(pathToGeneratedWadl); List<String> generated = Arrays.asList(generatedStream.toString().split("\n")); generatedStream.close(); Map<String, Boolean> uniqueGoldenMap = new HashMap<String, Boolean>(); for (String s : golden) { uniqueGoldenMap.put(s, true); } List<String> uniqueGenerated = new ArrayList<String>(); for (String s : generated) { if (uniqueGoldenMap.containsKey(s)) { uniqueGoldenMap.remove(s); } else { uniqueGenerated.add(s); } } List<String> uniqueGolden = new ArrayList<String>(uniqueGoldenMap.keySet()); Collections.sort(uniqueGolden); Collections.sort(uniqueGenerated); System.setOut(pathToReportFile); LOG.info("Unique to Golden Wadl:"); for (String s : uniqueGolden) { LOG.info("\t" + s); } LOG.info("\nUnique to Generated Wadl:"); for (String s : uniqueGenerated) { LOG.info("\t" + s); } System.setOut(STDOUT); } WadlComparator(); static void main(String[] args);  }