|
Spring for Apache Hadoop | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT | ||||||||
@Retention(value=RUNTIME) @Target(value=TYPE) @ContextConfiguration(loader=YarnDelegatingSmartContextLoader.class) @MiniYarnCluster public @interface MiniYarnClusterTest
Composed annotation having @MiniYarnCluster,
@ContextConfiguration using loader YarnDelegatingSmartContextLoader
and empty Spring @Configuration.
Typical use for this annotation would look like:
@MiniYarnClusterTest
public class AppTests extends AbstractBootYarnClusterTests {
@Test
public void testApp() {
// test methods
}
}
Drawback of using a composed annotation like this is that the
@Configuration is then applied from an annotation
class itself and user can't no longer add a static @Configuration
class in a test class itself and expect Spring to pick it up from
there which is a normal behaviour in Spring testing support.
If user wants to use a simple composed annotation and use a
custom @Configuration, one can simply duplicate
functionality of this @MiniYarnClusterTest annotation.
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@ContextConfiguration(loader=YarnDelegatingSmartContextLoader.class)
@MiniYarnCluster
public @interface CustomMiniYarnClusterTest {
@Configuration
public static class Config {
@Bean
public String myCustomBean() {
return "myCustomBean";
}
}
}
|
Spring for Apache Hadoop | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT | ||||||||