Package com.mockey.model

Examples of com.mockey.model.ApiDocRequest


      // *****************************
      // REQUEST DEFINITION
      // *****************************

      ApiDocRequest apiDocRequest = new ApiDocRequest();

      // Parameter - 'action'
      ApiDocAttribute reqAttributeAction = new ApiDocAttribute();
      reqAttributeAction.setFieldName(API_SETPLAN_PARAMETER_ACTION);
      reqAttributeAction.addFieldValues(new ApiDocFieldValue(API_SETPLAN_PARAMETER_ACTION_VALUE_DELETE_PLAN,
          "Delete the service plan definition given a valid plan_id parameter."));
      reqAttributeAction.addFieldValues(new ApiDocFieldValue(API_SETPLAN_PARAMETER_ACTION_VALUE_SAVE_PLAN,
          "Saves current configuration settings as a service plan definition."));
      reqAttributeAction.addFieldValues(new ApiDocFieldValue(API_SETPLAN_PARAMETER_ACTION_VALUE_SET_PLAN,
          "Sets a service plan given a valid plan_id parameter."));
      reqAttributeAction.addFieldValues(new ApiDocFieldValue(API_SETPLAN_PARAMETER_ACTION_VALUE_SET_AS_DEFAULT_PLAN,
          "Sets a service plan to be set as the default state upon a Mockey startup. Set " + API_SETPLAN_PARAMETER_PLAN_ID
          +" to 'none' if no desired default plan is to be set."));
     
      apiDocRequest.addAttribute(reqAttributeAction);

      // Parameter - 'plan_id'
      ApiDocAttribute reqAttributePlanId = new ApiDocAttribute();
      reqAttributePlanId.setFieldName(API_SETPLAN_PARAMETER_PLAN_ID);
      reqAttributePlanId.addFieldValues(new ApiDocFieldValue("[identifier]", "A valid service plan identifier."));
      reqAttributePlanId.setExample("123");
      apiDocRequest.addAttribute(reqAttributePlanId);

      // Parameter - 'service_plan_name'
      ApiDocAttribute reqAttributePlanName = new ApiDocAttribute();
      reqAttributePlanName.setFieldName(API_SET_SAVE_OR_UPDATE_PARAMETER_PLAN_NAME);
      reqAttributePlanName
          .addFieldValues(new ApiDocFieldValue(
              "[string]",
              "The service plan name needed to create or save/update. If plan_id not provided, then this value is used to locate the service plan for setting or updating."));
      reqAttributePlanName.setExample("The Gold Service Plan");
      apiDocRequest.addAttribute(reqAttributePlanName);

      // Parameter - 'service_plan_name'
      ApiDocAttribute reqAttributePlanTag = new ApiDocAttribute();
      reqAttributePlanTag.setFieldName(API_SET_SAVE_OR_UPDATE_PARAMETER_PLAN_TAG);
      reqAttributePlanTag.addFieldValues(new ApiDocFieldValue("[string]", "The service plan tag(s)."));
      reqAttributePlanTag.setExample("Tag1 Tag2 Tag3");
      apiDocRequest.addAttribute(reqAttributePlanTag);

      // Parameter - 'type'
      ApiDocAttribute reqAttributeType = new ApiDocAttribute();
      reqAttributeType.setFieldName(API_SETPLAN_PARAMETER_TYPE);
      reqAttributeType.addFieldValues(new ApiDocFieldValue("json",
          "Response will be in JSON. Any other value for 'type' is undefined and you may experience a 302."));
      apiDocRequest.addAttribute(reqAttributeType);
      apiDocService.setApiRequest(apiDocRequest);

      // Parameter - 'type'
      ApiDocAttribute reqTransientState = new ApiDocAttribute();
      reqTransientState.setFieldName(API_TRANSIENT_STATE);
      reqTransientState
          .addFieldValues(new ApiDocFieldValue(
              "[boolean]",
              "If available and set to 'true', then all settings in this call will be in-memory only, not persisted to the file system. Otherwise, state settings will be written to the file system."));
      apiDocRequest.addAttribute(reqTransientState);
      apiDocService.setApiRequest(apiDocRequest);

      // *****************************
      // RESPONSE DEFINITION
      // *****************************
 
