AecuServiceImpl implements AecuService { @Override public boolean matchesRunmodes(String name) { if (!name.contains(".")) { return true; } Set<String> runModes = slingSettings.getRunModes(); String runModeString = name.substring(name.indexOf('.') + 1); String[] combinations = runModeString.split(";"); for (String combination : combinations) { String[] modes = combination.split("\\."); if (runModes.containsAll(Arrays.asList(modes))) { return true; } } return false; }  @Override String getVersion(); @Override List<String> getFiles(String path); @Override boolean matchesRunmodes(String name); @Override boolean isValidScriptName(String name); @Override ExecutionResult execute(String path); @Override HistoryEntry createHistoryEntry(); @Override HistoryEntry finishHistoryEntry(HistoryEntry history); @Override HistoryEntry storeExecutionInHistory(HistoryEntry history, ExecutionResult result); @Override List<HistoryEntry> getHistory(int startIndex, int count);  }
@Test public void matchesRunmodes_noMode() { assertTrue(service.matchesRunmodes("name")); }
@Test public void matchesRunmodes_nonMatching() { assertFalse(service.matchesRunmodes("name.publish")); }
@Test public void matchesRunmodes_matching() { assertTrue(service.matchesRunmodes("name.author")); assertTrue(service.matchesRunmodes("name.test")); }
@Test public void matchesRunmodes_matchingMulti() { assertTrue(service.matchesRunmodes("name.author.test")); assertTrue(service.matchesRunmodes("name.author.test;testNO")); assertTrue(service.matchesRunmodes("name.authorNO.test;test2.author")); }
@Test public void matchesRunmodes_nonMatchingMulti() { assertFalse(service.matchesRunmodes("name.author.testNO")); assertFalse(service.matchesRunmodes("name.author.testNO;testNO")); assertFalse(service.matchesRunmodes("name.author.testNO;test2NO.author")); }