本文整理了Java中io.kaif.service.ZoneService.createByUser()
方法的一些代码示例,展示了ZoneService.createByUser()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZoneService.createByUser()
方法的具体详情如下:
包路径:io.kaif.service.ZoneService
类名称:ZoneService
方法名:createByUser
暂无
代码示例来源:origin: kaif-open/kaif
@RequestMapping(value = "/", method = RequestMethod.PUT, consumes = {
MediaType.APPLICATION_JSON_VALUE })
public void create(AccountAccessToken token, @Valid @RequestBody CreateZone request) {
zoneService.createByUser(request.zone, request.aliasName, token);
}
代码示例来源:origin: kaif-open/kaif
@Test
public void createByUser_max_5_zone() throws Exception {
accountDao.changeTotalVotedDebate(citizen.getAccountId(), 60, 0);
service.createByUser("aaa1", "this is aaa1", citizen);
service.createByUser("aaa2", "this is aaa2", citizen);
service.createByUser("aaa3", "this is aaa3", citizen);
service.createByUser("aaa4", "this is aaa4", citizen);
service.createByUser("aaa5", "this is aaa5", citizen);
try {
service.createByUser("aaa6", "this is aaa6", citizen);
fail("CreditNotEnoughException expected");
} catch (CreditNotEnoughException expected) {
}
}
代码示例来源:origin: kaif-open/kaif
@Test
public void createByUser_10_per_zone() throws Exception {
accountDao.changeTotalVotedDebate(citizen.getAccountId(), 30, 0);
service.createByUser("aaa1", "this is aaa1", citizen);
service.createByUser("aaa2", "this is aaa2", citizen);
service.createByUser("aaa3", "this is aaa3", citizen);
try {
service.createByUser("aaa4", "this is aaa4", citizen);
fail("CreditNotEnoughException expected");
} catch (CreditNotEnoughException expected) {
}
}
代码示例来源:origin: kaif-open/kaif
@Test
public void createByUser_not_enough_honor_score() throws Exception {
try {
service.createByUser("aaa", "this is aaa", citizen);
fail("CreditNotEnoughException expected");
} catch (CreditNotEnoughException expected) {
}
}
代码示例来源:origin: kaif-open/kaif
@Test
public void listAdministerZones() {
assertTrue(service.listAdministerZones(citizen.getUsername()).isEmpty());
accountDao.changeTotalVotedDebate(citizen.getAccountId(), 30, 0);
ZoneInfo bZone = service.createByUser("bbb1", "this is aaa1", citizen);
ZoneInfo aZone = service.createByUser("aaa2", "this is aaa2", citizen);
List<ZoneInfo> administerZones = service.listAdministerZones(citizen.getUsername());
assertEquals(2, administerZones.size());
assertEquals(aZone, administerZones.get(0));
assertEquals(bZone, administerZones.get(1));
}
代码示例来源:origin: kaif-open/kaif
@Test
public void createByUser_must_be_citizen() throws Exception {
try {
Account tourist = savedAccountTourist("tourist");
accountDao.changeTotalVotedDebate(tourist.getAccountId(), 10, 0);
service.createByUser("aaa", "this is aaa", tourist);
fail("AccessDeniedException expected");
} catch (AccessDeniedException expected) {
}
}
代码示例来源: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 deleteArticle_zone_admin() throws Exception {
Account admin = savedAccountCitizen("admin");
accountDao.changeTotalVotedDebate(admin.getAccountId(), 1000, 0);
ZoneInfo aZone = zoneService.createByUser("a-zone", "a-zone", admin);
service.setClock(Clock.offset(Clock.systemDefaultZone(), Duration.ofMinutes(11)));
Article article = service.createSpeak(citizen, aZone.getZone(), "titleFoo", "contentFoo");
service.setClock(Clock.systemDefaultZone());
assertTrue(service.canDeleteArticle(admin.getUsername(), article.getArticleId()));
//admin can delete article without time constraint
service.deleteArticle(admin, article.getArticleId());
assertTrue(service.loadArticle(article.getArticleId()).isDeleted());
}
代码示例来源:origin: kaif-open/kaif
@Test
public void createByUser() throws Exception {
accountDao.changeTotalVotedDebate(citizen.getAccountId(), 10, 0);
ZoneInfo zoneInfo = service.createByUser("aaa", "this is aaa", citizen);
ZoneInfo loaded = zoneDao.loadZoneWithoutCache(Zone.valueOf("aaa"));
assertEquals(zoneInfo, loaded);
assertEquals("aaa", loaded.getName());
assertEquals("this is aaa", loaded.getAliasName());
assertEquals(Authority.CITIZEN, loaded.getVoteAuthority());
assertEquals(Authority.CITIZEN, loaded.getWriteAuthority());
assertEquals(Authority.CITIZEN, loaded.getDebateAuthority());
assertEquals(ZoneInfo.THEME_DEFAULT, loaded.getTheme());
assertFalse(loaded.isHideFromTop());
assertEquals(citizen.getAccountId(), loaded.getAdminAccountIds().get(0));
List<ZoneInfo> zones = zoneDao.listZonesByAdmin(citizen.getAccountId());
assertEquals(zoneInfo, zones.get(0));
}
内容来源于网络,如有侵权,请联系作者删除!