File tree 10 files changed +1727
-22
lines changed
src/main/java/org/tron/common
10 files changed +1727
-22
lines changed Original file line number Diff line number Diff line change @@ -38,8 +38,6 @@ dependencies {
38
38
api group : ' com.typesafe' , name : ' config' , version : ' 1.3.2'
39
39
api group : leveldbGroup, name : leveldbName, version : leveldbVersion
40
40
api group : ' org.rocksdb' , name : ' rocksdbjni' , version : ' 5.15.10'
41
- // https://mvnrepository.com/artifact/org.quartz-scheduler/quartz
42
- api group : ' org.quartz-scheduler' , name : ' quartz' , version : ' 2.3.2'
43
41
api group : ' io.prometheus' , name : ' simpleclient' , version : ' 0.15.0'
44
42
api group : ' io.prometheus' , name : ' simpleclient_httpserver' , version : ' 0.15.0'
45
43
api group : ' io.prometheus' , name : ' simpleclient_hotspot' , version : ' 0.15.0'
Load Diff Large diffs are not rendered by default.
Original file line number Diff line number Diff line change
1
+ package org .tron .common .cron ;
2
+
3
+ class ValueSet {
4
+ public int value ;
5
+
6
+ public int pos ;
7
+ }
Original file line number Diff line number Diff line change 8
8
import java .util .Set ;
9
9
import lombok .Getter ;
10
10
import lombok .Setter ;
11
- import org .quartz .CronExpression ;
11
+ import org .tron . common . cron .CronExpression ;
12
12
import org .tron .common .args .GenesisBlock ;
13
13
import org .tron .common .config .DbBackupConfig ;
14
14
import org .tron .common .logsfilter .EventPluginConfig ;
Original file line number Diff line number Diff line change 42
42
import lombok .extern .slf4j .Slf4j ;
43
43
import org .apache .commons .collections4 .CollectionUtils ;
44
44
import org .apache .commons .lang3 .StringUtils ;
45
- import org .quartz .CronExpression ;
45
+ import org .tron . common . cron .CronExpression ;
46
46
import org .springframework .beans .factory .annotation .Autowired ;
47
47
import org .springframework .stereotype .Component ;
48
48
import org .tron .common .args .Account ;
Original file line number Diff line number Diff line change 46
46
import lombok .extern .slf4j .Slf4j ;
47
47
import org .apache .commons .collections4 .CollectionUtils ;
48
48
import org .bouncycastle .util .encoders .Hex ;
49
- import org .quartz .CronExpression ;
49
+ import org .tron . common . cron .CronExpression ;
50
50
import org .springframework .beans .factory .annotation .Autowired ;
51
51
import org .springframework .stereotype .Component ;
52
52
import org .tron .api .GrpcAPI .TransactionInfoList ;
Original file line number Diff line number Diff line change 8
8
import static org .junit .Assert .assertThrows ;
9
9
import static org .junit .Assert .assertTrue ;
10
10
11
- import com .mchange .v2 .collection .MapEntry ;
12
11
import java .util .Collection ;
13
12
import java .util .HashSet ;
14
13
import java .util .Map ;
14
+ import java .util .Objects ;
15
15
import java .util .Set ;
16
+ import lombok .Getter ;
16
17
import org .junit .Before ;
17
18
import org .junit .Test ;
18
- import org .tron .core .db .ByteArrayWrapper ;
19
19
20
20
public class ByteArrayMapTest {
21
21
@@ -142,4 +142,32 @@ public void test() {
142
142
assertTrue (testMap .hashCode () <= 0 );
143
143
assertNotNull (testMap .toString ());
144
144
}
145
+
146
+
147
+ @ Getter
148
+ static class MapEntry <K , V > implements Map .Entry <K , V > {
149
+ K key ;
150
+ V value ;
151
+
152
+ public MapEntry (K key , V value ) {
153
+ this .key = key ;
154
+ this .value = value ;
155
+ }
156
+
157
+ public V setValue (V o ) {
158
+ throw new UnsupportedOperationException ();
159
+ }
160
+
161
+ public boolean equals (Object o ) {
162
+ if (o instanceof Map .Entry ) {
163
+ Map .Entry <K , V > other = (Map .Entry <K , V >) o ;
164
+ return Objects .equals (key , other .getKey ()) && Objects .equals (value , other .getValue ());
165
+ }
166
+ return false ;
167
+ }
168
+
169
+ public int hashCode () {
170
+ return Objects .hashCode (key ) ^ Objects .hashCode (value );
171
+ }
172
+ }
145
173
}
Original file line number Diff line number Diff line change 31
31
import org .mockito .invocation .InvocationOnMock ;
32
32
import org .mockito .stubbing .Answer ;
33
33
34
- import org .quartz .CronExpression ;
34
+ import org .tron . common . cron .CronExpression ;
35
35
import org .tron .common .parameter .CommonParameter ;
36
36
import org .tron .common .runtime .ProgramResult ;
37
37
import org .tron .common .utils .Sha256Hash ;
Original file line number Diff line number Diff line change 5
5
import java .util .Date ;
6
6
import lombok .extern .slf4j .Slf4j ;
7
7
import org .junit .Assert ;
8
- import org .quartz .CronExpression ;
8
+ import org .junit .Test ;
9
+ import org .tron .common .cron .CronExpression ;
9
10
import org .tron .common .parameter .CommonParameter ;
10
11
11
12
@ Slf4j
@@ -25,6 +26,21 @@ public class BlockTimeStopTest extends ConditionallyStopTest {
25
26
}
26
27
}
27
28
29
+ @ Test
30
+ public void isValidExpression () {
31
+ Assert .assertTrue (CronExpression .isValidExpression (cronExpression .getCronExpression ()));
32
+ ParseException err = Assert .assertThrows (ParseException .class , () ->
33
+ CronExpression .validateExpression ("invalid expression" ));
34
+ Assert .assertEquals ("Illegal characters for this position: 'INV'" , err .getMessage ());
35
+ }
36
+
37
+ @ Test
38
+ public void getNextTime () {
39
+ Date date = cronExpression .getNextValidTimeAfter (new Date ());
40
+ Date invalidDate = cronExpression .getNextInvalidTimeAfter (new Date ());
41
+ Assert .assertNotEquals (date , invalidDate );
42
+ }
43
+
28
44
29
45
protected void initParameter (CommonParameter parameter ) {
30
46
parameter .setShutdownBlockTime (cronExpression );
Original file line number Diff line number Diff line change 2088
2088
<sha256 value =" bca2bb252c6ec5db92584af7ab26f787b14a155f587c3e30ec1e1da0d4164694" origin =" Generated by Gradle" />
2089
2089
</artifact >
2090
2090
</component >
2091
- <component group =" org.quartz-scheduler" name =" quartz" version =" 2.3.2" >
2092
- <artifact name =" quartz-2.3.2.jar" >
2093
- <sha256 value =" 639c6a675bc472e1568df9d8c954ff702da6f83ed27da0ff9a7bd12ed73b8bf0" origin =" Generated by Gradle" />
2094
- </artifact >
2095
- <artifact name =" quartz-2.3.2.pom" >
2096
- <sha256 value =" f5bca37862760be888bdeed62e9f1061d7486a7d14917949ce0a91f3899a11dc" origin =" Generated by Gradle" />
2097
- </artifact >
2098
- </component >
2099
- <component group =" org.quartz-scheduler" name =" quartz-parent" version =" 2.3.2" >
2100
- <artifact name =" quartz-parent-2.3.2.pom" >
2101
- <sha256 value =" 24286b15786e3b5a71899f7ff0df17449820257475e3e74ece97f43a684a4463" origin =" Generated by Gradle" />
2102
- </artifact >
2103
- </component >
2104
2091
<component group =" org.reactivestreams" name =" reactive-streams" version =" 1.0.3" >
2105
2092
<artifact name =" reactive-streams-1.0.3.jar" >
2106
2093
<sha256 value =" 1dee0481072d19c929b623e155e14d2f6085dc011529a0a0dbefc84cf571d865" origin =" Generated by Gradle" />
You can’t perform that action at this time.
0 commit comments