Search in sources :

Example 1 with ImageStoreTO

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();
    }
}
Also used : OperationTimedoutException(com.cloud.exception.OperationTimedoutException) ImageStoreTO(org.apache.cloudstack.storage.to.ImageStoreTO) PrimaryDataStoreTO(org.apache.cloudstack.storage.to.PrimaryDataStoreTO) Command(com.cloud.agent.api.Command) ReadyCommand(com.cloud.agent.api.ReadyCommand) AgentUnavailableException(com.cloud.exception.AgentUnavailableException) TemplateObjectTO(org.apache.cloudstack.storage.to.TemplateObjectTO) Test(org.testng.annotations.Test)

Example 2 with ImageStoreTO

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;
}
Also used : DataStoreTO(com.cloud.agent.api.to.DataStoreTO) ImageStoreTO(org.apache.cloudstack.storage.to.ImageStoreTO)

Aggregations

ImageStoreTO (org.apache.cloudstack.storage.to.ImageStoreTO)2 Command (com.cloud.agent.api.Command)1 ReadyCommand (com.cloud.agent.api.ReadyCommand)1 DataStoreTO (com.cloud.agent.api.to.DataStoreTO)1 AgentUnavailableException (com.cloud.exception.AgentUnavailableException)1 OperationTimedoutException (com.cloud.exception.OperationTimedoutException)1 PrimaryDataStoreTO (org.apache.cloudstack.storage.to.PrimaryDataStoreTO)1 TemplateObjectTO (org.apache.cloudstack.storage.to.TemplateObjectTO)1 Test (org.testng.annotations.Test)1