@@ -96,7 +96,6 @@ public void GetCanContributeStatusShouldReturnCanContribute() {
9696 ChainTask chainTask = ChainTask .builder ()
9797 .dealid (chainDealId )
9898 .idx (0 )
99- .status (ACTIVE )
10099 .contributionDeadline (new Date ().getTime () + 1000 )
101100 .build ();
102101
@@ -106,6 +105,7 @@ public void GetCanContributeStatusShouldReturnCanContribute() {
106105 when (iexecHubService .getChainAccount ()).thenReturn (Optional .of (ChainAccount .builder ().deposit (1000 ).build ()));
107106 when (iexecHubService .getChainDeal (chainDealId )).thenReturn (Optional .of (ChainDeal .builder ().workerStake (BigInteger .valueOf (5 )).build ()));
108107 when (iexecHubService .getChainContribution (chainTaskId )).thenReturn (Optional .of (ChainContribution .builder ().status (ChainContributionStatus .UNSET ).build ()));
108+ when (iexecHubService .isChainTaskActiveWhenNodeNotSync (chainTaskId )).thenReturn (true );
109109
110110 assertThat (contributionService .getCanContributeStatus (chainTaskId ).isPresent ()).isTrue ();
111111 assertThat (contributionService .getCanContributeStatus (chainTaskId ).get ().equals (ReplicateStatus .CAN_CONTRIBUTE )).isTrue ();
@@ -118,7 +118,6 @@ public void GetCanContributeStatusShouldReturnStakeTooLoww() {
118118 ChainTask chainTask = ChainTask .builder ()
119119 .dealid (chainDealId )
120120 .idx (0 )
121- .status (ACTIVE )
122121 .contributionDeadline (new Date ().getTime () + 1000 )
123122 .build ();
124123
@@ -128,6 +127,7 @@ public void GetCanContributeStatusShouldReturnStakeTooLoww() {
128127 when (iexecHubService .getChainAccount ()).thenReturn (Optional .of (ChainAccount .builder ().deposit (0 ).build ()));
129128 when (iexecHubService .getChainDeal (chainDealId )).thenReturn (Optional .of (ChainDeal .builder ().workerStake (BigInteger .valueOf (5 )).build ()));
130129 when (iexecHubService .getChainContribution (chainTaskId )).thenReturn (Optional .of (ChainContribution .builder ().status (ChainContributionStatus .UNSET ).build ()));
130+ when (iexecHubService .isChainTaskActiveWhenNodeNotSync (chainTaskId )).thenReturn (true );
131131
132132 assertThat (contributionService .getCanContributeStatus (chainTaskId ).isPresent ()).isTrue ();
133133 assertThat (contributionService .getCanContributeStatus (chainTaskId ).get ().equals (ReplicateStatus .CANT_CONTRIBUTE_SINCE_STAKE_TOO_LOW )).isTrue ();
@@ -140,7 +140,6 @@ public void GetCanContributeStatusShouldReturnTaskNotActive() {
140140 ChainTask chainTask = ChainTask .builder ()
141141 .dealid (chainDealId )
142142 .idx (0 )
143- .status (REVEALING )
144143 .contributionDeadline (new Date ().getTime () + 1000 )
145144 .build ();
146145
@@ -150,6 +149,7 @@ public void GetCanContributeStatusShouldReturnTaskNotActive() {
150149 when (iexecHubService .getChainAccount ()).thenReturn (Optional .of (ChainAccount .builder ().deposit (1000 ).build ()));
151150 when (iexecHubService .getChainDeal (chainDealId )).thenReturn (Optional .of (ChainDeal .builder ().workerStake (BigInteger .valueOf (5 )).build ()));
152151 when (iexecHubService .getChainContribution (chainTaskId )).thenReturn (Optional .of (ChainContribution .builder ().status (ChainContributionStatus .UNSET ).build ()));
152+ when (iexecHubService .isChainTaskActiveWhenNodeNotSync (chainTaskId )).thenReturn (false );
153153
154154 assertThat (contributionService .getCanContributeStatus (chainTaskId ).isPresent ()).isTrue ();
155155 assertThat (contributionService .getCanContributeStatus (chainTaskId ).get ().equals (ReplicateStatus .CANT_CONTRIBUTE_SINCE_TASK_NOT_ACTIVE )).isTrue ();
@@ -162,7 +162,6 @@ public void GetCanContributeStatusShouldReturnAfterDeadline() {
162162 ChainTask chainTask = ChainTask .builder ()
163163 .dealid (chainDealId )
164164 .idx (0 )
165- .status (ACTIVE )
166165 .contributionDeadline (new Date ().getTime () - 1000 )
167166 .build ();
168167
@@ -172,6 +171,7 @@ public void GetCanContributeStatusShouldReturnAfterDeadline() {
172171 when (iexecHubService .getChainAccount ()).thenReturn (Optional .of (ChainAccount .builder ().deposit (1000 ).build ()));
173172 when (iexecHubService .getChainDeal (chainDealId )).thenReturn (Optional .of (ChainDeal .builder ().workerStake (BigInteger .valueOf (5 )).build ()));
174173 when (iexecHubService .getChainContribution (chainTaskId )).thenReturn (Optional .of (ChainContribution .builder ().status (ChainContributionStatus .UNSET ).build ()));
174+ when (iexecHubService .isChainTaskActiveWhenNodeNotSync (chainTaskId )).thenReturn (true );
175175
176176 assertThat (contributionService .getCanContributeStatus (chainTaskId ).isPresent ()).isTrue ();
177177 assertThat (contributionService .getCanContributeStatus (chainTaskId ).get ().equals (ReplicateStatus .CANT_CONTRIBUTE_SINCE_AFTER_DEADLINE )).isTrue ();
@@ -184,7 +184,6 @@ public void GetCanContributeStatusShouldReturnContributed() {
184184 ChainTask chainTask = ChainTask .builder ()
185185 .dealid (chainDealId )
186186 .idx (0 )
187- .status (ACTIVE )
188187 .contributionDeadline (new Date ().getTime () + 1000 )
189188 .build ();
190189
@@ -194,6 +193,7 @@ public void GetCanContributeStatusShouldReturnContributed() {
194193 when (iexecHubService .getChainAccount ()).thenReturn (Optional .of (ChainAccount .builder ().deposit (1000 ).build ()));
195194 when (iexecHubService .getChainDeal (chainDealId )).thenReturn (Optional .of (ChainDeal .builder ().workerStake (BigInteger .valueOf (5 )).build ()));
196195 when (iexecHubService .getChainContribution (chainTaskId )).thenReturn (Optional .of (ChainContribution .builder ().status (ChainContributionStatus .CONTRIBUTED ).build ()));
196+ when (iexecHubService .isChainTaskActiveWhenNodeNotSync (chainTaskId )).thenReturn (true );
197197
198198 assertThat (contributionService .getCanContributeStatus (chainTaskId ).isPresent ()).isTrue ();
199199 assertThat (contributionService .getCanContributeStatus (chainTaskId ).get ().equals (ReplicateStatus .CANT_CONTRIBUTE_SINCE_CONTRIBUTION_ALREADY_SET )).isTrue ();
0 commit comments