当前位置: 首页>>代码示例>>Java>>正文


Java Validators类代码示例

本文整理汇总了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);
}
 
开发者ID:heisedebaise,项目名称:ranch,代码行数:26,代码来源:RefreshTest.java

示例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()));
}
 
开发者ID:heisedebaise,项目名称:ranch,代码行数:20,代码来源:SchemaCtrl.java

示例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()));
}
 
开发者ID:heisedebaise,项目名称:ranch,代码行数:19,代码来源:WeixinCtrl.java

示例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"));
}
 
开发者ID:heisedebaise,项目名称:ranch,代码行数:21,代码来源:RecycleCtrlSupportTest.java

示例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 "";
}
 
开发者ID:heisedebaise,项目名称:ranch,代码行数:9,代码来源:LoggerCtrl.java

示例6: refresh

import org.lpw.tephra.ctrl.validate.Validators; //导入依赖的package包/类
@Execute(name = "refresh", validates = {
        @Validate(validator = Validators.SIGN)
})
public Object refresh() {
    classifyService.refresh();

    return "";
}
 
开发者ID:heisedebaise,项目名称:ranch,代码行数:9,代码来源:ClassifyCtrl.java

示例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);
}
 
开发者ID:heisedebaise,项目名称:tephra,代码行数:15,代码来源:WeixinCtrl.java

示例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"));
}
 
开发者ID:heisedebaise,项目名称:tephra,代码行数:15,代码来源:WeixinCtrl.java

示例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"));
}
 
开发者ID:heisedebaise,项目名称:ranch,代码行数:11,代码来源:MessageCtrl.java

示例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 "";
}
 
开发者ID:heisedebaise,项目名称:ranch,代码行数:11,代码来源:FriendCtrl.java

示例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"));
}
 
开发者ID:heisedebaise,项目名称:ranch,代码行数:10,代码来源:PushCtrl.java

示例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());
}
 
开发者ID:heisedebaise,项目名称:ranch,代码行数:15,代码来源:TransferCtrl.java

示例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"));
}
 
开发者ID:heisedebaise,项目名称:ranch,代码行数:8,代码来源:SnapshotCtrl.java

示例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"));
}
 
开发者ID:heisedebaise,项目名称:ranch,代码行数:8,代码来源:SnapshotCtrl.java

示例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);
}
 
开发者ID:heisedebaise,项目名称:ranch,代码行数:13,代码来源:ClassifyCtrl.java


注:本文中的org.lpw.tephra.ctrl.validate.Validators类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。