• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Datacenter类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.vmware.vim25.mo.Datacenter的典型用法代码示例。如果您正苦于以下问题:Java Datacenter类的具体用法?Java Datacenter怎么用?Java Datacenter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Datacenter类属于com.vmware.vim25.mo包,在下文中一共展示了Datacenter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: setUp

import com.vmware.vim25.mo.Datacenter; //导入依赖的package包/类
@BeforeMethod
@Override
protected void setUp() throws Exception {
  super.setUp();
  myIdxStorage = createTempDir();
  FakeModel.instance().addDatacenter("dc");
  FakeModel.instance().addFolder("cf").setParent("dc", Datacenter.class);
  FakeModel.instance().addResourcePool("rp").setParentFolder("cf");
  FakeModel.instance().addVM("image1").setParentFolder("cf");
  FakeModel.instance().addVM("image2").setParentFolder("cf");
  FakeModel.instance().addVM("image_template").setParentFolder("cf");
  FakeModel.instance().addVMSnapshot("image2", "snap");
  FakeModel.instance().getCustomizationSpecs().put("someCustomization", new CustomizationSpec());
  FakeModel.instance().getCustomizationSpecs().put("linux", new CustomizationSpec());
  myFakeApiConnector = new FakeApiConnector(TEST_SERVER_UUID, PROFILE_ID, null);
  setInternalProperty("teamcity.vsphere.instance.status.update.delay.ms", "250");
  myTaskManager = new MyExposingVmwareUpdateTaskManager();
}
 
开发者ID:JetBrains,项目名称:teamcity-vmware-plugin,代码行数:19,代码来源:VmwarePooledUpdateInstanceTaskTest.java


示例2: check_same_datacenter

import com.vmware.vim25.mo.Datacenter; //导入依赖的package包/类
public void check_same_datacenter() throws InterruptedException {
  FakeModel.instance().addDatacenter("dc2");
  FakeModel.instance().addFolder("cf2").setParent("dc2", Datacenter.class);
  FakeModel.instance().addResourcePool("rp2").setParentFolder("cf2");
  FakeModel.instance().addVM("image3").setParentFolder("cf");
  updateClientParameters(CloudProfileUtil.collectionFromJson(
    "[{sourceVmName:'image1', behaviour:'START_STOP'}," +
      "{sourceVmName:'image2',snapshot:'snap*',folder:'cf',pool:'rp',maxInstances:3,behaviour:'ON_DEMAND_CLONE'}," +
      "{sourceVmName:'image_template', snapshot:'" + VmwareConstants.CURRENT_STATE + "',folder:'cf',pool:'rp',maxInstances:3,behaviour:'FRESH_CLONE'}, " +
      "{sourceVmName:'image3',snapshot:'" + VmwareConstants.CURRENT_STATE + "'," + "folder:'cf2',pool:'rp2',maxInstances:3,behaviour:'ON_DEMAND_CLONE'}]", PROJECT_ID));
  recreateClient();

  final CloudInstanceUserData userData = createUserData("image3_agent");
  final VmwareCloudInstance vmwareCloudInstance = myClient.startNewInstance(getImageByName("image3"), userData);
  new WaitFor(10 * 1000) {
    @Override
    protected boolean condition() {
      return vmwareCloudInstance.getStatus() == InstanceStatus.ERROR && vmwareCloudInstance.getErrorInfo() != null;
    }
  }.assertCompleted();

  final String msg = vmwareCloudInstance.getErrorInfo().getMessage();
  assertContains(msg, "Unable to find folder cf2 in datacenter dc");
}
 
开发者ID:JetBrains,项目名称:teamcity-vmware-plugin,代码行数:25,代码来源:VmwareCloudIntegrationTest.java


示例3: VCenterDB

