Package com.mockey.model

Examples of com.mockey.model.ApiDocResponse


      // *****************************
      // RESPONSE DEFINITION
      // *****************************

      ApiDocResponse apiResponse = new ApiDocResponse();
      // Building a JSON RESPONSE example
      try {
        JSONObject jsonResponseObject = new JSONObject();
        JSONObject jsonResultObject = new JSONObject();
        jsonResultObject
            .put("success",
                "Some informative coaching message. If success isn't a value, then maybe you have a 'fail' message.");
        jsonResultObject.put("planId", "1234");
        jsonResultObject.put("planName", "Some service name");
        jsonResponseObject.put("result", jsonResultObject);
        apiResponse.setExample(jsonResponseObject.toString());
      } catch (Exception e) {
        log.error("Unabel to build a sample JSON message. ", e);
      }

      // Response attribute 'planId'
      ApiDocAttribute resAttributePlanId = new ApiDocAttribute();
      resAttributePlanId.setFieldName("planId");
      resAttributePlanId.setFieldDescription("Identifier of a Service Plan");
      apiResponse.addAttribute(resAttributePlanId);

      // Response attribute 'planName'
      ApiDocAttribute resAttributePlanName = new ApiDocAttribute();
      resAttributePlanName.setFieldName("planName");
      resAttributePlanName.setFieldDescription("Name of a Service Plan");
      apiResponse.addAttribute(resAttributePlanName);

      // Response attribute 'success'
      ApiDocAttribute resAttributeSuccess = new ApiDocAttribute();
      resAttributeSuccess.setFieldName("success");
      resAttributeSuccess
          .setFieldDescription("Successfully set, deleted, or saved a plan.  You get 'fail' or 'success', not both.");
      apiResponse.addAttribute(resAttributeSuccess);

      ApiDocAttribute resAttributeFail = new ApiDocAttribute();
      resAttributeFail.setFieldName("fail");
      resAttributeFail
          .setFieldDescription("Failed to set, delete, or save a plan. You get 'fail' or 'success', not both.");
      apiResponse.addAttribute(resAttributeFail);

      apiDocService.setApiResponse(apiResponse);
      apiStore.saveOrUpdateService(apiDocService);
    }
  }
View Full Code Here


      // *****************************
      // RESPONSE DEFINITION
      // *****************************

      ApiDocResponse apiResponse = new ApiDocResponse();
      // Building a JSON RESPONSE example
      try {
        JSONObject jsonResponseObject = new JSONObject();
        JSONObject jsonResultObject = new JSONObject();
        jsonResultObject
            .put("success",
                "Some informative coaching message. If success isn't a value, then maybe you have a 'fail' message.");
        jsonResultObject.put(ServiceConfigurationAPI.API_SERVICE_ID,
            "1234");
        jsonResultObject.put(ServiceConfigurationAPI.API_SERVICE_NAME,
            "Some service name");
        jsonResultObject.put(
            ServiceConfigurationAPI.API_SERVICE_SCHEMA,
            "JSON Schema");
        jsonResultObject
            .put(ServiceConfigurationAPI.API_SERVICE_SCENARIO_ID,
                "5678");
        jsonResultObject.put(
            ServiceConfigurationAPI.API_SERVICE_SCENARIO_NAME,
            "Some scenario name");
        jsonResultObject
            .put(ServiceConfigurationAPI.API_SERVICE_RESPONSE_TYPE,
                ServiceConfigurationAPI.API_SERVICE_RESPONSE_TYPE_VALUE_PROXY);
        jsonResultObject.put(
            ServiceConfigurationAPI.API_SERVICE_HANGTIME, "500");
        jsonResultObject.put(
            ServiceConfigurationAPI.API_TRANSIENT_STATE, "true");
        jsonResponseObject.put("result", jsonResultObject);
        apiResponse.setExample(jsonResponseObject.toString());
      } catch (Exception e) {
        log.error("Unabel to build a sample JSON message. ", e);
      }

      // Response attribute 'planId'
      ApiDocAttribute resAttributePlanId = new ApiDocAttribute();
      resAttributePlanId
          .setFieldName(ServiceConfigurationAPI.API_SERVICE_ID);
      resAttributePlanId.setFieldDescription("Identifier of a Service");
      apiResponse.addAttribute(resAttributePlanId);

      // Response attribute 'planName'
      ApiDocAttribute resAttributePlanName = new ApiDocAttribute();
      resAttributePlanName
          .setFieldName(ServiceConfigurationAPI.API_SERVICE_NAME);
      resAttributePlanName.setFieldDescription("Name of a Service");
      apiResponse.addAttribute(resAttributePlanName);

      // Response attribute 'success'
      ApiDocAttribute resAttributeSuccess = new ApiDocAttribute();
      resAttributeSuccess.setFieldName("success");
      resAttributeSuccess
          .setFieldDescription("Successfully set, deleted, or saved a plan.  You get 'fail' or 'success', not both.");
      apiResponse.addAttribute(resAttributeSuccess);

      ApiDocAttribute resAttributeFail = new ApiDocAttribute();
      resAttributeFail.setFieldName("fail");
      resAttributeFail
          .setFieldDescription("Failed to set, delete, or save a plan. You get 'fail' or 'success', not both.");
      apiResponse.addAttribute(resAttributeFail);

      apiDocService.setApiResponse(apiResponse);
      apiStore.saveOrUpdateService(apiDocService);
    }
  }
