/** * Creates a user-friendly names for given action context as the request body schema. */ public static String getSchemaName(final Resource singleResource, final ActionType actionEntry) { return CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, Joiner.on("_").join(actionEntry.name().toLowerCase(), getUniqueName(singleResource))); }
private void cleanupMethods (Resource resource, Map<ActionType, Action> actions) { final HashSet<String> methods = new HashSet<>(); for (ActionType action : actions.keySet()) { methods.add(action.toString()); } for (Method m : resource.getResourceMethods().values()) { String httpMethod = m.getHttpMethod().toUpperCase(); if (!methods.contains(httpMethod)) { LOG.info(format("Removing deleted method %s for resource %s", httpMethod, resource.getId())); m.deleteMethod(); } } }
public Action getAction(String name) { return actions.get(ActionType.valueOf(name.toUpperCase())); }
/** * Creates a user-friendly names for given response context as the response body schema. */ public static String getSchemaName(final Resource singleResource, final ActionType actionEntry, final String responseEntry) { return CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, Joiner.on("_").join(actionEntry.name().toLowerCase(),// getUniqueName(singleResource).toLowerCase(), responseEntry.toLowerCase(Locale.US), "response")); }
/** * Build a suitable Java type name for an {@link com.sap.cloud.yaas.rammler.commons.builder.ActionBuilder}, e.g. " * {@code GetActionBuilder}". * * @param ramlAction the RAML {@link Action} * @return a corresponding Java type name */ public static String buildActionBuilderName(final Action ramlAction) { return ramlAction != null ? buildName(ramlAction.getType().toString()) + "ActionBuilder" : null; }
public Action getAction(String name) { return actions.get(ActionType.valueOf(name.toUpperCase())); }
public ActionMethod(ReqSpecField reqFieldName, RespSpecField respFieldName, UriConst uriConst, Action action) { this.reqFieldName = reqFieldName.name(); this.respFieldName = respFieldName.name(); this.uriConst = uriConst.name(); this.action = action; this.httpMethod = action.getType().name().toLowerCase(); this.name = defaultIfEmpty(action.getDisplayName(), httpMethod); }
String type = action.getType().toString().toLowerCase();
private static boolean isAction(String key) { try { ActionType.valueOf(normalizeKey(key).toUpperCase()); return true; } catch (IllegalArgumentException e) { return false; } }
static Usage.Action actionUsage(Usage usage, Action action) { return usage.resource(action.getResource().getUri()).action(action.getType().name()); }
public static String buildResourceMethodName(final Action action, final MimeType bodyMimeType) { final String methodBaseName = buildJavaFriendlyName(action.getResource() .getUri() .replace("{", " By ")); return action.getType().toString().toLowerCase() + buildMimeTypeInfix(bodyMimeType) + methodBaseName; }
private static boolean isAction(String key) { try { ActionType.valueOf(normalizeKey(key).toUpperCase()); return true; } catch (IllegalArgumentException e) { return false; } }
Operation operation = new Operation(); operation.setDescription(action.getDescription()); operation.setMethod(entry.getKey().name().toString());
/** * <p>buildResourceMethodName.</p> * * @param action a {@link org.raml.model.Action} object. * @param bodyMimeType a {@link org.raml.model.MimeType} object. * @return a {@link java.lang.String} object. */ public static String buildResourceMethodName(final Action action, final MimeType bodyMimeType) { final String methodBaseName = buildJavaFriendlyName(action.getResource() .getUri() .replace("{", " By ")); return action.getType().toString().toLowerCase() + buildMimeTypeInfix(bodyMimeType) + methodBaseName; }
Operation operation = new Operation(); operation.setDescription(action.getDescription()); operation.setMethod(entry.getKey().name().toString());
/** * Returns the name of the method for getting an {@link com.sap.cloud.yaas.rammler.commons.builder.ActionBuilder}, * e.g. " {@code prepareDelete}". * * @param ramlAction the action for which the method name should be built * @return the name of the method for getting the action builder */ public static String buildActionBuilderMethodName(final Action ramlAction) { if (ramlAction == null) { return null; } return "prepare" + buildName(ramlAction.getType() != null ? ramlAction.getType().toString() : "Any"); }
Operation operation = new Operation(); operation.setDescription(action.getDescription()); operation.setMethod(entry.getKey().name().toString());
/** * Creates a specific constructor body. * * @param ramlAction an action which the body reflects * @param codeModel the code model to access JCodeModel functionality * @param constructorBody target block to filled in */ protected void createConstructorBody(final Action ramlAction, final JCodeModel codeModel, final JBlock constructorBody) { final JInvocation setHttpMethodInvocation = constructorBody.invoke("setHttpMethod"); final JClass httpMethodEnum = codeModel.ref(HttpMethod.class); setHttpMethodInvocation.arg(httpMethodEnum.staticRef(ramlAction.getType().toString())); }
Operation operation = new Operation(); operation.setDescription(action.getDescription()); operation.setMethod(entry.getKey().name().toString());