private org.ovirt.engine.core.common.businessentities.VmPool setUpEntityExpectations(
      org.ovirt.engine.core.common.businessentities.VmPool entity, int index) {
    expect(entity.getVmPoolId()).andReturn(GUIDS[index]).anyTimes();
    expect(entity.getVdsGroupId()).andReturn(GUIDS[2]).anyTimes();
    expect(entity.getName()).andReturn(NAMES[index]).anyTimes();
    expect(entity.getVmPoolType()).andReturn(VmPoolType.Automatic).anyTimes();
    expect(entity.getVmPoolDescription()).andReturn(DESCRIPTIONS[index]).anyTimes();

    return entity;
  }
  private void updateProperties() {
    final VmPool pool = getEntity();

    setName(pool.getName());
    setDescription(pool.getVmPoolDescription());

    AsyncQuery _asyncQuery = new AsyncQuery();

    _asyncQuery.setModel(this);
    _asyncQuery.asyncCallback =
        new INewAsyncCallback() {
          @Override
          public void onSuccess(Object model, Object result) {
            // currently, only query that is being invoked asynchrounously in
            // this context is GetVmDataByPoolIdQuery. If more async queries will be needed,
            // refactor to "switch ... case...".
            if (result != null) {
              setvm((VM) ((VdcQueryReturnValue) result).getReturnValue());
            }
            PoolGeneralModel poolGeneralModel = (PoolGeneralModel) model;
            if (getvm() != null) {
              poolGeneralModel.setTemplate(vmTemplateNameRenderer.render(getvm()));
              poolGeneralModel.setCpuInfo(
                  ConstantsManager.getInstance()
                      .getMessages()
                      .cpuInfoLabel(
                          getvm().getNumOfCpus(),
                          getvm().getNumOfSockets(),
                          getvm().getCpuPerSocket(),
                          getvm().getThreadsPerCpu()));
              poolGeneralModel.setMonitorCount(getvm().getNumOfMonitors());

              poolGeneralModel.setOS(getvm().getVmOsId());

              poolGeneralModel.setDefinedMemory(getvm().getVmMemSizeMb() + " MB"); // $NON-NLS-1$
              poolGeneralModel.setMinAllocatedMemory(
                  getvm().getMinAllocatedMem() + " MB"); // $NON-NLS-1$

              Translator translator = EnumTranslator.getInstance();
              setDefaultDisplayType(translator.translate(getvm().getDefaultDisplayType()));

              poolGeneralModel.setOrigin(translator.translate(getvm().getOrigin()));
              poolGeneralModel.setUsbPolicy(translator.translate(getvm().getUsbPolicy()));

              setHasDomain(AsyncDataProvider.getInstance().isWindowsOsType(getvm().getVmOsId()));

              setHasTimeZone(AsyncDataProvider.getInstance().isWindowsOsType(getvm().getVmOsId()));
              poolGeneralModel.setTimeZone(getvm().getTimeZone());

              poolGeneralModel.setIsStateless(getvm().isStateless());

              poolGeneralModel.setQuotaName(getvm().getQuotaName());

              poolGeneralModel.setHasDefaultHost(getvm().getDedicatedVmForVdsList().size() > 0);
              if (poolGeneralModel.getHasDefaultHost()) {
                AsyncQuery _asyncQuery1 = new AsyncQuery();
                _asyncQuery1.setModel(poolGeneralModel);
                _asyncQuery1.asyncCallback =
                    new INewAsyncCallback() {
                      @Override
                      public void onSuccess(Object model1, Object ReturnValue1) {
                        PoolGeneralModel poolGeneralModel1 = (PoolGeneralModel) model1;
                        String defaultHost = "";
                        ArrayList<VDS> hosts =
                            ((VdcQueryReturnValue) ReturnValue1).getReturnValue();
                        for (VDS host : hosts) {
                          if (poolGeneralModel1
                              .getvm()
                              .getDedicatedVmForVdsList()
                              .contains(host.getId())) {
                            if (defaultHost.isEmpty()) {
                              defaultHost = host.getName();
                            } else {
                              defaultHost += ", " + host.getName(); // $NON-NLS-1$
                            }
                          }
                        }
                        poolGeneralModel1.setDefaultHost(defaultHost);
                      }
                    };

                Frontend.getInstance()
                    .runQuery(
                        VdcQueryType.Search,
                        new SearchParameters(
                            "Host: cluster = " //$NON-NLS-1$
                                + getvm().getClusterName()
                                + " sortby name",
                            SearchType.VDS),
                        _asyncQuery1); //$NON-NLS-1$
              } else {
                poolGeneralModel.setDefaultHost(
                    ConstantsManager.getInstance().getConstants().anyHostInCluster());
              }
              if (getvm() != null) {
                PoolGeneralModel.super.updateProperties(getvm().getId());
              }
            } else {
              poolGeneralModel.setTemplate(null);
              poolGeneralModel.setCpuCount(0);
              poolGeneralModel.setMonitorCount(0);
              poolGeneralModel.setOS(0);
              poolGeneralModel.setDefinedMemory(null);
              poolGeneralModel.setMinAllocatedMemory(null);
              poolGeneralModel.setDefaultDisplayType(null);
              poolGeneralModel.setHasDomain(false);
              poolGeneralModel.setDomain(null);
              poolGeneralModel.setHasTimeZone(false);
              poolGeneralModel.setTimeZone(null);
              poolGeneralModel.setUsbPolicy(null);
              poolGeneralModel.setDefaultHost(null);
              poolGeneralModel.setIsStateless(false);
              poolGeneralModel.setGraphicsType(""); // $NON-NLS-1$

              poolGeneralModel.getUpdateCompleteEvent().raise(this, EventArgs.EMPTY);
            }
          }
        };
    Frontend.getInstance()
        .runQuery(
            VdcQueryType.GetVmDataByPoolId, new IdQueryParameters(pool.getVmPoolId()), _asyncQuery);
  }