use of org.apache.cloudstack.storage.to.ImageStoreTO in project cloudstack by apache.
the class DirectAgentTest method testDownloadTemplate.
@Test
public void testDownloadTemplate() {
ImageStoreTO image = Mockito.mock(ImageStoreTO.class);
PrimaryDataStoreTO primaryStore = Mockito.mock(PrimaryDataStoreTO.class);
Mockito.when(primaryStore.getUuid()).thenReturn(getLocalStorageUuid());
// Mockito.when(image.get).thenReturn(primaryStore);
ImageStoreTO imageStore = Mockito.mock(ImageStoreTO.class);
Mockito.when(imageStore.getProtocol()).thenReturn("http");
TemplateObjectTO template = Mockito.mock(TemplateObjectTO.class);
Mockito.when(template.getPath()).thenReturn(getTemplateUrl());
Mockito.when(template.getDataStore()).thenReturn(imageStore);
// Mockito.when(image.getTemplate()).thenReturn(template);
// CopyTemplateToPrimaryStorageCmd cmd = new
// CopyTemplateToPrimaryStorageCmd(image);
Command cmd = null;
try {
agentMgr.send(hostId, cmd);
} catch (AgentUnavailableException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (OperationTimedoutException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
use of org.apache.cloudstack.storage.to.ImageStoreTO in project cloudstack by apache.
the class ImageStoreImpl method getTO.
@Override
public DataStoreTO getTO() {
DataStoreTO to = getDriver().getStoreTO(this);
if (to == null) {
ImageStoreTO primaryTO = new ImageStoreTO();
primaryTO.setProviderName(getProviderName());
primaryTO.setRole(getRole());
primaryTO.setType(getProtocol());
primaryTO.setUri(getUri());
return primaryTO;
}
return to;
}
Aggregations