core.dynamic.resources.SpoofApi Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of EpikosRestService Show documentation
Show all versions of EpikosRestService Show documentation
Epikos is a Rest Serivce framework which can be extend to develop any other Rest API/Services. For more
detail please checkout github (https://github.com/epikosrest/epikos.git)
package core.dynamic.resources;
import core.domain.enums.ApiValidationStatusCode;
import core.error.ApiValidationStatus;
import core.exception.EpikosException;
import core.lib.Utility;
/**
* Created by nitina on 1/14/17.
*/
final public class SpoofApi extends Api{
@Override
public ApiValidationStatus isValid() throws EpikosException {
ApiValidationStatus apiValidity = new ApiValidationStatus(ApiValidationStatusCode.Valid);
ApiValidationStatus valid = Utility.isValidMethod(getMethod());
if(!valid.isValidStatus()) {
apiValidity.setDescription(valid.getDescription());
}
valid = Utility.isValidPath(getPath());
if(!valid.isValidStatus()){
apiValidity.setDescription(apiValidity.getDescription() + "\n" + valid.getDescription());
}
valid = Utility.isValidStatusCode(getStatus());
if(!valid.isValidStatus()){
apiValidity.setDescription(apiValidity.getDescription() + "\n" + valid.getDescription());
}
valid = Utility.isValidContentType(getConsume());
if(!valid.isValidStatus()){
apiValidity.setDescription(apiValidity.getDescription() + "\n" + valid.getDescription());
}
valid = Utility.isValidContentType(getProduce());
if(!valid.isValidStatus()){
apiValidity.setDescription(apiValidity.getDescription() + "\n" + valid.getDescription());
}
valid = Utility.doesPathParamsMatchWithApiPathParam(getPath(),getApiParamList());
if(!valid.isValidStatus()){
apiValidity.setDescription(apiValidity.getDescription() + "\n" + valid.getDescription());
}
return apiValidity;
}
}