Alex,
The reasons as far as I can tell:
ConfigurationManagerImpl is the class under test. Unfortunately it depends on a
dozon of DAOs/managers, which are not added as Mocks but real impls and they
have further cascading dependencies.
Currently not all of required dependencies are added to mockcomponentlocator in
setUp(), and componentlocator will complain about missing Daos/Managers when
ant test.
But even if I added all required dependencies (a lot), it still failed. Please
check following log, seems that PremiumSecondaryStorageManagerImpl is using a
componentLocator (instead of MockComponentLocator) to configure..
dary storage vm manager
[junit] ERROR [utils.component.ComponentLocator] (main:) Unable to load
configuration for management-server from components.xml
[junit] com.cloud.utils.exception.CloudRuntimeException: Unable to find DAO
com.cloud.configuration.dao.ConfigurationDao
[junit] at
com.cloud.utils.component.ComponentLocator.getDao(ComponentLocator.java:399)
[junit] at
com.cloud.utils.component.ComponentLocator.getDao(ComponentLocator.java:422)
[junit] at
com.cloud.storage.secondary.SecondaryStorageManagerImpl.configure(SecondaryStorageManagerImpl.java:794)
[junit] at
com.cloud.secstorage.PremiumSecondaryStorageManagerImpl.configure(PremiumSecondaryStorageManagerImpl.java:67)
[junit] at
com.cloud.utils.component.ComponentLocator.configureManagers(ComponentLocator.java:460)
[junit] at
com.cloud.utils.component.ComponentLocator.parse(ComponentLocator.java:252)
[junit] at
com.cloud.utils.component.ComponentLocator.getLocatorInternal(ComponentLocator.java:836)
[junit] at
com.cloud.utils.component.ComponentLocator.getLocator(ComponentLocator.java:874)
[junit] at
com.cloud.storage.listener.StoragePoolMonitor.<init>(StoragePoolMonitor.java:53)
[junit] at
com.cloud.storage.StorageManagerImpl.configure(StorageManagerImpl.java:949)
[junit] at
com.cloud.utils.component.ComponentLocator.configureManagers(ComponentLocator.java:460)
[junit] at
com.cloud.utils.component.ComponentLocator.parse(ComponentLocator.java:252)
[junit] at
com.cloud.utils.component.MockComponentLocator.makeActive(MockComponentLocator.java:91)
[junit] at
com.cloud.agent.manager.ResourceManagerTest.setUp(ResourceManagerTest.java:381)
[junit] at junit.framework.TestCase.runBare(TestCase.java:132)
[junit] at junit.framework.TestResult$1.protect(TestResult.java:110)
[junit] at junit.framework.TestResult.runProtected(TestResult.java:128)
[junit] at junit.framework.TestResult.run(TestResult.java:113)
[junit] at junit.framework.TestCase.run(TestCase.java:124)
[junit] at junit.framework.TestSuite.runTest(TestSuite.java:232)
[junit] at junit.framework.TestSuite.run(TestSuite.java:227)
[junit] at
org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
[junit] at
junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:39)
[junit] at
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:420)
[junit] at
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:911)
[junit] at
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:768)
Finally I'm not very clear about the intention and scope of this unit-test, and
why it does not use any mocks. It seems to test a createZoneCmd, IMHO, this is
more like an integration test, since CreateZoneCmd will call networkmanager,
which in turns will call networkGurus, too much to be tested here.
Hope this help.
Regards
Mice