1313
1414package io .dapr .it .testcontainers .jobs ;
1515
16- import io .dapr .client .DaprPreviewClient ;
16+ import io .dapr .client .DaprClient ;
1717import io .dapr .client .domain .ConstantFailurePolicy ;
1818import io .dapr .client .domain .DeleteJobRequest ;
1919import io .dapr .client .domain .DropFailurePolicy ;
2828import org .junit .jupiter .api .BeforeEach ;
2929import org .junit .jupiter .api .Tag ;
3030import org .junit .jupiter .api .Test ;
31- import org .junit .runner .notification .Failure ;
3231import org .springframework .beans .factory .annotation .Autowired ;
3332import org .springframework .boot .test .context .SpringBootTest ;
3433import org .springframework .boot .test .context .SpringBootTest .WebEnvironment ;
@@ -85,7 +84,7 @@ static void daprProperties(DynamicPropertyRegistry registry) {
8584 }
8685
8786 @ Autowired
88- private DaprPreviewClient daprPreviewClient ;
87+ private DaprClient daprClient ;
8988
9089 @ BeforeEach
9190 public void setUp (){
@@ -98,12 +97,12 @@ public void testJobScheduleCreationWithDueTime() {
9897 .withZone (ZoneOffset .UTC );
9998
10099 Instant currentTime = Instant .now ();
101- daprPreviewClient .scheduleJob (new ScheduleJobRequest ("Job" , currentTime ).setOverwrite (true )).block ();
100+ daprClient .scheduleJob (new ScheduleJobRequest ("Job" , currentTime ).setOverwrite (true )).block ();
102101
103102 GetJobResponse getJobResponse =
104- daprPreviewClient .getJob (new GetJobRequest ("Job" )).block ();
103+ daprClient .getJob (new GetJobRequest ("Job" )).block ();
105104
106- daprPreviewClient .deleteJob (new DeleteJobRequest ("Job" )).block ();
105+ daprClient .deleteJob (new DeleteJobRequest ("Job" )).block ();
107106
108107 assertEquals (iso8601Formatter .format (currentTime ), getJobResponse .getDueTime ().toString ());
109108 assertEquals ("Job" , getJobResponse .getName ());
@@ -115,13 +114,13 @@ public void testJobScheduleCreationWithSchedule() {
115114 .withZone (ZoneOffset .UTC );
116115
117116 Instant currentTime = Instant .now ();
118- daprPreviewClient .scheduleJob (new ScheduleJobRequest ("Job" , JobSchedule .hourly ())
117+ daprClient .scheduleJob (new ScheduleJobRequest ("Job" , JobSchedule .hourly ())
119118 .setDueTime (currentTime ).setOverwrite (true )).block ();
120119
121120 GetJobResponse getJobResponse =
122- daprPreviewClient .getJob (new GetJobRequest ("Job" )).block ();
121+ daprClient .getJob (new GetJobRequest ("Job" )).block ();
123122
124- daprPreviewClient .deleteJob (new DeleteJobRequest ("Job" )).block ();
123+ daprClient .deleteJob (new DeleteJobRequest ("Job" )).block ();
125124
126125 assertEquals (iso8601Formatter .format (currentTime ), getJobResponse .getDueTime ().toString ());
127126 assertEquals (JobSchedule .hourly ().getExpression (), getJobResponse .getSchedule ().getExpression ());
@@ -136,17 +135,17 @@ public void testJobScheduleCreationWithAllParameters() {
136135
137136 String cronExpression = "2 * 3 * * FRI" ;
138137
139- daprPreviewClient .scheduleJob (new ScheduleJobRequest ("Job" , currentTime )
138+ daprClient .scheduleJob (new ScheduleJobRequest ("Job" , currentTime )
140139 .setTtl (currentTime .plus (2 , ChronoUnit .HOURS ))
141140 .setData ("Job data" .getBytes ())
142141 .setRepeat (3 )
143142 .setOverwrite (true )
144143 .setSchedule (JobSchedule .fromString (cronExpression ))).block ();
145144
146145 GetJobResponse getJobResponse =
147- daprPreviewClient .getJob (new GetJobRequest ("Job" )).block ();
146+ daprClient .getJob (new GetJobRequest ("Job" )).block ();
148147
149- daprPreviewClient .deleteJob (new DeleteJobRequest ("Job" )).block ();
148+ daprClient .deleteJob (new DeleteJobRequest ("Job" )).block ();
150149
151150 assertEquals (iso8601Formatter .format (currentTime ), getJobResponse .getDueTime ().toString ());
152151 assertEquals ("2 * 3 * * FRI" , getJobResponse .getSchedule ().getExpression ());
@@ -165,17 +164,17 @@ public void testJobScheduleCreationWithDropFailurePolicy() {
165164
166165 String cronExpression = "2 * 3 * * FRI" ;
167166
168- daprPreviewClient .scheduleJob (new ScheduleJobRequest ("Job" , currentTime )
167+ daprClient .scheduleJob (new ScheduleJobRequest ("Job" , currentTime )
169168 .setTtl (currentTime .plus (2 , ChronoUnit .HOURS ))
170169 .setData ("Job data" .getBytes ())
171170 .setRepeat (3 )
172171 .setFailurePolicy (new DropFailurePolicy ())
173172 .setSchedule (JobSchedule .fromString (cronExpression ))).block ();
174173
175174 GetJobResponse getJobResponse =
176- daprPreviewClient .getJob (new GetJobRequest ("Job" )).block ();
175+ daprClient .getJob (new GetJobRequest ("Job" )).block ();
177176
178- daprPreviewClient .deleteJob (new DeleteJobRequest ("Job" )).block ();
177+ daprClient .deleteJob (new DeleteJobRequest ("Job" )).block ();
179178
180179 assertEquals (FailurePolicyType .DROP , getJobResponse .getFailurePolicy ().getFailurePolicyType ());
181180 }
@@ -188,7 +187,7 @@ public void testJobScheduleCreationWithConstantFailurePolicy() {
188187
189188 String cronExpression = "2 * 3 * * FRI" ;
190189
191- daprPreviewClient .scheduleJob (new ScheduleJobRequest ("Job" , currentTime )
190+ daprClient .scheduleJob (new ScheduleJobRequest ("Job" , currentTime )
192191 .setTtl (currentTime .plus (2 , ChronoUnit .HOURS ))
193192 .setData ("Job data" .getBytes ())
194193 .setRepeat (3 )
@@ -197,9 +196,9 @@ public void testJobScheduleCreationWithConstantFailurePolicy() {
197196 .setSchedule (JobSchedule .fromString (cronExpression ))).block ();
198197
199198 GetJobResponse getJobResponse =
200- daprPreviewClient .getJob (new GetJobRequest ("Job" )).block ();
199+ daprClient .getJob (new GetJobRequest ("Job" )).block ();
201200
202- daprPreviewClient .deleteJob (new DeleteJobRequest ("Job" )).block ();
201+ daprClient .deleteJob (new DeleteJobRequest ("Job" )).block ();
203202
204203 ConstantFailurePolicy jobFailurePolicyConstant = (ConstantFailurePolicy ) getJobResponse .getFailurePolicy ();
205204 assertEquals (FailurePolicyType .CONSTANT , getJobResponse .getFailurePolicy ().getFailurePolicyType ());
@@ -214,13 +213,13 @@ public void testDeleteJobRequest() {
214213
215214 String cronExpression = "2 * 3 * * FRI" ;
216215
217- daprPreviewClient .scheduleJob (new ScheduleJobRequest ("Job" , currentTime )
216+ daprClient .scheduleJob (new ScheduleJobRequest ("Job" , currentTime )
218217 .setTtl (currentTime .plus (2 , ChronoUnit .HOURS ))
219218 .setData ("Job data" .getBytes ())
220219 .setRepeat (3 )
221220 .setOverwrite (true )
222221 .setSchedule (JobSchedule .fromString (cronExpression ))).block ();
223222
224- daprPreviewClient .deleteJob (new DeleteJobRequest ("Job" )).block ();
223+ daprClient .deleteJob (new DeleteJobRequest ("Job" )).block ();
225224 }
226225}
0 commit comments