import com.vmware.vim25.mo.Datacenter; //导入依赖的package包/类
public VCenterDB(String vcenterUrl, String vcenterUsername,
                 String vcenterPassword, String contrailDcName, String contrailClusterName,
                 String contrailDvsName, String ipFabricPgName, Mode mode) {
    this.vcenterUrl             = vcenterUrl;
    this.vcenterUsername        = vcenterUsername;
    this.vcenterPassword        = vcenterPassword;
    this.contrailDataCenterName = contrailDcName;
    this.contrailClusterName = contrailClusterName;
    this.contrailDvSwitchName   = contrailDvsName;
    this.contrailIpFabricPgName = ipFabricPgName;
    this.mode                   = mode;

    s_logger.info("VCenterDB(" + contrailDvsName + ", " + ipFabricPgName + ")");
    datacenters = new ConcurrentHashMap<String, Datacenter>();
    dvswitches = new ConcurrentHashMap<String, VmwareDistributedVirtualSwitch>();
    dvsPvlanMap = new ConcurrentHashMap<String, VMwareDVSPvlanMapEntry[]>();

    // Create ESXi host to vRouterVM Ip address map
    buildEsxiToVRouterIpMap();
}
 
开发者ID:Juniper,项目名称:contrail-vcenter-plugin,代码行数:21,代码来源:VCenterDB.java


示例4: getIpPoolById

import com.vmware.vim25.mo.Datacenter; //导入依赖的package包/类
public IpPool getIpPoolById(Integer poolid,  String nwName, Datacenter dc, String dcName)
        throws RemoteException {

    if (ipPools == null) {
        ipPools = ipPoolManager.queryIpPools(dc);
        if (ipPools == null || ipPools.length == 0) {
            s_logger.debug(" Datacenter: " + dcName + " IP Pools NOT configured");
            return null;
        }
    }

    // refresh cached pools and try again
    ipPools = ipPoolManager.queryIpPools(dc);
    if (ipPools == null || ipPools.length == 0) {
        s_logger.debug(" Datacenter: " + dcName + " IP Pools NOT configured");
        return null;
    }

    return getIpPool(poolid, nwName);
}
 
开发者ID:Juniper,项目名称:contrail-vcenter-plugin,代码行数:21,代码来源:VCenterDB.java


示例5: populateVCenterServerInfo

import com.vmware.vim25.mo.Datacenter; //导入依赖的package包/类
private void populateVCenterServerInfo() {
    VCenterServerInfo vCenterServerInfo = vCenterPluginInfo.getVCenterServerInfo();

    if (VCenterNotify.getVcenterDB() != null) {
        vCenterServerInfo.setUrl(VCenterNotify.getVcenterDB().getVcenterUrl() );

        vCenterServerInfo.setConnected(VCenterNotify.getVCenterConnected());

        vCenterServerInfo.setOperationalStatus(VCenterNotify.getVcenterDB().getOperationalStatus());
        Datacenter dc = VCenterNotify.getVcenterDB().getDatacenter();
        if (dc != null && dc.getMOR() != null) {
            vCenterServerInfo.setDatacenterMor(dc.getMOR().getVal());
        }
        VmwareDistributedVirtualSwitch dvs = VCenterNotify.getVcenterDB().getDvs();
        if (dvs != null && dvs.getMOR() != null) {
            vCenterServerInfo.setDvsMor(dvs.getMOR().getVal());
        }
    }
}
 
开发者ID:Juniper,项目名称:contrail-vcenter-plugin,代码行数:20,代码来源:VCenterPluginResp.java


示例6: setUp

