@Test public void testBuildDelayParam() { final MethodInfo target = index.getClassByName(DotName.createSimple(BeanWithScheduledMethods.class.getName())) .method("checkEverySecondWithDelay"); AnnotationInstance annotation = target.annotation(SpringScheduledProcessor.SPRING_SCHEDULED); List<AnnotationValue> annotationValues = springScheduledProcessor.buildDelayParams(annotation.values()); AnnotationValue expectedDelayValue = AnnotationValue.createLongValue("delay", 1000L); AnnotationValue expectedDelayUnitValue = AnnotationValue.createEnumValue("delayUnit", DotName.createSimple("java.util.concurrent.TimeUnit"), TimeUnit.MILLISECONDS.name()); assertThat(annotationValues).contains(expectedDelayValue); assertThat(annotationValues).contains(expectedDelayUnitValue); }
List<AnnotationValue> buildDelayParams(List<AnnotationValue> springAnnotationValues) { List<AnnotationValue> confValues = new ArrayList<>(); long delay = getLongValueFromParam(springAnnotationValues, "initialDelay"); confValues.add(AnnotationValue.createLongValue("delay", delay)); confValues.add(AnnotationValue.createEnumValue("delayUnit", DotName.createSimple("java.util.concurrent.TimeUnit"), TimeUnit.MILLISECONDS.name())); return confValues; }
SpringScheduledProcessor { List<AnnotationValue> buildDelayParams(List<AnnotationValue> springAnnotationValues) { List<AnnotationValue> confValues = new ArrayList<>(); long delay = getLongValueFromParam(springAnnotationValues, "initialDelay"); confValues.add(AnnotationValue.createLongValue("delay", delay)); confValues.add(AnnotationValue.createEnumValue("delayUnit", DotName.createSimple("java.util.concurrent.TimeUnit"), TimeUnit.MILLISECONDS.name())); return confValues; } }
SpringScheduledProcessor { List<AnnotationValue> buildDelayParams(List<AnnotationValue> springAnnotationValues) { List<AnnotationValue> confValues = new ArrayList<>(); long delay = getLongValueFromParam(springAnnotationValues, "initialDelay"); confValues.add(AnnotationValue.createLongValue("delay", delay)); confValues.add(AnnotationValue.createEnumValue("delayUnit", DotName.createSimple("java.util.concurrent.TimeUnit"), TimeUnit.MILLISECONDS.name())); return confValues; }  }
SpringScheduledProcessor { List<AnnotationValue> buildDelayParams(List<AnnotationValue> springAnnotationValues) { List<AnnotationValue> confValues = new ArrayList<>(); long delay = getLongValueFromParam(springAnnotationValues, "initialDelay"); confValues.add(AnnotationValue.createLongValue("delay", delay)); confValues.add(AnnotationValue.createEnumValue("delayUnit", DotName.createSimple("java.util.concurrent.TimeUnit"), TimeUnit.MILLISECONDS.name())); return confValues; }  @BuildStep List<UnremovableBeanBuildItem> unremovableBeans(); }
SpringScheduledProcessor { List<AnnotationValue> buildDelayParams(List<AnnotationValue> springAnnotationValues) { List<AnnotationValue> confValues = new ArrayList<>(); long delay = getLongValueFromParam(springAnnotationValues, "initialDelay"); confValues.add(AnnotationValue.createLongValue("delay", delay)); confValues.add(AnnotationValue.createEnumValue("delayUnit", DotName.createSimple("java.util.concurrent.TimeUnit"), TimeUnit.MILLISECONDS.name())); return confValues; }  @BuildStep List<UnremovableBeanBuildItem> unremovableBeans();  }