Package org.apache.cloudstack.storage.helper

Examples of org.apache.cloudstack.storage.helper.StorageStrategyFactoryImpl


        doReturn(StrategyPriority.HIGHEST).when(highestStrategy).canHandle(any(Snapshot.class), any(SnapshotOperation.class));

        List<SnapshotStrategy> strategies = new ArrayList<SnapshotStrategy>(5);
        SnapshotStrategy strategy = null;

        StorageStrategyFactoryImpl factory = new StorageStrategyFactoryImpl();
        factory.setSnapshotStrategies(strategies);

        strategies.add(cantHandleStrategy);
        strategy = factory.getSnapshotStrategy(mock(Snapshot.class), SnapshotOperation.TAKE);
        assertEquals("A strategy was found when it shouldn't have been.", null, strategy);

        strategies.add(defaultStrategy);
        strategy = factory.getSnapshotStrategy(mock(Snapshot.class), SnapshotOperation.TAKE);
        assertEquals("Default strategy was not picked.", defaultStrategy, strategy);

        strategies.add(hyperStrategy);
        strategy = factory.getSnapshotStrategy(mock(Snapshot.class), SnapshotOperation.TAKE);
        assertEquals("Hypervisor strategy was not picked.", hyperStrategy, strategy);

        strategies.add(pluginStrategy);
        strategy = factory.getSnapshotStrategy(mock(Snapshot.class), SnapshotOperation.TAKE);
        assertEquals("Plugin strategy was not picked.", pluginStrategy, strategy);

        strategies.add(highestStrategy);
        strategy = factory.getSnapshotStrategy(mock(Snapshot.class), SnapshotOperation.TAKE);
        assertEquals("Highest strategy was not picked.", highestStrategy, strategy);
    }
View Full Code Here


        doReturn(StrategyPriority.HIGHEST).when(highestStrategy).canHandle(any(DataObject.class), any(DataObject.class));

        List<DataMotionStrategy> strategies = new ArrayList<DataMotionStrategy>(5);
        DataMotionStrategy strategy = null;

        StorageStrategyFactoryImpl factory = new StorageStrategyFactoryImpl();
        factory.setDataMotionStrategies(strategies);

        strategies.add(cantHandleStrategy);
        strategy = factory.getDataMotionStrategy(mock(DataObject.class), mock(DataObject.class));
        assertEquals("A strategy was found when it shouldn't have been.", null, strategy);

        strategies.add(defaultStrategy);
        strategy = factory.getDataMotionStrategy(mock(DataObject.class), mock(DataObject.class));
        assertEquals("Default strategy was not picked.", defaultStrategy, strategy);

        strategies.add(hyperStrategy);
        strategy = factory.getDataMotionStrategy(mock(DataObject.class), mock(DataObject.class));
        assertEquals("Hypervisor strategy was not picked.", hyperStrategy, strategy);

        strategies.add(pluginStrategy);
        strategy = factory.getDataMotionStrategy(mock(DataObject.class), mock(DataObject.class));
        assertEquals("Plugin strategy was not picked.", pluginStrategy, strategy);

        strategies.add(highestStrategy);
        strategy = factory.getDataMotionStrategy(mock(DataObject.class), mock(DataObject.class));
        assertEquals("Highest strategy was not picked.", highestStrategy, strategy);
    }
View Full Code Here

        doReturn(StrategyPriority.HIGHEST).when(highestStrategy).canHandle(any(Map.class), any(Host.class), any(Host.class));

        List<DataMotionStrategy> strategies = new ArrayList<DataMotionStrategy>(5);
        DataMotionStrategy strategy = null;

        StorageStrategyFactoryImpl factory = new StorageStrategyFactoryImpl();
        factory.setDataMotionStrategies(strategies);

        strategies.add(cantHandleStrategy);
        strategy = factory.getDataMotionStrategy(mock(Map.class), mock(Host.class), mock(Host.class));
        assertEquals("A strategy was found when it shouldn't have been.", null, strategy);

        strategies.add(defaultStrategy);
        strategy = factory.getDataMotionStrategy(mock(Map.class), mock(Host.class), mock(Host.class));
        assertEquals("Default strategy was not picked.", defaultStrategy, strategy);

        strategies.add(hyperStrategy);
        strategy = factory.getDataMotionStrategy(mock(Map.class), mock(Host.class), mock(Host.class));
        assertEquals("Hypervisor strategy was not picked.", hyperStrategy, strategy);

        strategies.add(pluginStrategy);
        strategy = factory.getDataMotionStrategy(mock(Map.class), mock(Host.class), mock(Host.class));
        assertEquals("Plugin strategy was not picked.", pluginStrategy, strategy);

        strategies.add(highestStrategy);
        strategy = factory.getDataMotionStrategy(mock(Map.class), mock(Host.class), mock(Host.class));
        assertEquals("Highest strategy was not picked.", highestStrategy, strategy);
    }
