Skip to content

feat(dependencies): remove org.quartz-scheduler:quartz #6257

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions common/build.gradle
Original file line number Diff line number Diff line change
@@ -38,8 +38,6 @@ dependencies {
api group: 'com.typesafe', name: 'config', version: '1.3.2'
api group: leveldbGroup, name: leveldbName, version: leveldbVersion
api group: 'org.rocksdb', name: 'rocksdbjni', version: '5.15.10'
// https://mvnrepository.com/artifact/org.quartz-scheduler/quartz
api group: 'org.quartz-scheduler', name: 'quartz', version: '2.3.2'
api group: 'io.prometheus', name: 'simpleclient', version: '0.15.0'
api group: 'io.prometheus', name: 'simpleclient_httpserver', version: '0.15.0'
api group: 'io.prometheus', name: 'simpleclient_hotspot', version: '0.15.0'
1,669 changes: 1,669 additions & 0 deletions common/src/main/java/org/tron/common/cron/CronExpression.java

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions common/src/main/java/org/tron/common/cron/ValueSet.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package org.tron.common.cron;

class ValueSet {
public int value;

public int pos;
}
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@
import java.util.Set;
import lombok.Getter;
import lombok.Setter;
import org.quartz.CronExpression;
import org.tron.common.cron.CronExpression;
import org.tron.common.args.GenesisBlock;
import org.tron.common.config.DbBackupConfig;
import org.tron.common.logsfilter.EventPluginConfig;
Original file line number Diff line number Diff line change
@@ -42,7 +42,7 @@
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.quartz.CronExpression;
import org.tron.common.cron.CronExpression;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.tron.common.args.Account;
2 changes: 1 addition & 1 deletion framework/src/main/java/org/tron/core/db/Manager.java
Original file line number Diff line number Diff line change
@@ -46,7 +46,7 @@
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.bouncycastle.util.encoders.Hex;
import org.quartz.CronExpression;
import org.tron.common.cron.CronExpression;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.tron.api.GrpcAPI.TransactionInfoList;
Original file line number Diff line number Diff line change
@@ -8,14 +8,14 @@
import static org.junit.Assert.assertThrows;
import static org.junit.Assert.assertTrue;

import com.mchange.v2.collection.MapEntry;
import java.util.Collection;
import java.util.HashSet;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import lombok.Getter;
import org.junit.Before;
import org.junit.Test;
import org.tron.core.db.ByteArrayWrapper;

public class ByteArrayMapTest {

@@ -142,4 +142,32 @@ public void test() {
assertTrue(testMap.hashCode() <= 0);
assertNotNull(testMap.toString());
}


@Getter
static class MapEntry<K, V> implements Map.Entry<K, V> {
K key;
V value;

public MapEntry(K key, V value) {
this.key = key;
this.value = value;
}

public V setValue(V o) {
throw new UnsupportedOperationException();
}

public boolean equals(Object o) {
if (o instanceof Map.Entry) {
Map.Entry<K, V> other = (Map.Entry<K, V>) o;
return Objects.equals(key, other.getKey()) && Objects.equals(value, other.getValue());
}
return false;
}

public int hashCode() {
return Objects.hashCode(key) ^ Objects.hashCode(value);
}
}
}
Original file line number Diff line number Diff line change
@@ -31,7 +31,7 @@
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;

import org.quartz.CronExpression;
import org.tron.common.cron.CronExpression;
import org.tron.common.parameter.CommonParameter;
import org.tron.common.runtime.ProgramResult;
import org.tron.common.utils.Sha256Hash;
Original file line number Diff line number Diff line change
@@ -5,7 +5,8 @@
import java.util.Date;
import lombok.extern.slf4j.Slf4j;
import org.junit.Assert;
import org.quartz.CronExpression;
import org.junit.Test;
import org.tron.common.cron.CronExpression;
import org.tron.common.parameter.CommonParameter;

@Slf4j
@@ -25,6 +26,21 @@ public class BlockTimeStopTest extends ConditionallyStopTest {
}
}

@Test
public void isValidExpression() {
Assert.assertTrue(CronExpression.isValidExpression(cronExpression.getCronExpression()));
ParseException err = Assert.assertThrows(ParseException.class, () ->
CronExpression.validateExpression("invalid expression"));
Assert.assertEquals("Illegal characters for this position: 'INV'", err.getMessage());
}

@Test
public void getNextTime() {
Date date = cronExpression.getNextValidTimeAfter(new Date());
Date invalidDate = cronExpression.getNextInvalidTimeAfter(new Date());
Assert.assertNotEquals(date, invalidDate);
}


protected void initParameter(CommonParameter parameter) {
parameter.setShutdownBlockTime(cronExpression);
13 changes: 0 additions & 13 deletions gradle/verification-metadata.xml
Original file line number Diff line number Diff line change
@@ -2088,19 +2088,6 @@
<sha256 value="bca2bb252c6ec5db92584af7ab26f787b14a155f587c3e30ec1e1da0d4164694" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.quartz-scheduler" name="quartz" version="2.3.2">
<artifact name="quartz-2.3.2.jar">
<sha256 value="639c6a675bc472e1568df9d8c954ff702da6f83ed27da0ff9a7bd12ed73b8bf0" origin="Generated by Gradle"/>
</artifact>
<artifact name="quartz-2.3.2.pom">
<sha256 value="f5bca37862760be888bdeed62e9f1061d7486a7d14917949ce0a91f3899a11dc" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.quartz-scheduler" name="quartz-parent" version="2.3.2">
<artifact name="quartz-parent-2.3.2.pom">
<sha256 value="24286b15786e3b5a71899f7ff0df17449820257475e3e74ece97f43a684a4463" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.reactivestreams" name="reactive-streams" version="1.0.3">
<artifact name="reactive-streams-1.0.3.jar">
<sha256 value="1dee0481072d19c929b623e155e14d2f6085dc011529a0a0dbefc84cf571d865" origin="Generated by Gradle"/>