Search in sources :

Example 1 with VisibleForTesting

use of com.google.api.client.repackaged.com.google.common.annotations.VisibleForTesting in project google-cloud-intellij by GoogleCloudPlatform.

the class AppEngineDeploy method parseDeployOutput.

/**
 * Parse the raw json output of the deployment.
 *
 * @return an object modeling the output of a deploy command
 * @throws JsonParseException if unable to extract the deploy output information needed
 */
@VisibleForTesting
static DeployOutput parseDeployOutput(String jsonOutput) throws JsonParseException {
    Type deployOutputType = new TypeToken<DeployOutput>() {
    }.getType();
    DeployOutput deployOutput = new Gson().fromJson(jsonOutput, deployOutputType);
    if (deployOutput == null || deployOutput.versions == null || deployOutput.versions.size() != 1) {
        throw new JsonParseException("Cannot get app version: unexpected gcloud JSON output format");
    }
    return deployOutput;
}
Also used : Type(java.lang.reflect.Type) Gson(com.google.gson.Gson) JsonParseException(com.google.gson.JsonParseException) VisibleForTesting(com.google.api.client.repackaged.com.google.common.annotations.VisibleForTesting)

Aggregations

VisibleForTesting (com.google.api.client.repackaged.com.google.common.annotations.VisibleForTesting)1 Gson (com.google.gson.Gson)1 JsonParseException (com.google.gson.JsonParseException)1 Type (java.lang.reflect.Type)1