View Full Code Here


      // *****************************
      // REQUEST DEFINITION
      // *****************************

      ApiDocRequest apiDocRequest = new ApiDocRequest();

      ApiDocAttribute reqServiceId = new ApiDocAttribute();
      reqServiceId.setFieldName(ServiceConfigurationAPI.API_SERVICE_ID);
      reqServiceId.addFieldValues(new ApiDocFieldValue("[identifier]",
          "A valid service identifier."));
      reqServiceId.setExample("123");
      apiDocRequest.addAttribute(reqServiceId);

      ApiDocAttribute reqServiceName = new ApiDocAttribute();
      reqServiceName
          .setFieldName(ServiceConfigurationAPI.API_SERVICE_NAME);
      reqServiceName.addFieldValues(new ApiDocFieldValue("[string]",
          "A valid service name."));
      reqServiceName.setExample("My Service Name");
      apiDocRequest.addAttribute(reqServiceName);

      // SCHEMA
      ApiDocAttribute reqServiceSchema = new ApiDocAttribute();
      reqServiceSchema
          .setFieldName(ServiceConfigurationAPI.API_SERVICE_SCHEMA);
      reqServiceSchema.addFieldValues(new ApiDocFieldValue("[string]",
          "A valid JSON Schema definition."));
      reqServiceSchema
          .setExample("{\"type\":\"object\",\"$schema\": \"http://json-schema.org/draft-03/schema\",\"id\": \"#\",\"required\":false,\"properties\":{ \"address\": { \"type\":\"object\", \"id\": \"address\", \"required\":false, \"properties\":{ \"streetAddress\": { \"type\":\"string\", \"id\": \"streetAddress\", \"required\":false } } } }}");
      apiDocRequest.addAttribute(reqServiceSchema);

      ApiDocAttribute reqServiceSchemaEnableFlag = new ApiDocAttribute();
      reqServiceSchemaEnableFlag
          .setFieldName(ServiceConfigurationAPI.API_SERVICE_SCHEMA_ENABLE_FLAG);
      reqServiceSchemaEnableFlag
          .addFieldValues(new ApiDocFieldValue(
              "[boolean]",
              "Set to true for the service to validate each Service Scenario JSON response with the provided JSON Schema."));
      reqServiceSchemaEnableFlag.setExample("true");
      apiDocRequest.addAttribute(reqServiceSchemaEnableFlag);

      // REQUEST INSPECTOR RULES
      ApiDocAttribute reqInspectorRules = new ApiDocAttribute();
      reqInspectorRules
          .setFieldName(ServiceConfigurationAPI.API_SERVICE_REQUEST_INSPECTOR_RULES);
      reqInspectorRules.addFieldValues(new ApiDocFieldValue("[string]",
          "Request evaluation rules in JSON. "));
      reqInspectorRules.setExample("");
      apiDocRequest.addAttribute(reqInspectorRules);

      ApiDocAttribute reqInspectorRulesEnableFlag = new ApiDocAttribute();
      reqInspectorRulesEnableFlag
          .setFieldName(ServiceConfigurationAPI.API_SERVICE_REQUEST_INSPECTOR_RULES_ENABLE_FLAG);
      reqInspectorRulesEnableFlag
          .addFieldValues(new ApiDocFieldValue(
              "[boolean]",
              "Set to true for the service to validate each incoming request to ensure the appropriate parameters are being passed."));
      reqInspectorRulesEnableFlag.setExample("true");
      apiDocRequest.addAttribute(reqInspectorRulesEnableFlag);

      ApiDocAttribute reqScenarioId = new ApiDocAttribute();
      reqScenarioId
          .setFieldName(ServiceConfigurationAPI.API_SERVICE_SCENARIO_ID);
      reqScenarioId.addFieldValues(new ApiDocFieldValue("[identifier]",
          "A valid service scenario identifier."));
      reqScenarioId.setExample("123");
      apiDocRequest.addAttribute(reqScenarioId);

      ApiDocAttribute reqScenarioName = new ApiDocAttribute();
      reqScenarioName
          .setFieldName(ServiceConfigurationAPI.API_SERVICE_NAME);
      reqScenarioName.addFieldValues(new ApiDocFieldValue("[string]",
          "A valid service scenario name."));
      reqScenarioName.setExample("My Service Scenario Name");
      apiDocRequest.addAttribute(reqScenarioName);

      ApiDocAttribute reqHangtime = new ApiDocAttribute();
      reqHangtime
          .setFieldName(ServiceConfigurationAPI.API_SERVICE_HANGTIME);
      reqHangtime.addFieldValues(new ApiDocFieldValue("[int]",
          "Hang time in milliseconds."));
      reqHangtime.setExample("500");
      apiDocRequest.addAttribute(reqHangtime);

      ApiDocAttribute transientSet = new ApiDocAttribute();
      transientSet
          .setFieldName(ServiceConfigurationAPI.API_TRANSIENT_STATE);
      transientSet
          .addFieldValues(new ApiDocFieldValue(
              "[boolean]",
              "If available and set to 'true', then all settings in this call will be in-memory only, not persisted to the file system. Otherwise, state settings will be written to the file system."));
      transientSet.setExample("true");
      apiDocRequest.addAttribute(transientSet);

      ApiDocAttribute reqAttributeAction = new ApiDocAttribute();
      reqAttributeAction
          .setFieldName(ServiceConfigurationAPI.API_SERVICE_RESPONSE_TYPE);
      reqAttributeAction
          .addFieldValues(new ApiDocFieldValue(
              ServiceConfigurationAPI.API_SERVICE_RESPONSE_TYPE_VALUE_DYNAMIC,
              "Sets service to respond as dynamic."));
      reqAttributeAction
          .addFieldValues(new ApiDocFieldValue(
              ServiceConfigurationAPI.API_SERVICE_RESPONSE_TYPE_VALUE_PROXY,
              "Sets service to act as a proxy."));
      reqAttributeAction
          .addFieldValues(new ApiDocFieldValue(
              ServiceConfigurationAPI.API_SERVICE_RESPONSE_TYPE_VALUE_STATIC,
              "Sets service to respond with a static response"));
      apiDocRequest.addAttribute(reqAttributeAction);

      apiDocService.setApiRequest(apiDocRequest);

      // *****************************
      // RESPONSE DEFINITION
