use of com.qcadoo.plugin.api.RunIfEnabled in project mes by qcadoo.
the class UnusedContextsCleanUpServiceTest method shouldBeAnnotatedWithRunIfEnabled.
@Test
public final void shouldBeAnnotatedWithRunIfEnabled() throws NoSuchMethodException {
RunIfEnabled runIfEnabledAnnotation = getPerformCleanUpMethod().getAnnotation(RunIfEnabled.class);
Assert.assertNotNull("class should be annotated with @RunIfEnabled!", runIfEnabledAnnotation);
Assert.assertArrayEquals(new String[] { TechnologiesGeneratorConstants.PLUGIN_IDENTIFIER }, runIfEnabledAnnotation.value());
}
use of com.qcadoo.plugin.api.RunIfEnabled in project mes by qcadoo.
the class UnusedContextsCleanUpService method performCleanUp.
@Async
@Scheduled(cron = CRON_EVERYDAY_AT_5AM)
@RunIfEnabled(TechnologiesGeneratorConstants.PLUGIN_IDENTIFIER)
public void performCleanUp() {
DateTime threshold = DateTime.now().minusWeeks(1);
Either<EntityMessagesHolder, List<ContextId>> result = generatorContextDataProvider.deleteContextsNotUsedSince(threshold);
if (result.isLeft()) {
warn(String.format("CleanUp aborted - Technology generator context couldn't be deleted: %s", result.getLeft()));
} else {
info(String.format("CleanUp done - %s technology generator contexts were deleted.", result.getRight().size()));
}
}
use of com.qcadoo.plugin.api.RunIfEnabled in project mes by qcadoo.
the class DeliveryStateValidationAspectTest method shouldBeAnnotatedWithAspectAndRunIfEnabledAnnotations.
@Test
public final void shouldBeAnnotatedWithAspectAndRunIfEnabledAnnotations() {
assertEquals("com.qcadoo.mes.deliveries.states.aop.listeners.DeliveryStateValidationAspect", clazz.getCanonicalName());
assertNotNull(clazz.getAnnotation(Aspect.class));
RunIfEnabled runIfEnabled = clazz.getAnnotation(RunIfEnabled.class);
assertNotNull(runIfEnabled);
String runIfEnabledPliginIdentifier = runIfEnabled.value()[0];
assertEquals(DeliveriesConstants.PLUGIN_IDENTIFIER, runIfEnabledPliginIdentifier);
}
use of com.qcadoo.plugin.api.RunIfEnabled in project mes by qcadoo.
the class ExportToPdfControllerOOverrideAspectTest method checkAspectAnnotations.
@Test
public final void checkAspectAnnotations() {
Class<?> clazz = ExportToPdfControllerOOverrideAspect.class;
assertNotNull(clazz.getAnnotation(Aspect.class));
RunIfEnabled runIfEnabledAnnotation = clazz.getAnnotation(RunIfEnabled.class);
assertEquals(OrdersConstants.PLUGIN_IDENTIFIER, runIfEnabledAnnotation.value()[0]);
}
Aggregations