Search in sources :

Example 1 with ImageEnumerationTaskState

use of com.vmware.photon.controller.model.tasks.ImageEnumerationTaskService.ImageEnumerationTaskState in project photon-model by vmware.

the class TestAzureImageEnumerationTask method testPublicImageEnumeration_defaultThroughFilter.

@Test
public void testPublicImageEnumeration_defaultThroughFilter() throws Throwable {
    Assume.assumeFalse(this.isMock);
    ImageEnumerationTaskState task = kickOffImageEnumeration(this.endpointState, PUBLIC, AZURE_DEFAULT_IMAGES_FILTER);
    // Validate 11 image states are created.
    assertDefaultImages(task);
}
Also used : ImageEnumerationTaskState(com.vmware.photon.controller.model.tasks.ImageEnumerationTaskService.ImageEnumerationTaskState) AzureBaseTest(com.vmware.photon.controller.model.adapters.azure.base.AzureBaseTest) Test(org.junit.Test)

Example 2 with ImageEnumerationTaskState

use of com.vmware.photon.controller.model.tasks.ImageEnumerationTaskService.ImageEnumerationTaskState in project photon-model by vmware.

the class TestVSphereProvisionFromImageLink method doRefresh.

private void doRefresh() throws Throwable {
    ImageEnumerationTaskState task = new ImageEnumerationTaskState();
    if (isMock()) {
        task.options = EnumSet.of(TaskOption.IS_MOCK);
    }
    task.enumerationAction = EnumerationAction.REFRESH;
    task.endpointLink = this.endpoint.documentSelfLink;
    ImageEnumerationTaskState outTask = TestUtils.doPost(this.host, task, ImageEnumerationTaskState.class, UriUtils.buildUri(this.host, ImageEnumerationTaskService.FACTORY_LINK));
    this.host.waitForFinishedTask(ImageEnumerationTaskState.class, outTask.documentSelfLink);
}
Also used : ImageEnumerationTaskState(com.vmware.photon.controller.model.tasks.ImageEnumerationTaskService.ImageEnumerationTaskState)

Example 3 with ImageEnumerationTaskState

use of com.vmware.photon.controller.model.tasks.ImageEnumerationTaskService.ImageEnumerationTaskState in project photon-model by vmware.

the class TestVSphereImageEnumerationTask method doRefresh.

private void doRefresh() throws Throwable {
    ImageEnumerationTaskState task = new ImageEnumerationTaskState();
    if (isMock()) {
        task.options = EnumSet.of(TaskOption.IS_MOCK);
    }
    task.enumerationAction = EnumerationAction.REFRESH;
    task.endpointLink = this.endpoint.documentSelfLink;
    ImageEnumerationTaskState outTask = TestUtils.doPost(this.host, task, ImageEnumerationTaskState.class, UriUtils.buildUri(this.host, ImageEnumerationTaskService.FACTORY_LINK));
    this.host.waitForFinishedTask(ImageEnumerationTaskState.class, outTask.documentSelfLink);
}
Also used : ImageEnumerationTaskState(com.vmware.photon.controller.model.tasks.ImageEnumerationTaskService.ImageEnumerationTaskState)

Example 4 with ImageEnumerationTaskState

use of com.vmware.photon.controller.model.tasks.ImageEnumerationTaskService.ImageEnumerationTaskState in project photon-model by vmware.

the class TestAzureImageEnumerationTask method testPublicImageEnumeration_all.

@Test
public void testPublicImageEnumeration_all() throws Throwable {
    Assume.assumeFalse(this.isMock);
    Assume.assumeTrue(this.enableLongRunning);
    // This test takes about 30 mins!
    getHost().setTimeoutSeconds((int) TimeUnit.MINUTES.toSeconds(40));
    ImageEnumerationTaskState task = kickOffImageEnumeration(this.endpointState, PUBLIC, null);
    // Validate at least 4.5K image states are created
    QueryByPages<ImageState> queryAll = new QueryByPages<ImageState>(getHost(), Builder.create().addKindFieldClause(ImageState.class).build(), ImageState.class, task.tenantLinks);
    queryAll.setMaxPageSize(QueryUtils.DEFAULT_MAX_RESULT_LIMIT);
    Long imagesCount = PhotonModelUtils.waitToComplete(queryAll.collectLinks(Collectors.counting()));
    Assert.assertTrue("Expected at least " + 4_500 + " images, but found only " + imagesCount, imagesCount > 4_500);
}
Also used : QueryByPages(com.vmware.photon.controller.model.query.QueryUtils.QueryByPages) ImageEnumerationTaskState(com.vmware.photon.controller.model.tasks.ImageEnumerationTaskService.ImageEnumerationTaskState) ImageState(com.vmware.photon.controller.model.resources.ImageService.ImageState) AzureBaseTest(com.vmware.photon.controller.model.adapters.azure.base.AzureBaseTest) Test(org.junit.Test)

Example 5 with ImageEnumerationTaskState

use of com.vmware.photon.controller.model.tasks.ImageEnumerationTaskService.ImageEnumerationTaskState in project photon-model by vmware.

the class TestAzureImageEnumerationTask method testPublicImageEnumeration_defaultThroughMode.

@Test
public void testPublicImageEnumeration_defaultThroughMode() throws Throwable {
    Assume.assumeFalse(this.isMock);
    setImagesLoadMode(ImagesLoadMode.DEFAULT);
    try {
        ImageEnumerationTaskState task = kickOffImageEnumeration(this.endpointState, PUBLIC, AZURE_ALL_IMAGES_FILTER);
        assertDefaultImages(task);
    } finally {
        setImagesLoadMode(ImagesLoadMode.ALL);
    }
}
Also used : ImageEnumerationTaskState(com.vmware.photon.controller.model.tasks.ImageEnumerationTaskService.ImageEnumerationTaskState) AzureBaseTest(com.vmware.photon.controller.model.adapters.azure.base.AzureBaseTest) Test(org.junit.Test)

Aggregations

ImageEnumerationTaskState (com.vmware.photon.controller.model.tasks.ImageEnumerationTaskService.ImageEnumerationTaskState)10 Test (org.junit.Test)6 AzureBaseTest (com.vmware.photon.controller.model.adapters.azure.base.AzureBaseTest)4 ImageState (com.vmware.photon.controller.model.resources.ImageService.ImageState)4 QueryByPages (com.vmware.photon.controller.model.query.QueryUtils.QueryByPages)3 BaseModelTest (com.vmware.photon.controller.model.helpers.BaseModelTest)2 EndpointState (com.vmware.photon.controller.model.resources.EndpointService.EndpointState)2 QueryTop (com.vmware.photon.controller.model.query.QueryUtils.QueryTop)1 List (java.util.List)1