import com.vmware.vim25.mo.Datacenter; //导入依赖的package包/类
@BeforeMethod
public void setUp() throws Exception {
  super.setUp();
  FakeModel.instance().clear();
  myTaskExecutor = new CloudAsyncTaskExecutor("Test-vmware");
  myApiConnector = new FakeApiConnector(VmwareCloudIntegrationTest.TEST_SERVER_UUID, VmwareCloudIntegrationTest.PROFILE_ID);
  myIdxStorage = createTempDir();
  Map<String, String> params = new HashMap<>();
  params.put("nickname", "imageNickname");
  params.put("sourceVmName", "srcVM");
  params.put("snapshot", "srcVMSnap");
  params.put("folder", "folderId");
  params.put("pool", "rpId");
  params.put("behaviour", CloneBehaviour.FRESH_CLONE.toString());
  params.put("maxInstances", "5");
  CloudImageParameters imageParameters = new CloudImageParametersImpl(params, VmwareCloudIntegrationTest.PROJECT_ID);

  myImageDetails = new VmwareCloudImageDetails(imageParameters);

  FakeModel.instance().addDatacenter("dc2");
  FakeModel.instance().addFolder("folderId").setParent("dc2", Datacenter.class);
  FakeModel.instance().addVM("srcVM").setParentFolder("folderId");
  FakeModel.instance().addResourcePool("rpId").setParentFolder("folderId");

  FakeModel.instance().addVMSnapshot("srcVM", "srcVMSnap");

  myProfile = VmwareTestUtils.createProfileFromProps(new CloudClientParametersImpl(Collections.emptyMap(), Collections.emptyList()));
  myImage = new VmwareCloudImage(myApiConnector, myImageDetails, myTaskExecutor, myIdxStorage, myProfile);

  myCloudClient = new VMWareCloudClient(myProfile, myApiConnector, new VmwareUpdateTaskManager(), createTempDir());
  myCloudClient.populateImagesData(Collections.singletonList(myImageDetails));
  myUpdateTask = new UpdateInstancesTask<VmwareCloudInstance, VmwareCloudImage, VMWareCloudClient>(myApiConnector, myCloudClient, 10*1000, false);
}
 
开发者ID:JetBrains,项目名称:teamcity-vmware-plugin,代码行数:34,代码来源:VmwareCloudImageTest.java


示例7: deleteDisk

import com.vmware.vim25.mo.Datacenter; //导入依赖的package包/类
public void deleteDisk(String datastoreName, String fileName) {
    // Datacenter
    ManagedEntity datacenter = vmwareClient.getRootEntity();

    // Datastore
    Datastore datastore = vmwareClient.search(Datastore.class, datastoreName);
    if (datastore == null) {
        // データストアが見つからない場合
        throw new AutoException("EPROCESS-000505", datastoreName);
    }

    // ディスクの削除
    FileManager fileManager = vmwareClient.getServiceInstance().getFileManager();
    if (fileManager == null) {
        // fileManagerが利用できない場合
        throw new AutoException("EPROCESS-000533");
    }

    try {
        // ディスク削除
        fileManager.deleteDatastoreFile_Task(fileName, (Datacenter) datacenter);
        // ディスク削除後にごみができ、再度アタッチするとエラーになるので削除
        String flatname;
        flatname = fileName.substring(0, fileName.length() - 5) + "-flat.vmdk";
        fileManager.deleteDatastoreFile_Task(flatname, (Datacenter) datacenter);
    } catch (RemoteException e) {
        throw new AutoException("EPROCESS-000522", e, fileName);
    }

    if (log.isInfoEnabled()) {
        log.info(MessageUtils.getMessage("IPROCESS-100455", fileName));
    }
}
 
开发者ID:primecloud-controller-org,项目名称:primecloud-controller,代码行数:34,代码来源:VmwareProcessClient.java


示例8: getVmwareDvs

import com.vmware.vim25.mo.Datacenter; //导入依赖的package包/类
public VmwareDistributedVirtualSwitch getVmwareDvs(String name,
        Datacenter dc, String dcName)
                throws RemoteException {
    if (dvswitches.containsKey(name)) {
        return dvswitches.get(name);
    }

    String description = "<dvs " + name + ", datacenter " + dcName
            + ", vCenter " + vcenterUrl + ">.";

    InventoryNavigator inventoryNavigator = new InventoryNavigator(dc);

    VmwareDistributedVirtualSwitch dvs = null;
    try {
        dvs = (VmwareDistributedVirtualSwitch)inventoryNavigator.searchManagedEntity(
                "VmwareDistributedVirtualSwitch", name);
    } catch (RemoteException e ) {
        operationalStatus = "Failed to retrieve " + description;
        s_logger.error(operationalStatus);
        throw new RemoteException(operationalStatus, e);
    }

    if (dvs == null) {
        operationalStatus = "Failed to retrieve " + description;
        s_logger.error(operationalStatus);
        throw new RemoteException(operationalStatus);
    }

    s_logger.info("Found " + description);
    dvswitches.put(name, dvs);
    return dvs;
}
 
开发者ID:Juniper,项目名称:contrail-vcenter-plugin,代码行数:33,代码来源:VCenterDB.java