View Full Code Here

      // *****************************
      // RESPONSE DEFINITION
      // *****************************

      ApiDocResponse apiResponse = new ApiDocResponse();
      // Building a JSON RESPONSE example
      try {
        JSONObject jsonResponseObject = new JSONObject();
        JSONObject jsonResultObject = new JSONObject();
        jsonResultObject
            .put(SUCCESS,
                "Some informative coaching message. If success isn't a value, then maybe you have a 'fail' message.");
        jsonResultObject.put("file", "Some file name");
        jsonResponseObject.put("result", jsonResultObject);
        apiResponse.setExample(jsonResponseObject.toString());
      } catch (Exception e) {
        logger.error("Unabel to build a sample JSON message. ", e);
      }

      // Response attribute 'file'
      ApiDocAttribute resAttributeFile = new ApiDocAttribute();
      resAttributeFile.setFieldName(BSC.FILE);
      resAttributeFile.setFieldDescription("Name of file used to initialize Mockey.");
      apiResponse.addAttribute(resAttributeFile);

      // Response attribute 'success'
      ApiDocAttribute resAttributeSuccess = new ApiDocAttribute();
      resAttributeSuccess.setFieldName(SUCCESS);
      resAttributeSuccess
          .setFieldDescription("Successfully initialized or deleted service definitions.  You get 'fail' or 'success', not both.");
      apiResponse.addAttribute(resAttributeSuccess);

      ApiDocAttribute resAttributeFail = new ApiDocAttribute();
      resAttributeFail.setFieldName(FAIL);
      resAttributeFail
          .setFieldDescription("Failed to initialize or delete service definitions. You get 'fail' or 'success', not both.");
      apiResponse.addAttribute(resAttributeFail);

      apiDocService.setApiResponse(apiResponse);
      apiStore.saveOrUpdateService(apiDocService);
    }
  }
View Full Code Here

      // *****************************
      // RESPONSE DEFINITION
      // *****************************

      ApiDocResponse apiResponse = new ApiDocResponse();
      // Building a JSON RESPONSE example
      try {
        JSONObject jsonResponseObject = new JSONObject();
        JSONObject jsonResultObject = new JSONObject();
        jsonResultObject.put(ServiceConfigurationAPI.API_SERVICE_ID, "1234");
        jsonResultObject.put(ServiceConfigurationAPI.API_SERVICE_NAME, "Some service name");
        jsonResultObject.put(ServiceConfigurationAPI.API_DEFAULT_SCENARIO_ID, "5678");
        jsonResultObject.put(ServiceConfigurationAPI.API_DEFAULT_SCENARIO_NAME, "Some scenario name");
        jsonResultObject.put(ServiceConfigurationAPI.API_SERVICE_RESPONSE_TYPE,
            ServiceConfigurationAPI.API_SERVICE_RESPONSE_TYPE_VALUE_PROXY);
        jsonResultObject.put(ServiceConfigurationAPI.API_SERVICE_HANGTIME, "500");
        JSONObject jsonScenarioObject = new JSONObject();
        jsonScenarioObject.put(ServiceConfigurationAPI.API_SERVICE_SCENARIO_ID, 1);
        jsonScenarioObject.put(ServiceConfigurationAPI.API_SERVICE_SCENARIO_NAME, "Some scenario name");
        jsonResultObject.append("scenarioArray", jsonScenarioObject);
        jsonResponseObject.append("serviceDefinitions", jsonResultObject);
        apiResponse.setExample(jsonResponseObject.toString());
      } catch (Exception e) {
        log.error("Unabel to build a sample JSON message. ", e);
      }
      ApiDocAttribute resAttributeFail = new ApiDocAttribute();
      resAttributeFail.setFieldName("");
      resAttributeFail.setFieldDescription("Refer to example. This is a simple JSON dump of Mockey definitions. ");
      apiResponse.addAttribute(resAttributeFail);

      apiDocService.setApiResponse(apiResponse);
      apiStore.saveOrUpdateService(apiDocService);

      apiStore.saveOrUpdateService(apiDocService);
View Full Code Here

TOP

Related Classes of com.mockey.model.ApiDocResponse

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.