/** * Performs a test (of the given identifying name) on the canvas and an associated tool by * injecting the given inputs, and comparing the final state of the associated tool with the * expected one given. */ public void performTest(String testID, Inputs inputs, int expectedState) throws Exception { this.testID = testID; try { // perform the inputs on the canvas inputs.perform(); Activepoller_c.Oneshot(); // test that the new current tool state is the given one // that was expected int currentState = inputs.getToolCurrentState(); assertTrue( "Expected State: " + expectedState + " got " + currentState, currentState == expectedState); validateOrGenerateResults( UITestingUtilities.getGraphicalEditorFor( (NonRootModelElement) canvas.getRepresents(), true), recordResults, true); } finally { // perform the given cleanup inputs on the canvas inputs.cleanup(); Activepoller_c.Oneshot(); } }
@Override public void execute(Inputs inputs) { Component mainComponent = Register.componentMap.get(inputs.getParams().get(0)); List<String> comList = mainComponent.getDepens(); for (String name : comList) { Register.componentMap.get(name).install(); } }
public static void main(String args[]) { try { Scanner inputScanner = new Scanner(new File(args[0])); JobsInDay myJobs = new JobsInDay(); while (inputScanner.hasNext()) { String s = inputScanner.nextLine(); String[] params = s.split(" "); if (params[0].equals("Job")) { Inputs inputs = new Inputs(params); myJobs.addJob(inputs.getFrom(), inputs.getTo()); } } LinkedList<Job> jobs = myJobs.getJobs(); for (Job j : jobs) { System.out.println( "From (" + j.getFrom().getX() + "," + j.getFrom().getY() + ") to (" + j.getTo().getX() + "," + j.getTo().getY() + ")."); } myJobs.getJobPath(); inputScanner.close(); } catch (FileNotFoundException e) { System.out.println("File not found."); e.printStackTrace(); } }
private static synchronized void logAtMostOnce(Logger logger, String message, boolean error) { Inputs.checkNull(logger, message); Set<String> previous = atMostOnceLogs.get(logger); if (previous == null) { previous = new LinkedHashSet<>(); atMostOnceLogs.put(logger, previous); } if (!previous.contains(message)) { previous.add(message); if (error) { logger.error(message); } else { logger.warn(message); } } }