Package org.apache.cloudstack.engine.subsystem.api.storage

Examples of org.apache.cloudstack.engine.subsystem.api.storage.StrategyPriority


    private static <T> T bestMatch(Collection<T> collection, final CanHandle<T> canHandle) {
        if (collection.size() == 0)
            return null;

        StrategyPriority highestPriority = StrategyPriority.CANT_HANDLE;

        T strategyToUse = null;
        for (T strategy : collection) {
            StrategyPriority priority = canHandle.canHandle(strategy);
            if (priority.ordinal() > highestPriority.ordinal()) {
                highestPriority = priority;
                strategyToUse = strategy;
            }
        }
View Full Code Here


        Host srcHost = mock(Host.class);
        Host destHost = mock(Host.class);
        when(srcHost.getHypervisorType()).thenReturn(HypervisorType.VMware);
        when(destHost.getHypervisorType()).thenReturn(HypervisorType.VMware);
        Map<VolumeInfo, DataStore> volumeMap = new HashMap<VolumeInfo, DataStore>();
        StrategyPriority canHandle = strategy.canHandle(volumeMap, srcHost, destHost);
        assertTrue("The strategy is only supposed to handle vmware hosts", canHandle == StrategyPriority.HYPERVISOR);
    }
View Full Code Here

        Host srcHost = mock(Host.class);
        Host destHost = mock(Host.class);
        when(srcHost.getHypervisorType()).thenReturn(HypervisorType.XenServer);
        when(destHost.getHypervisorType()).thenReturn(HypervisorType.XenServer);
        Map<VolumeInfo, DataStore> volumeMap = new HashMap<VolumeInfo, DataStore>();
        StrategyPriority canHandle = strategy.canHandle(volumeMap, srcHost, destHost);
        assertFalse("The strategy is only supposed to handle vmware hosts", canHandle == StrategyPriority.HYPERVISOR);
    }
View Full Code Here

    private static <T> T bestMatch(Collection<T> collection, final CanHandle<T> canHandle) {
        if (collection.size() == 0)
            return null;

        StrategyPriority highestPriority = StrategyPriority.CANT_HANDLE;

        T strategyToUse = null;
        for (T strategy : collection) {
            StrategyPriority priority = canHandle.canHandle(strategy);
            if (priority.ordinal() > highestPriority.ordinal()) {
                highestPriority = priority;
                strategyToUse = strategy;
            }
        }
View Full Code Here

        Host srcHost = mock(Host.class);
        Host destHost = mock(Host.class);
        when(srcHost.getHypervisorType()).thenReturn(HypervisorType.VMware);
        when(destHost.getHypervisorType()).thenReturn(HypervisorType.VMware);
        Map<VolumeInfo, DataStore> volumeMap = new HashMap<VolumeInfo, DataStore>();
        StrategyPriority canHandle = strategy.canHandle(volumeMap, srcHost, destHost);
        assertTrue("The strategy is only supposed to handle vmware hosts", canHandle == StrategyPriority.HYPERVISOR);
    }
View Full Code Here

        Host srcHost = mock(Host.class);
        Host destHost = mock(Host.class);
        when(srcHost.getHypervisorType()).thenReturn(HypervisorType.XenServer);
        when(destHost.getHypervisorType()).thenReturn(HypervisorType.XenServer);
        Map<VolumeInfo, DataStore> volumeMap = new HashMap<VolumeInfo, DataStore>();
        StrategyPriority canHandle = strategy.canHandle(volumeMap, srcHost, destHost);
        assertFalse("The strategy is only supposed to handle vmware hosts", canHandle == StrategyPriority.HYPERVISOR);
    }
View Full Code Here

TOP

Related Classes of org.apache.cloudstack.engine.subsystem.api.storage.StrategyPriority

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.