use of org.apache.cloudstack.engine.subsystem.api.storage.TemplateService.TemplateApiResult in project cloudstack by apache.
the class S3TemplateTest method registerTemplate.
@Test(priority = 1)
public void registerTemplate() {
TemplateInfo template = templateFactory.getTemplate(templateId, DataStoreRole.Image);
DataStore store = dataStoreMgr.getImageStore(dcId);
AsyncCallFuture<TemplateApiResult> future = new AsyncCallFuture<TemplateApiResult>();
templateSvr.createTemplateAsync(template, store, future);
try {
TemplateApiResult result = future.get();
assertTrue(result.isSuccess(), "failed to register template: " + result.getResult());
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
assertTrue(false, e.getMessage());
} catch (ExecutionException e) {
// TODO Auto-generated catch block
e.printStackTrace();
assertTrue(false, e.getMessage());
}
}
use of org.apache.cloudstack.engine.subsystem.api.storage.TemplateService.TemplateApiResult in project cloudstack by apache.
the class TemplateTest method deleteTemplate.
// @Test
public void deleteTemplate() {
TemplateInfo template = templateFactory.getTemplate(templateId, DataStoreRole.Image);
DataStore store = dataStoreMgr.getImageStore(dcId);
AsyncCallFuture<TemplateApiResult> future = new AsyncCallFuture<TemplateApiResult>();
templateSvr.deleteTemplateAsync(template);
try {
TemplateApiResult result = future.get();
assertTrue(result.isSuccess(), "failed to delete template: " + result.getResult());
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
assertTrue(false, e.getMessage());
} catch (ExecutionException e) {
// TODO Auto-generated catch block
e.printStackTrace();
assertTrue(false, e.getMessage());
}
}
use of org.apache.cloudstack.engine.subsystem.api.storage.TemplateService.TemplateApiResult in project cloudstack by apache.
the class TemplateTest method registerTemplate.
@Test
public void registerTemplate() {
TemplateInfo template = templateFactory.getTemplate(templateId, DataStoreRole.Image);
DataStore store = dataStoreMgr.getImageStore(dcId);
AsyncCallFuture<TemplateApiResult> future = new AsyncCallFuture<TemplateApiResult>();
templateSvr.createTemplateAsync(template, store, future);
try {
TemplateApiResult result = future.get();
assertTrue(result.isSuccess(), "failed to register template: " + result.getResult());
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
assertTrue(false, e.getMessage());
} catch (ExecutionException e) {
// TODO Auto-generated catch block
e.printStackTrace();
assertTrue(false, e.getMessage());
}
}
use of org.apache.cloudstack.engine.subsystem.api.storage.TemplateService.TemplateApiResult in project cloudstack by apache.
the class VolumeTest method testCreateTemplateFromVolume.
@Test
public void testCreateTemplateFromVolume() throws InterruptedException, ExecutionException {
DataStore primaryStore = createPrimaryDataStore();
primaryStoreId = primaryStore.getId();
primaryStore = this.dataStoreMgr.getPrimaryDataStore(primaryStoreId);
VolumeVO volume = createVolume(null, primaryStore.getId());
VolumeInfo volInfo = this.volFactory.getVolume(volume.getId());
AsyncCallFuture<VolumeApiResult> future = this.volumeService.createVolumeAsync(volInfo, primaryStore);
VolumeApiResult result = future.get();
AssertJUnit.assertTrue(result.isSuccess());
volInfo = result.getVolume();
VMTemplateVO templateVO = createTemplateInDb();
TemplateInfo tmpl = this.templateFactory.getTemplate(templateVO.getId(), DataStoreRole.Image);
DataStore imageStore = this.dataStoreMgr.getImageStore(this.dcId);
AsyncCallFuture<TemplateApiResult> templateResult = this.imageService.createTemplateFromVolumeAsync(volInfo, tmpl, imageStore);
TemplateApiResult templateApiResult = templateResult.get();
Assert.assertTrue(templateApiResult.isSuccess());
}
Aggregations