示例9: getDvsPvlanMap

import com.vmware.vim25.mo.Datacenter; //导入依赖的package包/类
public VMwareDVSPvlanMapEntry[] getDvsPvlanMap(String dvsName, Datacenter dc, String dcName)
                throws RemoteException {
    if (dvsPvlanMap.containsKey(dvsName)) {
        return dvsPvlanMap.get(dvsName);
    }

    VmwareDistributedVirtualSwitch dvs = getVmwareDvs(dvsName, dc, dcName);

    // Extract private vlan entries for the virtual switch
    VMwareDVSConfigInfo dvsConfigInfo = (VMwareDVSConfigInfo) dvs.getConfig();
    if (dvsConfigInfo == null) {
        s_logger.error("dvSwitch: " + dvsName
                + " Datacenter: " + dcName + " ConfigInfo is empty");
    }

    if (!(dvsConfigInfo instanceof VMwareDVSConfigInfo)) {
        s_logger.error("dvSwitch: " + dvsName +
                " Datacenter: " + dcName + " ConfigInfo " +
                "isn't instanceof VMwareDVSConfigInfo");
    }

    VMwareDVSPvlanMapEntry[] pvlanMapArray = dvsConfigInfo.getPvlanConfig();
    if (pvlanMapArray != null) {
        dvsPvlanMap.put(dvsName, pvlanMapArray);
        s_logger.info("Found private vlan map array on dvSwitch: " + dvsName +
                " Datacenter: " + dcName);
        return pvlanMapArray;
    }

    s_logger.error("dvSwitch: " + dvsName +
            " Datacenter: " + dcName + " Private VLAN NOT" +
            "configured");
    return null;
}
 
开发者ID:Juniper,项目名称:contrail-vcenter-plugin,代码行数:35,代码来源:VCenterDB.java


示例10: isVmEventOnMonitoredCluster

import com.vmware.vim25.mo.Datacenter; //导入依赖的package包/类
public boolean isVmEventOnMonitoredCluster(Event event, String hostName)
    throws RemoteException {
    String dcName;
    Datacenter dc;

    // If contrailClusterName is null, all clusters under datacenter 
    // are monitored by vcenter plugin.
    if (contrailClusterName == null)
        return true;

    if (event.getHost() != null) {
        hostName = event.getHost().getName();
        HostSystem host = getVmwareHost(hostName, contrailDC, contrailDataCenterName);

        if (host != null) {
            ClusterComputeResource cluster = (ClusterComputeResource) host.getParent();
            if (cluster != null) {
                String clstrName = cluster.getName();
                if (clstrName != null && clstrName.equals(contrailClusterName)) {
                    return true;
                }
            }
        }
    }

    return false;
}
 
开发者ID:Juniper,项目名称:contrail-vcenter-plugin,代码行数:28,代码来源:VCenterDB.java


示例11: createDatacenterEventFilter

import com.vmware.vim25.mo.Datacenter; //导入依赖的package包/类
private void createDatacenterEventFilter(Datacenter dc) throws RemoteException {

        if (dc == null) {
            s_logger.error("Cannot register for events on null datacenter  ");
            return;
        }
        s_logger.info("Register for events on datacenter ");

        String[] eventNames = {
            // Host events
            "HostConnectionLostEvent",
            "HostConnectedEvent",
            "EnteredMaintenanceModeEvent",
            "ExitMaintenanceModeEvent",

            // VM events
            // VM create events
             "VmCreatedEvent",
            "VmClonedEvent",
            "VmDeployedEvent",
            // VM modify events
            "VmPoweredOnEvent",
            "DrsVmPoweredOnEvent",
            "VmPoweredOffEvent",
            "VmSuspendedEvent",
            "VmRenamedEvent",
            "VmMacChangedEvent",
            "VmMacAssignedEvent",
            "VmReconfiguredEvent",
            // VM Migration events
            "DrsVmMigratedEvent",
            "VmMigratedEvent",
            // VM delete events
            "VmRemovedEvent"
        };

        watchManagedObjectEvents(dc, eventNames);
    }
 
开发者ID:Juniper,项目名称:contrail-vcenter-plugin,代码行数:39,代码来源:VCenterNotify.java


