private ContainerDescription createAndStoreContainerDescription( String link, Long memoryLimit) throws Throwable { ContainerDescription containerDesc = new ContainerDescription(); containerDesc.documentSelfLink = link + UUID.randomUUID().toString(); containerDesc.name = "name"; containerDesc.memoryLimit = memoryLimit; containerDesc.image = "image"; containerDesc = doPost(containerDesc, ContainerDescriptionService.FACTORY_LINK); assertNotNull(containerDesc); return containerDesc; }
private ContainerState createContainer(String groupResourcePlacementLink) throws Throwable { ContainerState containerState = new ContainerState(); containerState.id = UUID.randomUUID().toString(); containerState.names = new ArrayList<>(Arrays.asList("name_" + containerState.id)); containerState.command = new String[] { "cat" }; containerState.adapterManagementReference = URI .create("http://remote-host:8082/docker-executor"); containerState.address = "http://docker:5432/"; containerState.descriptionLink = UriUtils.buildUriPath( ContainerDescriptionService.FACTORY_LINK, "docker-nginx"); containerState.customProperties = new HashMap<>(); containerState.powerState = ContainerState.PowerState.RUNNING; containerState.parentLink = "/parent/link"; containerState.groupResourcePlacementLink = groupResourcePlacementLink; containerState = doPost(containerState, ContainerFactoryService.SELF_LINK); return containerState; } }
private ResourcePoolState createResourcePool(String link, Long maxMemory, Long maxStorage) throws Throwable { ResourcePoolState poolState = new ResourcePoolState(); poolState.id = link + "-" + UUID.randomUUID().toString(); poolState.name = poolState.id; poolState.documentSelfLink = poolState.id; poolState.maxCpuCount = 1600L; poolState.minCpuCount = 16L; poolState.minMemoryBytes = maxMemory / 2; poolState.maxMemoryBytes = maxMemory; poolState.minDiskCapacityBytes = poolState.maxDiskCapacityBytes = maxStorage; ResourcePoolState outResPoolState = doPost(poolState, ResourcePoolService.FACTORY_LINK); assertNotNull(outResPoolState); return outResPoolState; }
state.documentSelfLink = UUID.randomUUID().toString(); doPost(state, GroupResourcePlacementService.FACTORY_LINK);
placementState.resourcePoolLink = resourcePool.documentSelfLink; GroupResourcePlacementState outPlacementState = doPost(placementState, GroupResourcePlacementService.FACTORY_LINK);