-
Notifications
You must be signed in to change notification settings - Fork 133
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'Dev-2.0-esign' into Dev-2.0
- Loading branch information
Showing
32 changed files
with
745 additions
and
996 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
192 changes: 96 additions & 96 deletions
192
...flow-v2/src/test/java/org/egov/wf/repository/querybuilder/EscalationQueryBuilderTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,96 +1,96 @@ | ||
package org.egov.wf.repository.querybuilder; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.mockito.Mockito.atLeast; | ||
import static org.mockito.Mockito.mock; | ||
import static org.mockito.Mockito.verify; | ||
import static org.mockito.Mockito.when; | ||
|
||
import java.util.ArrayList; | ||
|
||
import org.egov.wf.web.models.EscalationSearchCriteria; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.test.context.ContextConfiguration; | ||
import org.springframework.test.context.junit.jupiter.SpringExtension; | ||
|
||
@ContextConfiguration(classes = {EscalationQueryBuilder.class}) | ||
@ExtendWith(SpringExtension.class) | ||
class EscalationQueryBuilderTest { | ||
@Autowired | ||
private EscalationQueryBuilder escalationQueryBuilder; | ||
|
||
|
||
@Test | ||
void testGetEscalationQuery() { | ||
EscalationSearchCriteria escalationSearchCriteria = mock(EscalationSearchCriteria.class); | ||
when(escalationSearchCriteria.getBusinessSlaExceededBy()).thenReturn(1L); | ||
when(escalationSearchCriteria.getStateSlaExceededBy()).thenReturn(1L); | ||
when(escalationSearchCriteria.getBusinessService()).thenReturn("Business Service"); | ||
when(escalationSearchCriteria.getStatus()).thenReturn("Status"); | ||
when(escalationSearchCriteria.getTenantId()).thenReturn("42"); | ||
ArrayList<Object> objectList = new ArrayList<>(); | ||
assertEquals( | ||
"select businessId from ( SELECT *,RANK () OVER (PARTITION BY businessId ORDER BY createdtime DESC)" | ||
+ " rank_number FROM eg_wf_processinstance_v2 WHERE businessservice = ? AND tenantid= ? ) wf WHERE" | ||
+ " rank_number = 1 AND wf.status = ? AND (select extract(epoch from current_timestamp)) * 1000 -" | ||
+ " wf.createdtime > ? AND (select extract(epoch from current_timestamp)) * 1000 -" | ||
+ " wf.createdtime > ? ", | ||
this.escalationQueryBuilder.getEscalationQuery(escalationSearchCriteria, objectList)); | ||
verify(escalationSearchCriteria, atLeast(1)).getBusinessSlaExceededBy(); | ||
verify(escalationSearchCriteria, atLeast(1)).getStateSlaExceededBy(); | ||
verify(escalationSearchCriteria).getBusinessService(); | ||
verify(escalationSearchCriteria).getStatus(); | ||
verify(escalationSearchCriteria).getTenantId(); | ||
assertEquals(5, objectList.size()); | ||
} | ||
|
||
|
||
@Test | ||
void testGetEscalationQuerywithstatesla() { | ||
EscalationSearchCriteria escalationSearchCriteria = mock(EscalationSearchCriteria.class); | ||
when(escalationSearchCriteria.getBusinessSlaExceededBy()).thenReturn(null); | ||
when(escalationSearchCriteria.getStateSlaExceededBy()).thenReturn(1L); | ||
when(escalationSearchCriteria.getBusinessService()).thenReturn("Business Service"); | ||
when(escalationSearchCriteria.getStatus()).thenReturn("Status"); | ||
when(escalationSearchCriteria.getTenantId()).thenReturn("42"); | ||
ArrayList<Object> objectList = new ArrayList<>(); | ||
assertEquals( | ||
"select businessId from ( SELECT *,RANK () OVER (PARTITION BY businessId ORDER BY createdtime DESC)" | ||
+ " rank_number FROM eg_wf_processinstance_v2 WHERE businessservice = ? AND tenantid= ? ) wf WHERE" | ||
+ " rank_number = 1 AND wf.status = ? AND (select extract(epoch from current_timestamp)) * 1000 -" | ||
+ " wf.createdtime > ? ", | ||
this.escalationQueryBuilder.getEscalationQuery(escalationSearchCriteria, objectList)); | ||
verify(escalationSearchCriteria).getBusinessSlaExceededBy(); | ||
verify(escalationSearchCriteria, atLeast(1)).getStateSlaExceededBy(); | ||
verify(escalationSearchCriteria).getBusinessService(); | ||
verify(escalationSearchCriteria).getStatus(); | ||
verify(escalationSearchCriteria).getTenantId(); | ||
assertEquals(4, objectList.size()); | ||
} | ||
|
||
@Test | ||
void testGetEscalationQuerywithbusinessservicesla() { | ||
EscalationSearchCriteria escalationSearchCriteria = mock(EscalationSearchCriteria.class); | ||
when(escalationSearchCriteria.getBusinessSlaExceededBy()).thenReturn(1L); | ||
when(escalationSearchCriteria.getStateSlaExceededBy()).thenReturn(null); | ||
when(escalationSearchCriteria.getBusinessService()).thenReturn("Business Service"); | ||
when(escalationSearchCriteria.getStatus()).thenReturn("Status"); | ||
when(escalationSearchCriteria.getTenantId()).thenReturn("42"); | ||
ArrayList<Object> objectList = new ArrayList<>(); | ||
assertEquals( | ||
"select businessId from ( SELECT *,RANK () OVER (PARTITION BY businessId ORDER BY createdtime DESC)" | ||
+ " rank_number FROM eg_wf_processinstance_v2 WHERE businessservice = ? AND tenantid= ? ) wf WHERE" | ||
+ " rank_number = 1 AND wf.status = ? AND (select extract(epoch from current_timestamp)) * 1000 -" | ||
+ " wf.createdtime > ? ", | ||
this.escalationQueryBuilder.getEscalationQuery(escalationSearchCriteria, objectList)); | ||
verify(escalationSearchCriteria, atLeast(1)).getBusinessSlaExceededBy(); | ||
verify(escalationSearchCriteria).getStateSlaExceededBy(); | ||
verify(escalationSearchCriteria).getBusinessService(); | ||
verify(escalationSearchCriteria).getStatus(); | ||
verify(escalationSearchCriteria).getTenantId(); | ||
assertEquals(4, objectList.size()); | ||
} | ||
} | ||
package org.egov.wf.repository.querybuilder; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.mockito.Mockito.atLeast; | ||
import static org.mockito.Mockito.mock; | ||
import static org.mockito.Mockito.verify; | ||
import static org.mockito.Mockito.when; | ||
|
||
import java.util.ArrayList; | ||
|
||
import org.egov.wf.web.models.EscalationSearchCriteria; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.test.context.ContextConfiguration; | ||
import org.springframework.test.context.junit.jupiter.SpringExtension; | ||
|
||
@ContextConfiguration(classes = {EscalationQueryBuilder.class}) | ||
@ExtendWith(SpringExtension.class) | ||
class EscalationQueryBuilderTest { | ||
@Autowired | ||
private EscalationQueryBuilder escalationQueryBuilder; | ||
|
||
|
||
@Test | ||
void testGetEscalationQuery() { | ||
EscalationSearchCriteria escalationSearchCriteria = mock(EscalationSearchCriteria.class); | ||
when(escalationSearchCriteria.getBusinessSlaExceededBy()).thenReturn(1L); | ||
when(escalationSearchCriteria.getStateSlaExceededBy()).thenReturn(1L); | ||
when(escalationSearchCriteria.getBusinessService()).thenReturn("Business Service"); | ||
when(escalationSearchCriteria.getStatus()).thenReturn("Status"); | ||
when(escalationSearchCriteria.getTenantId()).thenReturn("42"); | ||
ArrayList<Object> objectList = new ArrayList<>(); | ||
assertEquals( | ||
"select businessId from ( SELECT *,RANK () OVER (PARTITION BY businessId ORDER BY createdtime DESC)" | ||
+ " rank_number FROM eg_wf_processinstance_v2 WHERE businessservice = ? AND tenantid= ? ) wf WHERE" | ||
+ " rank_number = 1 AND wf.status = ? AND (select extract(epoch from current_timestamp)) * 1000 -" | ||
+ " wf.createdtime - wf.statesla > ? AND (select extract(epoch from current_timestamp)) * 1000 -" | ||
+ " wf.createdtime - wf.businessservicesla > ? ", | ||
this.escalationQueryBuilder.getEscalationQuery(escalationSearchCriteria, objectList)); | ||
verify(escalationSearchCriteria, atLeast(1)).getBusinessSlaExceededBy(); | ||
verify(escalationSearchCriteria, atLeast(1)).getStateSlaExceededBy(); | ||
verify(escalationSearchCriteria).getBusinessService(); | ||
verify(escalationSearchCriteria).getStatus(); | ||
verify(escalationSearchCriteria).getTenantId(); | ||
assertEquals(5, objectList.size()); | ||
} | ||
|
||
|
||
@Test | ||
void testGetEscalationQuerywithstatesla() { | ||
EscalationSearchCriteria escalationSearchCriteria = mock(EscalationSearchCriteria.class); | ||
when(escalationSearchCriteria.getBusinessSlaExceededBy()).thenReturn(null); | ||
when(escalationSearchCriteria.getStateSlaExceededBy()).thenReturn(1L); | ||
when(escalationSearchCriteria.getBusinessService()).thenReturn("Business Service"); | ||
when(escalationSearchCriteria.getStatus()).thenReturn("Status"); | ||
when(escalationSearchCriteria.getTenantId()).thenReturn("42"); | ||
ArrayList<Object> objectList = new ArrayList<>(); | ||
assertEquals( | ||
"select businessId from ( SELECT *,RANK () OVER (PARTITION BY businessId ORDER BY createdtime DESC)" | ||
+ " rank_number FROM eg_wf_processinstance_v2 WHERE businessservice = ? AND tenantid= ? ) wf WHERE" | ||
+ " rank_number = 1 AND wf.status = ? AND (select extract(epoch from current_timestamp)) * 1000 -" | ||
+ " wf.createdtime - wf.statesla > ? ", | ||
this.escalationQueryBuilder.getEscalationQuery(escalationSearchCriteria, objectList)); | ||
verify(escalationSearchCriteria).getBusinessSlaExceededBy(); | ||
verify(escalationSearchCriteria, atLeast(1)).getStateSlaExceededBy(); | ||
verify(escalationSearchCriteria).getBusinessService(); | ||
verify(escalationSearchCriteria).getStatus(); | ||
verify(escalationSearchCriteria).getTenantId(); | ||
assertEquals(4, objectList.size()); | ||
} | ||
|
||
@Test | ||
void testGetEscalationQuerywithbusinessservicesla() { | ||
EscalationSearchCriteria escalationSearchCriteria = mock(EscalationSearchCriteria.class); | ||
when(escalationSearchCriteria.getBusinessSlaExceededBy()).thenReturn(1L); | ||
when(escalationSearchCriteria.getStateSlaExceededBy()).thenReturn(null); | ||
when(escalationSearchCriteria.getBusinessService()).thenReturn("Business Service"); | ||
when(escalationSearchCriteria.getStatus()).thenReturn("Status"); | ||
when(escalationSearchCriteria.getTenantId()).thenReturn("42"); | ||
ArrayList<Object> objectList = new ArrayList<>(); | ||
assertEquals( | ||
"select businessId from ( SELECT *,RANK () OVER (PARTITION BY businessId ORDER BY createdtime DESC)" | ||
+ " rank_number FROM eg_wf_processinstance_v2 WHERE businessservice = ? AND tenantid= ? ) wf WHERE" | ||
+ " rank_number = 1 AND wf.status = ? AND (select extract(epoch from current_timestamp)) * 1000 -" | ||
+ " wf.createdtime - wf.businessservicesla > ? ", | ||
this.escalationQueryBuilder.getEscalationQuery(escalationSearchCriteria, objectList)); | ||
verify(escalationSearchCriteria, atLeast(1)).getBusinessSlaExceededBy(); | ||
verify(escalationSearchCriteria).getStateSlaExceededBy(); | ||
verify(escalationSearchCriteria).getBusinessService(); | ||
verify(escalationSearchCriteria).getStatus(); | ||
verify(escalationSearchCriteria).getTenantId(); | ||
assertEquals(4, objectList.size()); | ||
} | ||
} | ||
|
Oops, something went wrong.