示例12: copyVirtualDiskTask

import com.vmware.vim25.mo.Datacenter; //导入依赖的package包/类
Task copyVirtualDiskTask(String sourceName, Datacenter sourceDatacenter, String destName,
Datacenter destDatacenter, VirtualDiskSpec destSpec, Boolean force) throws FileFault, RuntimeFault, RemoteException;
 
开发者ID:igreenfield,项目名称:jcloud-vsphere,代码行数:3,代码来源:VirtualDiskManagerApi.java


示例13: changeOwner

import com.vmware.vim25.mo.Datacenter; //导入依赖的package包/类
@Override
public void changeOwner(String name, Datacenter datacenter, String owner) throws InvalidDatastore, FileFault, UserNotFound, RuntimeFault, RemoteException {
   //To change body of implemented methods use File | Settings | File Templates.
}
 
开发者ID:igreenfield,项目名称:jcloud-vsphere,代码行数:5,代码来源:VSphereFileManager.java


示例14: copyDatastoreFileTask

import com.vmware.vim25.mo.Datacenter; //导入依赖的package包/类
@Override
public Task copyDatastoreFileTask(String sourceName, Datacenter sourceDatacenter, String destinationName, Datacenter destinationDatacenter, boolean force) throws FileFault, InvalidDatastore, RuntimeFault, RemoteException {
   return null;  //To change body of implemented methods use File | Settings | File Templates.
}
 
开发者ID:igreenfield,项目名称:jcloud-vsphere,代码行数:5,代码来源:VSphereFileManager.java


示例15: deleteDatastoreFileTask

import com.vmware.vim25.mo.Datacenter; //导入依赖的package包/类
@Override
public Task deleteDatastoreFileTask(String name, Datacenter datacenter) throws FileFault, InvalidDatastore, RuntimeFault, RemoteException {
   return null;  //To change body of implemented methods use File | Settings | File Templates.
}
 
开发者ID:igreenfield,项目名称:jcloud-vsphere,代码行数:5,代码来源:VSphereFileManager.java


示例16: makeDirectory

import com.vmware.vim25.mo.Datacenter; //导入依赖的package包/类
@Override
public void makeDirectory(String name, Datacenter datacenter, boolean createParentDirectories) throws FileFault, InvalidDatastore, RuntimeFault, RemoteException {
   //To change body of implemented methods use File | Settings | File Templates.
}
 
开发者ID:igreenfield,项目名称:jcloud-vsphere,代码行数:5,代码来源:VSphereFileManager.java


示例17: moveDatastoreFileTask

import com.vmware.vim25.mo.Datacenter; //导入依赖的package包/类
@Override
public Task moveDatastoreFileTask(String sourceName, Datacenter sourceDatacenter, String destinationName, Datacenter destinationDatacenter, boolean force) throws FileFault, InvalidDatastore, RuntimeFault, RemoteException {
   return null;  //To change body of implemented methods use File | Settings | File Templates.
}
 
开发者ID:igreenfield,项目名称:jcloud-vsphere,代码行数:5,代码来源:VSphereFileManager.java


示例18: check_called_once

