...
NOTE #1: Specifying @RunWith denotes a junit test@RunWith(SpringJUnit4ClassRunner.class)
NOTE #2: ContextConfiguration tells Spring where to find the component configuration for this Junit test. AnnotationConfigContextLoader.class specifies that the test configuration exists within this class.@ContextConfiguration(loader = AnnotationConfigContextLoader.class)
NOTE #3: You need to initComponentsLifeCycle in setup because that causes all of the components injected follows CloudStack's life cycle management.ComponentContext.initComponentsLifeCycle();
NOTE #4: TestConfiguration Class tells Spring the configuration you want to use for this Junit test. Note the following things in the class.
...