Package com.cloud.resource

Examples of com.cloud.resource.ResourceService


    }

    @Test
    public void testExecuteForNullResult() {

        ResourceService resourceService = Mockito.mock(ResourceService.class);
        addHostCmd._resourceService = resourceService;

        try {
            Mockito.when(resourceService.discoverHosts(addHostCmd)).thenReturn(
                    null);
        } catch (InvalidParameterValueException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IllegalArgumentException e) {
View Full Code Here


    }

    @Test
    public void testExecuteForNullResult() {

        ResourceService resourceService = Mockito.mock(ResourceService.class);

        try {
            Mockito.when(resourceService.discoverCluster(addClusterCmd))
                    .thenReturn(null);
        } catch (ResourceInUseException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IllegalArgumentException e) {
View Full Code Here

    }

    @Test
    public void testExecuteForEmptyResult() {

        ResourceService resourceService = Mockito.mock(ResourceService.class);
        addClusterCmd._resourceService = resourceService;

        try {
            addClusterCmd.execute();
        } catch (ServerApiException exception) {
View Full Code Here

    }

    @Test
    public void testExecuteForNullResult() {

        ResourceService resourceService = Mockito.mock(ResourceService.class);
        addHostCmd._resourceService = resourceService;

        try {
            Mockito.when(resourceService.discoverHosts(addHostCmd)).thenReturn(null);
        } catch (InvalidParameterValueException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IllegalArgumentException e) {
            // TODO Auto-generated catch block
View Full Code Here

    }

    @Test
    public void testExecuteForNullResult() {

        ResourceService resourceService = Mockito.mock(ResourceService.class);

        try {
            Mockito.when(resourceService.discoverCluster(addClusterCmd)).thenReturn(null);
        } catch (ResourceInUseException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IllegalArgumentException e) {
            // TODO Auto-generated catch block
View Full Code Here

    }

    @Test
    public void testExecuteForEmptyResult() {

        ResourceService resourceService = Mockito.mock(ResourceService.class);
        addClusterCmd._resourceService = resourceService;

        try {
            addClusterCmd.execute();
        } catch (ServerApiException exception) {
View Full Code Here

    }

    @Test
    public void testExecuteSuccess() {

        ResourceService resourceService = Mockito.mock(ResourceService.class);
        addSwiftCmd._resourceService = resourceService;

        Swift swift = Mockito.mock(Swift.class);

        try {
            Mockito.when(resourceService.discoverSwift(addSwiftCmd))
                    .thenReturn(swift);
        } catch (DiscoveryException e) {
            e.printStackTrace();
        }
View Full Code Here

    }

    @Test
    public void testExecuteFailure() {

        ResourceService resourceService = Mockito.mock(ResourceService.class);
        addSwiftCmd._resourceService = resourceService;
        try {
            Mockito.when(resourceService.discoverSwift(addSwiftCmd))
                    .thenReturn(null);
        } catch (DiscoveryException e) {
            e.printStackTrace();
        }
View Full Code Here

    }

    @Test
    public void testExecuteForResult() throws Exception {

        ResourceService resourceService = Mockito.mock(ResourceService.class);
        addSecondaryStorageCmd._resourceService = resourceService;

        Host host = Mockito.mock(Host.class);
        Host[] mockHosts = new Host[] { host };

        Mockito.when(resourceService.discoverHosts(addSecondaryStorageCmd))
                .thenReturn(Arrays.asList(mockHosts));

        ResponseGenerator responseGenerator = Mockito
                .mock(ResponseGenerator.class);
        addSecondaryStorageCmd._responseGenerator = responseGenerator;
View Full Code Here

    }

    @Test
    public void testExecuteForEmptyResult() throws Exception {

        ResourceService resourceService = Mockito.mock(ResourceService.class);
        addSecondaryStorageCmd._resourceService = resourceService;

        Host[] mockHosts = new Host[] {};

        Mockito.when(resourceService.discoverHosts(addSecondaryStorageCmd))
                .thenReturn(Arrays.asList(mockHosts));

        try {
            addSecondaryStorageCmd.execute();
        } catch (ServerApiException exception) {
View Full Code Here

TOP

Related Classes of com.cloud.resource.ResourceService

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.