import com.vmware.vim25.mo.Datacenter; //导入依赖的package包/类
public void check_called_once() throws MalformedURLException {
  final AtomicBoolean listAllCanBeCalled = new AtomicBoolean();
  final AtomicBoolean listAllCalledOnce = new AtomicBoolean();

  final AtomicBoolean getByNameCanBeCalled = new AtomicBoolean();
  final AtomicBoolean getByNameCalledOnce = new AtomicBoolean();

  myFakeApiConnector = new FakeApiConnector(TEST_SERVER_UUID, PROFILE_ID, null) {

    @Override
    protected <T extends ManagedEntity> Map<String, T> findAllEntitiesAsMapOld(final Class<T> instanceType) throws VmwareCheckedCloudException {
      if (!listAllCanBeCalled.get()) {
        fail("Shouldn't be called");
      }
      assertFalse(listAllCalledOnce.get());
      listAllCalledOnce.set(true);
      return super.findAllEntitiesAsMapOld(instanceType);
    }

    @Override
    protected Map<String, VirtualMachine> searchVMsByNames(@NotNull final Collection<String> names, @Nullable final Datacenter dc) throws VmwareCheckedCloudException {
      if (!getByNameCanBeCalled.get()) {
        fail("Shouldn't be called");
      }
      assertFalse(getByNameCalledOnce.get());
      getByNameCalledOnce.set(true);
      return super.searchVMsByNames(names, dc);
    }
  };

  final CloudClientParameters clientParameters1 = new CloudClientParametersImpl(
    Collections.emptyMap(), CloudProfileUtil.collectionFromJson("[{sourceVmName:'image1', behaviour:'START_STOP'}]", PROJECT_ID));
  final VMWareCloudClient client1 = new MyClient(clientParameters1, null);


  final CloudClientParameters clientParameters2 = new CloudClientParametersImpl(
    Collections.emptyMap(), CloudProfileUtil.collectionFromJson(
    "[{sourceVmName:'image2',snapshot:'snap*',folder:'cf',pool:'rp'," +
    "maxInstances:3,behaviour:'ON_DEMAND_CLONE',customizationSpec:'someCustomization'}]", PROJECT_ID));
  final VMWareCloudClient client2 = new MyClient(clientParameters2, null);

  final CloudClientParameters clientParameters3 = new CloudClientParametersImpl(
    Collections.emptyMap(), CloudProfileUtil.collectionFromJson(
    "[{'source-id':'image_template',sourceVmName:'image_template', snapshot:'" + VmwareConstants.CURRENT_STATE +
    "',folder:'cf',pool:'rp',maxInstances:3,behaviour:'FRESH_CLONE', customizationSpec: 'linux'}]",
    PROJECT_ID));
  final VMWareCloudClient client3 = new MyClient(clientParameters3, null);

  final VmwareUpdateInstanceTask task1 = myTaskManager.createUpdateTask(myFakeApiConnector, client1);
  final VmwareUpdateInstanceTask task2 = myTaskManager.createUpdateTask(myFakeApiConnector, client2);
  final VmwareUpdateInstanceTask task3 = myTaskManager.createUpdateTask(myFakeApiConnector, client3);

  listAllCanBeCalled.set(true);
  listAllCalledOnce.set(false);
  getByNameCalledOnce.set(false);
  getByNameCanBeCalled.set(true);
  task1.run();
  task2.run();
  task3.run();
  assertTrue(listAllCalledOnce.get());
  assertTrue(getByNameCalledOnce.get());
}
 
开发者ID:JetBrains,项目名称:teamcity-vmware-plugin,代码行数:63,代码来源:VmwarePooledUpdateInstanceTaskTest.java


示例19: check_cleared_after_dispose_2

import com.vmware.vim25.mo.Datacenter; //导入依赖的package包/类
public void check_cleared_after_dispose_2() throws MalformedURLException {
  final AtomicBoolean canBeCalled = new AtomicBoolean();
  final AtomicInteger callsCount = new AtomicInteger();

  myFakeApiConnector = new FakeApiConnector(TEST_SERVER_UUID, PROFILE_ID, null) {
    @Override
    protected <T extends ManagedEntity> Map<String, T> findAllEntitiesAsMapOld(final Class<T> instanceType) throws VmwareCheckedCloudException {
      processChecks();
      return Collections.emptyMap();
    }

    private void processChecks() {
      if (!canBeCalled.get()) {
        fail("Shouldn't be called");
      }
      assertTrue(callsCount.get() < 2);
      callsCount.incrementAndGet();
    }

    @Override
    protected Map<String, VirtualMachine> searchVMsByNames(@NotNull final Collection<String> names, @Nullable final Datacenter dc) throws VmwareCheckedCloudException {
      processChecks();
      return Collections.emptyMap();
    }
  };

  final CloudClientParameters clientParameters1 = new CloudClientParametersImpl(
    Collections.emptyMap(), CloudProfileUtil.collectionFromJson("[{sourceVmName:'image1', behaviour:'START_STOP'}]", PROJECT_ID));
  final VMWareCloudClient client1 = new MyClient(clientParameters1, null);


  final CloudClientParameters clientParameters2 = new CloudClientParametersImpl(
    Collections.emptyMap(), CloudProfileUtil.collectionFromJson(
    "[{sourceVmName:'image2',snapshot:'snap*',folder:'cf',pool:'rp'," +
    "maxInstances:3,behaviour:'ON_DEMAND_CLONE',customizationSpec:'someCustomization'}]", PROJECT_ID));

  final VMWareCloudClient client2 = new MyClient(clientParameters2, null);
  final VmwareUpdateInstanceTask task1 = myTaskManager.createUpdateTask(myFakeApiConnector, client1);


  canBeCalled.set(true);
  callsCount.set(0);
  task1.run();
  assertTrue(callsCount.get() > 0);

  client1.dispose();
  final VmwareUpdateInstanceTask task2 = myTaskManager.createUpdateTask(myFakeApiConnector, client2);
  canBeCalled.set(true);
  callsCount.set(0);
  task2.run();
  assertTrue(callsCount.get() > 0);


}
 
