private void validateInstance(String lookuplocators, String deploypuCommand) throws Exception {
    String gridname;
    String partitions, backups, maxPerVM, maxPerMachine;
    String[] deployCmdArr = deploypuCommand.split(" ");
    if (deployCmdArr[0].equals("deploy-pu")) {
      gridname = deployCmdArr[1];
      partitions = deployCmdArr[4];
      backups = deployCmdArr[5];
      maxPerVM = deployCmdArr[6];
      maxPerMachine = deployCmdArr[7];
    } else if (deployCmdArr[0].equals("deploy-grid")) {
      gridname = deployCmdArr[1];
      partitions = deployCmdArr[3];
      backups = deployCmdArr[4];
      maxPerVM = deployCmdArr[5];
      maxPerMachine = deployCmdArr[6];
    } else if (deployCmdArr[0].equals("deploy-pu-basic")) {
      File file = new File(PUURL);
      gridname = file.getName();
      partitions = "1";
      backups = "0";
      maxPerVM = "1";
      maxPerMachine = "1";
    } else if (deployCmdArr[0].equals("deploy-grid-basic")) {
      gridname = deployCmdArr[1];
      partitions = "1";
      backups = "1";
      maxPerVM = "0";
      maxPerMachine = "0";
    } else {
      throw new Exception(
          "Unknown command. Please recheck the command or add it to validateInstance function.");
    }
    InvokeServiceCommandResponse response;
    InvocationResult result;
    String appName = "default";
    String numOfInstances =
        String.valueOf(Integer.valueOf(partitions) * (1 + Integer.valueOf(backups)));

    response =
        customCommand(
            "get-datagrid-instances " + gridname + " " + lookuplocators + " " + numOfInstances,
            SG_VALIDATOR,
            appName);
    result = getCustomCommandResult(response);
    Assert.assertEquals(result.getInvocationStatus(), CloudifyConstants.InvocationStatus.SUCCESS);
    Assert.assertEquals(result.getResult(), numOfInstances);

    response =
        customCommand(
            "get-datagrid-deploymentstatus "
                + gridname
                + " "
                + lookuplocators
                + " "
                + numOfInstances,
            SG_VALIDATOR,
            appName);
    result = getCustomCommandResult(response);
    Assert.assertEquals(result.getInvocationStatus(), CloudifyConstants.InvocationStatus.SUCCESS);
    Assert.assertEquals(result.getResult(), String.valueOf(DeploymentStatus.INTACT));

    response =
        customCommand(
            "get-datagrid-partitions " + gridname + " " + lookuplocators + " " + numOfInstances,
            SG_VALIDATOR,
            appName);
    result = getCustomCommandResult(response);
    Assert.assertEquals(result.getInvocationStatus(), CloudifyConstants.InvocationStatus.SUCCESS);
    Assert.assertEquals(result.getResult(), partitions);

    response =
        customCommand(
            "get-datagrid-backups " + gridname + " " + lookuplocators + " " + numOfInstances,
            SG_VALIDATOR,
            appName);
    result = getCustomCommandResult(response);
    Assert.assertEquals(result.getInvocationStatus(), CloudifyConstants.InvocationStatus.SUCCESS);
    Assert.assertEquals(result.getResult(), backups);

    response =
        customCommand(
            "get-datagrid-maxinstancespermachine "
                + gridname
                + " "
                + lookuplocators
                + " "
                + numOfInstances,
            SG_VALIDATOR,
            appName);
    result = getCustomCommandResult(response);
    Assert.assertEquals(result.getInvocationStatus(), CloudifyConstants.InvocationStatus.SUCCESS);
    Assert.assertEquals(result.getResult(), maxPerMachine);

    response =
        customCommand(
            "get-datagrid-maxinstancespervm "
                + gridname
                + " "
                + lookuplocators
                + " "
                + numOfInstances,
            SG_VALIDATOR,
            appName);
    result = getCustomCommandResult(response);
    Assert.assertEquals(result.getInvocationStatus(), CloudifyConstants.InvocationStatus.SUCCESS);
    Assert.assertEquals(result.getResult(), maxPerVM);
  }