View Full Code Here

          .setDescription("If you need to initialize Mockey with a definitions file, then this API may serve your needs. ");
      // *****************************
      // REQUEST DEFINITION
      // *****************************

      ApiDocRequest apiDocRequest = new ApiDocRequest();

      // Parameter - 'action'
      ApiDocAttribute reqAttributeAction = new ApiDocAttribute();
      reqAttributeAction.setFieldName(BSC.ACTION);
      reqAttributeAction.addFieldValues(new ApiDocFieldValue(API_CONFIGURATION_PARAMETER_ACTION_VALUE_DELETE,
          "Delete all configurations, history, settings, etc., and start with a clean Mockey. "));
      reqAttributeAction.addFieldValues(new ApiDocFieldValue(BSC.INIT,
          "Will delete everything and configure Mockey with the defined file. "));
      apiDocRequest.addAttribute(reqAttributeAction);

      // Parameter - 'file'
      ApiDocAttribute reqAttributeFile = new ApiDocAttribute();
      reqAttributeFile.setFieldName(BSC.FILE);
      reqAttributeFile.addFieldValues(new ApiDocFieldValue("[string]",
          "Relative path to the service definitions configuration file. Required if 'action' is 'init'"));
      reqAttributeFile.setExample("../some_file.xml or /Users/someuser/Work/some_file.xml");
      apiDocRequest.addAttribute(reqAttributeFile);

      // Parameter - 'type'
      ApiDocAttribute reqAttributeType = new ApiDocAttribute();
      reqAttributeType.setFieldName(BSC.TYPE);
      reqAttributeType
          .addFieldValues(new ApiDocFieldValue("json",
              "Response will be in JSON. Any other value for 'type' is undefined and you may experience a 302 or get HTML back."));
      apiDocRequest.addAttribute(reqAttributeType);
      apiDocService.setApiRequest(apiDocRequest);

      // Parameter - 'transientState'
      ApiDocAttribute reqAttributeState = new ApiDocAttribute();
      reqAttributeState.setFieldName(BSC.TRANSIENT);
      reqAttributeState
          .addFieldValues(new ApiDocFieldValue("boolean", "Read only mode? Also known as transient."));
      apiDocRequest.addAttribute(reqAttributeState);
      apiDocService.setApiRequest(apiDocRequest);

      // *****************************
      // RESPONSE DEFINITION
      // *****************************
 
View Full Code Here

      // *****************************
      // REQUEST DEFINITION
      // *****************************

      ApiDocRequest apiDocRequest = new ApiDocRequest();
      String commonTxt = "(optional) Either a Service ID or Service Name is needed. Otherwise, all Service definitions meta-data will be provided.";
      ApiDocAttribute reqServiceId = new ApiDocAttribute();
      reqServiceId.setFieldName(ServiceConfigurationAPI.API_SERVICE_ID);
      reqServiceId.addFieldValues(new ApiDocFieldValue("[identifier]", commonTxt));
      reqServiceId.setExample("123");
      apiDocRequest.addAttribute(reqServiceId);

      ApiDocAttribute reqServiceName = new ApiDocAttribute();
      reqServiceName.setFieldName(ServiceConfigurationAPI.API_SERVICE_NAME);
      reqServiceName.addFieldValues(new ApiDocFieldValue("[string]", commonTxt));
      reqServiceName.setExample("My Service Name");
      apiDocRequest.addAttribute(reqServiceName);

      apiDocService.setApiRequest(apiDocRequest);

      // *****************************
      // RESPONSE DEFINITION
View Full Code Here

TOP

Related Classes of com.mockey.model.ApiDocRequest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.