mirror of
https://github.com/frode-carlsen/cron.git
synced 2025-12-06 14:00:57 +03:00
Separate modules to provide java6/jodatime support and java8/java-time support
This commit is contained in:
18
README.md
18
README.md
@@ -5,9 +5,25 @@ cron
|
|||||||
|
|
||||||
Allows for specifying cron - expressions (in Unix or Quartz like format) and evaluating when it will next match.
|
Allows for specifying cron - expressions (in Unix or Quartz like format) and evaluating when it will next match.
|
||||||
|
|
||||||
2016-09-11: rewritten to Java 8 DateTime by zemiak
|
|
||||||
|
|
||||||
|
|
||||||
usage
|
usage
|
||||||
=====
|
=====
|
||||||
See javadoc
|
See javadoc
|
||||||
|
|
||||||
|
|
||||||
|
Change history
|
||||||
|
==============
|
||||||
|
|
||||||
|
version 1.4:
|
||||||
|
2017-02-13: added support for java6 (supports android 4) by adelnizamutdinov
|
||||||
|
2016-09-11: rewritten to Java 8 DateTime by zemiak
|
||||||
|
|
||||||
|
version 1.3:
|
||||||
|
2015-09-23: added timezone to tests by alf
|
||||||
|
|
||||||
|
version 1.2:
|
||||||
|
2015-08-05: added protection for endless loop when looking up Feb 30th & optional seconds by michaelknigge
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package fc.cron;
|
package fc.cron;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2012 Frode Carlsen.
|
* Copyright (C) 2012- Frode Carlsen.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -25,6 +26,9 @@ import java.util.regex.Matcher;
|
|||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* This provides cron support for java8 using java-time.
|
||||||
|
* <P>
|
||||||
|
*
|
||||||
* Parser for unix-like cron expressions: Cron expressions allow specifying combinations of criteria for time
|
* Parser for unix-like cron expressions: Cron expressions allow specifying combinations of criteria for time
|
||||||
* such as: "Each Monday-Friday at 08:00" or "Every last friday of the month at 01:30"
|
* such as: "Each Monday-Friday at 08:00" or "Every last friday of the month at 01:30"
|
||||||
* <p>
|
* <p>
|
||||||
@@ -86,7 +90,7 @@ import java.util.regex.Pattern;
|
|||||||
* <P>
|
* <P>
|
||||||
* '*' Can be used in all fields and means 'for all values'. E.g. "*" in minutes, means 'for all minutes'
|
* '*' Can be used in all fields and means 'for all values'. E.g. "*" in minutes, means 'for all minutes'
|
||||||
* <P>
|
* <P>
|
||||||
* '?' Ca be used in Day-of-month and Day-of-week fields. Used to signify 'no special value'. It is used when one want
|
* '?' Can be used in Day-of-month and Day-of-week fields. Used to signify 'no special value'. It is used when one want
|
||||||
* to specify something for one of those two fields, but not the other.
|
* to specify something for one of those two fields, but not the other.
|
||||||
* <P>
|
* <P>
|
||||||
* '-' Used to specify a time interval. E.g. "10-12" in Hours field means 'for hours 10, 11 and 12'
|
* '-' Used to specify a time interval. E.g. "10-12" in Hours field means 'for hours 10, 11 and 12'
|
||||||
@@ -114,22 +118,19 @@ import java.util.regex.Pattern;
|
|||||||
* - the third). If the day does not exist (e.g. "5#5" - 5th friday of month) and there aren't 5 fridays in
|
* - the third). If the day does not exist (e.g. "5#5" - 5th friday of month) and there aren't 5 fridays in
|
||||||
* the month, then it won't match until the next month with 5 fridays.
|
* the month, then it won't match until the next month with 5 fridays.
|
||||||
* <P>
|
* <P>
|
||||||
* <b>Case-sensitivt</b> No fields are case-sensitive
|
* <b>Case-sensitive</b> No fields are case-sensitive
|
||||||
* <P>
|
* <P>
|
||||||
* <b>Dependencies between fields</b> Fields are always evaluated independently, but the expression doesn't match until
|
* <b>Dependencies between fields</b> Fields are always evaluated independently, but the expression doesn't match until
|
||||||
* the constraints of each field are met.Feltene evalueres Overlap of intervals are not allowed. That is: for
|
* the constraints of each field are met. Overlap of intervals are not allowed. That is: for
|
||||||
* Day-of-week field "FRI-MON" is invalid,but "FRI-SUN,MON" is valid
|
* Day-of-week field "FRI-MON" is invalid,but "FRI-SUN,MON" is valid
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class CronExpression {
|
public class CronExpression {
|
||||||
|
|
||||||
enum CronFieldType {
|
enum CronFieldType {
|
||||||
SECOND(0, 59, null),
|
SECOND(0, 59, null), MINUTE(0, 59, null), HOUR(0, 23, null), DAY_OF_MONTH(1, 31, null), MONTH(1, 12,
|
||||||
MINUTE(0, 59, null),
|
Arrays.asList("JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC")), DAY_OF_WEEK(1, 7,
|
||||||
HOUR(0, 23, null),
|
Arrays.asList("MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN"));
|
||||||
DAY_OF_MONTH(1, 31, null),
|
|
||||||
MONTH(1, 12, Arrays.asList("JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC")),
|
|
||||||
DAY_OF_WEEK(1, 7, Arrays.asList("MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN"));
|
|
||||||
|
|
||||||
final int from, to;
|
final int from, to;
|
||||||
final List<String> names;
|
final List<String> names;
|
||||||
@@ -163,8 +164,7 @@ public class CronExpression {
|
|||||||
final int expectedParts = withSeconds ? 6 : 5;
|
final int expectedParts = withSeconds ? 6 : 5;
|
||||||
final String[] parts = expr.split("\\s+"); //$NON-NLS-1$
|
final String[] parts = expr.split("\\s+"); //$NON-NLS-1$
|
||||||
if (parts.length != expectedParts) {
|
if (parts.length != expectedParts) {
|
||||||
throw new IllegalArgumentException(String.format("Invalid cron expression [%s], expected %s felt, got %s"
|
throw new IllegalArgumentException(String.format("Invalid cron expression [%s], expected %s field, got %s", expr, expectedParts, parts.length));
|
||||||
, expr, expectedParts, parts.length));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int ix = withSeconds ? 1 : 0;
|
int ix = withSeconds ? 1 : 0;
|
||||||
@@ -199,7 +199,8 @@ public class CronExpression {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ZonedDateTime nextTimeAfter(ZonedDateTime afterTime, ZonedDateTime dateTimeBarrier) {
|
public ZonedDateTime nextTimeAfter(ZonedDateTime afterTime, ZonedDateTime dateTimeBarrier) {
|
||||||
ZonedDateTime nextTime = ZonedDateTime.from(afterTime).withNano(0).plusSeconds(1).withNano(0);;
|
ZonedDateTime nextTime = ZonedDateTime.from(afterTime).withNano(0).plusSeconds(1).withNano(0);
|
||||||
|
;
|
||||||
|
|
||||||
while (true) { // day of week
|
while (true) { // day of week
|
||||||
while (true) { // month
|
while (true) { // month
|
||||||
@@ -261,17 +262,17 @@ public class CronExpression {
|
|||||||
}
|
}
|
||||||
|
|
||||||
abstract static class BasicField {
|
abstract static class BasicField {
|
||||||
private static final Pattern CRON_FELT_REGEXP = Pattern
|
private static final Pattern CRON_FIELD_REGEXP = Pattern
|
||||||
.compile("(?: # start of group 1\n"
|
.compile("(?: # start of group 1\n"
|
||||||
+ " (?:(\\*)|(\\?)|(L)) # globalt flag (L, ?, *)\n"
|
+ " (?:(?<all>\\*)|(?<ignore>\\?)|(?<last>L)) # global flag (L, ?, *)\n"
|
||||||
+ " | ([0-9]{1,2}|[a-z]{3,3}) # or start number or symbol\n"
|
+ " | (?<start>[0-9]{1,2}|[a-z]{3,3}) # or start number or symbol\n"
|
||||||
+ " (?: # start of group 2\n"
|
+ " (?: # start of group 2\n"
|
||||||
+ " (L|W) # modifier (L,W)\n"
|
+ " (?<mod>L|W) # modifier (L,W)\n"
|
||||||
+ " | -([0-9]{1,2}|[a-z]{3,3}) # or end nummer or symbol (in range)\n"
|
+ " | -(?<end>[0-9]{1,2}|[a-z]{3,3}) # or end nummer or symbol (in range)\n"
|
||||||
+ " )? # end of group 2\n"
|
+ " )? # end of group 2\n"
|
||||||
+ ") # end of group 1\n"
|
+ ") # end of group 1\n"
|
||||||
+ "(?:(/|\\#)([0-9]{1,7}))? # increment and increment modifier (/ or \\#)\n"
|
+ "(?:(?<incmod>/|\\#)(?<inc>[0-9]{1,7}))? # increment and increment modifier (/ or \\#)\n",
|
||||||
, Pattern.CASE_INSENSITIVE | Pattern.COMMENTS);
|
Pattern.CASE_INSENSITIVE | Pattern.COMMENTS);
|
||||||
|
|
||||||
final CronFieldType fieldType;
|
final CronFieldType fieldType;
|
||||||
final List<FieldPart> parts = new ArrayList<>();
|
final List<FieldPart> parts = new ArrayList<>();
|
||||||
@@ -284,15 +285,15 @@ public class CronExpression {
|
|||||||
private void parse(String fieldExpr) { // NOSONAR
|
private void parse(String fieldExpr) { // NOSONAR
|
||||||
String[] rangeParts = fieldExpr.split(",");
|
String[] rangeParts = fieldExpr.split(",");
|
||||||
for (String rangePart : rangeParts) {
|
for (String rangePart : rangeParts) {
|
||||||
Matcher m = CRON_FELT_REGEXP.matcher(rangePart);
|
Matcher m = CRON_FIELD_REGEXP.matcher(rangePart);
|
||||||
if (!m.matches()) {
|
if (!m.matches()) {
|
||||||
throw new IllegalArgumentException("Invalid cron field '" + rangePart + "' for field [" + fieldType + "]");
|
throw new IllegalArgumentException("Invalid cron field '" + rangePart + "' for field [" + fieldType + "]");
|
||||||
}
|
}
|
||||||
String startNummer = m.group(4);
|
String startNummer = m.group("start");
|
||||||
String modifier = m.group(5);
|
String modifier = m.group("mod");
|
||||||
String sluttNummer = m.group(6);
|
String sluttNummer = m.group("end");
|
||||||
String inkrementModifier = m.group(7);
|
String incrementModifier = m.group("incmod");
|
||||||
String inkrement = m.group(8);
|
String increment = m.group("inc");
|
||||||
|
|
||||||
FieldPart part = new FieldPart();
|
FieldPart part = new FieldPart();
|
||||||
part.increment = 999;
|
part.increment = 999;
|
||||||
@@ -302,26 +303,26 @@ public class CronExpression {
|
|||||||
if (sluttNummer != null) {
|
if (sluttNummer != null) {
|
||||||
part.to = mapValue(sluttNummer);
|
part.to = mapValue(sluttNummer);
|
||||||
part.increment = 1;
|
part.increment = 1;
|
||||||
} else if (inkrement != null) {
|
} else if (increment != null) {
|
||||||
part.to = fieldType.to;
|
part.to = fieldType.to;
|
||||||
} else {
|
} else {
|
||||||
part.to = part.from;
|
part.to = part.from;
|
||||||
}
|
}
|
||||||
} else if (m.group(1) != null) {
|
} else if (m.group("all") != null) {
|
||||||
part.from = fieldType.from;
|
part.from = fieldType.from;
|
||||||
part.to = fieldType.to;
|
part.to = fieldType.to;
|
||||||
part.increment = 1;
|
part.increment = 1;
|
||||||
} else if (m.group(2) != null) {
|
} else if (m.group("ignore") != null) {
|
||||||
part.modifier = m.group(2);
|
part.modifier = m.group("ignore");
|
||||||
} else if (m.group(3) != null) {
|
} else if (m.group("last") != null) {
|
||||||
part.modifier = m.group(3);
|
part.modifier = m.group("last");
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalArgumentException("Invalid cron part: " + rangePart);
|
throw new IllegalArgumentException("Invalid cron part: " + rangePart);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inkrement != null) {
|
if (increment != null) {
|
||||||
part.incrementModifier = inkrementModifier;
|
part.incrementModifier = incrementModifier;
|
||||||
part.increment = Integer.valueOf(inkrement);
|
part.increment = Integer.valueOf(increment);
|
||||||
}
|
}
|
||||||
|
|
||||||
validateRange(part);
|
validateRange(part);
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2012 Frode Carlsen
|
* Copyright (C) 2012- Frode Carlsen
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -15,10 +15,10 @@
|
|||||||
*/
|
*/
|
||||||
package fc.cron;
|
package fc.cron;
|
||||||
|
|
||||||
import fc.cron.CronExpression.CronFieldType;
|
import static org.junit.Assert.assertEquals;
|
||||||
import fc.cron.CronExpression.DayOfMonthField;
|
import static org.junit.Assert.assertFalse;
|
||||||
import fc.cron.CronExpression.DayOfWeekField;
|
import static org.junit.Assert.assertTrue;
|
||||||
import fc.cron.CronExpression.SimpleField;
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.YearMonth;
|
import java.time.YearMonth;
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
@@ -27,11 +27,16 @@ import java.util.Arrays;
|
|||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.TimeZone;
|
import java.util.TimeZone;
|
||||||
|
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import static org.junit.Assert.*;
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import fc.cron.CronExpression.CronFieldType;
|
||||||
|
import fc.cron.CronExpression.DayOfMonthField;
|
||||||
|
import fc.cron.CronExpression.DayOfWeekField;
|
||||||
|
import fc.cron.CronExpression.SimpleField;
|
||||||
|
|
||||||
public class CronExpressionTest {
|
public class CronExpressionTest {
|
||||||
TimeZone original;
|
TimeZone original;
|
||||||
ZoneId zoneId;
|
ZoneId zoneId;
|
||||||
@@ -16,11 +16,17 @@
|
|||||||
<name>cron-jodatime</name>
|
<name>cron-jodatime</name>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>joda-time</groupId>
|
<groupId>joda-time</groupId>
|
||||||
<artifactId>joda-time</artifactId>
|
<artifactId>joda-time</artifactId>
|
||||||
<version>2.9.7</version>
|
<version>2.9.7</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.assertj</groupId>
|
||||||
|
<artifactId>assertj-core</artifactId>
|
||||||
|
<version>3.6.2</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,9 @@ import org.joda.time.LocalDate;
|
|||||||
import org.joda.time.MutableDateTime;
|
import org.joda.time.MutableDateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* This provides cron support for java6 upwards and jodatime.
|
||||||
|
* <P>
|
||||||
|
*
|
||||||
* Parser for unix-like cron expressions: Cron expressions allow specifying combinations of criteria for time
|
* Parser for unix-like cron expressions: Cron expressions allow specifying combinations of criteria for time
|
||||||
* such as: "Each Monday-Friday at 08:00" or "Every last friday of the month at 01:30"
|
* such as: "Each Monday-Friday at 08:00" or "Every last friday of the month at 01:30"
|
||||||
* <p>
|
* <p>
|
||||||
@@ -90,7 +93,7 @@ import org.joda.time.MutableDateTime;
|
|||||||
* <P>
|
* <P>
|
||||||
* '*' Can be used in all fields and means 'for all values'. E.g. "*" in minutes, means 'for all minutes'
|
* '*' Can be used in all fields and means 'for all values'. E.g. "*" in minutes, means 'for all minutes'
|
||||||
* <P>
|
* <P>
|
||||||
* '?' Ca be used in Day-of-month and Day-of-week fields. Used to signify 'no special value'. It is used when one want
|
* '?' Can be used in Day-of-month and Day-of-week fields. Used to signify 'no special value'. It is used when one want
|
||||||
* to specify something for one of those two fields, but not the other.
|
* to specify something for one of those two fields, but not the other.
|
||||||
* <P>
|
* <P>
|
||||||
* '-' Used to specify a time interval. E.g. "10-12" in Hours field means 'for hours 10, 11 and 12'
|
* '-' Used to specify a time interval. E.g. "10-12" in Hours field means 'for hours 10, 11 and 12'
|
||||||
@@ -118,10 +121,10 @@ import org.joda.time.MutableDateTime;
|
|||||||
* - the third). If the day does not exist (e.g. "5#5" - 5th friday of month) and there aren't 5 fridays in
|
* - the third). If the day does not exist (e.g. "5#5" - 5th friday of month) and there aren't 5 fridays in
|
||||||
* the month, then it won't match until the next month with 5 fridays.
|
* the month, then it won't match until the next month with 5 fridays.
|
||||||
* <P>
|
* <P>
|
||||||
* <b>Case-sensitivt</b> No fields are case-sensitive
|
* <b>Case-sensitive</b> No fields are case-sensitive
|
||||||
* <P>
|
* <P>
|
||||||
* <b>Dependencies between fields</b> Fields are always evaluated independently, but the expression doesn't match until
|
* <b>Dependencies between fields</b> Fields are always evaluated independently, but the expression doesn't match until
|
||||||
* the constraints of each field are met.Feltene evalueres Overlap of intervals are not allowed. That is: for
|
* the constraints of each field are met. Overlap of intervals are not allowed. That is: for
|
||||||
* Day-of-week field "FRI-MON" is invalid,but "FRI-SUN,MON" is valid
|
* Day-of-week field "FRI-MON" is invalid,but "FRI-SUN,MON" is valid
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@@ -274,13 +277,13 @@ public class CronExpression {
|
|||||||
}
|
}
|
||||||
|
|
||||||
abstract static class BasicField {
|
abstract static class BasicField {
|
||||||
private static final Pattern CRON_FELT_REGEXP = Pattern
|
private static final Pattern CRON_FIELD_REGEXP = Pattern
|
||||||
.compile("(?: # start of group 1\n"
|
.compile("(?: # start of group 1\n"
|
||||||
+ " (?:(\\*)|(\\?)|(L)) # globalt flag (L, ?, *)\n"
|
+ " (?:(\\*)|(\\?)|(L)) # global flag (L, ?, *)\n"
|
||||||
+ " | ([0-9]{1,2}|[a-z]{3,3}) # or start number or symbol\n"
|
+ " | ([0-9]{1,2}|[a-z]{3,3}) # or start number or symbol\n"
|
||||||
+ " (?: # start of group 2\n"
|
+ " (?: # start of group 2\n"
|
||||||
+ " (L|W) # modifier (L,W)\n"
|
+ " (L|W) # modifier (L,W)\n"
|
||||||
+ " | -([0-9]{1,2}|[a-z]{3,3}) # or end nummer or symbol (in range)\n"
|
+ " | -([0-9]{1,2}|[a-z]{3,3}) # or end number or symbol (in range)\n"
|
||||||
+ " )? # end of group 2\n"
|
+ " )? # end of group 2\n"
|
||||||
+ ") # end of group 1\n"
|
+ ") # end of group 1\n"
|
||||||
+ "(?:(/|\\#)([0-9]{1,7}))? # increment and increment modifier (/ or \\#)\n"
|
+ "(?:(/|\\#)([0-9]{1,7}))? # increment and increment modifier (/ or \\#)\n"
|
||||||
@@ -297,25 +300,25 @@ public class CronExpression {
|
|||||||
private void parse(String fieldExpr) { // NOSONAR
|
private void parse(String fieldExpr) { // NOSONAR
|
||||||
String[] rangeParts = fieldExpr.split(",");
|
String[] rangeParts = fieldExpr.split(",");
|
||||||
for (String rangePart : rangeParts) {
|
for (String rangePart : rangeParts) {
|
||||||
Matcher m = CRON_FELT_REGEXP.matcher(rangePart);
|
Matcher m = CRON_FIELD_REGEXP.matcher(rangePart);
|
||||||
if (!m.matches()) {
|
if (!m.matches()) {
|
||||||
throw new IllegalArgumentException("Invalid cron field '" + rangePart + "' for field [" + fieldType + "]");
|
throw new IllegalArgumentException("Invalid cron field '" + rangePart + "' for field [" + fieldType + "]");
|
||||||
}
|
}
|
||||||
String startNummer = m.group(4);
|
String startNumber = m.group(4);
|
||||||
String modifier = m.group(5);
|
String modifier = m.group(5);
|
||||||
String sluttNummer = m.group(6);
|
String endNumber = m.group(6);
|
||||||
String inkrementModifier = m.group(7);
|
String incrementModifier = m.group(7);
|
||||||
String inkrement = m.group(8);
|
String increment = m.group(8);
|
||||||
|
|
||||||
FieldPart part = new FieldPart();
|
FieldPart part = new FieldPart();
|
||||||
part.increment = 999;
|
part.increment = 999;
|
||||||
if (startNummer != null) {
|
if (startNumber != null) {
|
||||||
part.from = mapValue(startNummer);
|
part.from = mapValue(startNumber);
|
||||||
part.modifier = modifier;
|
part.modifier = modifier;
|
||||||
if (sluttNummer != null) {
|
if (endNumber != null) {
|
||||||
part.to = mapValue(sluttNummer);
|
part.to = mapValue(endNumber);
|
||||||
part.increment = 1;
|
part.increment = 1;
|
||||||
} else if (inkrement != null) {
|
} else if (increment != null) {
|
||||||
part.to = fieldType.to;
|
part.to = fieldType.to;
|
||||||
} else {
|
} else {
|
||||||
part.to = part.from;
|
part.to = part.from;
|
||||||
@@ -332,9 +335,9 @@ public class CronExpression {
|
|||||||
throw new IllegalArgumentException("Invalid cron part: " + rangePart);
|
throw new IllegalArgumentException("Invalid cron part: " + rangePart);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inkrement != null) {
|
if (increment != null) {
|
||||||
part.incrementModifier = inkrementModifier;
|
part.incrementModifier = incrementModifier;
|
||||||
part.increment = Integer.valueOf(inkrement);
|
part.increment = Integer.valueOf(increment);
|
||||||
}
|
}
|
||||||
|
|
||||||
validateRange(part);
|
validateRange(part);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2012 Frode Carlsen
|
* Copyright (C) 2012- Frode Carlsen
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
package fc.cron;
|
package fc.cron;
|
||||||
|
|
||||||
import static org.fest.assertions.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
|||||||
40
pom.xml
40
pom.xml
@@ -1,10 +1,11 @@
|
|||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<groupId>fc.cron</groupId>
|
<groupId>fc.cron</groupId>
|
||||||
<artifactId>cron</artifactId>
|
<artifactId>cron</artifactId>
|
||||||
<packaging>jar</packaging>
|
<packaging>pom</packaging>
|
||||||
<version>1.3</version>
|
<version>1.4-SNAPSHOT</version>
|
||||||
<name>cron</name>
|
<name>cron</name>
|
||||||
<url>https://github.com/frode-carlsen/cron</url>
|
<url>https://github.com/frode-carlsen/cron</url>
|
||||||
|
|
||||||
@@ -15,43 +16,20 @@
|
|||||||
</license>
|
</license>
|
||||||
</licenses>
|
</licenses>
|
||||||
|
|
||||||
|
<modules>
|
||||||
|
<module>java8</module>
|
||||||
|
<module>jodatime</module>
|
||||||
|
</modules>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
|
||||||
<groupId>joda-time</groupId>
|
|
||||||
<artifactId>joda-time</artifactId>
|
|
||||||
<version>2.3</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.easytesting</groupId>
|
|
||||||
<artifactId>fest-assert</artifactId>
|
|
||||||
<version>1.4</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit</artifactId>
|
||||||
<version>4.11</version>
|
<version>4.12</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
|
||||||
<version>3.1</version>
|
|
||||||
<configuration>
|
|
||||||
<fork>true</fork>
|
|
||||||
<source>1.7</source>
|
|
||||||
<target>1.7</target>
|
|
||||||
<encoding>UTF-8</encoding>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
|
|||||||
Reference in New Issue
Block a user