@@ -66,7 +66,7 @@ void setup() {
66
66
@ Test
67
67
void run_shouldProvision () throws InterruptedException {
68
68
//arrange
69
- final TransferProcess process = createTransferProcess (TransferProcessStates .INITIAL );
69
+ TransferProcess process = createTransferProcess (TransferProcessStates .INITIAL );
70
70
var cdl = new CountDownLatch (1 );
71
71
//prepare provision manager
72
72
provisionManager .provision (anyObject (TransferProcess .class ));
@@ -77,7 +77,7 @@ void run_shouldProvision() throws InterruptedException {
77
77
replay (provisionManager );
78
78
79
79
//prepare process store
80
- final TransferProcessStore processStoreMock = niceMock (TransferProcessStore .class );
80
+ TransferProcessStore processStoreMock = niceMock (TransferProcessStore .class );
81
81
expect (processStoreMock .nextForState (eq (TransferProcessStates .INITIAL .code ()), anyInt ())).andReturn (Collections .singletonList (process ));
82
82
processStoreMock .update (process );
83
83
expectLastCall ().times (1 );
@@ -97,7 +97,7 @@ void run_shouldProvision() throws InterruptedException {
97
97
@ DisplayName ("verifySend: check that the process is in REQUESTED state" )
98
98
void verifySend () throws InterruptedException {
99
99
//arrange
100
- final TransferProcess process = createTransferProcess (TransferProcessStates .PROVISIONED );
100
+ TransferProcess process = createTransferProcess (TransferProcessStates .PROVISIONED );
101
101
var cdl = new CountDownLatch (1 );
102
102
//prepare provision manager
103
103
expect (dispatcherRegistry .send (eq (Void .class ), anyObject (), anyObject ())).andAnswer (() -> {
@@ -107,7 +107,7 @@ void verifySend() throws InterruptedException {
107
107
replay (dispatcherRegistry );
108
108
109
109
//prepare process store
110
- final TransferProcessStore processStoreMock = niceMock (TransferProcessStore .class );
110
+ TransferProcessStore processStoreMock = niceMock (TransferProcessStore .class );
111
111
expect (processStoreMock .nextForState (eq (TransferProcessStates .INITIAL .code ()), anyInt ())).andReturn (Collections .emptyList ());
112
112
expect (processStoreMock .nextForState (eq (TransferProcessStates .PROVISIONED .code ()), anyInt ())).andReturn (Collections .singletonList (process ));
113
113
processStoreMock .update (process );
@@ -129,13 +129,13 @@ void verifySend() throws InterruptedException {
129
129
@ DisplayName ("checkProvisioned: all resources belong to finite processes" )
130
130
void verifyCheckProvisioned_allAreFinite () throws InterruptedException {
131
131
//arrange
132
- final TransferProcess process = createTransferProcess (TransferProcessStates .REQUESTED_ACK );
132
+ TransferProcess process = createTransferProcess (TransferProcessStates .REQUESTED_ACK );
133
133
process .getProvisionedResourceSet ().addResource (new TestResource ());
134
134
135
135
var cdl = new CountDownLatch (1 );
136
136
137
137
//prepare process store
138
- final TransferProcessStore processStoreMock = mock (TransferProcessStore .class );
138
+ TransferProcessStore processStoreMock = mock (TransferProcessStore .class );
139
139
expect (processStoreMock .nextForState (eq (TransferProcessStates .INITIAL .code ()), anyInt ())).andReturn (Collections .emptyList ());
140
140
expect (processStoreMock .nextForState (eq (TransferProcessStates .PROVISIONED .code ()), anyInt ())).andReturn (Collections .emptyList ());
141
141
expect (processStoreMock .nextForState (eq (TransferProcessStates .REQUESTED_ACK .code ()), anyInt ())).andReturn (Collections .singletonList (process ));
@@ -162,16 +162,16 @@ void verifyCheckProvisioned_allAreFinite() throws InterruptedException {
162
162
@ DisplayName ("checkProvisioned: all resources belong to non-finite processes" )
163
163
void verifyCheckProvisioned_allAreNonFinite () throws InterruptedException {
164
164
//arrange
165
- final TransferType type = TransferType .Builder .transferType ()
165
+ TransferType type = TransferType .Builder .transferType ()
166
166
.isFinite (false ).build ();
167
167
168
- final TransferProcess process = createTransferProcess (TransferProcessStates .REQUESTED_ACK , type );
168
+ TransferProcess process = createTransferProcess (TransferProcessStates .REQUESTED_ACK , type );
169
169
process .getProvisionedResourceSet ().addResource (new TestResource ());
170
170
171
171
var cdl = new CountDownLatch (1 );
172
172
173
173
//prepare process store
174
- final TransferProcessStore processStoreMock = mock (TransferProcessStore .class );
174
+ TransferProcessStore processStoreMock = mock (TransferProcessStore .class );
175
175
expect (processStoreMock .nextForState (eq (TransferProcessStates .INITIAL .code ()), anyInt ())).andReturn (Collections .emptyList ());
176
176
expect (processStoreMock .nextForState (eq (TransferProcessStates .PROVISIONED .code ()), anyInt ())).andReturn (Collections .emptyList ());
177
177
expect (processStoreMock .nextForState (eq (TransferProcessStates .REQUESTED_ACK .code ()), anyInt ())).andReturn (Collections .singletonList (process ));
@@ -198,14 +198,14 @@ void verifyCheckProvisioned_allAreNonFinite() throws InterruptedException {
198
198
@ DisplayName ("checkComplete: all ProvisionedResources are complete" )
199
199
void verifyCompleted_allCompleted () throws InterruptedException {
200
200
//arrange
201
- final TransferProcess process = createTransferProcess (TransferProcessStates .REQUESTED_ACK );
201
+ TransferProcess process = createTransferProcess (TransferProcessStates .REQUESTED_ACK );
202
202
process .getProvisionedResourceSet ().addResource (new TestResource ());
203
203
process .getProvisionedResourceSet ().addResource (new TestResource ());
204
204
205
205
var cdl = new CountDownLatch (1 );
206
206
207
207
//prepare process store
208
- final TransferProcessStore processStoreMock = mock (TransferProcessStore .class );
208
+ TransferProcessStore processStoreMock = mock (TransferProcessStore .class );
209
209
expect (processStoreMock .nextForState (eq (TransferProcessStates .INITIAL .code ()), anyInt ())).andReturn (Collections .emptyList ());
210
210
expect (processStoreMock .nextForState (eq (TransferProcessStates .PROVISIONED .code ()), anyInt ())).andReturn (Collections .emptyList ());
211
211
expect (processStoreMock .nextForState (eq (TransferProcessStates .REQUESTED_ACK .code ()), anyInt ())).andReturn (Collections .emptyList ());
@@ -237,14 +237,14 @@ void verifyCompleted_allCompleted() throws InterruptedException {
237
237
@ DisplayName ("checkComplete: not all ProvisionedResources are yet completed" )
238
238
void verifyCompleted_notAllYetCompleted () throws InterruptedException {
239
239
//arrange
240
- final TransferProcess process = createTransferProcess (TransferProcessStates .IN_PROGRESS );
240
+ TransferProcess process = createTransferProcess (TransferProcessStates .IN_PROGRESS );
241
241
process .getProvisionedResourceSet ().addResource (new TestResource ());
242
242
process .getProvisionedResourceSet ().addResource (new TestResource ());
243
243
244
244
var cdl = new CountDownLatch (1 );
245
245
246
246
//prepare process store
247
- final TransferProcessStore processStoreMock = mock (TransferProcessStore .class );
247
+ TransferProcessStore processStoreMock = mock (TransferProcessStore .class );
248
248
expect (processStoreMock .nextForState (eq (TransferProcessStates .INITIAL .code ()), anyInt ())).andReturn (Collections .emptyList ());
249
249
expect (processStoreMock .nextForState (eq (TransferProcessStates .PROVISIONED .code ()), anyInt ())).andReturn (Collections .emptyList ());
250
250
expect (processStoreMock .nextForState (eq (TransferProcessStates .REQUESTED_ACK .code ()), anyInt ())).andReturn (Collections .emptyList ());
@@ -277,14 +277,14 @@ void verifyCompleted_notAllYetCompleted() throws InterruptedException {
277
277
@ DisplayName ("checkComplete: Should ignore resources without StatusCheckers" )
278
278
void verifyCompleted_noCheckerForSomeResources () throws InterruptedException {
279
279
//arrange
280
- final TransferProcess process = createTransferProcess (TransferProcessStates .IN_PROGRESS );
280
+ TransferProcess process = createTransferProcess (TransferProcessStates .IN_PROGRESS );
281
281
process .getProvisionedResourceSet ().addResource (new TestResource ());
282
282
process .getProvisionedResourceSet ().addResource (new TestResource ());
283
283
284
284
var cdl = new CountDownLatch (1 );
285
285
286
286
//prepare process store
287
- final TransferProcessStore processStoreMock = mock (TransferProcessStore .class );
287
+ TransferProcessStore processStoreMock = mock (TransferProcessStore .class );
288
288
expect (processStoreMock .nextForState (eq (TransferProcessStates .INITIAL .code ()), anyInt ())).andReturn (Collections .emptyList ());
289
289
expect (processStoreMock .nextForState (eq (TransferProcessStates .PROVISIONED .code ()), anyInt ())).andReturn (Collections .emptyList ());
290
290
expect (processStoreMock .nextForState (eq (TransferProcessStates .REQUESTED_ACK .code ()), anyInt ())).andReturn (Collections .emptyList ());
@@ -320,12 +320,12 @@ void verifyProvision_shouldNotStarve() throws InterruptedException {
320
320
var numProcesses = TRANSFER_MANAGER_BATCHSIZE * 2 ;
321
321
322
322
//prepare process store
323
- final TransferProcessStore inMemoryProcessStore = new InMemoryTransferProcessStore ();
323
+ TransferProcessStore inMemoryProcessStore = new InMemoryTransferProcessStore ();
324
324
325
325
//create a few processes
326
326
var processes = new ArrayList <TransferProcess >();
327
327
for (int i = 0 ; i < numProcesses ; i ++) {
328
- final TransferProcess process = createTransferProcess (TransferProcessStates .UNSAVED );
328
+ TransferProcess process = createTransferProcess (TransferProcessStates .UNSAVED );
329
329
processes .add (process );
330
330
inMemoryProcessStore .create (process );
331
331
}
@@ -369,7 +369,7 @@ private TransferProcess createTransferProcess(TransferProcessStates inState, Tra
369
369
370
370
String processId = UUID .randomUUID ().toString ();
371
371
372
- final DataRequest mock = niceMock (DataRequest .class );
372
+ DataRequest mock = niceMock (DataRequest .class );
373
373
expect (mock .getTransferType ()).andReturn (type ).anyTimes ();
374
374
expect (mock .getId ()).andReturn (processId ).anyTimes ();
375
375
replay (mock );
@@ -382,6 +382,19 @@ private TransferProcess createTransferProcess(TransferProcessStates inState, Tra
382
382
.build ();
383
383
}
384
384
385
- private static class TestResource extends ProvisionedResource {
385
+ private static class TestResource extends ProvisionedDataDestinationResource {
386
+ protected TestResource () {
387
+ super ();
388
+ }
389
+
390
+ @ Override
391
+ public String getResourceName () {
392
+ return "test-resource" ;
393
+ }
394
+
395
+ @ Override
396
+ public DataAddress createDataDestination () {
397
+ return null ;
398
+ }
386
399
}
387
400
}
0 commit comments