protected ResourceGroupState createResourceGroup(String contextId, List<String> tenantLinks) throws Throwable { ResourceGroupState resGroup = new ResourceGroupState(); resGroup.name = contextId; resGroup.documentSelfLink = UriUtils.buildUriPath(ResourceGroupService.FACTORY_LINK, contextId); resGroup.tenantLinks = tenantLinks; resGroup.customProperties = new HashMap<>(); resGroup.customProperties.put(ComputeProperties.RESOURCE_TYPE_KEY, COMPUTE_DEPLOYMENT_TYPE_VALUE); return getOrCreateDocument(resGroup, ResourceGroupService.FACTORY_LINK); }
protected void createHostPortProfile() throws Throwable { if (hostPortProfileState != null) { return; } hostPortProfileState = new HostPortProfileService.HostPortProfileState(); hostPortProfileState.hostLink = computeHost.documentSelfLink; hostPortProfileState.id = computeHost.id; hostPortProfileState.documentSelfLink = hostPortProfileState.id; hostPortProfileState = getOrCreateDocument(hostPortProfileState, HostPortProfileService.FACTORY_LINK); assertNotNull(hostPortProfileState); documentsForDeletion.add(hostPortProfileState); }
protected synchronized ResourcePoolState createResourcePool() throws Throwable { synchronized (initializationLock) { if (resourcePool == null) { resourcePool = getOrCreateDocument(TestRequestStateFactory.createResourcePool(), ResourcePoolService.FACTORY_LINK); assertNotNull(resourcePool); } return resourcePool; } }
protected GroupResourcePlacementState createGroupResourcePlacement( ResourcePoolState resourcePool, int numberOfInstances) throws Throwable { synchronized (initializationLock) { if (groupPlacementState == null) { groupPlacementState = TestRequestStateFactory .createGroupResourcePlacementState(ResourceType.CONTAINER_TYPE); groupPlacementState.maxNumberInstances = numberOfInstances; groupPlacementState.resourcePoolLink = resourcePool.documentSelfLink; groupPlacementState = getOrCreateDocument(groupPlacementState, GroupResourcePlacementService.FACTORY_LINK); assertNotNull(groupPlacementState); } return groupPlacementState; } }
containerHost = getOrCreateDocument(containerHost, ComputeService.FACTORY_LINK); assertNotNull(containerHost); if (generateId) {