本文整理汇总了Java中org.lpw.tephra.ctrl.validate.Validators类的典型用法代码示例。如果您正苦于以下问题:Java Validators类的具体用法?Java Validators怎么用?Java Validators使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Validators类属于org.lpw.tephra.ctrl.validate包,在下文中一共展示了Validators类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: refresh
import org.lpw.tephra.ctrl.validate.Validators; //导入依赖的package包/类
@Test
public void refresh() {
String cacheKey = ClassifyModel.NAME + ".service.random";
cache.remove(cacheKey);
mockHelper.reset();
mockHelper.mock("/classify/refresh");
JSONObject object = mockHelper.getResponse().asJson();
Assert.assertEquals(9995, object.getIntValue("code"));
Assert.assertEquals(message.get(Validators.PREFIX + "illegal-sign"), object.getString("message"));
Assert.assertNull(cache.get(cacheKey));
mockHelper.reset();
sign.put(mockHelper.getRequest().getMap(), null);
mockHelper.mock("/classify/refresh");
object = mockHelper.getResponse().asJson();
Assert.assertEquals(0, object.getIntValue("code"));
Assert.assertEquals("", object.getString("data"));
String random = cache.get(cacheKey);
Assert.assertEquals(32, random.length());
((ClassifyServiceImpl) classifyService).executeDateJob();
String random2 = cache.get(cacheKey);
Assert.assertEquals(32, random2.length());
Assert.assertNotEquals(random, random2);
}
示例2: save
import org.lpw.tephra.ctrl.validate.Validators; //导入依赖的package包/类
@Execute(name = "save", validates = {
@Validate(validator = Validators.ID, emptyable = true, parameter = "id", failureCode = 1),
@Validate(validator = Validators.ID, emptyable = true, parameter = "group", failureCode = 2),
@Validate(validator = Validators.NOT_EMPTY, parameter = "key", failureCode = 3),
@Validate(validator = Validators.MAX_LENGTH, number = {100}, parameter = "key", failureCode = 4),
@Validate(validator = SchemaService.VALIDATOR_TYPE, parameter = "type", failureCode = 5),
@Validate(validator = Validators.NOT_EMPTY, parameter = "ip", failureCode = 6),
@Validate(validator = Validators.MAX_LENGTH, number = {100}, parameter = "ip", failureCode = 7),
@Validate(validator = Validators.MAX_LENGTH, number = {100}, parameter = "name", failureCode = 8),
@Validate(validator = Validators.MAX_LENGTH, number = {100}, parameter = "username", failureCode = 9),
@Validate(validator = Validators.MAX_LENGTH, number = {100}, parameter = "password", failureCode = 10),
@Validate(validator = Validators.MAX_LENGTH, number = {100}, parameter = "memo", failureCode = 11),
@Validate(validator = Validators.SIGN),
@Validate(validator = SchemaService.VALIDATOR_EXISTS, emptyable = true, parameter = "id", failureCode = 12),
@Validate(validator = SchemaService.VALIDATOR_KEY_NOT_EXISTS, parameters = {"id", "key"}, failureCode = 13)
})
public Object save() {
return schemaService.save(request.setToModel(new SchemaModel()));
}
示例3: save
import org.lpw.tephra.ctrl.validate.Validators; //导入依赖的package包/类
@Execute(name = "save", validates = {
@Validate(validator = Validators.NOT_EMPTY, parameter = "key", failureCode = 2),
@Validate(validator = Validators.MAX_LENGTH, number = {100}, parameter = "key", failureCode = 3),
@Validate(validator = Validators.MAX_LENGTH, number = {100}, parameter = "name", failureCode = 4),
@Validate(validator = Validators.NOT_EMPTY, parameter = "appId", failureCode = 5),
@Validate(validator = Validators.MAX_LENGTH, number = {100}, parameter = "appId", failureCode = 6),
@Validate(validator = Validators.NOT_EMPTY, parameter = "secret", failureCode = 7),
@Validate(validator = Validators.MAX_LENGTH, number = {100}, parameter = "secret", failureCode = 8),
@Validate(validator = Validators.MAX_LENGTH, number = {100}, parameter = "token", failureCode = 9),
@Validate(validator = Validators.MAX_LENGTH, number = {100}, parameter = "mchId", failureCode = 10),
@Validate(validator = Validators.MAX_LENGTH, number = {100}, parameter = "mchKey", failureCode = 11),
@Validate(validator = Validators.SIGN, string = {"ranch-weixin"}),
@Validate(validator = WeixinService.VALIDATOR_NOT_EXISTS, parameters = {"key", "appId"}, failureCode = 12)
})
public Object save() {
return weixinService.save(request.setToModel(new WeixinModel()));
}
示例4: recycle
import org.lpw.tephra.ctrl.validate.Validators; //导入依赖的package包/类
@Test
public void recycle() {
JSONObject json = new JSONObject();
json.put("name", "recycle");
recycleService().setRecycle(json);
mockHelper.reset();
mockHelper.mock("/" + uriPrefix() + "/recycle");
JSONObject object = mockHelper.getResponse().asJson();
Assert.assertEquals(9995, object.getIntValue("code"));
Assert.assertEquals(message.get(Validators.PREFIX + "illegal-sign"), object.getString("message"));
mockHelper.reset();
sign.put(mockHelper.getRequest().getMap(), null);
mockHelper.mock("/" + uriPrefix() + "/recycle");
object = mockHelper.getResponse().asJson();
Assert.assertEquals(0, object.getIntValue("code"));
JSONObject data = object.getJSONObject("data");
Assert.assertEquals("recycle", data.getString("name"));
}
示例5: state
import org.lpw.tephra.ctrl.validate.Validators; //导入依赖的package包/类
@Execute(name = "state", validates = {
@Validate(validator = Validators.SIGN)
})
public Object state() {
loggerService.state(request.get("id"), request.getAsInt("state"));
return "";
}
示例6: refresh
import org.lpw.tephra.ctrl.validate.Validators; //导入依赖的package包/类
@Execute(name = "refresh", validates = {
@Validate(validator = Validators.SIGN)
})
public Object refresh() {
classifyService.refresh();
return "";
}
示例7: auth
import org.lpw.tephra.ctrl.validate.Validators; //导入依赖的package包/类
/**
* 认证用户信息。
* appId 微信App ID。
* code 微信认证码。
*
* @return 微信用户信息,如果认证失败则返回空JSON。
*/
@Execute(name = "auth", validates = {
@Validate(validator = Validators.NOT_EMPTY, parameter = "appId", failureCode = 1),
@Validate(validator = Validators.NOT_EMPTY, parameter = "code", failureCode = 2)
})
public Object auth() {
return templates.get().success(weixinService.auth(request.get("appId"), request.get("code")), null);
}
示例8: jsapiSign
import org.lpw.tephra.ctrl.validate.Validators; //导入依赖的package包/类
/**
* 获取JS SDK签名。
* appId 微信公众号AppID。
* url 请求URL地址。
*
* @return {timestamp:"",nonceStr:"",signature:""}。
*/
@Execute(name = "jsapi-sign", validates = {
@Validate(validator = Validators.NOT_EMPTY, parameter = "appId", failureCode = 1),
@Validate(validator = Validators.NOT_EMPTY, parameter = "url", failureCode = 3)
})
public Object jsapiSign() {
return weixinHelper.getJsApiSign(request.get("appId"), request.get("url"));
}
示例9: notice
import org.lpw.tephra.ctrl.validate.Validators; //导入依赖的package包/类
@Execute(name = "notice", validates = {
@Validate(validator = Validators.BETWEEN, number = {0, 1}, parameter = "type", failureCode = 1),
@Validate(validator = Validators.ID, parameter = "receiver", failureCode = 2),
@Validate(validator = Validators.NOT_EMPTY, parameter = "content", failureCode = 4),
@Validate(validator = Validators.MATCH_REGEX, string = {"^[a-zA-Z0-9]{1,64}$"}, parameter = "code", failureCode = 5),
@Validate(validator = Validators.SIGN)
})
public Object notice() {
return messageService.notice(request.getAsInt("type"), request.get("receiver"), request.get("content"), request.getAsInt("deadline"), request.get("code"));
}
示例10: create
import org.lpw.tephra.ctrl.validate.Validators; //导入依赖的package包/类
@Execute(name = "create", validates = {
@Validate(validator = Validators.NOT_EMPTY, parameter = "user", failureCode = 1),
@Validate(validator = Validators.MAX_LENGTH, number = {100}, parameter = "memo", failureCode = 3),
@Validate(validator = UserHelper.VALIDATOR_SIGN_IN),
})
public Object create() {
friendService.create(request.get("user"), request.get("memo"));
return "";
}
示例11: state
import org.lpw.tephra.ctrl.validate.Validators; //导入依赖的package包/类
@Execute(name = "state", validates = {
@Validate(validator = Validators.ID, parameter = "id", failureCode = 1),
@Validate(validator = Validators.BETWEEN, number = {0, 1}, parameter = "state", failureCode = 8),
@Validate(validator = Validators.SIGN),
@Validate(validator = PushService.VALIDATOR_EXISTS, parameter = "id", failureCode = 9)
})
public Object state() {
return pushService.state(request.get("id"), request.getAsInt("state"));
}
示例12: create
import org.lpw.tephra.ctrl.validate.Validators; //导入依赖的package包/类
@Execute(name = "create", validates = {
@Validate(validator = Validators.NOT_EMPTY, parameter = "type", failureCode = 3),
@Validate(validator = Validators.MAX_LENGTH, number = {100}, parameter = "type", failureCode = 4),
@Validate(validator = Validators.MAX_LENGTH, number = {100}, parameter = "appId", failureCode = 5),
@Validate(validator = Validators.NOT_EMPTY, parameter = "account", failureCode = 6),
@Validate(validator = Validators.MAX_LENGTH, number = {100}, parameter = "account", failureCode = 7),
@Validate(validator = Validators.GREATER_THAN, number = {0}, parameter = "amount", failureCode = 8),
@Validate(validator = Validators.MAX_LENGTH, number = {100}, parameter = "billNo", failureCode = 9),
@Validate(validator = UserHelper.VALIDATOR_EXISTS_OR_SIGN_IN, parameter = "user", failureCode = 10)
})
public Object create() {
return transferService.create(request.get("type"), request.get("appId"), request.get("user"), request.get("account"),
request.getAsInt("amount"), request.get("billNo"), request.get("notice"), request.getMap());
}
示例13: get
import org.lpw.tephra.ctrl.validate.Validators; //导入依赖的package包/类
@Execute(name = "get", validates = {
@Validate(validator = Validators.NOT_EMPTY, parameter = "ids", failureCode = 1),
@Validate(validator = Validators.SIGN)
})
public Object get() {
return snapshotService.get(request.getAsArray("ids"));
}
示例14: create
import org.lpw.tephra.ctrl.validate.Validators; //导入依赖的package包/类
@Execute(name = "create", validates = {
@Validate(validator = Validators.NOT_EMPTY, parameter = "data", failureCode = 2),
@Validate(validator = Validators.SIGN)
})
public Object create() {
return snapshotService.create(request.get("data"), request.get("content"));
}
示例15: save
import org.lpw.tephra.ctrl.validate.Validators; //导入依赖的package包/类
@Execute(name = "save", validates = {
@Validate(validator = Validators.NOT_EMPTY, parameter = "code", failureCode = 2),
@Validate(validator = Validators.MAX_LENGTH, number = {100}, parameter = "code", failureCode = 3),
@Validate(validator = Validators.NOT_EMPTY, parameter = "key", failureCode = 4),
@Validate(validator = Validators.MAX_LENGTH, number = {100}, parameter = "key", failureCode = 5),
@Validate(validator = Validators.NOT_EMPTY, parameter = "name", failureCode = 6),
@Validate(validator = Validators.MAX_LENGTH, number = {100}, parameter = "name", failureCode = 7),
@Validate(validator = Validators.SIGN)
})
public Object save() {
return templates.get().success(classifyService.save(request.get("code"), request.get("key"), request.get("value"), request.get("name"), request.getMap()), null);
}