开发者ID:JetBrains,项目名称:teamcity-vmware-plugin,代码行数:55,代码来源:VmwarePooledUpdateInstanceTaskTest.java


示例20: setUp

import com.vmware.vim25.mo.Datacenter; //导入依赖的package包/类
@BeforeMethod
public void setUp() throws Exception {
  super.setUp();
  //org.apache.log4j.Logger.getLogger("jetbrains.buildServer").setLevel(Level.DEBUG);
  //org.apache.log4j.Logger.getRootLogger().addAppender(new ConsoleAppender());

  myIdxStorage = createTempDir();

  setInternalProperty("teamcity.vsphere.instance.status.update.delay.ms", "50");
  myClientParameters = new CloudClientParametersImpl(
    Collections.emptyMap(),
                                                     CloudProfileUtil.collectionFromJson("[{sourceVmName:'image1', behaviour:'START_STOP'}," +
                                                                                         "{sourceVmName:'image2',snapshot:'snap*',folder:'cf',pool:'rp',maxInstances:3,behaviour:'ON_DEMAND_CLONE', " +
                                                                                         "customizationSpec:'someCustomization'}," +
                                                                                         "{sourceVmName:'image_template', snapshot:'" + VmwareConstants.CURRENT_STATE +
                                                                                         "',folder:'cf',pool:'rp',maxInstances:3,behaviour:'FRESH_CLONE', customizationSpec: 'linux'}]",
                                                                                         PROJECT_ID));

  myFakeApi = new FakeApiConnector(TEST_SERVER_UUID, PROFILE_ID, null);
  FakeModel.instance().addDatacenter("dc");
  FakeModel.instance().addFolder("cf").setParent("dc", Datacenter.class);
  FakeModel.instance().addResourcePool("rp").setParentFolder("cf");
  FakeModel.instance().addVM("image1").setParentFolder("cf");
  FakeModel.instance().addVM("image2").setParentFolder("cf");
  FakeModel.instance().addVM("image_template").setParentFolder("cf");
  FakeModel.instance().addVMSnapshot("image2", "snap");
  FakeModel.instance().getCustomizationSpecs().put("someCustomization", new CustomizationSpec());
  FakeModel.instance().getCustomizationSpecs().put("linux", new CustomizationSpec());
  myLastRunTime = new AtomicLong(0);
  myStuckTime = new AtomicLong(2*60*1000);

  myTaskManager = new VmwareUpdateTaskManager(){
    @Override
    protected VmwarePooledUpdateInstanceTask createNewPooledTask(@NotNull final VMWareApiConnector connector, @NotNull final VMWareCloudClient client) {
      return new VmwarePooledUpdateInstanceTask(connector, client, myStuckTime.get(), false){
        @Override
        public void run() {
          super.run();
          myLastRunTime.set(System.currentTimeMillis());
        }
      };
    }
  };

  recreateClient();
  assertNull(myClient.getErrorInfo());
}
 
开发者ID:JetBrains,项目名称:teamcity-vmware-plugin,代码行数:48,代码来源:VmwareCloudIntegrationTest.java



注:本文中的com.vmware.vim25.mo.Datacenter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java PlainSocketFactory类代码示例发布时间:2022-05-22
下一篇:
Java SerialDatalink类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap