gpt4 book ai didi

io.kaif.service.ZoneService.listAdministratorsWithCache()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-13 10:56:59 26 4
gpt4 key购买 nike

本文整理了Java中io.kaif.service.ZoneService.listAdministratorsWithCache()方法的一些代码示例,展示了ZoneService.listAdministratorsWithCache()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZoneService.listAdministratorsWithCache()方法的具体详情如下:
包路径:io.kaif.service.ZoneService
类名称:ZoneService
方法名:listAdministratorsWithCache

ZoneService.listAdministratorsWithCache介绍

暂无

代码示例

代码示例来源:origin: kaif-open/kaif

@ApiOperation(value = "[public] List administrators of the zone", notes = "List username of administrators of the zone")
 @RequiredScope(PUBLIC)
 @RequestMapping(value = "/{zone}/administrator/username", method = RequestMethod.GET)
 public List<String> listAdministrators(ClientAppUserAccessToken token,
   @PathVariable("zone") String zone) {
  return zoneService.listAdministratorsWithCache(Zone.valueOf(zone));
 }
}

代码示例来源:origin: kaif-open/kaif

@RequestMapping("/{zone}/debates/{articleId}")
public Object articleDebates(@PathVariable("zone") String rawZone,
  @PathVariable("articleId") FlakeId articleFlakeId,
  HttpServletRequest request) throws IOException {
 return resolveZone(request, rawZone, zoneInfo -> {
  return new ModelAndView("article/debates")//
    .addObject("zoneInfo", zoneInfo)
    .addObject("recommendZones", zoneService.listRecommendZones())
    .addObject("article", articleService.loadArticle(articleFlakeId))
    .addObject("zoneAdmins",
      zoneService.listAdministratorsWithCache(zoneInfo.getZone())
        .stream()
        .collect(Collectors.joining(",")))
    .addObject("debateTree", articleService.listBestDebates(articleFlakeId, null));
 });
}

代码示例来源:origin: kaif-open/kaif

public ZonePageModelView(ZoneInfo zoneInfo, ZoneService zoneService) {
  super("/zone/zone-page");
  addObject("zoneInfo", zoneInfo);
  addObject("recommendZones", zoneService.listRecommendZones());
  addObject("administrators", zoneService.listAdministratorsWithCache(zoneInfo.getZone()));
 }
}

代码示例来源:origin: kaif-open/kaif

@Test
 public void listAdministrators() {
  Zone zone = Zone.valueOf("foo");
  assertTrue(service.listAdministratorsWithCache(zone).isEmpty());
  accountDao.changeTotalVotedDebate(citizen.getAccountId(), 30, 0);
  service.createByUser("foo", "this is aaa2", citizen);
  List<String> administerNames = service.listAdministratorsWithCache(zone);
  assertEquals(asList(citizen.getUsername()), administerNames);
 }
}

代码示例来源:origin: kaif-open/kaif

@Test
 public void listAdministrators() throws Exception {
  when(zoneService.listAdministratorsWithCache(Zone.valueOf("foo"))).thenReturn(asList("admin1",
    "admin2"));
  oauthPerform(user, get("/v1/zone/foo/administrator/username")).andExpect(status().isOk())
    .andExpect(jsonPath("$.data[0]", is("admin1")))
    .andExpect(jsonPath("$.data[1]", is("admin2")));
 }
}

代码示例来源:origin: kaif-open/kaif

@Test
public void hotArticlesWithPaging() throws Exception {
 Zone z = zoneInfo.getZone();
 when(zoneService.loadZone(z)).thenReturn(zoneInfo);
 Article article1 = article(z, "javascript discussion");
 Article article2 = article(z, FlakeId.fromString("phpone"), "php-lang discussion");
 when(articleService.listHotZoneArticles(z, FlakeId.fromString("123456"))).thenReturn(//
   asList(article1, article2));
 when(zoneService.listAdministratorsWithCache(z)).thenReturn(asList("admin1", "admin2"));
 mockMvc.perform(get("/z/programming?start=123456"))
   .andExpect(content().string(containsString("/css/z-theme-default.css")))
   .andExpect(content().string(containsString("programming-alias")))
   .andExpect(content().string(containsString("php-lang")))
   .andExpect(content().string(containsString("admin1")))
   .andExpect(content().string(containsString("href=\"/z/programming?start=phpone\"")));
}

代码示例来源:origin: kaif-open/kaif

@Test
public void articleDebates() throws Exception {
 Zone z = zoneInfo.getZone();
 FlakeId articleId = FlakeId.fromString("aaa");
 Article article = article(z, "erlang discussion");
 List<Debate> debates = asList(//
   debate(article, "ERLANG is bad", null), //
   debate(article, "JAVA is better", null));
 when(zoneService.loadZone(z)).thenReturn(zoneInfo);
 when(articleService.loadArticle(articleId)).thenReturn(article);
 when(articleService.listBestDebates(articleId, null)).thenReturn(DebateTree.fromDepthFirst(
   debates));
 when(zoneService.listAdministratorsWithCache(z)).thenReturn(asList("admin1", "admin2"));
 mockMvc.perform(get("/z/programming/debates/aaa"))
   .andExpect(view().name("article/debates"))
   .andExpect(content().string(containsString("/css/z-theme-default.css")))
   .andExpect(content().string(containsString("programming-alias")))
   .andExpect(content().string(containsString("erlang discussion")))
   .andExpect(content().string(containsString("ERLANG is bad")))
   .andExpect(content().string(containsString("JAVA is better")))
   .andExpect(containsText("data-zone-admins=\"admin1,admin2\""))
   .andExpect(containsDebateFormTemplate());
}

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com