Skip to content

Commit c2f1d59

Browse files
authored
Merge branch 'apache:master' into patch-1
2 parents 0404ff0 + bd97b9b commit c2f1d59

File tree

251 files changed

+1780
-1982
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

251 files changed

+1780
-1982
lines changed

elasticjob-api/src/test/java/org/apache/shardingsphere/elasticjob/annotation/ElasticJobConfigurationTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@
2929
import static org.hamcrest.MatcherAssert.assertThat;
3030
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
3131

32-
public final class ElasticJobConfigurationTest {
32+
class ElasticJobConfigurationTest {
3333

3434
@Test
35-
public void assertAnnotationJob() {
35+
void assertAnnotationJob() {
3636
ElasticJobConfiguration annotation = SimpleTestJob.class.getAnnotation(ElasticJobConfiguration.class);
3737
assertThat(annotation.jobName(), is("SimpleTestJob"));
3838
assertThat(annotation.cron(), is("0/5 * * * * ?"));

elasticjob-api/src/test/java/org/apache/shardingsphere/elasticjob/annotation/job/impl/SimpleTestJob.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
shardingTotalCount = 3,
3030
shardingItemParameters = "0=Beijing,1=Shanghai,2=Guangzhou",
3131
jobListenerTypes = {"NOOP", "LOG"},
32-
extraConfigurations = {SimpleTracingConfigurationFactory.class},
32+
extraConfigurations = SimpleTracingConfigurationFactory.class,
3333
props = {
3434
@ElasticJobProp(key = "print.title", value = "test title"),
3535
@ElasticJobProp(key = "print.content", value = "test content")

elasticjob-api/src/test/java/org/apache/shardingsphere/elasticjob/api/JobConfigurationTest.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@
2626
import static org.junit.jupiter.api.Assertions.assertThrows;
2727
import static org.junit.jupiter.api.Assertions.assertTrue;
2828

29-
public final class JobConfigurationTest {
29+
class JobConfigurationTest {
3030

3131
@Test
32-
public void assertBuildAllProperties() {
32+
void assertBuildAllProperties() {
3333
JobConfiguration actual = JobConfiguration.newBuilder("test_job", 3)
3434
.cron("0/1 * * * * ?")
3535
.timeZone("GMT+8")
@@ -83,12 +83,12 @@ public void assertBuildRequiredProperties() {
8383
}
8484

8585
@Test
86-
public void assertBuildWithEmptyJobName() {
86+
void assertBuildWithEmptyJobName() {
8787
assertThrows(IllegalArgumentException.class, () -> JobConfiguration.newBuilder("", 3).cron("0/1 * * * * ?").build());
8888
}
8989

9090
@Test
91-
public void assertBuildWithInvalidShardingTotalCount() {
91+
void assertBuildWithInvalidShardingTotalCount() {
9292
assertThrows(IllegalArgumentException.class, () -> JobConfiguration.newBuilder("test_job", -1).cron("0/1 * * * * ?").build());
9393
}
9494
}

elasticjob-cloud/elasticjob-cloud-common/src/test/java/org/apache/shardingsphere/elasticjob/cloud/config/pojo/CloudJobConfigurationPOJOTest.java

+7-7
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
import static org.junit.jupiter.api.Assertions.assertNull;
3030
import static org.junit.jupiter.api.Assertions.assertTrue;
3131

32-
public final class CloudJobConfigurationPOJOTest {
32+
class CloudJobConfigurationPOJOTest {
3333

3434
private static final String YAML = "appName: app\n"
3535
+ "cpuCount: 1.0\n"
@@ -69,7 +69,7 @@ public final class CloudJobConfigurationPOJOTest {
6969
+ "shardingTotalCount: 3\n";
7070

7171
@Test
72-
public void assertToJobConfiguration() {
72+
void assertToJobConfiguration() {
7373
CloudJobConfigurationPOJO pojo = new CloudJobConfigurationPOJO();
7474
pojo.setAppName("app");
7575
pojo.setCpuCount(1d);
@@ -113,7 +113,7 @@ public void assertToJobConfiguration() {
113113
}
114114

115115
@Test
116-
public void assertFromJobConfiguration() {
116+
void assertFromJobConfiguration() {
117117
JobConfiguration jobConfig = JobConfiguration.newBuilder("test_job", 3)
118118
.cron("0/1 * * * * ?")
119119
.shardingItemParameters("0=A,1=B,2=C").jobParameter("param")
@@ -145,7 +145,7 @@ public void assertFromJobConfiguration() {
145145
}
146146

147147
@Test
148-
public void assertMarshal() {
148+
void assertMarshal() {
149149
CloudJobConfigurationPOJO actual = new CloudJobConfigurationPOJO();
150150
actual.setAppName("app");
151151
actual.setCpuCount(1d);
@@ -165,7 +165,7 @@ public void assertMarshal() {
165165
}
166166

167167
@Test
168-
public void assertMarshalWithNullValue() {
168+
void assertMarshalWithNullValue() {
169169
CloudJobConfigurationPOJO actual = new CloudJobConfigurationPOJO();
170170
actual.setAppName("app");
171171
actual.setCpuCount(1d);
@@ -177,7 +177,7 @@ public void assertMarshalWithNullValue() {
177177
}
178178

179179
@Test
180-
public void assertUnmarshal() {
180+
void assertUnmarshal() {
181181
CloudJobConfigurationPOJO actual = YamlEngine.unmarshal(YAML, CloudJobConfigurationPOJO.class);
182182
assertThat(actual.getJobName(), is("test_job"));
183183
assertThat(actual.getCron(), is("0/1 * * * * ?"));
@@ -195,7 +195,7 @@ public void assertUnmarshal() {
195195
}
196196

197197
@Test
198-
public void assertUnmarshalWithNullValue() {
198+
void assertUnmarshalWithNullValue() {
199199
CloudJobConfigurationPOJO actual = YamlEngine.unmarshal(YAML_WITH_NULL, CloudJobConfigurationPOJO.class);
200200
assertThat(actual.getAppName(), is("app"));
201201
assertThat(actual.getCpuCount(), is(1d));

elasticjob-cloud/elasticjob-cloud-common/src/test/java/org/apache/shardingsphere/elasticjob/cloud/statistics/rdb/StatisticRdbRepositoryTest.java

+24-24
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@
3535
import static org.junit.jupiter.api.Assertions.assertFalse;
3636
import static org.junit.jupiter.api.Assertions.assertTrue;
3737

38-
public class StatisticRdbRepositoryTest {
38+
class StatisticRdbRepositoryTest {
3939

4040
private StatisticRdbRepository repository;
4141

4242
@BeforeEach
43-
public void setup() throws SQLException {
43+
void setup() throws SQLException {
4444
BasicDataSource dataSource = new BasicDataSource();
4545
dataSource.setDriverClassName(org.h2.Driver.class.getName());
4646
dataSource.setUrl("jdbc:h2:mem:");
@@ -50,36 +50,36 @@ public void setup() throws SQLException {
5050
}
5151

5252
@Test
53-
public void assertAddTaskResultStatistics() {
53+
void assertAddTaskResultStatistics() {
5454
for (StatisticInterval each : StatisticInterval.values()) {
5555
assertTrue(repository.add(new TaskResultStatistics(100, 0, each, new Date())));
5656
}
5757
}
5858

5959
@Test
60-
public void assertAddTaskRunningStatistics() {
60+
void assertAddTaskRunningStatistics() {
6161
assertTrue(repository.add(new TaskRunningStatistics(100, new Date())));
6262
}
6363

6464
@Test
65-
public void assertAddJobRunningStatistics() {
65+
void assertAddJobRunningStatistics() {
6666
assertTrue(repository.add(new TaskRunningStatistics(100, new Date())));
6767
}
6868

6969
@Test
70-
public void assertAddJobRegisterStatistics() {
70+
void assertAddJobRegisterStatistics() {
7171
assertTrue(repository.add(new JobRegisterStatistics(100, new Date())));
7272
}
7373

7474
@Test
75-
public void assertFindTaskResultStatisticsWhenTableIsEmpty() {
75+
void assertFindTaskResultStatisticsWhenTableIsEmpty() {
7676
assertThat(repository.findTaskResultStatistics(new Date(), StatisticInterval.MINUTE).size(), is(0));
7777
assertThat(repository.findTaskResultStatistics(new Date(), StatisticInterval.HOUR).size(), is(0));
7878
assertThat(repository.findTaskResultStatistics(new Date(), StatisticInterval.DAY).size(), is(0));
7979
}
8080

8181
@Test
82-
public void assertFindTaskResultStatisticsWithDifferentFromDate() {
82+
void assertFindTaskResultStatisticsWithDifferentFromDate() {
8383
Date now = new Date();
8484
Date yesterday = getYesterday();
8585
for (StatisticInterval each : StatisticInterval.values()) {
@@ -91,7 +91,7 @@ public void assertFindTaskResultStatisticsWithDifferentFromDate() {
9191
}
9292

9393
@Test
94-
public void assertGetSummedTaskResultStatisticsWhenTableIsEmpty() {
94+
void assertGetSummedTaskResultStatisticsWhenTableIsEmpty() {
9595
for (StatisticInterval each : StatisticInterval.values()) {
9696
TaskResultStatistics po = repository.getSummedTaskResultStatistics(new Date(), each);
9797
assertThat(po.getSuccessCount(), is(0));
@@ -100,7 +100,7 @@ public void assertGetSummedTaskResultStatisticsWhenTableIsEmpty() {
100100
}
101101

102102
@Test
103-
public void assertGetSummedTaskResultStatistics() {
103+
void assertGetSummedTaskResultStatistics() {
104104
for (StatisticInterval each : StatisticInterval.values()) {
105105
Date date = new Date();
106106
repository.add(new TaskResultStatistics(100, 2, each, date));
@@ -112,14 +112,14 @@ public void assertGetSummedTaskResultStatistics() {
112112
}
113113

114114
@Test
115-
public void assertFindLatestTaskResultStatisticsWhenTableIsEmpty() {
115+
void assertFindLatestTaskResultStatisticsWhenTableIsEmpty() {
116116
for (StatisticInterval each : StatisticInterval.values()) {
117117
assertFalse(repository.findLatestTaskResultStatistics(each).isPresent());
118118
}
119119
}
120120

121121
@Test
122-
public void assertFindLatestTaskResultStatistics() {
122+
void assertFindLatestTaskResultStatistics() {
123123
for (StatisticInterval each : StatisticInterval.values()) {
124124
repository.add(new TaskResultStatistics(100, 2, each, new Date()));
125125
repository.add(new TaskResultStatistics(200, 5, each, new Date()));
@@ -131,12 +131,12 @@ public void assertFindLatestTaskResultStatistics() {
131131
}
132132

133133
@Test
134-
public void assertFindTaskRunningStatisticsWhenTableIsEmpty() {
134+
void assertFindTaskRunningStatisticsWhenTableIsEmpty() {
135135
assertThat(repository.findTaskRunningStatistics(new Date()).size(), is(0));
136136
}
137137

138138
@Test
139-
public void assertFindTaskRunningStatisticsWithDifferentFromDate() {
139+
void assertFindTaskRunningStatisticsWithDifferentFromDate() {
140140
Date now = new Date();
141141
Date yesterday = getYesterday();
142142
assertTrue(repository.add(new TaskRunningStatistics(100, yesterday)));
@@ -146,12 +146,12 @@ public void assertFindTaskRunningStatisticsWithDifferentFromDate() {
146146
}
147147

148148
@Test
149-
public void assertFindLatestTaskRunningStatisticsWhenTableIsEmpty() {
149+
void assertFindLatestTaskRunningStatisticsWhenTableIsEmpty() {
150150
assertFalse(repository.findLatestTaskRunningStatistics().isPresent());
151151
}
152152

153153
@Test
154-
public void assertFindLatestTaskRunningStatistics() {
154+
void assertFindLatestTaskRunningStatistics() {
155155
repository.add(new TaskRunningStatistics(100, new Date()));
156156
repository.add(new TaskRunningStatistics(200, new Date()));
157157
Optional<TaskRunningStatistics> po = repository.findLatestTaskRunningStatistics();
@@ -160,12 +160,12 @@ public void assertFindLatestTaskRunningStatistics() {
160160
}
161161

162162
@Test
163-
public void assertFindJobRunningStatisticsWhenTableIsEmpty() {
163+
void assertFindJobRunningStatisticsWhenTableIsEmpty() {
164164
assertThat(repository.findJobRunningStatistics(new Date()).size(), is(0));
165165
}
166166

167167
@Test
168-
public void assertFindJobRunningStatisticsWithDifferentFromDate() {
168+
void assertFindJobRunningStatisticsWithDifferentFromDate() {
169169
Date now = new Date();
170170
Date yesterday = getYesterday();
171171
assertTrue(repository.add(new JobRunningStatistics(100, yesterday)));
@@ -175,12 +175,12 @@ public void assertFindJobRunningStatisticsWithDifferentFromDate() {
175175
}
176176

177177
@Test
178-
public void assertFindLatestJobRunningStatisticsWhenTableIsEmpty() {
178+
void assertFindLatestJobRunningStatisticsWhenTableIsEmpty() {
179179
assertFalse(repository.findLatestJobRunningStatistics().isPresent());
180180
}
181181

182182
@Test
183-
public void assertFindLatestJobRunningStatistics() {
183+
void assertFindLatestJobRunningStatistics() {
184184
repository.add(new JobRunningStatistics(100, new Date()));
185185
repository.add(new JobRunningStatistics(200, new Date()));
186186
Optional<JobRunningStatistics> po = repository.findLatestJobRunningStatistics();
@@ -189,12 +189,12 @@ public void assertFindLatestJobRunningStatistics() {
189189
}
190190

191191
@Test
192-
public void assertFindJobRegisterStatisticsWhenTableIsEmpty() {
192+
void assertFindJobRegisterStatisticsWhenTableIsEmpty() {
193193
assertThat(repository.findJobRegisterStatistics(new Date()).size(), is(0));
194194
}
195195

196196
@Test
197-
public void assertFindJobRegisterStatisticsWithDifferentFromDate() {
197+
void assertFindJobRegisterStatisticsWithDifferentFromDate() {
198198
Date now = new Date();
199199
Date yesterday = getYesterday();
200200
assertTrue(repository.add(new JobRegisterStatistics(100, yesterday)));
@@ -204,12 +204,12 @@ public void assertFindJobRegisterStatisticsWithDifferentFromDate() {
204204
}
205205

206206
@Test
207-
public void assertFindLatestJobRegisterStatisticsWhenTableIsEmpty() {
207+
void assertFindLatestJobRegisterStatisticsWhenTableIsEmpty() {
208208
assertFalse(repository.findLatestJobRegisterStatistics().isPresent());
209209
}
210210

211211
@Test
212-
public void assertFindLatestJobRegisterStatistics() {
212+
void assertFindLatestJobRegisterStatistics() {
213213
repository.add(new JobRegisterStatistics(100, new Date()));
214214
repository.add(new JobRegisterStatistics(200, new Date()));
215215
Optional<JobRegisterStatistics> po = repository.findLatestJobRegisterStatistics();

elasticjob-cloud/elasticjob-cloud-executor/src/test/java/org/apache/shardingsphere/elasticjob/cloud/executor/facade/CloudJobFacadeTest.java

+15-15
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
import static org.mockito.Mockito.verify;
4343

4444
@ExtendWith(MockitoExtension.class)
45-
public final class CloudJobFacadeTest {
45+
class CloudJobFacadeTest {
4646

4747
private ShardingContexts shardingContexts;
4848

@@ -52,7 +52,7 @@ public final class CloudJobFacadeTest {
5252
private JobFacade jobFacade;
5353

5454
@BeforeEach
55-
public void setUp() {
55+
void setUp() {
5656
shardingContexts = getShardingContexts();
5757
jobFacade = new CloudJobFacade(shardingContexts, getJobConfiguration(), jobTracingEventBus);
5858
}
@@ -68,69 +68,69 @@ private JobConfiguration getJobConfiguration() {
6868
}
6969

7070
@Test
71-
public void assertCheckJobExecutionEnvironment() throws JobExecutionEnvironmentException {
71+
void assertCheckJobExecutionEnvironment() throws JobExecutionEnvironmentException {
7272
jobFacade.checkJobExecutionEnvironment();
7373
}
7474

7575
@Test
76-
public void assertFailoverIfNecessary() {
76+
void assertFailoverIfNecessary() {
7777
jobFacade.failoverIfNecessary();
7878
}
7979

8080
@Test
81-
public void assertRegisterJobBegin() {
81+
void assertRegisterJobBegin() {
8282
jobFacade.registerJobBegin(null);
8383
}
8484

8585
@Test
86-
public void assertRegisterJobCompleted() {
86+
void assertRegisterJobCompleted() {
8787
jobFacade.registerJobCompleted(null);
8888
}
8989

9090
@Test
91-
public void assertGetShardingContext() {
91+
void assertGetShardingContext() {
9292
assertThat(jobFacade.getShardingContexts(), is(shardingContexts));
9393
}
9494

9595
@Test
96-
public void assertMisfireIfNecessary() {
96+
void assertMisfireIfNecessary() {
9797
jobFacade.misfireIfRunning(null);
9898
}
9999

100100
@Test
101-
public void assertClearMisfire() {
101+
void assertClearMisfire() {
102102
jobFacade.clearMisfire(null);
103103
}
104104

105105
@Test
106-
public void assertIsExecuteMisfired() {
106+
void assertIsExecuteMisfired() {
107107
assertFalse(jobFacade.isExecuteMisfired(null));
108108
}
109109

110110
@Test
111-
public void assertIsNeedSharding() {
111+
void assertIsNeedSharding() {
112112
assertFalse(jobFacade.isNeedSharding());
113113
}
114114

115115
@Test
116-
public void assertBeforeJobExecuted() {
116+
void assertBeforeJobExecuted() {
117117
jobFacade.beforeJobExecuted(null);
118118
}
119119

120120
@Test
121-
public void assertAfterJobExecuted() {
121+
void assertAfterJobExecuted() {
122122
jobFacade.afterJobExecuted(null);
123123
}
124124

125125
@Test
126-
public void assertPostJobExecutionEvent() {
126+
void assertPostJobExecutionEvent() {
127127
JobExecutionEvent jobExecutionEvent = new JobExecutionEvent("localhost", "127.0.0.1", "fake_task_id", "test_job", JobExecutionEvent.ExecutionSource.NORMAL_TRIGGER, 0);
128128
jobFacade.postJobExecutionEvent(jobExecutionEvent);
129129
verify(jobTracingEventBus).post(jobExecutionEvent);
130130
}
131131

132132
@Test
133-
public void assertPostJobStatusTraceEvent() {
133+
void assertPostJobStatusTraceEvent() {
134134
jobFacade.postJobStatusTraceEvent(String.format("%s@-@0@-@%s@-@fake_slave_id@-@0", "test_job", ExecutionType.READY), State.TASK_RUNNING, "message is empty.");
135135
}
136136
}

0 commit comments

Comments
 (0)