target stringlengths 20 113k | src_fm stringlengths 11 86.3k | src_fm_fc stringlengths 21 86.4k | src_fm_fc_co stringlengths 30 86.4k | src_fm_fc_ms stringlengths 42 86.8k | src_fm_fc_ms_ff stringlengths 43 86.8k |
|---|---|---|---|---|---|
@Test public void confirmNewEvent_differentDay() { final String title = "hello world"; final DateTime from = DateTime.parse("2010-08-13T20:15"); final DateTime to = from.plusHours(1).plusDays(1); final SsmlOutputSpeech result = (SsmlOutputSpeech)toTest.confirmNewEvent(title, from, to, aLocale); assertEquals(String.form... | public OutputSpeech confirmNewEvent(String title, DateTime from, DateTime to, Locale locale) { final String speechText; if(from.getYear() == to.getYear() && from.getDayOfYear() == to.getDayOfYear()) { speechText = messageService.de("event.new.confirm.sameday", from.toString(DAY_FORMAT, locale), from.toString(DATE_YEAR_... | SpeechService { public OutputSpeech confirmNewEvent(String title, DateTime from, DateTime to, Locale locale) { final String speechText; if(from.getYear() == to.getYear() && from.getDayOfYear() == to.getDayOfYear()) { speechText = messageService.de("event.new.confirm.sameday", from.toString(DAY_FORMAT, locale), from.toS... | SpeechService { public OutputSpeech confirmNewEvent(String title, DateTime from, DateTime to, Locale locale) { final String speechText; if(from.getYear() == to.getYear() && from.getDayOfYear() == to.getDayOfYear()) { speechText = messageService.de("event.new.confirm.sameday", from.toString(DAY_FORMAT, locale), from.toS... | SpeechService { public OutputSpeech confirmNewEvent(String title, DateTime from, DateTime to, Locale locale) { final String speechText; if(from.getYear() == to.getYear() && from.getDayOfYear() == to.getDayOfYear()) { speechText = messageService.de("event.new.confirm.sameday", from.toString(DAY_FORMAT, locale), from.toS... | SpeechService { public OutputSpeech confirmNewEvent(String title, DateTime from, DateTime to, Locale locale) { final String speechText; if(from.getYear() == to.getYear() && from.getDayOfYear() == to.getDayOfYear()) { speechText = messageService.de("event.new.confirm.sameday", from.toString(DAY_FORMAT, locale), from.toS... |
@Test public void speechNewEventSaved(){ final PlainTextOutputSpeech result = (PlainTextOutputSpeech)toTest.speechNewEventSaved(aLocale); assertEquals("OK. Ich habe den Termin gespeichert.", result.getText()); } | public OutputSpeech speechNewEventSaved(Locale locale) { final String speechText = messageService.de("event.new.saved"); return speechMessage(speechText); } | SpeechService { public OutputSpeech speechNewEventSaved(Locale locale) { final String speechText = messageService.de("event.new.saved"); return speechMessage(speechText); } } | SpeechService { public OutputSpeech speechNewEventSaved(Locale locale) { final String speechText = messageService.de("event.new.saved"); return speechMessage(speechText); } } | SpeechService { public OutputSpeech speechNewEventSaved(Locale locale) { final String speechText = messageService.de("event.new.saved"); return speechMessage(speechText); } OutputSpeech speechWelcomeMessage(Locale locale); OutputSpeech speechBye(Locale locale); OutputSpeech speechHelpMessage(Locale locale); OutputSpee... | SpeechService { public OutputSpeech speechNewEventSaved(Locale locale) { final String speechText = messageService.de("event.new.saved"); return speechMessage(speechText); } OutputSpeech speechWelcomeMessage(Locale locale); OutputSpeech speechBye(Locale locale); OutputSpeech speechHelpMessage(Locale locale); OutputSpee... |
@Test public void speechGeneralConfirmation(){ final PlainTextOutputSpeech result = (PlainTextOutputSpeech)toTest.speechGeneralConfirmation(aLocale); assertEquals("OK.", result.getText()); } | public OutputSpeech speechGeneralConfirmation(Locale locale) { final String speechText = messageService.de("confirm"); return speechMessage(speechText); } | SpeechService { public OutputSpeech speechGeneralConfirmation(Locale locale) { final String speechText = messageService.de("confirm"); return speechMessage(speechText); } } | SpeechService { public OutputSpeech speechGeneralConfirmation(Locale locale) { final String speechText = messageService.de("confirm"); return speechMessage(speechText); } } | SpeechService { public OutputSpeech speechGeneralConfirmation(Locale locale) { final String speechText = messageService.de("confirm"); return speechMessage(speechText); } OutputSpeech speechWelcomeMessage(Locale locale); OutputSpeech speechBye(Locale locale); OutputSpeech speechHelpMessage(Locale locale); OutputSpeech... | SpeechService { public OutputSpeech speechGeneralConfirmation(Locale locale) { final String speechText = messageService.de("confirm"); return speechMessage(speechText); } OutputSpeech speechWelcomeMessage(Locale locale); OutputSpeech speechBye(Locale locale); OutputSpeech speechHelpMessage(Locale locale); OutputSpeech... |
@Test public void getNextEvents() throws CalendarReadException { final List<Event> events = new ArrayList<>(); doReturn(events).when(toTest).getEvents(any(), any()); final DateTime now = DateTime.now(); final List<Event> result = toTest.getNextEvents(); ArgumentCaptor<DateTime> timeCap = ArgumentCaptor.forClass(DateTim... | public List<Event> getNextEvents() throws CalendarReadException { final DateTime from = DateTime.now(); final DateTime to = from.plusWeeks(1).plusDays(1).withTimeAtStartOfDay(); return getEvents(from, to); } | CalendarService { public List<Event> getNextEvents() throws CalendarReadException { final DateTime from = DateTime.now(); final DateTime to = from.plusWeeks(1).plusDays(1).withTimeAtStartOfDay(); return getEvents(from, to); } } | CalendarService { public List<Event> getNextEvents() throws CalendarReadException { final DateTime from = DateTime.now(); final DateTime to = from.plusWeeks(1).plusDays(1).withTimeAtStartOfDay(); return getEvents(from, to); } } | CalendarService { public List<Event> getNextEvents() throws CalendarReadException { final DateTime from = DateTime.now(); final DateTime to = from.plusWeeks(1).plusDays(1).withTimeAtStartOfDay(); return getEvents(from, to); } List<Event> getEvents(DateTime from, DateTime to); List<Event> getNextEvents(); String create... | CalendarService { public List<Event> getNextEvents() throws CalendarReadException { final DateTime from = DateTime.now(); final DateTime to = from.plusWeeks(1).plusDays(1).withTimeAtStartOfDay(); return getEvents(from, to); } List<Event> getEvents(DateTime from, DateTime to); List<Event> getNextEvents(); String create... |
@Test public void getEvents() throws IOException, CalendarReadException { final CalendarCLIAdapter calendarOne = mock(CalendarCLIAdapter.class); final CalendarCLIAdapter calendarTwo = mock(CalendarCLIAdapter.class); final Map<String, CalendarCLIAdapter> calendars = new HashMap<>(); calendars.put("one", calendarOne); ca... | public List<Event> getEvents(DateTime from, DateTime to) throws CalendarReadException { if(getCalendars() == null) return Collections.emptyList(); try { List<Event> allEvents = new ArrayList<>(); List<Future<List<Event>>> futures = new ArrayList<>(getCalendars().size()); for(CalendarCLIAdapter calendar : getCalendars()... | CalendarService { public List<Event> getEvents(DateTime from, DateTime to) throws CalendarReadException { if(getCalendars() == null) return Collections.emptyList(); try { List<Event> allEvents = new ArrayList<>(); List<Future<List<Event>>> futures = new ArrayList<>(getCalendars().size()); for(CalendarCLIAdapter calenda... | CalendarService { public List<Event> getEvents(DateTime from, DateTime to) throws CalendarReadException { if(getCalendars() == null) return Collections.emptyList(); try { List<Event> allEvents = new ArrayList<>(); List<Future<List<Event>>> futures = new ArrayList<>(getCalendars().size()); for(CalendarCLIAdapter calenda... | CalendarService { public List<Event> getEvents(DateTime from, DateTime to) throws CalendarReadException { if(getCalendars() == null) return Collections.emptyList(); try { List<Event> allEvents = new ArrayList<>(); List<Future<List<Event>>> futures = new ArrayList<>(getCalendars().size()); for(CalendarCLIAdapter calenda... | CalendarService { public List<Event> getEvents(DateTime from, DateTime to) throws CalendarReadException { if(getCalendars() == null) return Collections.emptyList(); try { List<Event> allEvents = new ArrayList<>(); List<Future<List<Event>>> futures = new ArrayList<>(getCalendars().size()); for(CalendarCLIAdapter calenda... |
@Test public void readAgenda() throws IOException { final DateTime from = DateTime.now().minusDays(1); final DateTime to = from.plusDays(2); List<String> result = toTest.readAgenda(from, to); assertTrue(result.isEmpty()); ArgumentCaptor<CommandLine> cmdCap = ArgumentCaptor.forClass(CommandLine.class); verify(toTest, ti... | public List<String> readAgenda(DateTime from, DateTime to) throws IOException { List<String> subCommands = new ArrayList<>(); subCommands.add("--icalendar"); subCommands.add("calendar"); subCommands.add("agenda"); if(from != null) { subCommands.add("--from-time"); subCommands.add(from.toString()); } if(to != null) { su... | CalendarCLIAdapter { public List<String> readAgenda(DateTime from, DateTime to) throws IOException { List<String> subCommands = new ArrayList<>(); subCommands.add("--icalendar"); subCommands.add("calendar"); subCommands.add("agenda"); if(from != null) { subCommands.add("--from-time"); subCommands.add(from.toString()); ... | CalendarCLIAdapter { public List<String> readAgenda(DateTime from, DateTime to) throws IOException { List<String> subCommands = new ArrayList<>(); subCommands.add("--icalendar"); subCommands.add("calendar"); subCommands.add("agenda"); if(from != null) { subCommands.add("--from-time"); subCommands.add(from.toString()); ... | CalendarCLIAdapter { public List<String> readAgenda(DateTime from, DateTime to) throws IOException { List<String> subCommands = new ArrayList<>(); subCommands.add("--icalendar"); subCommands.add("calendar"); subCommands.add("agenda"); if(from != null) { subCommands.add("--from-time"); subCommands.add(from.toString()); ... | CalendarCLIAdapter { public List<String> readAgenda(DateTime from, DateTime to) throws IOException { List<String> subCommands = new ArrayList<>(); subCommands.add("--icalendar"); subCommands.add("calendar"); subCommands.add("agenda"); if(from != null) { subCommands.add("--from-time"); subCommands.add(from.toString()); ... |
@Test public void createEvent() throws IOException { final String summary = "<summary>"; final DateTime from = DateTime.parse("2010-08-13T20:15:00"); final DateTime to = from.plusDays(1).plusHours(1).plusMinutes(1); doAnswer((inv) -> { OutputStream os = (OutputStream)ReflectionTestUtils.getField( ((DefaultExecutor)inv.... | public String createEvent(final String summary, final DateTime from, final DateTime to) throws IOException { List<String> subCommands = new ArrayList<>(); subCommands.add("calendar"); subCommands.add("add"); final Duration duration = new Interval(from, to).toDuration(); final StringBuilder eventTime = new StringBuilder... | CalendarCLIAdapter { public String createEvent(final String summary, final DateTime from, final DateTime to) throws IOException { List<String> subCommands = new ArrayList<>(); subCommands.add("calendar"); subCommands.add("add"); final Duration duration = new Interval(from, to).toDuration(); final StringBuilder eventTim... | CalendarCLIAdapter { public String createEvent(final String summary, final DateTime from, final DateTime to) throws IOException { List<String> subCommands = new ArrayList<>(); subCommands.add("calendar"); subCommands.add("add"); final Duration duration = new Interval(from, to).toDuration(); final StringBuilder eventTim... | CalendarCLIAdapter { public String createEvent(final String summary, final DateTime from, final DateTime to) throws IOException { List<String> subCommands = new ArrayList<>(); subCommands.add("calendar"); subCommands.add("add"); final Duration duration = new Interval(from, to).toDuration(); final StringBuilder eventTim... | CalendarCLIAdapter { public String createEvent(final String summary, final DateTime from, final DateTime to) throws IOException { List<String> subCommands = new ArrayList<>(); subCommands.add("calendar"); subCommands.add("add"); final Duration duration = new Interval(from, to).toDuration(); final StringBuilder eventTim... |
@Test public void testParser(){ List<String> rawEvents = Arrays.asList( "BEGIN:VCALENDAR\n" + "VERSION:2.0\n" + "PRODID:- + "CALSCALE:GREGORIAN\n" + "BEGIN:VEVENT\n" + "DTSTAMP:20170411T200614Z\n" + "UID:20170411T200614Z-2ce178178dd977ce\n" + "DTSTART;VALUE=DATE:20170527\n" + "DTEND;VALUE=DATE:20170528\n" + "SUMMARY:Gr... | public List<VEvent> parseEvents(List<String> rawEvents) { List<VEvent> events = rawEvents.stream() .flatMap(raw -> parseEvent(raw).stream()) .collect(Collectors.toList()); return events; } | ICalendarParser { public List<VEvent> parseEvents(List<String> rawEvents) { List<VEvent> events = rawEvents.stream() .flatMap(raw -> parseEvent(raw).stream()) .collect(Collectors.toList()); return events; } } | ICalendarParser { public List<VEvent> parseEvents(List<String> rawEvents) { List<VEvent> events = rawEvents.stream() .flatMap(raw -> parseEvent(raw).stream()) .collect(Collectors.toList()); return events; } } | ICalendarParser { public List<VEvent> parseEvents(List<String> rawEvents) { List<VEvent> events = rawEvents.stream() .flatMap(raw -> parseEvent(raw).stream()) .collect(Collectors.toList()); return events; } List<VEvent> parseEvents(List<String> rawEvents); List<VEvent> parseEvent(String rawEvent); } | ICalendarParser { public List<VEvent> parseEvents(List<String> rawEvents) { List<VEvent> events = rawEvents.stream() .flatMap(raw -> parseEvent(raw).stream()) .collect(Collectors.toList()); return events; } List<VEvent> parseEvents(List<String> rawEvents); List<VEvent> parseEvent(String rawEvent); } |
@Test(expected = IllegalArgumentException.class) public void argumentsNotRight() throws NoSuchMethodException { TestClass toTest = new TestClass(); Method method = TestClass.class.getMethod("integer", Integer.class); ReflectionUtils.call(method, toTest, new Argument(Long.class, 13L)); } | public static Object call(Method method, Object target, Argument...arguments) { checkArguments(method, arguments); Object[] methodArguments = collectArguments(method, arguments); return org.springframework.util.ReflectionUtils.invokeMethod(method, target, methodArguments); } | ReflectionUtils { public static Object call(Method method, Object target, Argument...arguments) { checkArguments(method, arguments); Object[] methodArguments = collectArguments(method, arguments); return org.springframework.util.ReflectionUtils.invokeMethod(method, target, methodArguments); } } | ReflectionUtils { public static Object call(Method method, Object target, Argument...arguments) { checkArguments(method, arguments); Object[] methodArguments = collectArguments(method, arguments); return org.springframework.util.ReflectionUtils.invokeMethod(method, target, methodArguments); } } | ReflectionUtils { public static Object call(Method method, Object target, Argument...arguments) { checkArguments(method, arguments); Object[] methodArguments = collectArguments(method, arguments); return org.springframework.util.ReflectionUtils.invokeMethod(method, target, methodArguments); } static Object call(Method... | ReflectionUtils { public static Object call(Method method, Object target, Argument...arguments) { checkArguments(method, arguments); Object[] methodArguments = collectArguments(method, arguments); return org.springframework.util.ReflectionUtils.invokeMethod(method, target, methodArguments); } static Object call(Method... |
@Test public void map() { final VEvent event = new VEvent(); event.setDateStart(DateTime.parse("2009-12-15T22:15:00").withZone(DateTimeZone.UTC).toDate(), true); event.setDateEnd(DateTime.parse("2010-08-13T20:15:00").withZone(DateTimeZone.UTC).toDate(), true); event.setSummary("<summary>"); event.setDescription("<descr... | public Event map(VEvent event, TimeZone defaultTimeZone) { Event result = new Event(); nullSave(() -> { final DateTime start = new DateTime(event.getDateStart().getValue().getTime(), DateTimeZone.forTimeZone(defaultTimeZone)); result.setStart(start, event.getDateStart().getValue().hasTime()); }); nullSave(() -> { final... | EventMapper { public Event map(VEvent event, TimeZone defaultTimeZone) { Event result = new Event(); nullSave(() -> { final DateTime start = new DateTime(event.getDateStart().getValue().getTime(), DateTimeZone.forTimeZone(defaultTimeZone)); result.setStart(start, event.getDateStart().getValue().hasTime()); }); nullSave... | EventMapper { public Event map(VEvent event, TimeZone defaultTimeZone) { Event result = new Event(); nullSave(() -> { final DateTime start = new DateTime(event.getDateStart().getValue().getTime(), DateTimeZone.forTimeZone(defaultTimeZone)); result.setStart(start, event.getDateStart().getValue().hasTime()); }); nullSave... | EventMapper { public Event map(VEvent event, TimeZone defaultTimeZone) { Event result = new Event(); nullSave(() -> { final DateTime start = new DateTime(event.getDateStart().getValue().getTime(), DateTimeZone.forTimeZone(defaultTimeZone)); result.setStart(start, event.getDateStart().getValue().hasTime()); }); nullSave... | EventMapper { public Event map(VEvent event, TimeZone defaultTimeZone) { Event result = new Event(); nullSave(() -> { final DateTime start = new DateTime(event.getDateStart().getValue().getTime(), DateTimeZone.forTimeZone(defaultTimeZone)); result.setStart(start, event.getDateStart().getValue().hasTime()); }); nullSave... |
@Test public void map_noTime() { final VEvent event = new VEvent(); event.setDateStart(DateTime.parse("2009-12-15T22:15:00").withZone(DateTimeZone.UTC).toDate(), false); event.setDateEnd(DateTime.parse("2010-08-13T21:15:00").withZone(DateTimeZone.UTC).toDate(), false); event.setSummary("<summary>"); event.setDescriptio... | public Event map(VEvent event, TimeZone defaultTimeZone) { Event result = new Event(); nullSave(() -> { final DateTime start = new DateTime(event.getDateStart().getValue().getTime(), DateTimeZone.forTimeZone(defaultTimeZone)); result.setStart(start, event.getDateStart().getValue().hasTime()); }); nullSave(() -> { final... | EventMapper { public Event map(VEvent event, TimeZone defaultTimeZone) { Event result = new Event(); nullSave(() -> { final DateTime start = new DateTime(event.getDateStart().getValue().getTime(), DateTimeZone.forTimeZone(defaultTimeZone)); result.setStart(start, event.getDateStart().getValue().hasTime()); }); nullSave... | EventMapper { public Event map(VEvent event, TimeZone defaultTimeZone) { Event result = new Event(); nullSave(() -> { final DateTime start = new DateTime(event.getDateStart().getValue().getTime(), DateTimeZone.forTimeZone(defaultTimeZone)); result.setStart(start, event.getDateStart().getValue().hasTime()); }); nullSave... | EventMapper { public Event map(VEvent event, TimeZone defaultTimeZone) { Event result = new Event(); nullSave(() -> { final DateTime start = new DateTime(event.getDateStart().getValue().getTime(), DateTimeZone.forTimeZone(defaultTimeZone)); result.setStart(start, event.getDateStart().getValue().hasTime()); }); nullSave... | EventMapper { public Event map(VEvent event, TimeZone defaultTimeZone) { Event result = new Event(); nullSave(() -> { final DateTime start = new DateTime(event.getDateStart().getValue().getTime(), DateTimeZone.forTimeZone(defaultTimeZone)); result.setStart(start, event.getDateStart().getValue().hasTime()); }); nullSave... |
@Test public void map_nullSave() { final VEvent event = new VEvent(); final TimeZone tz = TimeZone.getTimeZone("Europe/Berlin"); final Event result = toTest.map(event, tz); assertNull(result.getStart()); assertNull(result.getEnd()); assertNull(result.getSummary()); assertNull(result.getDescription()); } | public Event map(VEvent event, TimeZone defaultTimeZone) { Event result = new Event(); nullSave(() -> { final DateTime start = new DateTime(event.getDateStart().getValue().getTime(), DateTimeZone.forTimeZone(defaultTimeZone)); result.setStart(start, event.getDateStart().getValue().hasTime()); }); nullSave(() -> { final... | EventMapper { public Event map(VEvent event, TimeZone defaultTimeZone) { Event result = new Event(); nullSave(() -> { final DateTime start = new DateTime(event.getDateStart().getValue().getTime(), DateTimeZone.forTimeZone(defaultTimeZone)); result.setStart(start, event.getDateStart().getValue().hasTime()); }); nullSave... | EventMapper { public Event map(VEvent event, TimeZone defaultTimeZone) { Event result = new Event(); nullSave(() -> { final DateTime start = new DateTime(event.getDateStart().getValue().getTime(), DateTimeZone.forTimeZone(defaultTimeZone)); result.setStart(start, event.getDateStart().getValue().hasTime()); }); nullSave... | EventMapper { public Event map(VEvent event, TimeZone defaultTimeZone) { Event result = new Event(); nullSave(() -> { final DateTime start = new DateTime(event.getDateStart().getValue().getTime(), DateTimeZone.forTimeZone(defaultTimeZone)); result.setStart(start, event.getDateStart().getValue().hasTime()); }); nullSave... | EventMapper { public Event map(VEvent event, TimeZone defaultTimeZone) { Event result = new Event(); nullSave(() -> { final DateTime start = new DateTime(event.getDateStart().getValue().getTime(), DateTimeZone.forTimeZone(defaultTimeZone)); result.setStart(start, event.getDateStart().getValue().hasTime()); }); nullSave... |
@Test public void inProgress_NotAllSlotsAreFilled() throws CalendarWriteException { final Session session = Session.builder() .withSessionId("<session-id>") .build(); final Intent intent = Intent.builder() .withName("<intent>") .withSlots(slots( slot("day", null) )) .build(); final IntentRequest request = IntentRequest... | @OnIntent("NewEvent") public SpeechletResponse handleDialogAction(final IntentRequest request, final Session session) throws CalendarWriteException { session.setAttribute(BasicSpeechlet.KEY_DIALOG_TYPE, BasicSpeechlet.DIALOG_TYPE_NEW_EVENT); final SpeechletResponse response; try { switch (request.getIntent().getConfirm... | NewEventSpeechlet { @OnIntent("NewEvent") public SpeechletResponse handleDialogAction(final IntentRequest request, final Session session) throws CalendarWriteException { session.setAttribute(BasicSpeechlet.KEY_DIALOG_TYPE, BasicSpeechlet.DIALOG_TYPE_NEW_EVENT); final SpeechletResponse response; try { switch (request.ge... | NewEventSpeechlet { @OnIntent("NewEvent") public SpeechletResponse handleDialogAction(final IntentRequest request, final Session session) throws CalendarWriteException { session.setAttribute(BasicSpeechlet.KEY_DIALOG_TYPE, BasicSpeechlet.DIALOG_TYPE_NEW_EVENT); final SpeechletResponse response; try { switch (request.ge... | NewEventSpeechlet { @OnIntent("NewEvent") public SpeechletResponse handleDialogAction(final IntentRequest request, final Session session) throws CalendarWriteException { session.setAttribute(BasicSpeechlet.KEY_DIALOG_TYPE, BasicSpeechlet.DIALOG_TYPE_NEW_EVENT); final SpeechletResponse response; try { switch (request.ge... | NewEventSpeechlet { @OnIntent("NewEvent") public SpeechletResponse handleDialogAction(final IntentRequest request, final Session session) throws CalendarWriteException { session.setAttribute(BasicSpeechlet.KEY_DIALOG_TYPE, BasicSpeechlet.DIALOG_TYPE_NEW_EVENT); final SpeechletResponse response; try { switch (request.ge... |
@Test public void inProgress_AllSlotsAreFilled() throws CalendarWriteException { final Intent intent = Intent.builder() .withName("<intent>") .withSlots(slots( slot(SLOT_DATE_FROM, "2010-08-13"), slot(SLOT_TIME_FROM, "20:15"), slot(SLOT_DURATION, "PT2H"), slot(SLOT_PREFIX_SUMMARY, "Title") )) .build(); final IntentRequ... | @OnIntent("NewEvent") public SpeechletResponse handleDialogAction(final IntentRequest request, final Session session) throws CalendarWriteException { session.setAttribute(BasicSpeechlet.KEY_DIALOG_TYPE, BasicSpeechlet.DIALOG_TYPE_NEW_EVENT); final SpeechletResponse response; try { switch (request.getIntent().getConfirm... | NewEventSpeechlet { @OnIntent("NewEvent") public SpeechletResponse handleDialogAction(final IntentRequest request, final Session session) throws CalendarWriteException { session.setAttribute(BasicSpeechlet.KEY_DIALOG_TYPE, BasicSpeechlet.DIALOG_TYPE_NEW_EVENT); final SpeechletResponse response; try { switch (request.ge... | NewEventSpeechlet { @OnIntent("NewEvent") public SpeechletResponse handleDialogAction(final IntentRequest request, final Session session) throws CalendarWriteException { session.setAttribute(BasicSpeechlet.KEY_DIALOG_TYPE, BasicSpeechlet.DIALOG_TYPE_NEW_EVENT); final SpeechletResponse response; try { switch (request.ge... | NewEventSpeechlet { @OnIntent("NewEvent") public SpeechletResponse handleDialogAction(final IntentRequest request, final Session session) throws CalendarWriteException { session.setAttribute(BasicSpeechlet.KEY_DIALOG_TYPE, BasicSpeechlet.DIALOG_TYPE_NEW_EVENT); final SpeechletResponse response; try { switch (request.ge... | NewEventSpeechlet { @OnIntent("NewEvent") public SpeechletResponse handleDialogAction(final IntentRequest request, final Session session) throws CalendarWriteException { session.setAttribute(BasicSpeechlet.KEY_DIALOG_TYPE, BasicSpeechlet.DIALOG_TYPE_NEW_EVENT); final SpeechletResponse response; try { switch (request.ge... |
@Test public void denied() throws CalendarWriteException { final Session session = Session.builder() .withSessionId("<session-id>") .build(); final Intent intent = Intent.builder() .withName("<intent>") .withConfirmationStatus(ConfirmationStatus.DENIED) .build(); final IntentRequest request = IntentRequest.builder() .w... | @OnIntent("NewEvent") public SpeechletResponse handleDialogAction(final IntentRequest request, final Session session) throws CalendarWriteException { session.setAttribute(BasicSpeechlet.KEY_DIALOG_TYPE, BasicSpeechlet.DIALOG_TYPE_NEW_EVENT); final SpeechletResponse response; try { switch (request.getIntent().getConfirm... | NewEventSpeechlet { @OnIntent("NewEvent") public SpeechletResponse handleDialogAction(final IntentRequest request, final Session session) throws CalendarWriteException { session.setAttribute(BasicSpeechlet.KEY_DIALOG_TYPE, BasicSpeechlet.DIALOG_TYPE_NEW_EVENT); final SpeechletResponse response; try { switch (request.ge... | NewEventSpeechlet { @OnIntent("NewEvent") public SpeechletResponse handleDialogAction(final IntentRequest request, final Session session) throws CalendarWriteException { session.setAttribute(BasicSpeechlet.KEY_DIALOG_TYPE, BasicSpeechlet.DIALOG_TYPE_NEW_EVENT); final SpeechletResponse response; try { switch (request.ge... | NewEventSpeechlet { @OnIntent("NewEvent") public SpeechletResponse handleDialogAction(final IntentRequest request, final Session session) throws CalendarWriteException { session.setAttribute(BasicSpeechlet.KEY_DIALOG_TYPE, BasicSpeechlet.DIALOG_TYPE_NEW_EVENT); final SpeechletResponse response; try { switch (request.ge... | NewEventSpeechlet { @OnIntent("NewEvent") public SpeechletResponse handleDialogAction(final IntentRequest request, final Session session) throws CalendarWriteException { session.setAttribute(BasicSpeechlet.KEY_DIALOG_TYPE, BasicSpeechlet.DIALOG_TYPE_NEW_EVENT); final SpeechletResponse response; try { switch (request.ge... |
@Test public void confirmed() throws CalendarWriteException { final Intent intent = Intent.builder() .withName("<intent>") .withSlots(slots( slot(SLOT_DATE_FROM, "2010-08-13"), slot(SLOT_TIME_FROM, "20:15"), slot(SLOT_DURATION, "PT2H"), slot(SLOT_PREFIX_SUMMARY, "Title") )) .withConfirmationStatus(ConfirmationStatus.CO... | @OnIntent("NewEvent") public SpeechletResponse handleDialogAction(final IntentRequest request, final Session session) throws CalendarWriteException { session.setAttribute(BasicSpeechlet.KEY_DIALOG_TYPE, BasicSpeechlet.DIALOG_TYPE_NEW_EVENT); final SpeechletResponse response; try { switch (request.getIntent().getConfirm... | NewEventSpeechlet { @OnIntent("NewEvent") public SpeechletResponse handleDialogAction(final IntentRequest request, final Session session) throws CalendarWriteException { session.setAttribute(BasicSpeechlet.KEY_DIALOG_TYPE, BasicSpeechlet.DIALOG_TYPE_NEW_EVENT); final SpeechletResponse response; try { switch (request.ge... | NewEventSpeechlet { @OnIntent("NewEvent") public SpeechletResponse handleDialogAction(final IntentRequest request, final Session session) throws CalendarWriteException { session.setAttribute(BasicSpeechlet.KEY_DIALOG_TYPE, BasicSpeechlet.DIALOG_TYPE_NEW_EVENT); final SpeechletResponse response; try { switch (request.ge... | NewEventSpeechlet { @OnIntent("NewEvent") public SpeechletResponse handleDialogAction(final IntentRequest request, final Session session) throws CalendarWriteException { session.setAttribute(BasicSpeechlet.KEY_DIALOG_TYPE, BasicSpeechlet.DIALOG_TYPE_NEW_EVENT); final SpeechletResponse response; try { switch (request.ge... | NewEventSpeechlet { @OnIntent("NewEvent") public SpeechletResponse handleDialogAction(final IntentRequest request, final Session session) throws CalendarWriteException { session.setAttribute(BasicSpeechlet.KEY_DIALOG_TYPE, BasicSpeechlet.DIALOG_TYPE_NEW_EVENT); final SpeechletResponse response; try { switch (request.ge... |
@Test public void inProgress_CalendarName() throws CalendarWriteException { checkCalendarName("geburtstag", "Geburtstage"); checkCalendarName("geburt", "Geburtstage"); checkCalendarName("termin", "Termine"); checkCalendarName("termine", "Termine"); checkCalendarName("haus", "Haushalt"); checkCalendarName("haushalt", "H... | private String checkCalendarName(IntentRequest request, Session session) { if(sv(request, SLOT_CALENDAR) == null) { return null; } final String givenName = sv(request, SLOT_CALENDAR); if(givenName == null) { return null; } final String foundName = findCalendarName(givenName); session.setAttribute(SESSION_CALENDAR, foun... | NewEventSpeechlet { private String checkCalendarName(IntentRequest request, Session session) { if(sv(request, SLOT_CALENDAR) == null) { return null; } final String givenName = sv(request, SLOT_CALENDAR); if(givenName == null) { return null; } final String foundName = findCalendarName(givenName); session.setAttribute(SE... | NewEventSpeechlet { private String checkCalendarName(IntentRequest request, Session session) { if(sv(request, SLOT_CALENDAR) == null) { return null; } final String givenName = sv(request, SLOT_CALENDAR); if(givenName == null) { return null; } final String foundName = findCalendarName(givenName); session.setAttribute(SE... | NewEventSpeechlet { private String checkCalendarName(IntentRequest request, Session session) { if(sv(request, SLOT_CALENDAR) == null) { return null; } final String givenName = sv(request, SLOT_CALENDAR); if(givenName == null) { return null; } final String foundName = findCalendarName(givenName); session.setAttribute(SE... | NewEventSpeechlet { private String checkCalendarName(IntentRequest request, Session session) { if(sv(request, SLOT_CALENDAR) == null) { return null; } final String givenName = sv(request, SLOT_CALENDAR); if(givenName == null) { return null; } final String foundName = findCalendarName(givenName); session.setAttribute(SE... |
@Test public void exactMatch() throws NoSuchMethodException { TestClass toTest = new TestClass(); Method method = TestClass.class.getMethod("integer", Integer.class); final Object result = ReflectionUtils.call(method, toTest, new Argument(Integer.class, 13)); assertEquals("integer13", result); } | public static Object call(Method method, Object target, Argument...arguments) { checkArguments(method, arguments); Object[] methodArguments = collectArguments(method, arguments); return org.springframework.util.ReflectionUtils.invokeMethod(method, target, methodArguments); } | ReflectionUtils { public static Object call(Method method, Object target, Argument...arguments) { checkArguments(method, arguments); Object[] methodArguments = collectArguments(method, arguments); return org.springframework.util.ReflectionUtils.invokeMethod(method, target, methodArguments); } } | ReflectionUtils { public static Object call(Method method, Object target, Argument...arguments) { checkArguments(method, arguments); Object[] methodArguments = collectArguments(method, arguments); return org.springframework.util.ReflectionUtils.invokeMethod(method, target, methodArguments); } } | ReflectionUtils { public static Object call(Method method, Object target, Argument...arguments) { checkArguments(method, arguments); Object[] methodArguments = collectArguments(method, arguments); return org.springframework.util.ReflectionUtils.invokeMethod(method, target, methodArguments); } static Object call(Method... | ReflectionUtils { public static Object call(Method method, Object target, Argument...arguments) { checkArguments(method, arguments); Object[] methodArguments = collectArguments(method, arguments); return org.springframework.util.ReflectionUtils.invokeMethod(method, target, methodArguments); } static Object call(Method... |
@Test public void oneOfArgumentsMatches() throws NoSuchMethodException { TestClass toTest = new TestClass(); Method method = TestClass.class.getMethod("integer", Integer.class); final Object result = ReflectionUtils.call(method, toTest, new Argument(Integer.class, 13), new Argument(Long.class, 14L)); assertEquals("inte... | public static Object call(Method method, Object target, Argument...arguments) { checkArguments(method, arguments); Object[] methodArguments = collectArguments(method, arguments); return org.springframework.util.ReflectionUtils.invokeMethod(method, target, methodArguments); } | ReflectionUtils { public static Object call(Method method, Object target, Argument...arguments) { checkArguments(method, arguments); Object[] methodArguments = collectArguments(method, arguments); return org.springframework.util.ReflectionUtils.invokeMethod(method, target, methodArguments); } } | ReflectionUtils { public static Object call(Method method, Object target, Argument...arguments) { checkArguments(method, arguments); Object[] methodArguments = collectArguments(method, arguments); return org.springframework.util.ReflectionUtils.invokeMethod(method, target, methodArguments); } } | ReflectionUtils { public static Object call(Method method, Object target, Argument...arguments) { checkArguments(method, arguments); Object[] methodArguments = collectArguments(method, arguments); return org.springframework.util.ReflectionUtils.invokeMethod(method, target, methodArguments); } static Object call(Method... | ReflectionUtils { public static Object call(Method method, Object target, Argument...arguments) { checkArguments(method, arguments); Object[] methodArguments = collectArguments(method, arguments); return org.springframework.util.ReflectionUtils.invokeMethod(method, target, methodArguments); } static Object call(Method... |
@Test public void multipleArgumentsMatches() throws NoSuchMethodException { TestClass toTest = new TestClass(); Method method = TestClass.class.getMethod("integer", Integer.class); final Object result = ReflectionUtils.call(method, toTest, new Argument(Integer.class, 13), new Argument(Integer.class, 14)); assertEquals(... | public static Object call(Method method, Object target, Argument...arguments) { checkArguments(method, arguments); Object[] methodArguments = collectArguments(method, arguments); return org.springframework.util.ReflectionUtils.invokeMethod(method, target, methodArguments); } | ReflectionUtils { public static Object call(Method method, Object target, Argument...arguments) { checkArguments(method, arguments); Object[] methodArguments = collectArguments(method, arguments); return org.springframework.util.ReflectionUtils.invokeMethod(method, target, methodArguments); } } | ReflectionUtils { public static Object call(Method method, Object target, Argument...arguments) { checkArguments(method, arguments); Object[] methodArguments = collectArguments(method, arguments); return org.springframework.util.ReflectionUtils.invokeMethod(method, target, methodArguments); } } | ReflectionUtils { public static Object call(Method method, Object target, Argument...arguments) { checkArguments(method, arguments); Object[] methodArguments = collectArguments(method, arguments); return org.springframework.util.ReflectionUtils.invokeMethod(method, target, methodArguments); } static Object call(Method... | ReflectionUtils { public static Object call(Method method, Object target, Argument...arguments) { checkArguments(method, arguments); Object[] methodArguments = collectArguments(method, arguments); return org.springframework.util.ReflectionUtils.invokeMethod(method, target, methodArguments); } static Object call(Method... |
@Test public void subClassMatch() throws NoSuchMethodException { TestClass toTest = new TestClass(); Method method = TestClass.class.getMethod("interfaceMethod", List.class); final Object result = ReflectionUtils.call(method, toTest, new Argument(Integer.class, 13), new Argument(ArrayList.class, new ArrayList())); asse... | public static Object call(Method method, Object target, Argument...arguments) { checkArguments(method, arguments); Object[] methodArguments = collectArguments(method, arguments); return org.springframework.util.ReflectionUtils.invokeMethod(method, target, methodArguments); } | ReflectionUtils { public static Object call(Method method, Object target, Argument...arguments) { checkArguments(method, arguments); Object[] methodArguments = collectArguments(method, arguments); return org.springframework.util.ReflectionUtils.invokeMethod(method, target, methodArguments); } } | ReflectionUtils { public static Object call(Method method, Object target, Argument...arguments) { checkArguments(method, arguments); Object[] methodArguments = collectArguments(method, arguments); return org.springframework.util.ReflectionUtils.invokeMethod(method, target, methodArguments); } } | ReflectionUtils { public static Object call(Method method, Object target, Argument...arguments) { checkArguments(method, arguments); Object[] methodArguments = collectArguments(method, arguments); return org.springframework.util.ReflectionUtils.invokeMethod(method, target, methodArguments); } static Object call(Method... | ReflectionUtils { public static Object call(Method method, Object target, Argument...arguments) { checkArguments(method, arguments); Object[] methodArguments = collectArguments(method, arguments); return org.springframework.util.ReflectionUtils.invokeMethod(method, target, methodArguments); } static Object call(Method... |
@Test public void de(){ final String messageKey = "help"; final String result = toTest.de(messageKey); assertEquals("Frage mich: was ansteht, um die aktuellen Termine zu erfahren. Oder trage einen neuen Termin ein.", result); } | public String de(String key, Object...args) { return String.format(messages.getOrDefault(key, key), args); } | MessageService { public String de(String key, Object...args) { return String.format(messages.getOrDefault(key, key), args); } } | MessageService { public String de(String key, Object...args) { return String.format(messages.getOrDefault(key, key), args); } } | MessageService { public String de(String key, Object...args) { return String.format(messages.getOrDefault(key, key), args); } String de(String key, Object...args); } | MessageService { public String de(String key, Object...args) { return String.format(messages.getOrDefault(key, key), args); } String de(String key, Object...args); } |
@Test public void speechWelcomeMessage(){ final PlainTextOutputSpeech result = (PlainTextOutputSpeech)toTest.speechWelcomeMessage(aLocale); assertEquals("Willkommen in deinem Kalender.", result.getText()); } | public OutputSpeech speechWelcomeMessage(Locale locale) { final String speechText = messageService.de("welcome"); return speechMessage(speechText); } | SpeechService { public OutputSpeech speechWelcomeMessage(Locale locale) { final String speechText = messageService.de("welcome"); return speechMessage(speechText); } } | SpeechService { public OutputSpeech speechWelcomeMessage(Locale locale) { final String speechText = messageService.de("welcome"); return speechMessage(speechText); } } | SpeechService { public OutputSpeech speechWelcomeMessage(Locale locale) { final String speechText = messageService.de("welcome"); return speechMessage(speechText); } OutputSpeech speechWelcomeMessage(Locale locale); OutputSpeech speechBye(Locale locale); OutputSpeech speechHelpMessage(Locale locale); OutputSpeech spee... | SpeechService { public OutputSpeech speechWelcomeMessage(Locale locale) { final String speechText = messageService.de("welcome"); return speechMessage(speechText); } OutputSpeech speechWelcomeMessage(Locale locale); OutputSpeech speechBye(Locale locale); OutputSpeech speechHelpMessage(Locale locale); OutputSpeech spee... |
@Test public void speechHelpMessage(){ final PlainTextOutputSpeech result = (PlainTextOutputSpeech)toTest.speechHelpMessage(aLocale); assertEquals("Frage mich: was ansteht, um die aktuellen Termine zu erfahren. Oder trage einen neuen Termin ein.", result.getText()); } | public OutputSpeech speechHelpMessage(Locale locale) { final String speechText = messageService.de("help"); return speechMessage(speechText); } | SpeechService { public OutputSpeech speechHelpMessage(Locale locale) { final String speechText = messageService.de("help"); return speechMessage(speechText); } } | SpeechService { public OutputSpeech speechHelpMessage(Locale locale) { final String speechText = messageService.de("help"); return speechMessage(speechText); } } | SpeechService { public OutputSpeech speechHelpMessage(Locale locale) { final String speechText = messageService.de("help"); return speechMessage(speechText); } OutputSpeech speechWelcomeMessage(Locale locale); OutputSpeech speechBye(Locale locale); OutputSpeech speechHelpMessage(Locale locale); OutputSpeech speechGene... | SpeechService { public OutputSpeech speechHelpMessage(Locale locale) { final String speechText = messageService.de("help"); return speechMessage(speechText); } OutputSpeech speechWelcomeMessage(Locale locale); OutputSpeech speechBye(Locale locale); OutputSpeech speechHelpMessage(Locale locale); OutputSpeech speechGene... |
@Test public void elemental2ElementTag_customElement() { final Collection<String> tags = elemental2ElementTags(metaClass(CustomElement.class)); assertEquals(singletonList("div"), tags); } | static Collection<String> elemental2ElementTags(final MetaClass type) { final Collection<String> customElementTags = customElementTags(type); if (!customElementTags.isEmpty()) { return customElementTags; } return Elemental2TagMapping.getTags(type.asClass()); } | ElementProviderExtension implements IOCExtensionConfigurator { static Collection<String> elemental2ElementTags(final MetaClass type) { final Collection<String> customElementTags = customElementTags(type); if (!customElementTags.isEmpty()) { return customElementTags; } return Elemental2TagMapping.getTags(type.asClass())... | ElementProviderExtension implements IOCExtensionConfigurator { static Collection<String> elemental2ElementTags(final MetaClass type) { final Collection<String> customElementTags = customElementTags(type); if (!customElementTags.isEmpty()) { return customElementTags; } return Elemental2TagMapping.getTags(type.asClass())... | ElementProviderExtension implements IOCExtensionConfigurator { static Collection<String> elemental2ElementTags(final MetaClass type) { final Collection<String> customElementTags = customElementTags(type); if (!customElementTags.isEmpty()) { return customElementTags; } return Elemental2TagMapping.getTags(type.asClass())... | ElementProviderExtension implements IOCExtensionConfigurator { static Collection<String> elemental2ElementTags(final MetaClass type) { final Collection<String> customElementTags = customElementTags(type); if (!customElementTags.isEmpty()) { return customElementTags; } return Elemental2TagMapping.getTags(type.asClass())... |
@Test public void testGetUrls() { final ClassLoader classLoader = ErraiAppPropertiesFilesTest.class.getClassLoader(); final List<URL> urls = ErraiAppPropertiesFiles.getUrls(classLoader); assertEquals(3, urls.size()); } | public static List<URL> getUrls(final ClassLoader... classLoaders) { return Stream.of(classLoaders).flatMap(ErraiAppPropertiesFiles::getUrls).collect(Collectors.toList()); } | ErraiAppPropertiesFiles { public static List<URL> getUrls(final ClassLoader... classLoaders) { return Stream.of(classLoaders).flatMap(ErraiAppPropertiesFiles::getUrls).collect(Collectors.toList()); } } | ErraiAppPropertiesFiles { public static List<URL> getUrls(final ClassLoader... classLoaders) { return Stream.of(classLoaders).flatMap(ErraiAppPropertiesFiles::getUrls).collect(Collectors.toList()); } } | ErraiAppPropertiesFiles { public static List<URL> getUrls(final ClassLoader... classLoaders) { return Stream.of(classLoaders).flatMap(ErraiAppPropertiesFiles::getUrls).collect(Collectors.toList()); } static List<URL> getUrls(final ClassLoader... classLoaders); static List<URL> getModulesUrls(); } | ErraiAppPropertiesFiles { public static List<URL> getUrls(final ClassLoader... classLoaders) { return Stream.of(classLoaders).flatMap(ErraiAppPropertiesFiles::getUrls).collect(Collectors.toList()); } static List<URL> getUrls(final ClassLoader... classLoaders); static List<URL> getModulesUrls(); } |
@Test public void testGetModuleUrls() { final List<URL> moduleUrls = ErraiAppPropertiesFiles.getModulesUrls(); assertEquals(2, moduleUrls.size()); } | public static List<URL> getModulesUrls() { return getModulesUrls(ErraiAppPropertiesFiles.class.getClassLoader()); } | ErraiAppPropertiesFiles { public static List<URL> getModulesUrls() { return getModulesUrls(ErraiAppPropertiesFiles.class.getClassLoader()); } } | ErraiAppPropertiesFiles { public static List<URL> getModulesUrls() { return getModulesUrls(ErraiAppPropertiesFiles.class.getClassLoader()); } } | ErraiAppPropertiesFiles { public static List<URL> getModulesUrls() { return getModulesUrls(ErraiAppPropertiesFiles.class.getClassLoader()); } static List<URL> getUrls(final ClassLoader... classLoaders); static List<URL> getModulesUrls(); } | ErraiAppPropertiesFiles { public static List<URL> getModulesUrls() { return getModulesUrls(ErraiAppPropertiesFiles.class.getClassLoader()); } static List<URL> getUrls(final ClassLoader... classLoaders); static List<URL> getModulesUrls(); } |
@Test public void testGetModuleDirRootFile() throws MalformedURLException { final URL url = new URL("file:/foo/bar/ErraiApp.properties/"); final String moduleDir = ErraiAppPropertiesFiles.getModuleDir(url); assertEquals("file:/foo/bar/", moduleDir); } | static String getModuleDir(final URL url) { final String urlString = url.toExternalForm(); final int metaInfEndIndex = urlString.indexOf(META_INF_FILE_NAME); if (metaInfEndIndex > -1) { return urlString.substring(0, metaInfEndIndex); } final int rootDirEndIndex = urlString.indexOf(FILE_NAME); if (rootDirEndIndex > -1) ... | ErraiAppPropertiesFiles { static String getModuleDir(final URL url) { final String urlString = url.toExternalForm(); final int metaInfEndIndex = urlString.indexOf(META_INF_FILE_NAME); if (metaInfEndIndex > -1) { return urlString.substring(0, metaInfEndIndex); } final int rootDirEndIndex = urlString.indexOf(FILE_NAME); ... | ErraiAppPropertiesFiles { static String getModuleDir(final URL url) { final String urlString = url.toExternalForm(); final int metaInfEndIndex = urlString.indexOf(META_INF_FILE_NAME); if (metaInfEndIndex > -1) { return urlString.substring(0, metaInfEndIndex); } final int rootDirEndIndex = urlString.indexOf(FILE_NAME); ... | ErraiAppPropertiesFiles { static String getModuleDir(final URL url) { final String urlString = url.toExternalForm(); final int metaInfEndIndex = urlString.indexOf(META_INF_FILE_NAME); if (metaInfEndIndex > -1) { return urlString.substring(0, metaInfEndIndex); } final int rootDirEndIndex = urlString.indexOf(FILE_NAME); ... | ErraiAppPropertiesFiles { static String getModuleDir(final URL url) { final String urlString = url.toExternalForm(); final int metaInfEndIndex = urlString.indexOf(META_INF_FILE_NAME); if (metaInfEndIndex > -1) { return urlString.substring(0, metaInfEndIndex); } final int rootDirEndIndex = urlString.indexOf(FILE_NAME); ... |
@Test public void testGetModuleDirMetaInfFile() throws MalformedURLException { final URL url = new URL("file:/foo/bar/META-INF/ErraiApp.properties/"); final String moduleDir = ErraiAppPropertiesFiles.getModuleDir(url); assertEquals("file:/foo/bar/", moduleDir); } | static String getModuleDir(final URL url) { final String urlString = url.toExternalForm(); final int metaInfEndIndex = urlString.indexOf(META_INF_FILE_NAME); if (metaInfEndIndex > -1) { return urlString.substring(0, metaInfEndIndex); } final int rootDirEndIndex = urlString.indexOf(FILE_NAME); if (rootDirEndIndex > -1) ... | ErraiAppPropertiesFiles { static String getModuleDir(final URL url) { final String urlString = url.toExternalForm(); final int metaInfEndIndex = urlString.indexOf(META_INF_FILE_NAME); if (metaInfEndIndex > -1) { return urlString.substring(0, metaInfEndIndex); } final int rootDirEndIndex = urlString.indexOf(FILE_NAME); ... | ErraiAppPropertiesFiles { static String getModuleDir(final URL url) { final String urlString = url.toExternalForm(); final int metaInfEndIndex = urlString.indexOf(META_INF_FILE_NAME); if (metaInfEndIndex > -1) { return urlString.substring(0, metaInfEndIndex); } final int rootDirEndIndex = urlString.indexOf(FILE_NAME); ... | ErraiAppPropertiesFiles { static String getModuleDir(final URL url) { final String urlString = url.toExternalForm(); final int metaInfEndIndex = urlString.indexOf(META_INF_FILE_NAME); if (metaInfEndIndex > -1) { return urlString.substring(0, metaInfEndIndex); } final int rootDirEndIndex = urlString.indexOf(FILE_NAME); ... | ErraiAppPropertiesFiles { static String getModuleDir(final URL url) { final String urlString = url.toExternalForm(); final int metaInfEndIndex = urlString.indexOf(META_INF_FILE_NAME); if (metaInfEndIndex > -1) { return urlString.substring(0, metaInfEndIndex); } final int rootDirEndIndex = urlString.indexOf(FILE_NAME); ... |
@Test(expected = RuntimeException.class) public void testGetModuleDirWithInvalidFileName() throws MalformedURLException { final URL url = new URL("file:/foo/bar/META-INF/InvalidName.properties/"); ErraiAppPropertiesFiles.getModuleDir(url); } | static String getModuleDir(final URL url) { final String urlString = url.toExternalForm(); final int metaInfEndIndex = urlString.indexOf(META_INF_FILE_NAME); if (metaInfEndIndex > -1) { return urlString.substring(0, metaInfEndIndex); } final int rootDirEndIndex = urlString.indexOf(FILE_NAME); if (rootDirEndIndex > -1) ... | ErraiAppPropertiesFiles { static String getModuleDir(final URL url) { final String urlString = url.toExternalForm(); final int metaInfEndIndex = urlString.indexOf(META_INF_FILE_NAME); if (metaInfEndIndex > -1) { return urlString.substring(0, metaInfEndIndex); } final int rootDirEndIndex = urlString.indexOf(FILE_NAME); ... | ErraiAppPropertiesFiles { static String getModuleDir(final URL url) { final String urlString = url.toExternalForm(); final int metaInfEndIndex = urlString.indexOf(META_INF_FILE_NAME); if (metaInfEndIndex > -1) { return urlString.substring(0, metaInfEndIndex); } final int rootDirEndIndex = urlString.indexOf(FILE_NAME); ... | ErraiAppPropertiesFiles { static String getModuleDir(final URL url) { final String urlString = url.toExternalForm(); final int metaInfEndIndex = urlString.indexOf(META_INF_FILE_NAME); if (metaInfEndIndex > -1) { return urlString.substring(0, metaInfEndIndex); } final int rootDirEndIndex = urlString.indexOf(FILE_NAME); ... | ErraiAppPropertiesFiles { static String getModuleDir(final URL url) { final String urlString = url.toExternalForm(); final int metaInfEndIndex = urlString.indexOf(META_INF_FILE_NAME); if (metaInfEndIndex > -1) { return urlString.substring(0, metaInfEndIndex); } final int rootDirEndIndex = urlString.indexOf(FILE_NAME); ... |
@Test public void parsePropertiesWithEquals() { final String data = "key1=value1\nkey2=value2"; final Map<String, String> props = Properties.load(data); assertEquals("value1", props.get("key1")); assertEquals("value2", props.get("key2")); assertEquals(2, props.size()); } | public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } | Properties { public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } } | Properties { public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } private Properties(); } | Properties { public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } private Properties(); static Map<String, String> load(final String data); } | Properties { public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } private Properties(); static Map<String, String> load(final String data); } |
@Test public void parsePropertiesWithColon() throws Exception { final String data = "key1:value1\nkey2:value2"; final Map<String, String> props = Properties.load(data); assertEquals("value1", props.get("key1")); assertEquals("value2", props.get("key2")); assertEquals(2, props.size()); } | public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } | Properties { public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } } | Properties { public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } private Properties(); } | Properties { public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } private Properties(); static Map<String, String> load(final String data); } | Properties { public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } private Properties(); static Map<String, String> load(final String data); } |
@Test public void parsePropertiesWithEqualsAndColon() throws Exception { final String data = "key1:value1\nkey2=value2"; final Map<String, String> props = Properties.load(data); assertEquals("value1", props.get("key1")); assertEquals("value2", props.get("key2")); assertEquals(2, props.size()); } | public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } | Properties { public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } } | Properties { public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } private Properties(); } | Properties { public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } private Properties(); static Map<String, String> load(final String data); } | Properties { public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } private Properties(); static Map<String, String> load(final String data); } |
@Test public void ignoreSpaceBetweenKeyAndValue() throws Exception { final String data = "key1 = value1\nkey2= value2\nkey3 =value3"; final Map<String, String> props = Properties.load(data); assertEquals("value1", props.get("key1")); assertEquals("value2", props.get("key2")); assertEquals("value3", props.get("key3")); ... | public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } | Properties { public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } } | Properties { public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } private Properties(); } | Properties { public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } private Properties(); static Map<String, String> load(final String data); } | Properties { public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } private Properties(); static Map<String, String> load(final String data); } |
@Test public void ignoreCommentLines() throws Exception { final String data = "key1=value1\n#key2=value2\n!key3=value3"; final Map<String, String> props = Properties.load(data); assertEquals("value1", props.get("key1")); assertEquals(1, props.size()); } | public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } | Properties { public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } } | Properties { public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } private Properties(); } | Properties { public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } private Properties(); static Map<String, String> load(final String data); } | Properties { public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } private Properties(); static Map<String, String> load(final String data); } |
@Test public void elemental2ElementTag_customElementChild() { final Collection<String> tags = elemental2ElementTags(metaClass(CustomElement.Child.class)); assertEquals(singletonList("div"), tags); } | static Collection<String> elemental2ElementTags(final MetaClass type) { final Collection<String> customElementTags = customElementTags(type); if (!customElementTags.isEmpty()) { return customElementTags; } return Elemental2TagMapping.getTags(type.asClass()); } | ElementProviderExtension implements IOCExtensionConfigurator { static Collection<String> elemental2ElementTags(final MetaClass type) { final Collection<String> customElementTags = customElementTags(type); if (!customElementTags.isEmpty()) { return customElementTags; } return Elemental2TagMapping.getTags(type.asClass())... | ElementProviderExtension implements IOCExtensionConfigurator { static Collection<String> elemental2ElementTags(final MetaClass type) { final Collection<String> customElementTags = customElementTags(type); if (!customElementTags.isEmpty()) { return customElementTags; } return Elemental2TagMapping.getTags(type.asClass())... | ElementProviderExtension implements IOCExtensionConfigurator { static Collection<String> elemental2ElementTags(final MetaClass type) { final Collection<String> customElementTags = customElementTags(type); if (!customElementTags.isEmpty()) { return customElementTags; } return Elemental2TagMapping.getTags(type.asClass())... | ElementProviderExtension implements IOCExtensionConfigurator { static Collection<String> elemental2ElementTags(final MetaClass type) { final Collection<String> customElementTags = customElementTags(type); if (!customElementTags.isEmpty()) { return customElementTags; } return Elemental2TagMapping.getTags(type.asClass())... |
@Test public void parseEmpty() throws Exception { final String data = ""; final Map<String, String> props = Properties.load(data); assertEquals(0, props.size()); } | public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } | Properties { public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } } | Properties { public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } private Properties(); } | Properties { public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } private Properties(); static Map<String, String> load(final String data); } | Properties { public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } private Properties(); static Map<String, String> load(final String data); } |
@Test public void parseWhitespaceOnly() throws Exception { final String data = " \n "; final Map<String, String> props = Properties.load(data); assertEquals(0, props.size()); } | public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } | Properties { public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } } | Properties { public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } private Properties(); } | Properties { public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } private Properties(); static Map<String, String> load(final String data); } | Properties { public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } private Properties(); static Map<String, String> load(final String data); } |
@Test public void includeWhitespaceAfterPropertyValueExceptTerminalNewline() throws Exception { final String data = "key1=value1 \t\n"; final Map<String, String> props = Properties.load(data); assertEquals("value1 \t", props.get("key1")); assertEquals(1, props.size()); } | public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } | Properties { public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } } | Properties { public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } private Properties(); } | Properties { public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } private Properties(); static Map<String, String> load(final String data); } | Properties { public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } private Properties(); static Map<String, String> load(final String data); } |
@Test public void ignoreWhitespaceAfterBackslash() throws Exception { final String data = "key1=value1\\ \t\n, and value2"; final Map<String, String> props = Properties.load(data); assertEquals("value1, and value2", props.get("key1")); assertEquals(1, props.size()); } | public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } | Properties { public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } } | Properties { public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } private Properties(); } | Properties { public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } private Properties(); static Map<String, String> load(final String data); } | Properties { public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } private Properties(); static Map<String, String> load(final String data); } |
@Test public void valueWithReturnNewlineAndTab() throws Exception { final String data = "key1=value1\\t\\r\\n"; final Map<String, String> props = Properties.load(data); assertEquals("value1\t\r\n", props.get("key1")); assertEquals(1, props.size()); } | public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } | Properties { public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } } | Properties { public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } private Properties(); } | Properties { public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } private Properties(); static Map<String, String> load(final String data); } | Properties { public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } private Properties(); static Map<String, String> load(final String data); } |
@Test public void escapeBackslashesBecomeSingleBackslashes() throws Exception { final String data = "key1=\\\\value1"; final Map<String, String> props = Properties.load(data); assertEquals("\\value1", props.get("key1")); assertEquals(1, props.size()); } | public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } | Properties { public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } } | Properties { public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } private Properties(); } | Properties { public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } private Properties(); static Map<String, String> load(final String data); } | Properties { public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } private Properties(); static Map<String, String> load(final String data); } |
@Test public void unicodeValues() throws Exception { final String data = "key1=value\\u2202"; final Map<String, String> props = Properties.load(data); assertEquals("value\u2202", props.get("key1")); assertEquals(1, props.size()); } | public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } | Properties { public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } } | Properties { public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } private Properties(); } | Properties { public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } private Properties(); static Map<String, String> load(final String data); } | Properties { public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } private Properties(); static Map<String, String> load(final String data); } |
@Test public void lineEndingWithReturn() throws Exception { final String data = "key1=value1\rkey2=value2"; final Map<String, String> props = Properties.load(data); assertEquals("value1", props.get("key1")); assertEquals("value2", props.get("key2")); assertEquals(2, props.size()); } | public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } | Properties { public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } } | Properties { public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } private Properties(); } | Properties { public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } private Properties(); static Map<String, String> load(final String data); } | Properties { public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } private Properties(); static Map<String, String> load(final String data); } |
@Test public void lineEndingWithReturnAndNewline() throws Exception { final String data = "key1=value1\r\nkey2=value2"; final Map<String, String> props = Properties.load(data); assertEquals("value1", props.get("key1")); assertEquals("value2", props.get("key2")); assertEquals(2, props.size()); } | public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } | Properties { public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } } | Properties { public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } private Properties(); } | Properties { public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } private Properties(); static Map<String, String> load(final String data); } | Properties { public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } private Properties(); static Map<String, String> load(final String data); } |
@Test public void parseValueEndingWithEscapedEquals() { final String data = "key1=value1\\=\nkey2=value2"; final Map<String, String> props = Properties.load(data); assertEquals("value1=", props.get("key1")); assertEquals("value2", props.get("key2")); assertEquals(2, props.size()); } | public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } | Properties { public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } } | Properties { public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } private Properties(); } | Properties { public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } private Properties(); static Map<String, String> load(final String data); } | Properties { public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } private Properties(); static Map<String, String> load(final String data); } |
@Test public void elemental2ElementTag_customElementWithCustomTag() { final Collection<String> tags = elemental2ElementTags(metaClass(CustomElement.WithCustomTag.class)); assertEquals(singletonList("foo"), tags); } | static Collection<String> elemental2ElementTags(final MetaClass type) { final Collection<String> customElementTags = customElementTags(type); if (!customElementTags.isEmpty()) { return customElementTags; } return Elemental2TagMapping.getTags(type.asClass()); } | ElementProviderExtension implements IOCExtensionConfigurator { static Collection<String> elemental2ElementTags(final MetaClass type) { final Collection<String> customElementTags = customElementTags(type); if (!customElementTags.isEmpty()) { return customElementTags; } return Elemental2TagMapping.getTags(type.asClass())... | ElementProviderExtension implements IOCExtensionConfigurator { static Collection<String> elemental2ElementTags(final MetaClass type) { final Collection<String> customElementTags = customElementTags(type); if (!customElementTags.isEmpty()) { return customElementTags; } return Elemental2TagMapping.getTags(type.asClass())... | ElementProviderExtension implements IOCExtensionConfigurator { static Collection<String> elemental2ElementTags(final MetaClass type) { final Collection<String> customElementTags = customElementTags(type); if (!customElementTags.isEmpty()) { return customElementTags; } return Elemental2TagMapping.getTags(type.asClass())... | ElementProviderExtension implements IOCExtensionConfigurator { static Collection<String> elemental2ElementTags(final MetaClass type) { final Collection<String> customElementTags = customElementTags(type); if (!customElementTags.isEmpty()) { return customElementTags; } return Elemental2TagMapping.getTags(type.asClass())... |
@Test public void parseValueEndingWithEscapedTwoPoints() { final String data = "key1=value1\\:\nkey2=value2"; final Map<String, String> props = Properties.load(data); assertEquals("value1:", props.get("key1")); assertEquals("value2", props.get("key2")); assertEquals(2, props.size()); } | public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } | Properties { public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } } | Properties { public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } private Properties(); } | Properties { public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } private Properties(); static Map<String, String> load(final String data); } | Properties { public static Map<String, String> load(final String data) { final ParseState parseState = new ParseState(data); while (parseState.next()); return parseState.properties; } private Properties(); static Map<String, String> load(final String data); } |
@Test public void testRemoveAllElementChildrenWhenNodeDoesNotHaveAnyChildren() { final Node node = Mockito.spy(makeNode()); final boolean hadChildren = elemental2DomUtil.removeAllElementChildren(node); Mockito.verify(node, Mockito.never()).removeChild(any()); assertFalse(hadChildren); } | public boolean removeAllElementChildren(final Node node) { final boolean hadChildren = node.lastChild != null; while (node.lastChild != null) { node.removeChild(node.lastChild); } return hadChildren; } | Elemental2DomUtil { public boolean removeAllElementChildren(final Node node) { final boolean hadChildren = node.lastChild != null; while (node.lastChild != null) { node.removeChild(node.lastChild); } return hadChildren; } } | Elemental2DomUtil { public boolean removeAllElementChildren(final Node node) { final boolean hadChildren = node.lastChild != null; while (node.lastChild != null) { node.removeChild(node.lastChild); } return hadChildren; } } | Elemental2DomUtil { public boolean removeAllElementChildren(final Node node) { final boolean hadChildren = node.lastChild != null; while (node.lastChild != null) { node.removeChild(node.lastChild); } return hadChildren; } boolean removeAllElementChildren(final Node node); void appendWidgetToElement(final HTMLElement p... | Elemental2DomUtil { public boolean removeAllElementChildren(final Node node) { final boolean hadChildren = node.lastChild != null; while (node.lastChild != null) { node.removeChild(node.lastChild); } return hadChildren; } boolean removeAllElementChildren(final Node node); void appendWidgetToElement(final HTMLElement p... |
@Test public void testRemoveAllElementChildrenWhenNodeHasChildren() { final Node child1 = mock(Node.class); final Node child2 = mock(Node.class); final Node node = Mockito.spy(makeNode(child1, child2)); final boolean hadChildren = elemental2DomUtil.removeAllElementChildren(node); Mockito.verify(node).removeChild(child1... | public boolean removeAllElementChildren(final Node node) { final boolean hadChildren = node.lastChild != null; while (node.lastChild != null) { node.removeChild(node.lastChild); } return hadChildren; } | Elemental2DomUtil { public boolean removeAllElementChildren(final Node node) { final boolean hadChildren = node.lastChild != null; while (node.lastChild != null) { node.removeChild(node.lastChild); } return hadChildren; } } | Elemental2DomUtil { public boolean removeAllElementChildren(final Node node) { final boolean hadChildren = node.lastChild != null; while (node.lastChild != null) { node.removeChild(node.lastChild); } return hadChildren; } } | Elemental2DomUtil { public boolean removeAllElementChildren(final Node node) { final boolean hadChildren = node.lastChild != null; while (node.lastChild != null) { node.removeChild(node.lastChild); } return hadChildren; } boolean removeAllElementChildren(final Node node); void appendWidgetToElement(final HTMLElement p... | Elemental2DomUtil { public boolean removeAllElementChildren(final Node node) { final boolean hadChildren = node.lastChild != null; while (node.lastChild != null) { node.removeChild(node.lastChild); } return hadChildren; } boolean removeAllElementChildren(final Node node); void appendWidgetToElement(final HTMLElement p... |
@Test public void testAsHTMLElementForGWTElement() throws Exception { final com.google.gwt.dom.client.Element gwtElement = mock(com.google.gwt.dom.client.Element.class); final HTMLElement expectedElement = mock(HTMLElement.class); mockJsCast(expectedElement, gwtElement); final HTMLElement actualElement = elemental2DomU... | public HTMLElement asHTMLElement(final com.google.gwt.dom.client.Element gwtElement) { return Js.cast(gwtElement); } | Elemental2DomUtil { public HTMLElement asHTMLElement(final com.google.gwt.dom.client.Element gwtElement) { return Js.cast(gwtElement); } } | Elemental2DomUtil { public HTMLElement asHTMLElement(final com.google.gwt.dom.client.Element gwtElement) { return Js.cast(gwtElement); } } | Elemental2DomUtil { public HTMLElement asHTMLElement(final com.google.gwt.dom.client.Element gwtElement) { return Js.cast(gwtElement); } boolean removeAllElementChildren(final Node node); void appendWidgetToElement(final HTMLElement parent, final Widget child); HTMLElement asHTMLElement(final com.google.gwt.dom.client... | Elemental2DomUtil { public HTMLElement asHTMLElement(final com.google.gwt.dom.client.Element gwtElement) { return Js.cast(gwtElement); } boolean removeAllElementChildren(final Node node); void appendWidgetToElement(final HTMLElement parent, final Widget child); HTMLElement asHTMLElement(final com.google.gwt.dom.client... |
@Test public void testAsHTMLElementForErraiHTMLElement() throws Exception { final org.jboss.errai.common.client.dom.HTMLElement htmlElement = mock( org.jboss.errai.common.client.dom.HTMLElement.class); final HTMLElement expectedElement = mock(HTMLElement.class); mockJsCast(expectedElement, htmlElement); final HTMLEleme... | public HTMLElement asHTMLElement(final com.google.gwt.dom.client.Element gwtElement) { return Js.cast(gwtElement); } | Elemental2DomUtil { public HTMLElement asHTMLElement(final com.google.gwt.dom.client.Element gwtElement) { return Js.cast(gwtElement); } } | Elemental2DomUtil { public HTMLElement asHTMLElement(final com.google.gwt.dom.client.Element gwtElement) { return Js.cast(gwtElement); } } | Elemental2DomUtil { public HTMLElement asHTMLElement(final com.google.gwt.dom.client.Element gwtElement) { return Js.cast(gwtElement); } boolean removeAllElementChildren(final Node node); void appendWidgetToElement(final HTMLElement parent, final Widget child); HTMLElement asHTMLElement(final com.google.gwt.dom.client... | Elemental2DomUtil { public HTMLElement asHTMLElement(final com.google.gwt.dom.client.Element gwtElement) { return Js.cast(gwtElement); } boolean removeAllElementChildren(final Node node); void appendWidgetToElement(final HTMLElement parent, final Widget child); HTMLElement asHTMLElement(final com.google.gwt.dom.client... |
@Test public void testAsHTMLElementForHTMLElement() throws Exception { final org.jboss.errai.common.client.dom.HTMLElement deprecatedElement = mock( org.jboss.errai.common.client.dom.HTMLElement.class); final HTMLElement htmlElement = mock(HTMLElement.class); mockJsCast(deprecatedElement, htmlElement); org.jboss.errai.... | public HTMLElement asHTMLElement(final com.google.gwt.dom.client.Element gwtElement) { return Js.cast(gwtElement); } | Elemental2DomUtil { public HTMLElement asHTMLElement(final com.google.gwt.dom.client.Element gwtElement) { return Js.cast(gwtElement); } } | Elemental2DomUtil { public HTMLElement asHTMLElement(final com.google.gwt.dom.client.Element gwtElement) { return Js.cast(gwtElement); } } | Elemental2DomUtil { public HTMLElement asHTMLElement(final com.google.gwt.dom.client.Element gwtElement) { return Js.cast(gwtElement); } boolean removeAllElementChildren(final Node node); void appendWidgetToElement(final HTMLElement parent, final Widget child); HTMLElement asHTMLElement(final com.google.gwt.dom.client... | Elemental2DomUtil { public HTMLElement asHTMLElement(final com.google.gwt.dom.client.Element gwtElement) { return Js.cast(gwtElement); } boolean removeAllElementChildren(final Node node); void appendWidgetToElement(final HTMLElement parent, final Widget child); HTMLElement asHTMLElement(final com.google.gwt.dom.client... |
@Test public void testSubTypesOf() { assertThat(reflections.getSubTypesOf(I1.class), are(I2.class, C1.class, C2.class, C3.class, C5.class)); assertThat(reflections.getSubTypesOf(I2.class), are(C1.class, C2.class, C3.class, C5.class)); } | public <T> Set<Class<? extends T>> getSubTypesOf(final Class<T> type) { Set<String> subTypes = store.getSubTypesOf(type.getName()); return ImmutableSet.copyOf(ReflectionUtils.<T>forNames(subTypes)); } | Reflections extends ReflectionUtils { public <T> Set<Class<? extends T>> getSubTypesOf(final Class<T> type) { Set<String> subTypes = store.getSubTypesOf(type.getName()); return ImmutableSet.copyOf(ReflectionUtils.<T>forNames(subTypes)); } } | Reflections extends ReflectionUtils { public <T> Set<Class<? extends T>> getSubTypesOf(final Class<T> type) { Set<String> subTypes = store.getSubTypesOf(type.getName()); return ImmutableSet.copyOf(ReflectionUtils.<T>forNames(subTypes)); } Reflections(final Configuration configuration); Reflections(final String prefix,... | Reflections extends ReflectionUtils { public <T> Set<Class<? extends T>> getSubTypesOf(final Class<T> type) { Set<String> subTypes = store.getSubTypesOf(type.getName()); return ImmutableSet.copyOf(ReflectionUtils.<T>forNames(subTypes)); } Reflections(final Configuration configuration); Reflections(final String prefix,... | Reflections extends ReflectionUtils { public <T> Set<Class<? extends T>> getSubTypesOf(final Class<T> type) { Set<String> subTypes = store.getSubTypesOf(type.getName()); return ImmutableSet.copyOf(ReflectionUtils.<T>forNames(subTypes)); } Reflections(final Configuration configuration); Reflections(final String prefix,... |
@Test public void testTypesAnnotatedWith() { assertThat("when honoring @Inherited, meta-annotation should only effect annotated super classes and it's sub types", reflections.getTypesAnnotatedWith(MAI1.class), are(AI1.class)); assertThat("when honoring @Inherited, meta-annotation should only effect annotated super clas... | public Set<Class<?>> getTypesAnnotatedWith(final Class<? extends Annotation> annotation) { Set<String> typesAnnotatedWith = store.getTypesAnnotatedWith(annotation.getName()); return ImmutableSet.copyOf(forNames(typesAnnotatedWith)); } | Reflections extends ReflectionUtils { public Set<Class<?>> getTypesAnnotatedWith(final Class<? extends Annotation> annotation) { Set<String> typesAnnotatedWith = store.getTypesAnnotatedWith(annotation.getName()); return ImmutableSet.copyOf(forNames(typesAnnotatedWith)); } } | Reflections extends ReflectionUtils { public Set<Class<?>> getTypesAnnotatedWith(final Class<? extends Annotation> annotation) { Set<String> typesAnnotatedWith = store.getTypesAnnotatedWith(annotation.getName()); return ImmutableSet.copyOf(forNames(typesAnnotatedWith)); } Reflections(final Configuration configuration);... | Reflections extends ReflectionUtils { public Set<Class<?>> getTypesAnnotatedWith(final Class<? extends Annotation> annotation) { Set<String> typesAnnotatedWith = store.getTypesAnnotatedWith(annotation.getName()); return ImmutableSet.copyOf(forNames(typesAnnotatedWith)); } Reflections(final Configuration configuration);... | Reflections extends ReflectionUtils { public Set<Class<?>> getTypesAnnotatedWith(final Class<? extends Annotation> annotation) { Set<String> typesAnnotatedWith = store.getTypesAnnotatedWith(annotation.getName()); return ImmutableSet.copyOf(forNames(typesAnnotatedWith)); } Reflections(final Configuration configuration);... |
@Test public void testMethodsAnnotatedWith() { try { assertThat(reflections.getMethodsAnnotatedWith(AM1.class), are(C4.class.getDeclaredMethod("m1"), C4.class.getDeclaredMethod("m1", int.class, String[].class), C4.class.getDeclaredMethod("m1", int[][].class, String[][].class), C4.class.getDeclaredMethod("m3"))); AM1 am... | public Set<Method> getMethodsAnnotatedWith(final Class<? extends Annotation> annotation) { Set<String> annotatedWith = store.getMethodsAnnotatedWith(annotation.getName()); Set<Method> result = Sets.newHashSet(); for (String annotated : annotatedWith) { result.add(Utils.getMethodFromDescriptor(annotated)); } return resu... | Reflections extends ReflectionUtils { public Set<Method> getMethodsAnnotatedWith(final Class<? extends Annotation> annotation) { Set<String> annotatedWith = store.getMethodsAnnotatedWith(annotation.getName()); Set<Method> result = Sets.newHashSet(); for (String annotated : annotatedWith) { result.add(Utils.getMethodFro... | Reflections extends ReflectionUtils { public Set<Method> getMethodsAnnotatedWith(final Class<? extends Annotation> annotation) { Set<String> annotatedWith = store.getMethodsAnnotatedWith(annotation.getName()); Set<Method> result = Sets.newHashSet(); for (String annotated : annotatedWith) { result.add(Utils.getMethodFro... | Reflections extends ReflectionUtils { public Set<Method> getMethodsAnnotatedWith(final Class<? extends Annotation> annotation) { Set<String> annotatedWith = store.getMethodsAnnotatedWith(annotation.getName()); Set<Method> result = Sets.newHashSet(); for (String annotated : annotatedWith) { result.add(Utils.getMethodFro... | Reflections extends ReflectionUtils { public Set<Method> getMethodsAnnotatedWith(final Class<? extends Annotation> annotation) { Set<String> annotatedWith = store.getMethodsAnnotatedWith(annotation.getName()); Set<Method> result = Sets.newHashSet(); for (String annotated : annotatedWith) { result.add(Utils.getMethodFro... |
@Test public void testFieldsAnnotatedWith() { try { assertThat(reflections.getFieldsAnnotatedWith(AF1.class), are(C4.class.getDeclaredField("f1"), C4.class.getDeclaredField("f2") )); assertThat(reflections.getFieldsAnnotatedWith(new AF1() { public String value() { return "2"; } public Class<? extends Annotation> annota... | public Set<Field> getFieldsAnnotatedWith(final Class<? extends Annotation> annotation) { final Set<Field> result = Sets.newHashSet(); Collection<String> annotatedWith = store.getFieldsAnnotatedWith(annotation.getName()); for (String annotated : annotatedWith) { result.add(Utils.getFieldFromString(annotated)); } return ... | Reflections extends ReflectionUtils { public Set<Field> getFieldsAnnotatedWith(final Class<? extends Annotation> annotation) { final Set<Field> result = Sets.newHashSet(); Collection<String> annotatedWith = store.getFieldsAnnotatedWith(annotation.getName()); for (String annotated : annotatedWith) { result.add(Utils.get... | Reflections extends ReflectionUtils { public Set<Field> getFieldsAnnotatedWith(final Class<? extends Annotation> annotation) { final Set<Field> result = Sets.newHashSet(); Collection<String> annotatedWith = store.getFieldsAnnotatedWith(annotation.getName()); for (String annotated : annotatedWith) { result.add(Utils.get... | Reflections extends ReflectionUtils { public Set<Field> getFieldsAnnotatedWith(final Class<? extends Annotation> annotation) { final Set<Field> result = Sets.newHashSet(); Collection<String> annotatedWith = store.getFieldsAnnotatedWith(annotation.getName()); for (String annotated : annotatedWith) { result.add(Utils.get... | Reflections extends ReflectionUtils { public Set<Field> getFieldsAnnotatedWith(final Class<? extends Annotation> annotation) { final Set<Field> result = Sets.newHashSet(); Collection<String> annotatedWith = store.getFieldsAnnotatedWith(annotation.getName()); for (String annotated : annotatedWith) { result.add(Utils.get... |
@Test public void elemental2ElementTag_customElementWithCustomTagChild() { final Collection<String> tags = elemental2ElementTags( metaClass(CustomElement.WithCustomTag.ChildWithoutElementAnnotation.class)); assertEquals(emptyList(), tags); } | static Collection<String> elemental2ElementTags(final MetaClass type) { final Collection<String> customElementTags = customElementTags(type); if (!customElementTags.isEmpty()) { return customElementTags; } return Elemental2TagMapping.getTags(type.asClass()); } | ElementProviderExtension implements IOCExtensionConfigurator { static Collection<String> elemental2ElementTags(final MetaClass type) { final Collection<String> customElementTags = customElementTags(type); if (!customElementTags.isEmpty()) { return customElementTags; } return Elemental2TagMapping.getTags(type.asClass())... | ElementProviderExtension implements IOCExtensionConfigurator { static Collection<String> elemental2ElementTags(final MetaClass type) { final Collection<String> customElementTags = customElementTags(type); if (!customElementTags.isEmpty()) { return customElementTags; } return Elemental2TagMapping.getTags(type.asClass())... | ElementProviderExtension implements IOCExtensionConfigurator { static Collection<String> elemental2ElementTags(final MetaClass type) { final Collection<String> customElementTags = customElementTags(type); if (!customElementTags.isEmpty()) { return customElementTags; } return Elemental2TagMapping.getTags(type.asClass())... | ElementProviderExtension implements IOCExtensionConfigurator { static Collection<String> elemental2ElementTags(final MetaClass type) { final Collection<String> customElementTags = customElementTags(type); if (!customElementTags.isEmpty()) { return customElementTags; } return Elemental2TagMapping.getTags(type.asClass())... |
@Test public void testConverters() { try { assertThat(reflections.getConverters(C2.class, C3.class), are(C4.class.getDeclaredMethod("c2toC3", C2.class))); } catch (NoSuchMethodException e) { fail(); } } | public Set<Method> getConverters(final Class<?> from, final Class<?> to) { Set<Method> result = Sets.newHashSet(); Set<String> converters = store.getConverters(from.getName(), to.getName()); for (String converter : converters) { result.add(Utils.getMethodFromDescriptor(converter)); } return result; } | Reflections extends ReflectionUtils { public Set<Method> getConverters(final Class<?> from, final Class<?> to) { Set<Method> result = Sets.newHashSet(); Set<String> converters = store.getConverters(from.getName(), to.getName()); for (String converter : converters) { result.add(Utils.getMethodFromDescriptor(converter));... | Reflections extends ReflectionUtils { public Set<Method> getConverters(final Class<?> from, final Class<?> to) { Set<Method> result = Sets.newHashSet(); Set<String> converters = store.getConverters(from.getName(), to.getName()); for (String converter : converters) { result.add(Utils.getMethodFromDescriptor(converter));... | Reflections extends ReflectionUtils { public Set<Method> getConverters(final Class<?> from, final Class<?> to) { Set<Method> result = Sets.newHashSet(); Set<String> converters = store.getConverters(from.getName(), to.getName()); for (String converter : converters) { result.add(Utils.getMethodFromDescriptor(converter));... | Reflections extends ReflectionUtils { public Set<Method> getConverters(final Class<?> from, final Class<?> to) { Set<Method> result = Sets.newHashSet(); Set<String> converters = store.getConverters(from.getName(), to.getName()); for (String converter : converters) { result.add(Utils.getMethodFromDescriptor(converter));... |
@Test public void collect() { String path = getUserDir() + "/target/test-classes" + "/META-INF/reflections/testModel-reflections.xml"; try { Predicate<String> filter = new FilterBuilder().include("org.jboss.errai.reflections.TestModel\\$.*"); Reflections testModelReflections = new Reflections(new ConfigurationBuilder()... | public static Reflections collect() { return new Reflections(new ConfigurationBuilder()). collect("META-INF/reflections", new FilterBuilder().include(".*-reflections.xml")); } | Reflections extends ReflectionUtils { public static Reflections collect() { return new Reflections(new ConfigurationBuilder()). collect("META-INF/reflections", new FilterBuilder().include(".*-reflections.xml")); } } | Reflections extends ReflectionUtils { public static Reflections collect() { return new Reflections(new ConfigurationBuilder()). collect("META-INF/reflections", new FilterBuilder().include(".*-reflections.xml")); } Reflections(final Configuration configuration); Reflections(final String prefix, final Scanner... scanner... | Reflections extends ReflectionUtils { public static Reflections collect() { return new Reflections(new ConfigurationBuilder()). collect("META-INF/reflections", new FilterBuilder().include(".*-reflections.xml")); } Reflections(final Configuration configuration); Reflections(final String prefix, final Scanner... scanner... | Reflections extends ReflectionUtils { public static Reflections collect() { return new Reflections(new ConfigurationBuilder()). collect("META-INF/reflections", new FilterBuilder().include(".*-reflections.xml")); } Reflections(final Configuration configuration); Reflections(final String prefix, final Scanner... scanner... |
@Test public void isLoggedInReturnsFalseWhenNoUserLoggedIn() throws Exception { assertFalse(authService.isLoggedIn()); } | @Override public boolean isLoggedIn() { return keycloakIsLoggedIn() || wrappedAuthService.isLoggedIn(); } | KeycloakAuthenticationService implements AuthenticationService, Serializable { @Override public boolean isLoggedIn() { return keycloakIsLoggedIn() || wrappedAuthService.isLoggedIn(); } } | KeycloakAuthenticationService implements AuthenticationService, Serializable { @Override public boolean isLoggedIn() { return keycloakIsLoggedIn() || wrappedAuthService.isLoggedIn(); } } | KeycloakAuthenticationService implements AuthenticationService, Serializable { @Override public boolean isLoggedIn() { return keycloakIsLoggedIn() || wrappedAuthService.isLoggedIn(); } @Override User login(final String username, final String password); @Override boolean isLoggedIn(); @Override void logout(); @Override... | KeycloakAuthenticationService implements AuthenticationService, Serializable { @Override public boolean isLoggedIn() { return keycloakIsLoggedIn() || wrappedAuthService.isLoggedIn(); } @Override User login(final String username, final String password); @Override boolean isLoggedIn(); @Override void logout(); @Override... |
@Test public void getUserReturnsAnonymousWhenNoUserLoggedIn() throws Exception { assertEquals(User.ANONYMOUS, authService.getUser()); } | @Override public User getUser() { if (keycloakIsLoggedIn()) { return getKeycloakUser(); } else if (wrappedAuthService.isLoggedIn()) { return wrappedAuthService.getUser(); } else { return User.ANONYMOUS; } } | KeycloakAuthenticationService implements AuthenticationService, Serializable { @Override public User getUser() { if (keycloakIsLoggedIn()) { return getKeycloakUser(); } else if (wrappedAuthService.isLoggedIn()) { return wrappedAuthService.getUser(); } else { return User.ANONYMOUS; } } } | KeycloakAuthenticationService implements AuthenticationService, Serializable { @Override public User getUser() { if (keycloakIsLoggedIn()) { return getKeycloakUser(); } else if (wrappedAuthService.isLoggedIn()) { return wrappedAuthService.getUser(); } else { return User.ANONYMOUS; } } } | KeycloakAuthenticationService implements AuthenticationService, Serializable { @Override public User getUser() { if (keycloakIsLoggedIn()) { return getKeycloakUser(); } else if (wrappedAuthService.isLoggedIn()) { return wrappedAuthService.getUser(); } else { return User.ANONYMOUS; } } @Override User login(final String... | KeycloakAuthenticationService implements AuthenticationService, Serializable { @Override public User getUser() { if (keycloakIsLoggedIn()) { return getKeycloakUser(); } else if (wrappedAuthService.isLoggedIn()) { return wrappedAuthService.getUser(); } else { return User.ANONYMOUS; } } @Override User login(final String... |
@Test public void logoutIsIdempotent() throws Exception { authService.logout(); authService.logout(); isLoggedInReturnsFalseWhenNoUserLoggedIn(); } | @Override public void logout() { if (keycloakIsLoggedIn()) { keycloakLogout(); try { if (RpcContext.getMessage() != null) ((HttpServletRequest) RpcContext.getServletRequest()).logout(); } catch (ServletException e) { throw new AuthenticationException("An error occurred while attempting to log out of Keycloak."); } } el... | KeycloakAuthenticationService implements AuthenticationService, Serializable { @Override public void logout() { if (keycloakIsLoggedIn()) { keycloakLogout(); try { if (RpcContext.getMessage() != null) ((HttpServletRequest) RpcContext.getServletRequest()).logout(); } catch (ServletException e) { throw new Authentication... | KeycloakAuthenticationService implements AuthenticationService, Serializable { @Override public void logout() { if (keycloakIsLoggedIn()) { keycloakLogout(); try { if (RpcContext.getMessage() != null) ((HttpServletRequest) RpcContext.getServletRequest()).logout(); } catch (ServletException e) { throw new Authentication... | KeycloakAuthenticationService implements AuthenticationService, Serializable { @Override public void logout() { if (keycloakIsLoggedIn()) { keycloakLogout(); try { if (RpcContext.getMessage() != null) ((HttpServletRequest) RpcContext.getServletRequest()).logout(); } catch (ServletException e) { throw new Authentication... | KeycloakAuthenticationService implements AuthenticationService, Serializable { @Override public void logout() { if (keycloakIsLoggedIn()) { keycloakLogout(); try { if (RpcContext.getMessage() != null) ((HttpServletRequest) RpcContext.getServletRequest()).logout(); } catch (ServletException e) { throw new Authentication... |
@Test(expected = AlreadyLoggedInException.class) public void loginFailsIfKeycloakUserLoggedIn() throws Exception { getUserReturnsUserWhenKeycloakUserLoggedIn(); authService.login(PREFERRED_USERNAME, ""); } | @Override public User login(final String username, final String password) { if (!keycloakIsLoggedIn()) { return wrappedAuthService.login(username, password); } else { throw new AlreadyLoggedInException("Already logged in through Keycloak."); } } | KeycloakAuthenticationService implements AuthenticationService, Serializable { @Override public User login(final String username, final String password) { if (!keycloakIsLoggedIn()) { return wrappedAuthService.login(username, password); } else { throw new AlreadyLoggedInException("Already logged in through Keycloak.");... | KeycloakAuthenticationService implements AuthenticationService, Serializable { @Override public User login(final String username, final String password) { if (!keycloakIsLoggedIn()) { return wrappedAuthService.login(username, password); } else { throw new AlreadyLoggedInException("Already logged in through Keycloak.");... | KeycloakAuthenticationService implements AuthenticationService, Serializable { @Override public User login(final String username, final String password) { if (!keycloakIsLoggedIn()) { return wrappedAuthService.login(username, password); } else { throw new AlreadyLoggedInException("Already logged in through Keycloak.");... | KeycloakAuthenticationService implements AuthenticationService, Serializable { @Override public User login(final String username, final String password) { if (!keycloakIsLoggedIn()) { return wrappedAuthService.login(username, password); } else { throw new AlreadyLoggedInException("Already logged in through Keycloak.");... |
@Test(expected = AlreadyLoggedInException.class) public void settingKeycloakUserFailsIfWrappedUserLoggedIn() throws Exception { getUserReturnsUserWhenWrappedUserLoggedIn(); authService.setSecurityContext(securityContext); } | void setSecurityContext(final KeycloakSecurityContext keycloakSecurityContext) { if (wrappedAuthService.isLoggedIn() && keycloakSecurityContext != null) { throw new AlreadyLoggedInException("Logged in as " + wrappedAuthService.getUser()); } this.keycloakSecurityContext = keycloakSecurityContext; keycloakUser = null; } | KeycloakAuthenticationService implements AuthenticationService, Serializable { void setSecurityContext(final KeycloakSecurityContext keycloakSecurityContext) { if (wrappedAuthService.isLoggedIn() && keycloakSecurityContext != null) { throw new AlreadyLoggedInException("Logged in as " + wrappedAuthService.getUser()); } ... | KeycloakAuthenticationService implements AuthenticationService, Serializable { void setSecurityContext(final KeycloakSecurityContext keycloakSecurityContext) { if (wrappedAuthService.isLoggedIn() && keycloakSecurityContext != null) { throw new AlreadyLoggedInException("Logged in as " + wrappedAuthService.getUser()); } ... | KeycloakAuthenticationService implements AuthenticationService, Serializable { void setSecurityContext(final KeycloakSecurityContext keycloakSecurityContext) { if (wrappedAuthService.isLoggedIn() && keycloakSecurityContext != null) { throw new AlreadyLoggedInException("Logged in as " + wrappedAuthService.getUser()); } ... | KeycloakAuthenticationService implements AuthenticationService, Serializable { void setSecurityContext(final KeycloakSecurityContext keycloakSecurityContext) { if (wrappedAuthService.isLoggedIn() && keycloakSecurityContext != null) { throw new AlreadyLoggedInException("Logged in as " + wrappedAuthService.getUser()); } ... |
@Test public void testSecurityContextJsonWhenAGroupHasAnApostrophe() throws Exception { final UserImpl user = new UserImpl("Mary", roles("admin"), groups("girls'", "programmer", "admin")); final String json = filter.securityContextJson(user); assertTrue(isValid(json)); } | String securityContextJson(final User user) { final String userJson = ServerMarshalling.toJSON(user); return "{\"" + SecurityConstants.DICTIONARY_USER + "\": " + userJson + "}"; } | UserHostPageFilter implements Filter { String securityContextJson(final User user) { final String userJson = ServerMarshalling.toJSON(user); return "{\"" + SecurityConstants.DICTIONARY_USER + "\": " + userJson + "}"; } } | UserHostPageFilter implements Filter { String securityContextJson(final User user) { final String userJson = ServerMarshalling.toJSON(user); return "{\"" + SecurityConstants.DICTIONARY_USER + "\": " + userJson + "}"; } } | UserHostPageFilter implements Filter { String securityContextJson(final User user) { final String userJson = ServerMarshalling.toJSON(user); return "{\"" + SecurityConstants.DICTIONARY_USER + "\": " + userJson + "}"; } @Override void init(FilterConfig filterConfig); @Override void destroy(); @Override void doFilter(Se... | UserHostPageFilter implements Filter { String securityContextJson(final User user) { final String userJson = ServerMarshalling.toJSON(user); return "{\"" + SecurityConstants.DICTIONARY_USER + "\": " + userJson + "}"; } @Override void init(FilterConfig filterConfig); @Override void destroy(); @Override void doFilter(Se... |
@Test public void testSecurityContextJsonWhenAGroupHasAQuote() throws Exception { final UserImpl user = new UserImpl("Mary", roles("admin"), groups("girls\"", "programmer", "admin")); final String json = filter.securityContextJson(user); assertTrue(isValid(json)); } | String securityContextJson(final User user) { final String userJson = ServerMarshalling.toJSON(user); return "{\"" + SecurityConstants.DICTIONARY_USER + "\": " + userJson + "}"; } | UserHostPageFilter implements Filter { String securityContextJson(final User user) { final String userJson = ServerMarshalling.toJSON(user); return "{\"" + SecurityConstants.DICTIONARY_USER + "\": " + userJson + "}"; } } | UserHostPageFilter implements Filter { String securityContextJson(final User user) { final String userJson = ServerMarshalling.toJSON(user); return "{\"" + SecurityConstants.DICTIONARY_USER + "\": " + userJson + "}"; } } | UserHostPageFilter implements Filter { String securityContextJson(final User user) { final String userJson = ServerMarshalling.toJSON(user); return "{\"" + SecurityConstants.DICTIONARY_USER + "\": " + userJson + "}"; } @Override void init(FilterConfig filterConfig); @Override void destroy(); @Override void doFilter(Se... | UserHostPageFilter implements Filter { String securityContextJson(final User user) { final String userJson = ServerMarshalling.toJSON(user); return "{\"" + SecurityConstants.DICTIONARY_USER + "\": " + userJson + "}"; } @Override void init(FilterConfig filterConfig); @Override void destroy(); @Override void doFilter(Se... |
@Test public void testEmptyVfsDirListing() throws Exception { JBossVfsDir jbvd = new JBossVfsDir(getJBossVfsMountPoint().asDirectoryURL()); int count = 0; for (org.jboss.errai.reflections.vfs.Vfs.File reflectionsFile : jbvd.getFiles()) { System.out.println("Visiting virtual file " + reflectionsFile.getRelativePath()); ... | @Override public Iterable<Vfs.File> getFiles() { return new Iterable<Vfs.File>() { @Override public Iterator<Vfs.File> iterator() { final List<VirtualFile> toVisit = new ArrayList<VirtualFile>(virtualFile.getChildren()); return new AbstractIterator<Vfs.File>() { @Override protected Vfs.File computeNext() { while (!toVi... | JBossVfsDir implements Vfs.Dir { @Override public Iterable<Vfs.File> getFiles() { return new Iterable<Vfs.File>() { @Override public Iterator<Vfs.File> iterator() { final List<VirtualFile> toVisit = new ArrayList<VirtualFile>(virtualFile.getChildren()); return new AbstractIterator<Vfs.File>() { @Override protected Vfs.... | JBossVfsDir implements Vfs.Dir { @Override public Iterable<Vfs.File> getFiles() { return new Iterable<Vfs.File>() { @Override public Iterator<Vfs.File> iterator() { final List<VirtualFile> toVisit = new ArrayList<VirtualFile>(virtualFile.getChildren()); return new AbstractIterator<Vfs.File>() { @Override protected Vfs.... | JBossVfsDir implements Vfs.Dir { @Override public Iterable<Vfs.File> getFiles() { return new Iterable<Vfs.File>() { @Override public Iterator<Vfs.File> iterator() { final List<VirtualFile> toVisit = new ArrayList<VirtualFile>(virtualFile.getChildren()); return new AbstractIterator<Vfs.File>() { @Override protected Vfs.... | JBossVfsDir implements Vfs.Dir { @Override public Iterable<Vfs.File> getFiles() { return new Iterable<Vfs.File>() { @Override public Iterator<Vfs.File> iterator() { final List<VirtualFile> toVisit = new ArrayList<VirtualFile>(virtualFile.getChildren()); return new AbstractIterator<Vfs.File>() { @Override protected Vfs.... |
@Test public void elemental2ElementTag_customElementWithCustomTagChildWithElementAnnotation() { final Collection<String> tags = elemental2ElementTags( metaClass(CustomElement.WithCustomTag.ChildWithoutElementAnnotation.class)); assertEquals(emptyList(), tags); } | static Collection<String> elemental2ElementTags(final MetaClass type) { final Collection<String> customElementTags = customElementTags(type); if (!customElementTags.isEmpty()) { return customElementTags; } return Elemental2TagMapping.getTags(type.asClass()); } | ElementProviderExtension implements IOCExtensionConfigurator { static Collection<String> elemental2ElementTags(final MetaClass type) { final Collection<String> customElementTags = customElementTags(type); if (!customElementTags.isEmpty()) { return customElementTags; } return Elemental2TagMapping.getTags(type.asClass())... | ElementProviderExtension implements IOCExtensionConfigurator { static Collection<String> elemental2ElementTags(final MetaClass type) { final Collection<String> customElementTags = customElementTags(type); if (!customElementTags.isEmpty()) { return customElementTags; } return Elemental2TagMapping.getTags(type.asClass())... | ElementProviderExtension implements IOCExtensionConfigurator { static Collection<String> elemental2ElementTags(final MetaClass type) { final Collection<String> customElementTags = customElementTags(type); if (!customElementTags.isEmpty()) { return customElementTags; } return Elemental2TagMapping.getTags(type.asClass())... | ElementProviderExtension implements IOCExtensionConfigurator { static Collection<String> elemental2ElementTags(final MetaClass type) { final Collection<String> customElementTags = customElementTags(type); if (!customElementTags.isEmpty()) { return customElementTags; } return Elemental2TagMapping.getTags(type.asClass())... |
@Test public void testShallowVfsDirListing() throws Exception { new File(mountedDir, "foo").createNewFile(); new File(mountedDir, "bar").createNewFile(); new File(mountedDir, "baz").createNewFile(); JBossVfsDir jbvd = new JBossVfsDir(getJBossVfsMountPoint().asDirectoryURL()); int count = 0; for (org.jboss.errai.reflect... | @Override public Iterable<Vfs.File> getFiles() { return new Iterable<Vfs.File>() { @Override public Iterator<Vfs.File> iterator() { final List<VirtualFile> toVisit = new ArrayList<VirtualFile>(virtualFile.getChildren()); return new AbstractIterator<Vfs.File>() { @Override protected Vfs.File computeNext() { while (!toVi... | JBossVfsDir implements Vfs.Dir { @Override public Iterable<Vfs.File> getFiles() { return new Iterable<Vfs.File>() { @Override public Iterator<Vfs.File> iterator() { final List<VirtualFile> toVisit = new ArrayList<VirtualFile>(virtualFile.getChildren()); return new AbstractIterator<Vfs.File>() { @Override protected Vfs.... | JBossVfsDir implements Vfs.Dir { @Override public Iterable<Vfs.File> getFiles() { return new Iterable<Vfs.File>() { @Override public Iterator<Vfs.File> iterator() { final List<VirtualFile> toVisit = new ArrayList<VirtualFile>(virtualFile.getChildren()); return new AbstractIterator<Vfs.File>() { @Override protected Vfs.... | JBossVfsDir implements Vfs.Dir { @Override public Iterable<Vfs.File> getFiles() { return new Iterable<Vfs.File>() { @Override public Iterator<Vfs.File> iterator() { final List<VirtualFile> toVisit = new ArrayList<VirtualFile>(virtualFile.getChildren()); return new AbstractIterator<Vfs.File>() { @Override protected Vfs.... | JBossVfsDir implements Vfs.Dir { @Override public Iterable<Vfs.File> getFiles() { return new Iterable<Vfs.File>() { @Override public Iterator<Vfs.File> iterator() { final List<VirtualFile> toVisit = new ArrayList<VirtualFile>(virtualFile.getChildren()); return new AbstractIterator<Vfs.File>() { @Override protected Vfs.... |
@Test public void testNestedEmptyVfsDirListing() throws Exception { new File(mountedDir, "deeply/nested/directories").mkdirs(); JBossVfsDir jbvd = new JBossVfsDir(getJBossVfsMountPoint().asDirectoryURL()); int count = 0; for (org.jboss.errai.reflections.vfs.Vfs.File reflectionsFile : jbvd.getFiles()) { System.out.print... | @Override public Iterable<Vfs.File> getFiles() { return new Iterable<Vfs.File>() { @Override public Iterator<Vfs.File> iterator() { final List<VirtualFile> toVisit = new ArrayList<VirtualFile>(virtualFile.getChildren()); return new AbstractIterator<Vfs.File>() { @Override protected Vfs.File computeNext() { while (!toVi... | JBossVfsDir implements Vfs.Dir { @Override public Iterable<Vfs.File> getFiles() { return new Iterable<Vfs.File>() { @Override public Iterator<Vfs.File> iterator() { final List<VirtualFile> toVisit = new ArrayList<VirtualFile>(virtualFile.getChildren()); return new AbstractIterator<Vfs.File>() { @Override protected Vfs.... | JBossVfsDir implements Vfs.Dir { @Override public Iterable<Vfs.File> getFiles() { return new Iterable<Vfs.File>() { @Override public Iterator<Vfs.File> iterator() { final List<VirtualFile> toVisit = new ArrayList<VirtualFile>(virtualFile.getChildren()); return new AbstractIterator<Vfs.File>() { @Override protected Vfs.... | JBossVfsDir implements Vfs.Dir { @Override public Iterable<Vfs.File> getFiles() { return new Iterable<Vfs.File>() { @Override public Iterator<Vfs.File> iterator() { final List<VirtualFile> toVisit = new ArrayList<VirtualFile>(virtualFile.getChildren()); return new AbstractIterator<Vfs.File>() { @Override protected Vfs.... | JBossVfsDir implements Vfs.Dir { @Override public Iterable<Vfs.File> getFiles() { return new Iterable<Vfs.File>() { @Override public Iterator<Vfs.File> iterator() { final List<VirtualFile> toVisit = new ArrayList<VirtualFile>(virtualFile.getChildren()); return new AbstractIterator<Vfs.File>() { @Override protected Vfs.... |
@Test public void testVfsFullPath() throws Exception { new File(mountedDir, "foo").createNewFile(); JBossVfsDir jbvd = new JBossVfsDir(getJBossVfsMountPoint().asDirectoryURL()); String path = jbvd.getFiles().iterator().next().getFullPath(); Assert.assertTrue("Wrong path:" + path, path.matches("/([A-Za-z]:/)?mnt/foo"));... | @Override public Iterable<Vfs.File> getFiles() { return new Iterable<Vfs.File>() { @Override public Iterator<Vfs.File> iterator() { final List<VirtualFile> toVisit = new ArrayList<VirtualFile>(virtualFile.getChildren()); return new AbstractIterator<Vfs.File>() { @Override protected Vfs.File computeNext() { while (!toVi... | JBossVfsDir implements Vfs.Dir { @Override public Iterable<Vfs.File> getFiles() { return new Iterable<Vfs.File>() { @Override public Iterator<Vfs.File> iterator() { final List<VirtualFile> toVisit = new ArrayList<VirtualFile>(virtualFile.getChildren()); return new AbstractIterator<Vfs.File>() { @Override protected Vfs.... | JBossVfsDir implements Vfs.Dir { @Override public Iterable<Vfs.File> getFiles() { return new Iterable<Vfs.File>() { @Override public Iterator<Vfs.File> iterator() { final List<VirtualFile> toVisit = new ArrayList<VirtualFile>(virtualFile.getChildren()); return new AbstractIterator<Vfs.File>() { @Override protected Vfs.... | JBossVfsDir implements Vfs.Dir { @Override public Iterable<Vfs.File> getFiles() { return new Iterable<Vfs.File>() { @Override public Iterator<Vfs.File> iterator() { final List<VirtualFile> toVisit = new ArrayList<VirtualFile>(virtualFile.getChildren()); return new AbstractIterator<Vfs.File>() { @Override protected Vfs.... | JBossVfsDir implements Vfs.Dir { @Override public Iterable<Vfs.File> getFiles() { return new Iterable<Vfs.File>() { @Override public Iterator<Vfs.File> iterator() { final List<VirtualFile> toVisit = new ArrayList<VirtualFile>(virtualFile.getChildren()); return new AbstractIterator<Vfs.File>() { @Override protected Vfs.... |
@Test public void testVfsRelativePath() throws Exception { new File(mountedDir, "foo").createNewFile(); JBossVfsDir jbvd = new JBossVfsDir(getJBossVfsMountPoint().asDirectoryURL()); String path = jbvd.getFiles().iterator().next().getRelativePath(); Assert.assertTrue("Wrong path:" + path, path.matches("/([A-Za-z]:/)?mnt... | @Override public Iterable<Vfs.File> getFiles() { return new Iterable<Vfs.File>() { @Override public Iterator<Vfs.File> iterator() { final List<VirtualFile> toVisit = new ArrayList<VirtualFile>(virtualFile.getChildren()); return new AbstractIterator<Vfs.File>() { @Override protected Vfs.File computeNext() { while (!toVi... | JBossVfsDir implements Vfs.Dir { @Override public Iterable<Vfs.File> getFiles() { return new Iterable<Vfs.File>() { @Override public Iterator<Vfs.File> iterator() { final List<VirtualFile> toVisit = new ArrayList<VirtualFile>(virtualFile.getChildren()); return new AbstractIterator<Vfs.File>() { @Override protected Vfs.... | JBossVfsDir implements Vfs.Dir { @Override public Iterable<Vfs.File> getFiles() { return new Iterable<Vfs.File>() { @Override public Iterator<Vfs.File> iterator() { final List<VirtualFile> toVisit = new ArrayList<VirtualFile>(virtualFile.getChildren()); return new AbstractIterator<Vfs.File>() { @Override protected Vfs.... | JBossVfsDir implements Vfs.Dir { @Override public Iterable<Vfs.File> getFiles() { return new Iterable<Vfs.File>() { @Override public Iterator<Vfs.File> iterator() { final List<VirtualFile> toVisit = new ArrayList<VirtualFile>(virtualFile.getChildren()); return new AbstractIterator<Vfs.File>() { @Override protected Vfs.... | JBossVfsDir implements Vfs.Dir { @Override public Iterable<Vfs.File> getFiles() { return new Iterable<Vfs.File>() { @Override public Iterator<Vfs.File> iterator() { final List<VirtualFile> toVisit = new ArrayList<VirtualFile>(virtualFile.getChildren()); return new AbstractIterator<Vfs.File>() { @Override protected Vfs.... |
@Test public void testVfsFileName() throws Exception { new File(mountedDir, "foo").createNewFile(); JBossVfsDir jbvd = new JBossVfsDir(getJBossVfsMountPoint().asDirectoryURL()); assertEquals("foo", jbvd.getFiles().iterator().next().getName()); } | @Override public Iterable<Vfs.File> getFiles() { return new Iterable<Vfs.File>() { @Override public Iterator<Vfs.File> iterator() { final List<VirtualFile> toVisit = new ArrayList<VirtualFile>(virtualFile.getChildren()); return new AbstractIterator<Vfs.File>() { @Override protected Vfs.File computeNext() { while (!toVi... | JBossVfsDir implements Vfs.Dir { @Override public Iterable<Vfs.File> getFiles() { return new Iterable<Vfs.File>() { @Override public Iterator<Vfs.File> iterator() { final List<VirtualFile> toVisit = new ArrayList<VirtualFile>(virtualFile.getChildren()); return new AbstractIterator<Vfs.File>() { @Override protected Vfs.... | JBossVfsDir implements Vfs.Dir { @Override public Iterable<Vfs.File> getFiles() { return new Iterable<Vfs.File>() { @Override public Iterator<Vfs.File> iterator() { final List<VirtualFile> toVisit = new ArrayList<VirtualFile>(virtualFile.getChildren()); return new AbstractIterator<Vfs.File>() { @Override protected Vfs.... | JBossVfsDir implements Vfs.Dir { @Override public Iterable<Vfs.File> getFiles() { return new Iterable<Vfs.File>() { @Override public Iterator<Vfs.File> iterator() { final List<VirtualFile> toVisit = new ArrayList<VirtualFile>(virtualFile.getChildren()); return new AbstractIterator<Vfs.File>() { @Override protected Vfs.... | JBossVfsDir implements Vfs.Dir { @Override public Iterable<Vfs.File> getFiles() { return new Iterable<Vfs.File>() { @Override public Iterator<Vfs.File> iterator() { final List<VirtualFile> toVisit = new ArrayList<VirtualFile>(virtualFile.getChildren()); return new AbstractIterator<Vfs.File>() { @Override protected Vfs.... |
@Test public void conversationalEventWithContext() { RpcContext.set(new MockMessage()); final String convSessionId = EventDispatcher.getConversationalSessionId(MyConversationalEvent.class); assertEquals("bearista", convSessionId); } | static String getConversationalSessionId(Class<? extends Object> eventType) { final QueueSession queueSession = RpcContext.getQueueSession(); if (eventType.isAnnotationPresent(Conversational.class) && queueSession != null && queueSession.getSessionId() != null) { return queueSession.getSessionId(); } return null; } | EventDispatcher implements MessageCallback { static String getConversationalSessionId(Class<? extends Object> eventType) { final QueueSession queueSession = RpcContext.getQueueSession(); if (eventType.isAnnotationPresent(Conversational.class) && queueSession != null && queueSession.getSessionId() != null) { return queu... | EventDispatcher implements MessageCallback { static String getConversationalSessionId(Class<? extends Object> eventType) { final QueueSession queueSession = RpcContext.getQueueSession(); if (eventType.isAnnotationPresent(Conversational.class) && queueSession != null && queueSession.getSessionId() != null) { return queu... | EventDispatcher implements MessageCallback { static String getConversationalSessionId(Class<? extends Object> eventType) { final QueueSession queueSession = RpcContext.getQueueSession(); if (eventType.isAnnotationPresent(Conversational.class) && queueSession != null && queueSession.getSessionId() != null) { return queu... | EventDispatcher implements MessageCallback { static String getConversationalSessionId(Class<? extends Object> eventType) { final QueueSession queueSession = RpcContext.getQueueSession(); if (eventType.isAnnotationPresent(Conversational.class) && queueSession != null && queueSession.getSessionId() != null) { return queu... |
@Test public void conversationalEventWithoutContext() { final String convSessionId = EventDispatcher.getConversationalSessionId(MyConversationalEvent.class); assertNull(convSessionId); } | static String getConversationalSessionId(Class<? extends Object> eventType) { final QueueSession queueSession = RpcContext.getQueueSession(); if (eventType.isAnnotationPresent(Conversational.class) && queueSession != null && queueSession.getSessionId() != null) { return queueSession.getSessionId(); } return null; } | EventDispatcher implements MessageCallback { static String getConversationalSessionId(Class<? extends Object> eventType) { final QueueSession queueSession = RpcContext.getQueueSession(); if (eventType.isAnnotationPresent(Conversational.class) && queueSession != null && queueSession.getSessionId() != null) { return queu... | EventDispatcher implements MessageCallback { static String getConversationalSessionId(Class<? extends Object> eventType) { final QueueSession queueSession = RpcContext.getQueueSession(); if (eventType.isAnnotationPresent(Conversational.class) && queueSession != null && queueSession.getSessionId() != null) { return queu... | EventDispatcher implements MessageCallback { static String getConversationalSessionId(Class<? extends Object> eventType) { final QueueSession queueSession = RpcContext.getQueueSession(); if (eventType.isAnnotationPresent(Conversational.class) && queueSession != null && queueSession.getSessionId() != null) { return queu... | EventDispatcher implements MessageCallback { static String getConversationalSessionId(Class<? extends Object> eventType) { final QueueSession queueSession = RpcContext.getQueueSession(); if (eventType.isAnnotationPresent(Conversational.class) && queueSession != null && queueSession.getSessionId() != null) { return queu... |
@Test public void nonConversationalEventWithContext() { RpcContext.set(new MockMessage()); final String convSessionId = EventDispatcher.getConversationalSessionId(MyNonConversationalEvent.class); assertNull(convSessionId); } | static String getConversationalSessionId(Class<? extends Object> eventType) { final QueueSession queueSession = RpcContext.getQueueSession(); if (eventType.isAnnotationPresent(Conversational.class) && queueSession != null && queueSession.getSessionId() != null) { return queueSession.getSessionId(); } return null; } | EventDispatcher implements MessageCallback { static String getConversationalSessionId(Class<? extends Object> eventType) { final QueueSession queueSession = RpcContext.getQueueSession(); if (eventType.isAnnotationPresent(Conversational.class) && queueSession != null && queueSession.getSessionId() != null) { return queu... | EventDispatcher implements MessageCallback { static String getConversationalSessionId(Class<? extends Object> eventType) { final QueueSession queueSession = RpcContext.getQueueSession(); if (eventType.isAnnotationPresent(Conversational.class) && queueSession != null && queueSession.getSessionId() != null) { return queu... | EventDispatcher implements MessageCallback { static String getConversationalSessionId(Class<? extends Object> eventType) { final QueueSession queueSession = RpcContext.getQueueSession(); if (eventType.isAnnotationPresent(Conversational.class) && queueSession != null && queueSession.getSessionId() != null) { return queu... | EventDispatcher implements MessageCallback { static String getConversationalSessionId(Class<? extends Object> eventType) { final QueueSession queueSession = RpcContext.getQueueSession(); if (eventType.isAnnotationPresent(Conversational.class) && queueSession != null && queueSession.getSessionId() != null) { return queu... |
@Test public void nonConversationalEventWithoutContext() { final String convSessionId = EventDispatcher.getConversationalSessionId(MyNonConversationalEvent.class); assertNull(convSessionId); } | static String getConversationalSessionId(Class<? extends Object> eventType) { final QueueSession queueSession = RpcContext.getQueueSession(); if (eventType.isAnnotationPresent(Conversational.class) && queueSession != null && queueSession.getSessionId() != null) { return queueSession.getSessionId(); } return null; } | EventDispatcher implements MessageCallback { static String getConversationalSessionId(Class<? extends Object> eventType) { final QueueSession queueSession = RpcContext.getQueueSession(); if (eventType.isAnnotationPresent(Conversational.class) && queueSession != null && queueSession.getSessionId() != null) { return queu... | EventDispatcher implements MessageCallback { static String getConversationalSessionId(Class<? extends Object> eventType) { final QueueSession queueSession = RpcContext.getQueueSession(); if (eventType.isAnnotationPresent(Conversational.class) && queueSession != null && queueSession.getSessionId() != null) { return queu... | EventDispatcher implements MessageCallback { static String getConversationalSessionId(Class<? extends Object> eventType) { final QueueSession queueSession = RpcContext.getQueueSession(); if (eventType.isAnnotationPresent(Conversational.class) && queueSession != null && queueSession.getSessionId() != null) { return queu... | EventDispatcher implements MessageCallback { static String getConversationalSessionId(Class<? extends Object> eventType) { final QueueSession queueSession = RpcContext.getQueueSession(); if (eventType.isAnnotationPresent(Conversational.class) && queueSession != null && queueSession.getSessionId() != null) { return queu... |
@Test public void elemental2ElementTag_customElementWithCustomTagChildWithCustomTag() { final Collection<String> tags = elemental2ElementTags( metaClass(CustomElement.WithCustomTag.ChildWithCustomTag.class)); assertEquals(singletonList("sub-foo"), tags); } | static Collection<String> elemental2ElementTags(final MetaClass type) { final Collection<String> customElementTags = customElementTags(type); if (!customElementTags.isEmpty()) { return customElementTags; } return Elemental2TagMapping.getTags(type.asClass()); } | ElementProviderExtension implements IOCExtensionConfigurator { static Collection<String> elemental2ElementTags(final MetaClass type) { final Collection<String> customElementTags = customElementTags(type); if (!customElementTags.isEmpty()) { return customElementTags; } return Elemental2TagMapping.getTags(type.asClass())... | ElementProviderExtension implements IOCExtensionConfigurator { static Collection<String> elemental2ElementTags(final MetaClass type) { final Collection<String> customElementTags = customElementTags(type); if (!customElementTags.isEmpty()) { return customElementTags; } return Elemental2TagMapping.getTags(type.asClass())... | ElementProviderExtension implements IOCExtensionConfigurator { static Collection<String> elemental2ElementTags(final MetaClass type) { final Collection<String> customElementTags = customElementTags(type); if (!customElementTags.isEmpty()) { return customElementTags; } return Elemental2TagMapping.getTags(type.asClass())... | ElementProviderExtension implements IOCExtensionConfigurator { static Collection<String> elemental2ElementTags(final MetaClass type) { final Collection<String> customElementTags = customElementTags(type); if (!customElementTags.isEmpty()) { return customElementTags; } return Elemental2TagMapping.getTags(type.asClass())... |
@Test public void testGetTags() { assertEquals("null should return no tag", emptyList(), getTags(null)); assertEquals("Object.class should not have any mapped tag name", emptyList(), getTags(Object.class)); assertEquals("String.class should not have any mapped tag name", emptyList(), getTags(String.class)); assertEqual... | static Collection<String> getTags(final Class<?> elemental2ElementClass) { if (elemental2ElementClass == null || Element.class.equals(elemental2ElementClass)) { return Collections.emptyList(); } final Collection<String> tags = TAG_NAMES_BY_DOM_INTERFACE.get(elemental2ElementClass); if (tags.isEmpty()) { return getTags(... | Elemental2TagMapping { static Collection<String> getTags(final Class<?> elemental2ElementClass) { if (elemental2ElementClass == null || Element.class.equals(elemental2ElementClass)) { return Collections.emptyList(); } final Collection<String> tags = TAG_NAMES_BY_DOM_INTERFACE.get(elemental2ElementClass); if (tags.isEmp... | Elemental2TagMapping { static Collection<String> getTags(final Class<?> elemental2ElementClass) { if (elemental2ElementClass == null || Element.class.equals(elemental2ElementClass)) { return Collections.emptyList(); } final Collection<String> tags = TAG_NAMES_BY_DOM_INTERFACE.get(elemental2ElementClass); if (tags.isEmp... | Elemental2TagMapping { static Collection<String> getTags(final Class<?> elemental2ElementClass) { if (elemental2ElementClass == null || Element.class.equals(elemental2ElementClass)) { return Collections.emptyList(); } final Collection<String> tags = TAG_NAMES_BY_DOM_INTERFACE.get(elemental2ElementClass); if (tags.isEmp... | Elemental2TagMapping { static Collection<String> getTags(final Class<?> elemental2ElementClass) { if (elemental2ElementClass == null || Element.class.equals(elemental2ElementClass)) { return Collections.emptyList(); } final Collection<String> tags = TAG_NAMES_BY_DOM_INTERFACE.get(elemental2ElementClass); if (tags.isEmp... |
@Test public void nativeQuickHandlerWithNoEventTypeThrowsGenerationException() throws Exception { final MetaMethod handlerMethod = mock(MetaMethod.class); final MetaParameter eventParam = mock(MetaParameter.class); when(templatedClass.getMethodsAnnotatedWith(EventHandler.class)) .thenReturn(singletonList(handlerMethod)... | @Override public void generateDecorator(final Decorable decorable, final FactoryController controller) { final MetaClass declaringClass = decorable.getDecorableDeclaringType(); final Templated anno = (Templated) decorable.getAnnotation(); final Class<?> templateProvider = anno.provider(); final boolean customProvider =... | TemplatedCodeDecorator extends IOCDecoratorExtension<Templated> { @Override public void generateDecorator(final Decorable decorable, final FactoryController controller) { final MetaClass declaringClass = decorable.getDecorableDeclaringType(); final Templated anno = (Templated) decorable.getAnnotation(); final Class<?> ... | TemplatedCodeDecorator extends IOCDecoratorExtension<Templated> { @Override public void generateDecorator(final Decorable decorable, final FactoryController controller) { final MetaClass declaringClass = decorable.getDecorableDeclaringType(); final Templated anno = (Templated) decorable.getAnnotation(); final Class<?> ... | TemplatedCodeDecorator extends IOCDecoratorExtension<Templated> { @Override public void generateDecorator(final Decorable decorable, final FactoryController controller) { final MetaClass declaringClass = decorable.getDecorableDeclaringType(); final Templated anno = (Templated) decorable.getAnnotation(); final Class<?> ... | TemplatedCodeDecorator extends IOCDecoratorExtension<Templated> { @Override public void generateDecorator(final Decorable decorable, final FactoryController controller) { final MetaClass declaringClass = decorable.getDecorableDeclaringType(); final Templated anno = (Templated) decorable.getAnnotation(); final Class<?> ... |
@Test public void testGetLocaleFromBundleFilename() { Assert.assertEquals(null, TranslationServiceGenerator.getLocaleFromBundlePath("myBundle.json")); Assert.assertEquals(null, TranslationServiceGenerator.getLocaleFromBundlePath("myBundle_en_US.other")); Assert.assertEquals("en_US", TranslationServiceGenerator.getLocal... | public static String getLocaleFromBundlePath(final String bundlePath) { final Matcher matcher = LOCALE_IN_FILENAME_PATTERN.matcher(bundlePath); if (matcher != null && matcher.matches()) { final StringBuilder locale = new StringBuilder(); final String lang = matcher.group(2); if (lang != null) locale.append(lang); final... | TranslationServiceGenerator extends AbstractAsyncGenerator { public static String getLocaleFromBundlePath(final String bundlePath) { final Matcher matcher = LOCALE_IN_FILENAME_PATTERN.matcher(bundlePath); if (matcher != null && matcher.matches()) { final StringBuilder locale = new StringBuilder(); final String lang = m... | TranslationServiceGenerator extends AbstractAsyncGenerator { public static String getLocaleFromBundlePath(final String bundlePath) { final Matcher matcher = LOCALE_IN_FILENAME_PATTERN.matcher(bundlePath); if (matcher != null && matcher.matches()) { final StringBuilder locale = new StringBuilder(); final String lang = m... | TranslationServiceGenerator extends AbstractAsyncGenerator { public static String getLocaleFromBundlePath(final String bundlePath) { final Matcher matcher = LOCALE_IN_FILENAME_PATTERN.matcher(bundlePath); if (matcher != null && matcher.matches()) { final StringBuilder locale = new StringBuilder(); final String lang = m... | TranslationServiceGenerator extends AbstractAsyncGenerator { public static String getLocaleFromBundlePath(final String bundlePath) { final Matcher matcher = LOCALE_IN_FILENAME_PATTERN.matcher(bundlePath); if (matcher != null && matcher.matches()) { final StringBuilder locale = new StringBuilder(); final String lang = m... |
@Test public void testRecordBundleKeys() { String jsonResourcePath = "org/jboss/errai/ui/test/i18n/client/I18nTemplateTest.json"; Map<String, Set<String>> result = new HashMap<String, Set<String>>(); TranslationServiceGenerator.recordBundleKeys(result, null, jsonResourcePath); Assert.assertEquals(1, result.keySet().siz... | @SuppressWarnings({ "rawtypes", "unchecked" }) protected static Set<String> recordBundleKeys(final Map<String, Set<String>> discoveredI18nMap, final String locale, final String bundlePath) { InputStream is = null; final Set<String> duplicates = new HashSet<>(); try { final Set<String> keys = discoveredI18nMap.computeIf... | TranslationServiceGenerator extends AbstractAsyncGenerator { @SuppressWarnings({ "rawtypes", "unchecked" }) protected static Set<String> recordBundleKeys(final Map<String, Set<String>> discoveredI18nMap, final String locale, final String bundlePath) { InputStream is = null; final Set<String> duplicates = new HashSet<>(... | TranslationServiceGenerator extends AbstractAsyncGenerator { @SuppressWarnings({ "rawtypes", "unchecked" }) protected static Set<String> recordBundleKeys(final Map<String, Set<String>> discoveredI18nMap, final String locale, final String bundlePath) { InputStream is = null; final Set<String> duplicates = new HashSet<>(... | TranslationServiceGenerator extends AbstractAsyncGenerator { @SuppressWarnings({ "rawtypes", "unchecked" }) protected static Set<String> recordBundleKeys(final Map<String, Set<String>> discoveredI18nMap, final String locale, final String bundlePath) { InputStream is = null; final Set<String> duplicates = new HashSet<>(... | TranslationServiceGenerator extends AbstractAsyncGenerator { @SuppressWarnings({ "rawtypes", "unchecked" }) protected static Set<String> recordBundleKeys(final Map<String, Set<String>> discoveredI18nMap, final String locale, final String bundlePath) { InputStream is = null; final Set<String> duplicates = new HashSet<>(... |
@Test public void testTagComboZero() { TagValue[][] expected = {{}}; assertEquals(MetricGetter.getTagCombinations(), expected); } | @SafeVarargs public static final TagValue[][] getTagCombinations(Class<? extends TagValue>... tagValueClazzes) { int combinations = 1; for (Class<? extends TagValue> clazz : tagValueClazzes) { combinations *= clazz.getEnumConstants().length; } TagValue[][] result = new TagValue[combinations][]; List<List<TagValue>> tag... | MetricGetter { @SafeVarargs public static final TagValue[][] getTagCombinations(Class<? extends TagValue>... tagValueClazzes) { int combinations = 1; for (Class<? extends TagValue> clazz : tagValueClazzes) { combinations *= clazz.getEnumConstants().length; } TagValue[][] result = new TagValue[combinations][]; List<List... | MetricGetter { @SafeVarargs public static final TagValue[][] getTagCombinations(Class<? extends TagValue>... tagValueClazzes) { int combinations = 1; for (Class<? extends TagValue> clazz : tagValueClazzes) { combinations *= clazz.getEnumConstants().length; } TagValue[][] result = new TagValue[combinations][]; List<List... | MetricGetter { @SafeVarargs public static final TagValue[][] getTagCombinations(Class<? extends TagValue>... tagValueClazzes) { int combinations = 1; for (Class<? extends TagValue> clazz : tagValueClazzes) { combinations *= clazz.getEnumConstants().length; } TagValue[][] result = new TagValue[combinations][]; List<List... | MetricGetter { @SafeVarargs public static final TagValue[][] getTagCombinations(Class<? extends TagValue>... tagValueClazzes) { int combinations = 1; for (Class<? extends TagValue> clazz : tagValueClazzes) { combinations *= clazz.getEnumConstants().length; } TagValue[][] result = new TagValue[combinations][]; List<List... |
@Test public void testTagComboOne() { TagValue[][] expected = {{TimeoutTimedOut.TRUE}, {TimeoutTimedOut.FALSE}}; assertEquals(MetricGetter.getTagCombinations(TimeoutTimedOut.class), expected); } | @SafeVarargs public static final TagValue[][] getTagCombinations(Class<? extends TagValue>... tagValueClazzes) { int combinations = 1; for (Class<? extends TagValue> clazz : tagValueClazzes) { combinations *= clazz.getEnumConstants().length; } TagValue[][] result = new TagValue[combinations][]; List<List<TagValue>> tag... | MetricGetter { @SafeVarargs public static final TagValue[][] getTagCombinations(Class<? extends TagValue>... tagValueClazzes) { int combinations = 1; for (Class<? extends TagValue> clazz : tagValueClazzes) { combinations *= clazz.getEnumConstants().length; } TagValue[][] result = new TagValue[combinations][]; List<List... | MetricGetter { @SafeVarargs public static final TagValue[][] getTagCombinations(Class<? extends TagValue>... tagValueClazzes) { int combinations = 1; for (Class<? extends TagValue> clazz : tagValueClazzes) { combinations *= clazz.getEnumConstants().length; } TagValue[][] result = new TagValue[combinations][]; List<List... | MetricGetter { @SafeVarargs public static final TagValue[][] getTagCombinations(Class<? extends TagValue>... tagValueClazzes) { int combinations = 1; for (Class<? extends TagValue> clazz : tagValueClazzes) { combinations *= clazz.getEnumConstants().length; } TagValue[][] result = new TagValue[combinations][]; List<List... | MetricGetter { @SafeVarargs public static final TagValue[][] getTagCombinations(Class<? extends TagValue>... tagValueClazzes) { int combinations = 1; for (Class<? extends TagValue> clazz : tagValueClazzes) { combinations *= clazz.getEnumConstants().length; } TagValue[][] result = new TagValue[combinations][]; List<List... |
@Test public void testTagComboTwo() { TagValue[][] expected = {{TimeoutTimedOut.TRUE, InvocationResult.VALUE_RETURNED}, {TimeoutTimedOut.TRUE, InvocationResult.EXCEPTION_THROWN}, {TimeoutTimedOut.FALSE, InvocationResult.VALUE_RETURNED}, {TimeoutTimedOut.FALSE, InvocationResult.EXCEPTION_THROWN}}; assertEquals(MetricGet... | @SafeVarargs public static final TagValue[][] getTagCombinations(Class<? extends TagValue>... tagValueClazzes) { int combinations = 1; for (Class<? extends TagValue> clazz : tagValueClazzes) { combinations *= clazz.getEnumConstants().length; } TagValue[][] result = new TagValue[combinations][]; List<List<TagValue>> tag... | MetricGetter { @SafeVarargs public static final TagValue[][] getTagCombinations(Class<? extends TagValue>... tagValueClazzes) { int combinations = 1; for (Class<? extends TagValue> clazz : tagValueClazzes) { combinations *= clazz.getEnumConstants().length; } TagValue[][] result = new TagValue[combinations][]; List<List... | MetricGetter { @SafeVarargs public static final TagValue[][] getTagCombinations(Class<? extends TagValue>... tagValueClazzes) { int combinations = 1; for (Class<? extends TagValue> clazz : tagValueClazzes) { combinations *= clazz.getEnumConstants().length; } TagValue[][] result = new TagValue[combinations][]; List<List... | MetricGetter { @SafeVarargs public static final TagValue[][] getTagCombinations(Class<? extends TagValue>... tagValueClazzes) { int combinations = 1; for (Class<? extends TagValue> clazz : tagValueClazzes) { combinations *= clazz.getEnumConstants().length; } TagValue[][] result = new TagValue[combinations][]; List<List... | MetricGetter { @SafeVarargs public static final TagValue[][] getTagCombinations(Class<? extends TagValue>... tagValueClazzes) { int combinations = 1; for (Class<? extends TagValue> clazz : tagValueClazzes) { combinations *= clazz.getEnumConstants().length; } TagValue[][] result = new TagValue[combinations][]; List<List... |
@Test public void sleepWhileConditionMet_conditionDoesNotChangeBeforeTime_sleepsAllottedTime() throws Exception { final long SLEEP_TIME_MS = 100; Sleeper sleeper = new Sleeper(); long start = System.nanoTime(); sleeper.sleepWhileConditionMet(Suppliers.of(true), Time.milliseconds(SLEEP_TIME_MS)); long passed = (long) ((... | public void sleepWhileConditionMet(BooleanSupplier condition, Time duration) throws InterruptedException { long timeoutMs = duration.valueAsMillis(); long sleepingPeriodMs = getSleepingPeriodMs(timeoutMs); long timeWaited = 0; while (condition.getAsBoolean() && timeWaited < timeoutMs) { sleepMs(sleepingPeriodMs); timeW... | Sleeper { public void sleepWhileConditionMet(BooleanSupplier condition, Time duration) throws InterruptedException { long timeoutMs = duration.valueAsMillis(); long sleepingPeriodMs = getSleepingPeriodMs(timeoutMs); long timeWaited = 0; while (condition.getAsBoolean() && timeWaited < timeoutMs) { sleepMs(sleepingPeriod... | Sleeper { public void sleepWhileConditionMet(BooleanSupplier condition, Time duration) throws InterruptedException { long timeoutMs = duration.valueAsMillis(); long sleepingPeriodMs = getSleepingPeriodMs(timeoutMs); long timeWaited = 0; while (condition.getAsBoolean() && timeWaited < timeoutMs) { sleepMs(sleepingPeriod... | Sleeper { public void sleepWhileConditionMet(BooleanSupplier condition, Time duration) throws InterruptedException { long timeoutMs = duration.valueAsMillis(); long sleepingPeriodMs = getSleepingPeriodMs(timeoutMs); long timeWaited = 0; while (condition.getAsBoolean() && timeWaited < timeoutMs) { sleepMs(sleepingPeriod... | Sleeper { public void sleepWhileConditionMet(BooleanSupplier condition, Time duration) throws InterruptedException { long timeoutMs = duration.valueAsMillis(); long sleepingPeriodMs = getSleepingPeriodMs(timeoutMs); long timeWaited = 0; while (condition.getAsBoolean() && timeWaited < timeoutMs) { sleepMs(sleepingPeriod... |
@Test public void getActionOnSubsystem_subsystemHasNoAction_returnsEmpty() throws Exception { Subsystem subsystem = mock(Subsystem.class); Optional<Action> optionalAction = mRequirementsControl.getActionOnRequirement(subsystem); assertFalse(optionalAction.isPresent()); } | public Optional<Action> getActionOnRequirement(Requirement requirement) { return Optional.ofNullable(mActionsOnRequirement.get(requirement)); } | RequirementsControl { public Optional<Action> getActionOnRequirement(Requirement requirement) { return Optional.ofNullable(mActionsOnRequirement.get(requirement)); } } | RequirementsControl { public Optional<Action> getActionOnRequirement(Requirement requirement) { return Optional.ofNullable(mActionsOnRequirement.get(requirement)); } RequirementsControl(Logger logger, Map<Requirement, Action> actionsOnRequirement, Map<Subsystem, Action> defaultActionsOnSubsystems); RequirementsControl... | RequirementsControl { public Optional<Action> getActionOnRequirement(Requirement requirement) { return Optional.ofNullable(mActionsOnRequirement.get(requirement)); } RequirementsControl(Logger logger, Map<Requirement, Action> actionsOnRequirement, Map<Subsystem, Action> defaultActionsOnSubsystems); RequirementsControl... | RequirementsControl { public Optional<Action> getActionOnRequirement(Requirement requirement) { return Optional.ofNullable(mActionsOnRequirement.get(requirement)); } RequirementsControl(Logger logger, Map<Requirement, Action> actionsOnRequirement, Map<Subsystem, Action> defaultActionsOnSubsystems); RequirementsControl... |
@Test public void setDefaultActionOnSubsystem_defaultAlreadyExists_replacesAction() throws Exception { Subsystem subsystem = mock(Subsystem.class); Action action = mock(Action.class); mDefaultActionsOnSubsystems.put(subsystem, action); Action newAction = ActionsMock.actionMocker() .mockWithRequirements(Collections.sing... | public void setDefaultActionOnSubsystem(Subsystem subsystem, Action action) { if (!action.getConfiguration().getRequirements().contains(subsystem)) { action.configure() .requires(subsystem) .save(); } mDefaultActionsOnSubsystems.put(subsystem, action); } | RequirementsControl { public void setDefaultActionOnSubsystem(Subsystem subsystem, Action action) { if (!action.getConfiguration().getRequirements().contains(subsystem)) { action.configure() .requires(subsystem) .save(); } mDefaultActionsOnSubsystems.put(subsystem, action); } } | RequirementsControl { public void setDefaultActionOnSubsystem(Subsystem subsystem, Action action) { if (!action.getConfiguration().getRequirements().contains(subsystem)) { action.configure() .requires(subsystem) .save(); } mDefaultActionsOnSubsystems.put(subsystem, action); } RequirementsControl(Logger logger, Map<Requ... | RequirementsControl { public void setDefaultActionOnSubsystem(Subsystem subsystem, Action action) { if (!action.getConfiguration().getRequirements().contains(subsystem)) { action.configure() .requires(subsystem) .save(); } mDefaultActionsOnSubsystems.put(subsystem, action); } RequirementsControl(Logger logger, Map<Requ... | RequirementsControl { public void setDefaultActionOnSubsystem(Subsystem subsystem, Action action) { if (!action.getConfiguration().getRequirements().contains(subsystem)) { action.configure() .requires(subsystem) .save(); } mDefaultActionsOnSubsystems.put(subsystem, action); } RequirementsControl(Logger logger, Map<Requ... |
@Test public void setDefaultActionOnSubsystem_defaultNotExists_putAction() throws Exception { Subsystem subsystem = mock(Subsystem.class); Action newAction = ActionsMock.actionMocker() .mockWithRequirements(Collections.singleton(subsystem)) .build(); mRequirementsControl.setDefaultActionOnSubsystem(subsystem, newAction... | public void setDefaultActionOnSubsystem(Subsystem subsystem, Action action) { if (!action.getConfiguration().getRequirements().contains(subsystem)) { action.configure() .requires(subsystem) .save(); } mDefaultActionsOnSubsystems.put(subsystem, action); } | RequirementsControl { public void setDefaultActionOnSubsystem(Subsystem subsystem, Action action) { if (!action.getConfiguration().getRequirements().contains(subsystem)) { action.configure() .requires(subsystem) .save(); } mDefaultActionsOnSubsystems.put(subsystem, action); } } | RequirementsControl { public void setDefaultActionOnSubsystem(Subsystem subsystem, Action action) { if (!action.getConfiguration().getRequirements().contains(subsystem)) { action.configure() .requires(subsystem) .save(); } mDefaultActionsOnSubsystems.put(subsystem, action); } RequirementsControl(Logger logger, Map<Requ... | RequirementsControl { public void setDefaultActionOnSubsystem(Subsystem subsystem, Action action) { if (!action.getConfiguration().getRequirements().contains(subsystem)) { action.configure() .requires(subsystem) .save(); } mDefaultActionsOnSubsystems.put(subsystem, action); } RequirementsControl(Logger logger, Map<Requ... | RequirementsControl { public void setDefaultActionOnSubsystem(Subsystem subsystem, Action action) { if (!action.getConfiguration().getRequirements().contains(subsystem)) { action.configure() .requires(subsystem) .save(); } mDefaultActionsOnSubsystems.put(subsystem, action); } RequirementsControl(Logger logger, Map<Requ... |
@Test public void setDefaultActionOnSubsystem_subsystemNotInRequirements_subsystemAdded() throws Exception { Subsystem subsystem = mock(Subsystem.class); Action newAction = ActionsMock.actionMocker().build(); mRequirementsControl.setDefaultActionOnSubsystem(subsystem, newAction); MatcherAssert.assertThat(newAction.getC... | public void setDefaultActionOnSubsystem(Subsystem subsystem, Action action) { if (!action.getConfiguration().getRequirements().contains(subsystem)) { action.configure() .requires(subsystem) .save(); } mDefaultActionsOnSubsystems.put(subsystem, action); } | RequirementsControl { public void setDefaultActionOnSubsystem(Subsystem subsystem, Action action) { if (!action.getConfiguration().getRequirements().contains(subsystem)) { action.configure() .requires(subsystem) .save(); } mDefaultActionsOnSubsystems.put(subsystem, action); } } | RequirementsControl { public void setDefaultActionOnSubsystem(Subsystem subsystem, Action action) { if (!action.getConfiguration().getRequirements().contains(subsystem)) { action.configure() .requires(subsystem) .save(); } mDefaultActionsOnSubsystems.put(subsystem, action); } RequirementsControl(Logger logger, Map<Requ... | RequirementsControl { public void setDefaultActionOnSubsystem(Subsystem subsystem, Action action) { if (!action.getConfiguration().getRequirements().contains(subsystem)) { action.configure() .requires(subsystem) .save(); } mDefaultActionsOnSubsystems.put(subsystem, action); } RequirementsControl(Logger logger, Map<Requ... | RequirementsControl { public void setDefaultActionOnSubsystem(Subsystem subsystem, Action action) { if (!action.getConfiguration().getRequirements().contains(subsystem)) { action.configure() .requires(subsystem) .save(); } mDefaultActionsOnSubsystems.put(subsystem, action); } RequirementsControl(Logger logger, Map<Requ... |
@Test public void getDefaultActionsToStart_noActionsAreRunning_returnsAll() throws Exception { Map<Subsystem, Action> defaultActions = new HashMap<>(); defaultActions.put(mock(Subsystem.class), mock(Action.class)); defaultActions.put(mock(Subsystem.class), mock(Action.class)); mDefaultActionsOnSubsystems.putAll(default... | public Map<Subsystem, Action> getDefaultActionsToStart() { Map<Subsystem, Action> actionsToStart = new HashMap<>(); for (Map.Entry<Subsystem, Action> entry : mDefaultActionsOnSubsystems.entrySet()) { if (mActionsOnRequirement.containsKey(entry.getKey())) { continue; } actionsToStart.put(entry.getKey(), entry.getValue()... | RequirementsControl { public Map<Subsystem, Action> getDefaultActionsToStart() { Map<Subsystem, Action> actionsToStart = new HashMap<>(); for (Map.Entry<Subsystem, Action> entry : mDefaultActionsOnSubsystems.entrySet()) { if (mActionsOnRequirement.containsKey(entry.getKey())) { continue; } actionsToStart.put(entry.getK... | RequirementsControl { public Map<Subsystem, Action> getDefaultActionsToStart() { Map<Subsystem, Action> actionsToStart = new HashMap<>(); for (Map.Entry<Subsystem, Action> entry : mDefaultActionsOnSubsystems.entrySet()) { if (mActionsOnRequirement.containsKey(entry.getKey())) { continue; } actionsToStart.put(entry.getK... | RequirementsControl { public Map<Subsystem, Action> getDefaultActionsToStart() { Map<Subsystem, Action> actionsToStart = new HashMap<>(); for (Map.Entry<Subsystem, Action> entry : mDefaultActionsOnSubsystems.entrySet()) { if (mActionsOnRequirement.containsKey(entry.getKey())) { continue; } actionsToStart.put(entry.getK... | RequirementsControl { public Map<Subsystem, Action> getDefaultActionsToStart() { Map<Subsystem, Action> actionsToStart = new HashMap<>(); for (Map.Entry<Subsystem, Action> entry : mDefaultActionsOnSubsystems.entrySet()) { if (mActionsOnRequirement.containsKey(entry.getKey())) { continue; } actionsToStart.put(entry.getK... |
@Test public void getDefaultActionsToStart_someActionsRunning_returnsTheOnesNotRunning() throws Exception { Map<Subsystem, Action> notRunning = new HashMap<>(); notRunning.put(mock(Subsystem.class), mock(Action.class)); notRunning.put(mock(Subsystem.class), mock(Action.class)); Map<Subsystem, Action> running = new Hash... | public Map<Subsystem, Action> getDefaultActionsToStart() { Map<Subsystem, Action> actionsToStart = new HashMap<>(); for (Map.Entry<Subsystem, Action> entry : mDefaultActionsOnSubsystems.entrySet()) { if (mActionsOnRequirement.containsKey(entry.getKey())) { continue; } actionsToStart.put(entry.getKey(), entry.getValue()... | RequirementsControl { public Map<Subsystem, Action> getDefaultActionsToStart() { Map<Subsystem, Action> actionsToStart = new HashMap<>(); for (Map.Entry<Subsystem, Action> entry : mDefaultActionsOnSubsystems.entrySet()) { if (mActionsOnRequirement.containsKey(entry.getKey())) { continue; } actionsToStart.put(entry.getK... | RequirementsControl { public Map<Subsystem, Action> getDefaultActionsToStart() { Map<Subsystem, Action> actionsToStart = new HashMap<>(); for (Map.Entry<Subsystem, Action> entry : mDefaultActionsOnSubsystems.entrySet()) { if (mActionsOnRequirement.containsKey(entry.getKey())) { continue; } actionsToStart.put(entry.getK... | RequirementsControl { public Map<Subsystem, Action> getDefaultActionsToStart() { Map<Subsystem, Action> actionsToStart = new HashMap<>(); for (Map.Entry<Subsystem, Action> entry : mDefaultActionsOnSubsystems.entrySet()) { if (mActionsOnRequirement.containsKey(entry.getKey())) { continue; } actionsToStart.put(entry.getK... | RequirementsControl { public Map<Subsystem, Action> getDefaultActionsToStart() { Map<Subsystem, Action> actionsToStart = new HashMap<>(); for (Map.Entry<Subsystem, Action> entry : mDefaultActionsOnSubsystems.entrySet()) { if (mActionsOnRequirement.containsKey(entry.getKey())) { continue; } actionsToStart.put(entry.getK... |
@Test public void startAction_actionNotRunning_addsToRunning() throws Exception { Action action = mock(Action.class); mActionControl.startAction(action); assertThat(mNextRunActions, IsIterableContaining.hasItem(action)); } | public void startAction(Action action) { if (mRunningActions.containsKey(action)) { throw new IllegalStateException("action already running"); } if (mNextRunActions.contains(action)) { throw new IllegalStateException("action already scheduled to run"); } mNextRunActions.add(action); } | ActionControl { public void startAction(Action action) { if (mRunningActions.containsKey(action)) { throw new IllegalStateException("action already running"); } if (mNextRunActions.contains(action)) { throw new IllegalStateException("action already scheduled to run"); } mNextRunActions.add(action); } } | ActionControl { public void startAction(Action action) { if (mRunningActions.containsKey(action)) { throw new IllegalStateException("action already running"); } if (mNextRunActions.contains(action)) { throw new IllegalStateException("action already scheduled to run"); } mNextRunActions.add(action); } ActionControl(Cloc... | ActionControl { public void startAction(Action action) { if (mRunningActions.containsKey(action)) { throw new IllegalStateException("action already running"); } if (mNextRunActions.contains(action)) { throw new IllegalStateException("action already scheduled to run"); } mNextRunActions.add(action); } ActionControl(Cloc... | ActionControl { public void startAction(Action action) { if (mRunningActions.containsKey(action)) { throw new IllegalStateException("action already running"); } if (mNextRunActions.contains(action)) { throw new IllegalStateException("action already scheduled to run"); } mNextRunActions.add(action); } ActionControl(Cloc... |
@Test public void startAction_actionRunning_throwsIllegalStateException() throws Exception { assertThrows(IllegalStateException.class, ()-> { Action action = mock(Action.class); mRunningActions.put(action, mock(ActionContext.class)); mActionControl.startAction(action); }); } | public void startAction(Action action) { if (mRunningActions.containsKey(action)) { throw new IllegalStateException("action already running"); } if (mNextRunActions.contains(action)) { throw new IllegalStateException("action already scheduled to run"); } mNextRunActions.add(action); } | ActionControl { public void startAction(Action action) { if (mRunningActions.containsKey(action)) { throw new IllegalStateException("action already running"); } if (mNextRunActions.contains(action)) { throw new IllegalStateException("action already scheduled to run"); } mNextRunActions.add(action); } } | ActionControl { public void startAction(Action action) { if (mRunningActions.containsKey(action)) { throw new IllegalStateException("action already running"); } if (mNextRunActions.contains(action)) { throw new IllegalStateException("action already scheduled to run"); } mNextRunActions.add(action); } ActionControl(Cloc... | ActionControl { public void startAction(Action action) { if (mRunningActions.containsKey(action)) { throw new IllegalStateException("action already running"); } if (mNextRunActions.contains(action)) { throw new IllegalStateException("action already scheduled to run"); } mNextRunActions.add(action); } ActionControl(Cloc... | ActionControl { public void startAction(Action action) { if (mRunningActions.containsKey(action)) { throw new IllegalStateException("action already running"); } if (mNextRunActions.contains(action)) { throw new IllegalStateException("action already scheduled to run"); } mNextRunActions.add(action); } ActionControl(Cloc... |
@Test public void startAction_actionRunForNext_throwsIllegalStateException() throws Exception { assertThrows(IllegalStateException.class, ()-> { Action action = mock(Action.class); mNextRunActions.add(action); mActionControl.startAction(action); }); } | public void startAction(Action action) { if (mRunningActions.containsKey(action)) { throw new IllegalStateException("action already running"); } if (mNextRunActions.contains(action)) { throw new IllegalStateException("action already scheduled to run"); } mNextRunActions.add(action); } | ActionControl { public void startAction(Action action) { if (mRunningActions.containsKey(action)) { throw new IllegalStateException("action already running"); } if (mNextRunActions.contains(action)) { throw new IllegalStateException("action already scheduled to run"); } mNextRunActions.add(action); } } | ActionControl { public void startAction(Action action) { if (mRunningActions.containsKey(action)) { throw new IllegalStateException("action already running"); } if (mNextRunActions.contains(action)) { throw new IllegalStateException("action already scheduled to run"); } mNextRunActions.add(action); } ActionControl(Cloc... | ActionControl { public void startAction(Action action) { if (mRunningActions.containsKey(action)) { throw new IllegalStateException("action already running"); } if (mNextRunActions.contains(action)) { throw new IllegalStateException("action already scheduled to run"); } mNextRunActions.add(action); } ActionControl(Cloc... | ActionControl { public void startAction(Action action) { if (mRunningActions.containsKey(action)) { throw new IllegalStateException("action already running"); } if (mNextRunActions.contains(action)) { throw new IllegalStateException("action already scheduled to run"); } mNextRunActions.add(action); } ActionControl(Cloc... |
@Test public void cancelAction_actionRunning_cancels() throws Exception { Action action = mock(Action.class); ActionContext context = mock(ActionContext.class); mRunningActions.put(action, context); mActionControl.cancelAction(action); verify(context, times(1)).cancelAction(); } | public void cancelAction(Action action) { ActionContext context = mRunningActions.get(action); if (context != null) { context.cancelAction(); } else { throw new IllegalStateException("action is not running"); } } | ActionControl { public void cancelAction(Action action) { ActionContext context = mRunningActions.get(action); if (context != null) { context.cancelAction(); } else { throw new IllegalStateException("action is not running"); } } } | ActionControl { public void cancelAction(Action action) { ActionContext context = mRunningActions.get(action); if (context != null) { context.cancelAction(); } else { throw new IllegalStateException("action is not running"); } } ActionControl(Clock clock, RequirementsControl requirementsControl, Map<Action, ActionConte... | ActionControl { public void cancelAction(Action action) { ActionContext context = mRunningActions.get(action); if (context != null) { context.cancelAction(); } else { throw new IllegalStateException("action is not running"); } } ActionControl(Clock clock, RequirementsControl requirementsControl, Map<Action, ActionConte... | ActionControl { public void cancelAction(Action action) { ActionContext context = mRunningActions.get(action); if (context != null) { context.cancelAction(); } else { throw new IllegalStateException("action is not running"); } } ActionControl(Clock clock, RequirementsControl requirementsControl, Map<Action, ActionConte... |
@Test public void before_thisIsNotValidOtherIsNotValid_returnsFalse() throws Exception { final Time THIS = Time.INVALID; final Time OTHER = Time.INVALID; assertFalse(THIS.before(OTHER)); } | public boolean before(Time other) { return lessThan(other); } | Time implements Comparable<Time> { public boolean before(Time other) { return lessThan(other); } } | Time implements Comparable<Time> { public boolean before(Time other) { return lessThan(other); } Time(long value, TimeUnit unit); } | Time implements Comparable<Time> { public boolean before(Time other) { return lessThan(other); } Time(long value, TimeUnit unit); static Time of(long value, TimeUnit unit); static Time milliseconds(long valueMs); static Time seconds(long valueSeconds); static Time seconds(double valueSeconds); static Time minutes(long ... | Time implements Comparable<Time> { public boolean before(Time other) { return lessThan(other); } Time(long value, TimeUnit unit); static Time of(long value, TimeUnit unit); static Time milliseconds(long valueMs); static Time seconds(long valueSeconds); static Time seconds(double valueSeconds); static Time minutes(long ... |
@Test public void cancelAction_actionNotRunning_throwsIllegalStateException() throws Exception { assertThrows(IllegalStateException.class, ()-> { Action action = mock(Action.class); mActionControl.cancelAction(action); }); } | public void cancelAction(Action action) { ActionContext context = mRunningActions.get(action); if (context != null) { context.cancelAction(); } else { throw new IllegalStateException("action is not running"); } } | ActionControl { public void cancelAction(Action action) { ActionContext context = mRunningActions.get(action); if (context != null) { context.cancelAction(); } else { throw new IllegalStateException("action is not running"); } } } | ActionControl { public void cancelAction(Action action) { ActionContext context = mRunningActions.get(action); if (context != null) { context.cancelAction(); } else { throw new IllegalStateException("action is not running"); } } ActionControl(Clock clock, RequirementsControl requirementsControl, Map<Action, ActionConte... | ActionControl { public void cancelAction(Action action) { ActionContext context = mRunningActions.get(action); if (context != null) { context.cancelAction(); } else { throw new IllegalStateException("action is not running"); } } ActionControl(Clock clock, RequirementsControl requirementsControl, Map<Action, ActionConte... | ActionControl { public void cancelAction(Action action) { ActionContext context = mRunningActions.get(action); if (context != null) { context.cancelAction(); } else { throw new IllegalStateException("action is not running"); } } ActionControl(Clock clock, RequirementsControl requirementsControl, Map<Action, ActionConte... |
@Test public void isRunning_actionNotRunning_returnsFalse() throws Exception { Action action = mock(Action.class); Assertions.assertFalse(mActionControl.isActionRunning(action)); } | public boolean isActionRunning(Action action) { return mRunningActions.containsKey(action); } | ActionControl { public boolean isActionRunning(Action action) { return mRunningActions.containsKey(action); } } | ActionControl { public boolean isActionRunning(Action action) { return mRunningActions.containsKey(action); } ActionControl(Clock clock, RequirementsControl requirementsControl, Map<Action, ActionContext> runningActions, Collection<Action> nextRunActions); ActionControl(Clock clock, RequirementsControl requirementsCon... | ActionControl { public boolean isActionRunning(Action action) { return mRunningActions.containsKey(action); } ActionControl(Clock clock, RequirementsControl requirementsControl, Map<Action, ActionContext> runningActions, Collection<Action> nextRunActions); ActionControl(Clock clock, RequirementsControl requirementsCon... | ActionControl { public boolean isActionRunning(Action action) { return mRunningActions.containsKey(action); } ActionControl(Clock clock, RequirementsControl requirementsControl, Map<Action, ActionContext> runningActions, Collection<Action> nextRunActions); ActionControl(Clock clock, RequirementsControl requirementsCon... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.