@Test public void should_get_proeprties_from_chameleon_annotation_with_system_properties() { System.setProperty("arquillian.container", "wildfly:8.2.0.Final:managed"); final ChameleonTarget chameleonTarget = SystemPropertiesTest.class.getAnnotation(ChameleonTarget.class); final ChameleonTargetConfiguration chameleonTargetConfiguration = AnnotationExtractor.extract(chameleonTarget); assertThat(chameleonTargetConfiguration.getContainer()).isEqualTo("wildfly"); assertThat(chameleonTargetConfiguration.getVersion()).isEqualTo("8.2.0.Final"); assertThat(chameleonTargetConfiguration.getMode()).isEqualTo(Mode.MANAGED); }
public static ChameleonTargetConfiguration extract(Annotation annotation) { final Class<? extends Annotation> annotationType = annotation.annotationType(); ChameleonTargetConfiguration currentConfiguration = null; if (annotationType == ChameleonTarget.class) { ChameleonTarget chameleonTarget = (ChameleonTarget) annotation; return ChameleonTargetConfiguration.from(chameleonTarget); } final Annotation[] metaAnnotations = findAndSortAnnotations(annotation); for (Annotation metaAnnotation : metaAnnotations) { if (! metaAnnotation.annotationType().getName().startsWith("java.lang")) { final ChameleonTargetConfiguration chameleonTargetConfiguration = extract(metaAnnotation); if (currentConfiguration != null) { currentConfiguration = currentConfiguration.importConfiguration(chameleonTargetConfiguration); } else { currentConfiguration = chameleonTargetConfiguration; } } } return currentConfiguration; }
AnnotationExtractor { public static ChameleonTargetConfiguration extract(Annotation annotation) { final Class<? extends Annotation> annotationType = annotation.annotationType(); ChameleonTargetConfiguration currentConfiguration = null; if (annotationType == ChameleonTarget.class) { ChameleonTarget chameleonTarget = (ChameleonTarget) annotation; return ChameleonTargetConfiguration.from(chameleonTarget); } final Annotation[] metaAnnotations = findAndSortAnnotations(annotation); for (Annotation metaAnnotation : metaAnnotations) { if (! metaAnnotation.annotationType().getName().startsWith("java.lang")) { final ChameleonTargetConfiguration chameleonTargetConfiguration = extract(metaAnnotation); if (currentConfiguration != null) { currentConfiguration = currentConfiguration.importConfiguration(chameleonTargetConfiguration); } else { currentConfiguration = chameleonTargetConfiguration; } } } return currentConfiguration; } }
AnnotationExtractor { public static ChameleonTargetConfiguration extract(Annotation annotation) { final Class<? extends Annotation> annotationType = annotation.annotationType(); ChameleonTargetConfiguration currentConfiguration = null; if (annotationType == ChameleonTarget.class) { ChameleonTarget chameleonTarget = (ChameleonTarget) annotation; return ChameleonTargetConfiguration.from(chameleonTarget); } final Annotation[] metaAnnotations = findAndSortAnnotations(annotation); for (Annotation metaAnnotation : metaAnnotations) { if (! metaAnnotation.annotationType().getName().startsWith("java.lang")) { final ChameleonTargetConfiguration chameleonTargetConfiguration = extract(metaAnnotation); if (currentConfiguration != null) { currentConfiguration = currentConfiguration.importConfiguration(chameleonTargetConfiguration); } else { currentConfiguration = chameleonTargetConfiguration; } } } return currentConfiguration; }  }
AnnotationExtractor { public static ChameleonTargetConfiguration extract(Annotation annotation) { final Class<? extends Annotation> annotationType = annotation.annotationType(); ChameleonTargetConfiguration currentConfiguration = null; if (annotationType == ChameleonTarget.class) { ChameleonTarget chameleonTarget = (ChameleonTarget) annotation; return ChameleonTargetConfiguration.from(chameleonTarget); } final Annotation[] metaAnnotations = findAndSortAnnotations(annotation); for (Annotation metaAnnotation : metaAnnotations) { if (! metaAnnotation.annotationType().getName().startsWith("java.lang")) { final ChameleonTargetConfiguration chameleonTargetConfiguration = extract(metaAnnotation); if (currentConfiguration != null) { currentConfiguration = currentConfiguration.importConfiguration(chameleonTargetConfiguration); } else { currentConfiguration = chameleonTargetConfiguration; } } } return currentConfiguration; }  static ChameleonTargetConfiguration extract(Annotation annotation); }
AnnotationExtractor { public static ChameleonTargetConfiguration extract(Annotation annotation) { final Class<? extends Annotation> annotationType = annotation.annotationType(); ChameleonTargetConfiguration currentConfiguration = null; if (annotationType == ChameleonTarget.class) { ChameleonTarget chameleonTarget = (ChameleonTarget) annotation; return ChameleonTargetConfiguration.from(chameleonTarget); } final Annotation[] metaAnnotations = findAndSortAnnotations(annotation); for (Annotation metaAnnotation : metaAnnotations) { if (! metaAnnotation.annotationType().getName().startsWith("java.lang")) { final ChameleonTargetConfiguration chameleonTargetConfiguration = extract(metaAnnotation); if (currentConfiguration != null) { currentConfiguration = currentConfiguration.importConfiguration(chameleonTargetConfiguration); } else { currentConfiguration = chameleonTargetConfiguration; } } } return currentConfiguration; }  static ChameleonTargetConfiguration extract(Annotation annotation);  }