View Full Code Here

        doReturn(StrategyPriority.HIGHEST).when(highestStrategy).canHandle(any(Snapshot.class), any(SnapshotOperation.class));

        List<SnapshotStrategy> strategies = new ArrayList<SnapshotStrategy>(5);
        SnapshotStrategy strategy = null;

        StorageStrategyFactoryImpl factory = new StorageStrategyFactoryImpl();
        factory.setSnapshotStrategies(strategies);

        strategies.add(cantHandleStrategy);
        strategy = factory.getSnapshotStrategy(mock(Snapshot.class), SnapshotOperation.TAKE);
        assertEquals("A strategy was found when it shouldn't have been.", null, strategy);

        strategies.add(defaultStrategy);
        strategy = factory.getSnapshotStrategy(mock(Snapshot.class), SnapshotOperation.TAKE);
        assertEquals("Default strategy was not picked.", defaultStrategy, strategy);

        strategies.add(hyperStrategy);
        strategy = factory.getSnapshotStrategy(mock(Snapshot.class), SnapshotOperation.TAKE);
        assertEquals("Hypervisor strategy was not picked.", hyperStrategy, strategy);

        strategies.add(pluginStrategy);
        strategy = factory.getSnapshotStrategy(mock(Snapshot.class), SnapshotOperation.TAKE);
        assertEquals("Plugin strategy was not picked.", pluginStrategy, strategy);

        strategies.add(highestStrategy);
        strategy = factory.getSnapshotStrategy(mock(Snapshot.class), SnapshotOperation.TAKE);
        assertEquals("Highest strategy was not picked.", highestStrategy, strategy);
    }
View Full Code Here

        doReturn(StrategyPriority.HIGHEST).when(highestStrategy).canHandle(any(DataObject.class), any(DataObject.class));

        List<DataMotionStrategy> strategies = new ArrayList<DataMotionStrategy>(5);
        DataMotionStrategy strategy = null;

        StorageStrategyFactoryImpl factory = new StorageStrategyFactoryImpl();
        factory.setDataMotionStrategies(strategies);

        strategies.add(cantHandleStrategy);
        strategy = factory.getDataMotionStrategy(mock(DataObject.class), mock(DataObject.class));
        assertEquals("A strategy was found when it shouldn't have been.", null, strategy);

        strategies.add(defaultStrategy);
        strategy = factory.getDataMotionStrategy(mock(DataObject.class), mock(DataObject.class));
        assertEquals("Default strategy was not picked.", defaultStrategy, strategy);

        strategies.add(hyperStrategy);
        strategy = factory.getDataMotionStrategy(mock(DataObject.class), mock(DataObject.class));
        assertEquals("Hypervisor strategy was not picked.", hyperStrategy, strategy);

        strategies.add(pluginStrategy);
        strategy = factory.getDataMotionStrategy(mock(DataObject.class), mock(DataObject.class));
        assertEquals("Plugin strategy was not picked.", pluginStrategy, strategy);

        strategies.add(highestStrategy);
        strategy = factory.getDataMotionStrategy(mock(DataObject.class), mock(DataObject.class));
        assertEquals("Highest strategy was not picked.", highestStrategy, strategy);
    }
View Full Code Here

        doReturn(StrategyPriority.HIGHEST).when(highestStrategy).canHandle(any(Map.class), any(Host.class), any(Host.class));

        List<DataMotionStrategy> strategies = new ArrayList<DataMotionStrategy>(5);
        DataMotionStrategy strategy = null;

        StorageStrategyFactoryImpl factory = new StorageStrategyFactoryImpl();
        factory.setDataMotionStrategies(strategies);

        strategies.add(cantHandleStrategy);
        strategy = factory.getDataMotionStrategy(mock(Map.class), mock(Host.class), mock(Host.class));
        assertEquals("A strategy was found when it shouldn't have been.", null, strategy);

        strategies.add(defaultStrategy);
        strategy = factory.getDataMotionStrategy(mock(Map.class), mock(Host.class), mock(Host.class));
        assertEquals("Default strategy was not picked.", defaultStrategy, strategy);

        strategies.add(hyperStrategy);
        strategy = factory.getDataMotionStrategy(mock(Map.class), mock(Host.class), mock(Host.class));
        assertEquals("Hypervisor strategy was not picked.", hyperStrategy, strategy);

        strategies.add(pluginStrategy);
        strategy = factory.getDataMotionStrategy(mock(Map.class), mock(Host.class), mock(Host.class));
        assertEquals("Plugin strategy was not picked.", pluginStrategy, strategy);

        strategies.add(highestStrategy);
        strategy = factory.getDataMotionStrategy(mock(Map.class), mock(Host.class), mock(Host.class));
        assertEquals("Highest strategy was not picked.", highestStrategy, strategy);
    }
View Full Code Here

TOP

Related Classes of org.apache.cloudstack.storage.helper.StorageStrategyFactoryImpl

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.