method2testcases stringlengths 118 6.63k |
|---|
### Question:
GirlController { @PutMapping("/{id}") public Girl updateGirlById(@PathVariable("id") Integer id, @RequestParam("cupSize") String cupSize, @RequestParam("age") Integer age) { Girl girl = new Girl(); girl.setId(id); girl.setCupSize(cupSize); girl.setAge(age); return girlRepository.save(girl); } @GetMapping... |
### Question:
GirlController { @DeleteMapping("/{id}") public void removeGirl(@PathVariable("id") Integer id) { girlRepository.deleteById(id); } @GetMapping List<Girl> listGirl(); @PostMapping Result<Girl> girlAdd(@Valid Girl girl, BindingResult bindingResult); @GetMapping("/{id}") Girl getGirlById(@PathVariable("id")... |
### Question:
GirlController { @GetMapping("/age/{age}") public List<Girl> listGirlByAge(@PathVariable("age") Integer age) { return girlRepository.findByAge(age); } @GetMapping List<Girl> listGirl(); @PostMapping Result<Girl> girlAdd(@Valid Girl girl, BindingResult bindingResult); @GetMapping("/{id}") Girl getGirlById... |
### Question:
GirlController { @PostMapping("/two") public void saveGirlTwo() { girlService.saveTwo(); } @GetMapping List<Girl> listGirl(); @PostMapping Result<Girl> girlAdd(@Valid Girl girl, BindingResult bindingResult); @GetMapping("/{id}") Girl getGirlById(@PathVariable("id") Integer id); @PutMapping("/{id}") Girl ... |
### Question:
TodoRepository { public void save(TodoItem item){ items.put(item.getName(),item); } void save(TodoItem item); TodoItem query(String name); }### Answer:
@Test public void saveTest(){ TodoItem todoItem = new TodoItem("imooc"); repository.save(todoItem); Assert.assertNull(repository.query(todoItem.getName(... |
### Question:
MailService { public void sendSimpleMail(String to, String subject, String content) { SimpleMailMessage message = new SimpleMailMessage(); message.setTo(to); message.setSubject(subject); message.setText(content); message.setFrom(from); this.mailSender.send(message); } void sendSimpleMail(String to, Strin... |
### Question:
MailService { public void sendHtmlMail(String to, String subject, String content) throws Exception { MimeMessage message = this.mailSender.createMimeMessage(); MimeMessageHelper helper = new MimeMessageHelper(message, true); helper.setTo(to); helper.setSubject(subject); helper.setText(content, true); help... |
### Question:
MailService { public void sendAttachmentsMail(String to, String subject, String content, String[] filePaths) throws Exception { MimeMessage message = this.mailSender.createMimeMessage(); MimeMessageHelper helper = new MimeMessageHelper(message, true); helper.setTo(to); helper.setSubject(subject); helper.s... |
### Question:
BindController { @RequestMapping(value = "/array") public String array(String[] name) { StringBuilder stringBuilder = new StringBuilder(); for (String item : name) { stringBuilder.append(item).append(" "); } return stringBuilder.toString(); } @RequestMapping(value = "/baseType") String baseType(@RequestP... |
### Question:
MailService { public void sendInlineResourceMail(String to, String subject, String content, String rscPath, String rscId) { logger.info("发送图片邮件开始:{},{},{},{},{}", to, subject, content, rscPath, rscId); MimeMessage message = this.mailSender.createMimeMessage(); MimeMessageHelper helper; try { helper = new ... |
### Question:
HelloService { public void sayHello() { System.out.println("Hello World"); } void sayHello(); }### Answer:
@Test public void sayHelloTest() { this.helloService.sayHello(); } |
### Question:
Students { public void setTeachers(Set<Teachers> teachers) { this.teachers = teachers; } Students(); Students(String sname, String gender, Date birthday, String major); @Override String toString(); Set<Teachers> getTeachers(); void setTeachers(Set<Teachers> teachers); String getSname(); void setSname(Str... |
### Question:
Students { public void setTeachers(Set<Teachers> teachers) { this.teachers = teachers; } Students(); Students(String sname, String gender, Date birthday, String major); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); Set<Teachers> getTeachers(); void setTeachers... |
### Question:
Students { public void setClassRoom(ClassRoom classRoom) { this.classRoom = classRoom; } Students(); Students(String sname, String gender, Date birthday, String major); @Override String toString(); String getSname(); void setSname(String sname); ClassRoom getClassRoom(); void setClassRoom(ClassRoom class... |
### Question:
GirlController { @GetMapping(value = "/girls") public List<Girl> girlList() { logger.info("girlList"); return girlRepository.findAll(); } @GetMapping(value = "/girls") List<Girl> girlList(); @PostMapping(value = "/girls") Result<Girl> girlAdd(@Valid Girl girl, BindingResult bindingResult); @GetMapping(va... |
### Question:
JDBCUtil { public static Connection getConnection() throws Exception { InputStream inputStream = JDBCUtil.class.getClassLoader().getResourceAsStream("db.properties"); Properties properties = new Properties(); properties.load(inputStream); String url = properties.getProperty("jdbc.url"); String user = prop... |
### Question:
EmployeeService { @Transactional public void update(Integer id, Integer age) { employeeRepository.update(id, age); } @Transactional void update(Integer id, Integer age); }### Answer:
@Test public void testUpdate() { employeeService.update(1, 55); } |
### Question:
BindController { @RequestMapping(value = "/object") public String object(User user, Admin admin) { return user.toString() + " ### " + admin.toString(); } @RequestMapping(value = "/baseType") String baseType(@RequestParam("age") int age); @RequestMapping(value = "/baseType2") String baseType2(Integer age)... |
### Question:
StudentDAOImpl implements StudentDAO { @Override public List<Student> query() { List<Student> students = new ArrayList<Student>(); Connection connection = null; PreparedStatement preparedStatement = null; ResultSet resultSet = null; String sql = "select id, name , age from student"; try { connection = JD... |
### Question:
StudentDAOImpl implements StudentDAO { @Override public void save(Student student) { Connection connection = null; PreparedStatement preparedStatement = null; ResultSet resultSet = null; String sql = "insert into student(name, age) values(?,?)"; try { connection = JDBCUtil.getConnection(); preparedStatem... |
### Question:
StudentDAOSpringJdbcImpl implements StudentDAO { @Override public List<Student> query() { final List<Student> students = new ArrayList<Student>(); String sql = "select id, name , age from student"; jdbcTemplate.query(sql, new RowCallbackHandler(){ @Override public void processRow(ResultSet rs) throws SQL... |
### Question:
StudentDAOSpringJdbcImpl implements StudentDAO { @Override public void save(Student student) { String sql = "insert into student(name, age) values(?,?)"; jdbcTemplate.update(sql, new Object[]{student.getName(), student.getAge()}); } @Override List<Student> query(); @Override void save(Student student); ... |
### Question:
SessionManager { public Long getSessionId() { return sessionIdProvider.get(); } @Inject SessionManager(
@SessionId Provider<Long> sessionIdProvider); Long getSessionId(); }### Answer:
@Test public void testGetSessionId() throws InterruptedException { Long sessionId1 = sessionManager.getSessionId(); T... |
### Question:
DemoService { @Transactional(rollbackFor = Exception.class) public void addUser(String name) { OperationLog log = new OperationLog(); log.setContent("create user:" + name); operationLogDao.save(log); User user = new User(); user.setName(name); userDao.save(user); } @Transactional(rollbackFor = Exception.... |
### Question:
GirlController { @GetMapping public List<Girl> listGirl() { return girlRepository.findAll(); } @GetMapping List<Girl> listGirl(); @PostMapping Girl girlAdd(@RequestParam("cupSize") String cupSize,
@RequestParam("age") Integer age); @GetMapping("/{id}") Girl getGirlById(@PathVariab... |
### Question:
GirlController { @PostMapping public Girl girlAdd(@RequestParam("cupSize") String cupSize, @RequestParam("age") Integer age) { Girl girl = new Girl(); girl.setCupSize(cupSize); girl.setAge(age); return girlRepository.save(girl); } @GetMapping List<Girl> listGirl(); @PostMapping Girl girlAdd(@RequestParam... |
### Question:
BindController { @RequestMapping(value = "list") public String list(UserListForm userListForm) { return "listSize:" + userListForm.getUsers().size() + userListForm.toString(); } @RequestMapping(value = "/baseType") String baseType(@RequestParam("age") int age); @RequestMapping(value = "/baseType2") Strin... |
### Question:
GirlController { @GetMapping("/{id}") public Girl getGirlById(@PathVariable("id") Integer id) { return girlRepository.findById(id).orElse(null); } @GetMapping List<Girl> listGirl(); @PostMapping Girl girlAdd(@RequestParam("cupSize") String cupSize,
@RequestParam("age") Integer age... |
### Question:
GirlController { @PutMapping("/{id}") public Girl updateGirlById(@PathVariable("id") Integer id, @RequestParam("cupSize") String cupSize, @RequestParam("age") Integer age) { Girl girl = new Girl(); girl.setId(id); girl.setCupSize(cupSize); girl.setAge(age); return girlRepository.save(girl); } @GetMapping... |
### Question:
GirlController { @DeleteMapping("/{id}") public void removeGirl(@PathVariable("id") Integer id) { girlRepository.deleteById(id); } @GetMapping List<Girl> listGirl(); @PostMapping Girl girlAdd(@RequestParam("cupSize") String cupSize,
@RequestParam("age") Integer age); @GetMapping("... |
### Question:
GirlController { @GetMapping("/age/{age}") public List<Girl> listGirlByAge(@PathVariable("age") Integer age) { return girlRepository.findByAge(age); } @GetMapping List<Girl> listGirl(); @PostMapping Girl girlAdd(@RequestParam("cupSize") String cupSize,
@RequestParam("age") Integer... |
### Question:
GirlController { @PostMapping("/two") public void saveGirlTwo() { girlService.saveTwo(); } @GetMapping List<Girl> listGirl(); @PostMapping Girl girlAdd(@RequestParam("cupSize") String cupSize,
@RequestParam("age") Integer age); @GetMapping("/{id}") Girl getGirlById(@PathVariable("... |
### Question:
SeckillServiceImpl implements SeckillService { @Override public List<Seckill> getSeckillList() { return seckillDao.queryAll(0, 4); } @Override List<Seckill> getSeckillList(); @Override Seckill getById(long seckillId); @Override Exposer exportSeckillUrl(long seckillId); @Transactional(rollbackFor = Except... |
### Question:
SeckillServiceImpl implements SeckillService { @Override public Seckill getById(long seckillId) { return seckillDao.queryById(seckillId); } @Override List<Seckill> getSeckillList(); @Override Seckill getById(long seckillId); @Override Exposer exportSeckillUrl(long seckillId); @Transactional(rollbackFor =... |
### Question:
SeckillServiceImpl implements SeckillService { @Override public SeckillExecution executeSeckillProcedure(long seckillId, long userPhone, String md5) { if (md5 == null || !md5.equals(getMd5(seckillId))) { return new SeckillExecution(seckillId, SeckillStatEnum.DATA_REWRITE); } Date killTime = new Date(); Ma... |
### Question:
BeanAnnotation { public void say(String arg) { System.out.println("BeanAnnotation : " + arg); } void say(String arg); }### Answer:
@Test public void testSay() { BeanAnnotation bean = super.getBean("beanAnnotation", BeanAnnotation.class); bean.say("This is test."); bean = super.getBean("beanAnnotation", ... |
### Question:
BindController { @RequestMapping(value = "set") public String set(UserSetForm userSetForm) { return userSetForm.toString(); } @RequestMapping(value = "/baseType") String baseType(@RequestParam("age") int age); @RequestMapping(value = "/baseType2") String baseType2(Integer age); @RequestMapping(value = "/... |
### Question:
BeanAnnotation { void myHashCode() { System.out.println("BeanAnnotation : " + this.hashCode()); } void say(String arg); }### Answer:
@Test public void testScpoe() { BeanAnnotation bean = super.getBean("beanAnnotation", BeanAnnotation.class); bean.myHashCode(); bean = super.getBean("beanAnnotation", Bean... |
### Question:
BeanScope { public void say() { System.out.println("BeanScope say : " + this.hashCode()); } void say(); }### Answer:
@Test public void testSay() { BeanScope beanScope = super.getBean("beanScope", BeanScope.class); beanScope.say(); BeanScope beanScope2 = super.getBean("beanScope", BeanScope.class); beanS... |
### Question:
SessionManager { public Long getSessionId() { return sessionIdProvider.get(); } @Inject SessionManager(@SessionId Provider<Long> sessionIdProvider); Long getSessionId(); }### Answer:
@Test public void testGetSessionId() throws InterruptedException { Long sessionId1 = sessionManager.getSessionId(); Threa... |
### Question:
OrderSender { public void send(Order order) { CorrelationData correlationData = new CorrelationData(); correlationData.setId(order.getMessageId()); this.rabbitTemplate.convertAndSend("order-exchange", "order.a", order, correlationData); } @Autowired OrderSender(
RabbitTemplate rabbitTemplate)... |
### Question:
BindController { @RequestMapping(value = "map") public String map(UserMapForm userMapForm) { return userMapForm.toString(); } @RequestMapping(value = "/baseType") String baseType(@RequestParam("age") int age); @RequestMapping(value = "/baseType2") String baseType2(Integer age); @RequestMapping(value = "/... |
### Question:
BindController { @RequestMapping(value = "json") public String json(@RequestBody User user) { return user.toString(); } @RequestMapping(value = "/baseType") String baseType(@RequestParam("age") int age); @RequestMapping(value = "/baseType2") String baseType2(Integer age); @RequestMapping(value = "/array"... |
### Question:
BindController { @RequestMapping(value = "xml", consumes = MediaType.APPLICATION_XML_VALUE, produces = MediaType.APPLICATION_XML_VALUE) public String xml(@RequestBody Admin admin) { return admin.toString(); } @RequestMapping(value = "/baseType") String baseType(@RequestParam("age") int age); @RequestMapp... |
### Question:
BindController { @RequestMapping(value = "date1") public String date1(Date date1) { return date1.toString(); } @RequestMapping(value = "/baseType") String baseType(@RequestParam("age") int age); @RequestMapping(value = "/baseType2") String baseType2(Integer age); @RequestMapping(value = "/array") String ... |
### Question:
ViewPagerAnimator implements ViewPager.OnPageChangeListener { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { if (position == 0 && positionOffsetPixels == 0 && !isAnimating()) { onPageSelected(0); } if (isAnimating() && lastPosition != position || posit... |
### Question:
ViewPagerAnimator implements ViewPager.OnPageChangeListener { public void destroy() { viewPager.removeOnPageChangeListener(this); } ViewPagerAnimator(@NonNull ViewPager viewPager,
@NonNull Provider<V> provider,
@NonNull Property<V> property,
... |
### Question:
RestCurseProvider implements BitcoinCurseProvider { @Override public BitcoinCurse getCurrentCurse() { if(lastCurse == null || ttlIsOver()) { try { lastCurse = requestBitcoinCurse(); } catch (IOException e) { log.error("Error while request bitcoin!", e); lastCurse = new BitcoinCurse(DateTime.now().minusDay... |
### Question:
SpeechService { public OutputSpeech speechError(Throwable t) { final String speechText; if (t instanceof AlexaExcpetion) { speechText = messageService.de(((AlexaExcpetion)t).getMessageKey()); } else { speechText = messageService.de("event.error"); } return speechMessage(speechText); } OutputSpeech speech... |
### Question:
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 Obje... |
### Question:
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, loc... |
### Question:
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 local... |
### Question:
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)... |
### Question:
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();... |
### Question:
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(CalendarCLIA... |
### Question:
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... |
### Question:
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 StringBu... |
### Question:
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); }### ... |
### Question:
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())... |
### Question:
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.s... |
### Question:
MessageService { public String de(String key, Object...args) { return String.format(messages.getOrDefault(key, key), args); } String de(String key, Object...args); }### Answer:
@Test public void de(){ final String messageKey = "help"; final String result = toTest.de(messageKey); assertEquals("Frage mich... |
### Question:
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); Out... |
### Question:
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); OutputSpe... |
### Question:
ElementProviderExtension implements IOCExtensionConfigurator { static Collection<String> elemental2ElementTags(final MetaClass type) { final Collection<String> customElementTags = customElementTags(type); if (!customElementTags.isEmpty()) { return customElementTags; } return Elemental2TagMapping.getTags(t... |
### Question:
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(); }### Ans... |
### Question:
ErraiAppPropertiesFiles { public static List<URL> getModulesUrls() { return getModulesUrls(ErraiAppPropertiesFiles.class.getClassLoader()); } static List<URL> getUrls(final ClassLoader... classLoaders); static List<URL> getModulesUrls(); }### Answer:
@Test public void testGetModuleUrls() { final List<UR... |
### Question:
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.indexO... |
### Question:
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... |
### Question:
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.... |
### Question:
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 ... |
### Question:
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 c... |
### Question:
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(Util... |
### Question:
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... |
### Question:
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.getMethodFromDescripto... |
### Question:
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 Scan... |
### Question:
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 logou... |
### Question:
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 logi... |
### Question:
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 ... |
### Question:
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 throug... |
### Question:
KeycloakAuthenticationService implements AuthenticationService, Serializable { void setSecurityContext(final KeycloakSecurityContext keycloakSecurityContext) { if (wrappedAuthService.isLoggedIn() && keycloakSecurityContext != null) { throw new AlreadyLoggedInException("Logged in as " + wrappedAuthService.... |
### Question:
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 vo... |
### Question:
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)... |
### Question:
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); ... |
### Question:
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(); f... |
### Question:
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 S... |
### Question:
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 = ... |
### Question:
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... |
### Question:
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(... |
### Question:
RequirementsControl { public Optional<Action> getActionOnRequirement(Requirement requirement) { return Optional.ofNullable(mActionsOnRequirement.get(requirement)); } RequirementsControl(Logger logger, Map<Requirement, Action> actionsOnRequirement, Map<Subsystem, Action> defaultActionsOnSubsystems); Requi... |
### Question:
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 lo... |
### Question:
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.... |
### Question:
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); } Acti... |
### Question:
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<Actio... |
### Question:
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... |
### Question:
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 r... |
### Question:
ActionControl { public void updateActionsForNextRun(Iterable<Action> actionsToRemove) { actionsToRemove.forEach(this::internalRemove); } ActionControl(Clock clock, RequirementsControl requirementsControl, Map<Action, ActionContext> runningActions, Collection<Action> nextRunActions); ActionControl(Clock c... |
### Question:
ActionControl { public void startNewActions() { mNextRunActions.forEach(this::internalAdd); mNextRunActions.clear(); } ActionControl(Clock clock, RequirementsControl requirementsControl, Map<Action, ActionContext> runningActions, Collection<Action> nextRunActions); ActionControl(Clock clock, Requirements... |
### Question:
ActionControl { public void cancelAllActions() { mNextRunActions.clear(); mRunningActions.forEach(this::onInternalRemove); mRunningActions.clear(); } ActionControl(Clock clock, RequirementsControl requirementsControl, Map<Action, ActionContext> runningActions, Collection<Action> nextRunActions); ActionCo... |
### Question:
SchedulerIteration { public void run(SchedulerMode mode) { mActionsToRemove.clear(); startNewActions(); runActions(mode); startDefaultSubsystemActions(mode); readyForNextRun(); } SchedulerIteration(ActionControl actionControl, RequirementsControl requirementsControl, Logger logger); void run(SchedulerMode... |
### Question:
Time implements Comparable<Time> { public boolean after(Time other) { return largerThan(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 Tim... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.