From 9648bbbacea94821eab67c2775099237b1603db1 Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Mon, 10 Feb 2025 18:18:53 +0100 Subject: [PATCH] Aggiunto OfficeConstants --- package-lock.json | 2 +- package.json | 2 +- pom.xml | 2 +- .../it/cnr/isti/epasmed/OfficeConstants.java | 15 ++++++ .../epasmed/domain/TimeCardsReporting.java | 2 +- .../it/cnr/isti/epasmed/sync/SyncService.java | 46 +++++++++---------- src/main/resources/.h2.server.properties | 2 +- .../rest/epas/EPASAbsenceTypesResourceIT.java | 5 -- .../rest/epas/EPASAffiliationsResourceIT.java | 16 +++---- .../epas/EPASCertificationsResourceIT.java | 19 ++++---- .../web/rest/epas/EPASChildrenResourceIT.java | 23 ++++------ .../rest/epas/EPASContractsResourceIT.java | 7 +-- .../web/rest/epas/EPASGroupsResourceIT.java | 20 ++++---- .../web/rest/epas/EPASLeavesResourceIT.java | 17 +++---- .../rest/epas/EPASOffSiteWorksResourceIT.java | 25 ++++------ .../rest/epas/EPASPersonWorkingTimeIT.java | 12 ++--- .../web/rest/epas/EPASPersonsResourceIT.java | 23 ++++------ .../rest/epas/EPASStampingsResourceIT.java | 4 -- .../rest/epas/EPASTimeCardsResourceIT.java | 26 ++++------- .../rest/epas/EPASValidatesResourceIT.java | 18 ++++---- .../epas/EPASWorkingTimeTypesResourceIT.java | 8 +--- 21 files changed, 131 insertions(+), 163 deletions(-) create mode 100644 src/main/java/it/cnr/isti/epasmed/OfficeConstants.java diff --git a/package-lock.json b/package-lock.json index 8bb4f21..734d392 100755 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "epasmed", - "version": "1.0.6", + "version": "1.0.7", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 7880d00..ccd780b 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "epasmed", - "version": "1.0.5", + "version": "1.0.7", "description": "Description for epasmed", "private": true, "license": "UNLICENSED", diff --git a/pom.xml b/pom.xml index db42f53..cb8bd94 100755 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ it.cnr.isti.epasmed epasmed - 1.0.6 + 1.0.7 jar epasmed diff --git a/src/main/java/it/cnr/isti/epasmed/OfficeConstants.java b/src/main/java/it/cnr/isti/epasmed/OfficeConstants.java new file mode 100644 index 0000000..0753b30 --- /dev/null +++ b/src/main/java/it/cnr/isti/epasmed/OfficeConstants.java @@ -0,0 +1,15 @@ +package it.cnr.isti.epasmed; + +/** + * + * ISTI Office + * + */ +public class OfficeConstants { + + public static final String ISTI_OFFICE_ID = "657"; + public static final String ISTI_OFFICE_NAME = "ISTI - Pisa"; + public static final String ISTI_OFFICE_CODE = "074000"; + public static final String ISTI_OFFICE_CODEID = "225200"; + +} diff --git a/src/main/java/it/cnr/isti/epasmed/domain/TimeCardsReporting.java b/src/main/java/it/cnr/isti/epasmed/domain/TimeCardsReporting.java index d5b068f..70e053a 100755 --- a/src/main/java/it/cnr/isti/epasmed/domain/TimeCardsReporting.java +++ b/src/main/java/it/cnr/isti/epasmed/domain/TimeCardsReporting.java @@ -13,7 +13,7 @@ import javax.persistence.Table; import javax.validation.constraints.NotNull; /** - * A user. + * TimeCardsReporting contains year and month */ @Entity @Table(name = "timecardsreporting") diff --git a/src/main/java/it/cnr/isti/epasmed/sync/SyncService.java b/src/main/java/it/cnr/isti/epasmed/sync/SyncService.java index aba114c..83c6711 100755 --- a/src/main/java/it/cnr/isti/epasmed/sync/SyncService.java +++ b/src/main/java/it/cnr/isti/epasmed/sync/SyncService.java @@ -26,6 +26,7 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import it.cnr.isti.epasmed.OfficeConstants; import it.cnr.isti.epasmed.domain.Leaves; import it.cnr.isti.epasmed.domain.PersOrario; import it.cnr.isti.epasmed.domain.TabsSI; @@ -91,8 +92,7 @@ import it.cnr.isti.epasmed.sistemainformativo.service.SITelefoniService; @Service public class SyncService { - private static final String ISTI_OFFICE_ID = "1"; - private static final String ISTI_OFFICE_CODEID = "225200"; + private static final String SI_FLAG_DEL_TRUE = "1"; private static final String SI_FLAG_DEL_FALSE = "0"; @@ -299,12 +299,12 @@ public class SyncService { case "telefoni": syncTelefoni(tab); break; - case "gruppi": - syncGruppi(tab); - break; - case "gruppo_pers": - syncGruppoPers(tab); - break; + //case "gruppi": + // syncGruppi(tab); + // break; + //case "gruppo_pers": + // syncGruppoPers(tab); + // break; // case "posizioni": // posizioniTab = tab; // break; @@ -350,7 +350,7 @@ public class SyncService { epasPersonsDTO.setFiscalCode(sia.getCodicefiscale()); epasPersonsDTO.setName(sia.getNome()); epasPersonsDTO.setSurname(sia.getCognome()); - epasPersonsDTO.setOfficeId(ISTI_OFFICE_ID); + epasPersonsDTO.setOfficeId(OfficeConstants.ISTI_OFFICE_ID); String email = createCNREmail(sia); epasPersonsDTO.setEmail(email); epasPersonsDTO.setQualification(PERSON_DEFAULT_QUALIFICATION); @@ -554,7 +554,7 @@ public class SyncService { if (sig.getId() != null && sig.getId() != 0) { if (sig.getFlag_del() != null && !sig.getFlag_del().isEmpty()) { if (sig.getFlag_del().compareTo(SI_FLAG_DEL_TRUE) != 0) { - List epasGroups = epasGroupsService.getList(ISTI_OFFICE_ID); + List epasGroups = epasGroupsService.getList(OfficeConstants.ISTI_OFFICE_ID); if (epasGroups != null) { EPASGroups groupPresent = null; for (EPASGroups g : epasGroups) { @@ -566,7 +566,7 @@ public class SyncService { if (groupPresent == null) { EPASGroupsDTO epasGroupsDTO = new EPASGroupsDTO(sig.getDescrizione(), null, - String.valueOf(sig.getId()), null, "1", sig.getSigla(), ISTI_OFFICE_ID); + String.valueOf(sig.getId()), null, "1", sig.getSigla(), OfficeConstants.ISTI_OFFICE_ID); EPASGroups epasGroup = epasGroupsService.create(epasGroupsDTO); logger.info("EPAS Created Group: {}", epasGroup); } else { @@ -575,19 +575,19 @@ public class SyncService { epasGroupsDTO.setDescription(sig.getDescrizione()); epasGroupsDTO.setName(sig.getSigla()); if (epasGroupsDTO.getOfficeId() == null || epasGroupsDTO.getOfficeId().isEmpty()) { - epasGroupsDTO.setOfficeId(ISTI_OFFICE_ID); + epasGroupsDTO.setOfficeId(OfficeConstants.ISTI_OFFICE_ID); } epasGroupsService.updateById(groupPresent.getId(), epasGroupsDTO); logger.info("EPAS Updated Group: {}", epasGroupsDTO); } } else { EPASGroupsDTO epasGroupsDTO = new EPASGroupsDTO(sig.getDescrizione(), null, - String.valueOf(sig.getId()), null, null, sig.getSigla(), ISTI_OFFICE_ID); + String.valueOf(sig.getId()), null, null, sig.getSigla(), OfficeConstants.ISTI_OFFICE_ID); EPASGroups epasGroup = epasGroupsService.create(epasGroupsDTO); logger.info("EPAS Created Group: {}", epasGroup); } } else { - List epasGroups = epasGroupsService.getList(ISTI_OFFICE_ID); + List epasGroups = epasGroupsService.getList(OfficeConstants.ISTI_OFFICE_ID); if (epasGroups != null) { EPASGroups groupPresent = null; for (EPASGroups g : epasGroups) { @@ -606,7 +606,7 @@ public class SyncService { EPASGroupsDTO epasGroupsDTO = epasGroupsMapper .epasGroupsToEPASGroupsDTO(groupPresent); if (epasGroupsDTO.getOfficeId() == null || epasGroupsDTO.getOfficeId().isEmpty()) { - epasGroupsDTO.setOfficeId(ISTI_OFFICE_ID); + epasGroupsDTO.setOfficeId(OfficeConstants.ISTI_OFFICE_ID); } epasGroupsService.updateById(groupPresent.getId(), epasGroupsDTO); logger.info("EPAS Delete Group: {}", epasGroupsDTO); @@ -712,7 +712,7 @@ public class SyncService { private void gestisciDipendenteNonAffiliato(SIGruppiPers sigp) { logger.debug("Aggiungi dipendente non affiliato"); - List epasGroups = epasGroupsService.getList(ISTI_OFFICE_ID); + List epasGroups = epasGroupsService.getList(OfficeConstants.ISTI_OFFICE_ID); EPASGroups groupPresent = null; if (epasGroups != null) { for (EPASGroups g : epasGroups) { @@ -769,7 +769,7 @@ public class SyncService { } } if (affPresent != null) { - List epasGroups = epasGroupsService.getList(ISTI_OFFICE_ID); + List epasGroups = epasGroupsService.getList(OfficeConstants.ISTI_OFFICE_ID); EPASGroups groupPresent = null; if (epasGroups != null) { for (EPASGroups g : epasGroups) { @@ -1154,7 +1154,7 @@ public class SyncService { LocalDateTime lastUpdate = tab.getLastUpdate(); LocalDateTime maxLastUpdate = null; - List eWTTs = epasWorkingTimeTypesService.getListByOfficeCodeId(ISTI_OFFICE_CODEID); + List eWTTs = epasWorkingTimeTypesService.getListByOfficeCodeId(OfficeConstants.ISTI_OFFICE_CODEID); for (EPASWorkingTimeTypes eWTT : eWTTs) { // "2021-02-03T09:49:05.231072" DateTimeFormatter formatter = new DateTimeFormatterBuilder().parseCaseInsensitive() @@ -1199,7 +1199,7 @@ public class SyncService { logger.info("Reference: {}-{}", year, month); - List epasOffSiteWorksList = epasOffSiteWorksService.getListByOfficeCodeId(ISTI_OFFICE_CODEID, + List epasOffSiteWorksList = epasOffSiteWorksService.getListByOfficeCodeId(OfficeConstants.ISTI_OFFICE_CODEID, year, month); if (epasOffSiteWorksList == null || epasOffSiteWorksList.isEmpty()) { @@ -1316,9 +1316,9 @@ public class SyncService { nextYear = nextYear + 1; logger.debug("Next Year: {}", nextYear.toString()); - List epasLeavesList = epasLeavesService.getLeavesByOfficeId(ISTI_OFFICE_ID, year, "true"); + List epasLeavesList = epasLeavesService.getLeavesByOfficeId(OfficeConstants.ISTI_OFFICE_ID, year, "true"); logger.debug("Current Year Leaves: {}", epasLeavesList); - List epasLeavesNextList = epasLeavesService.getLeavesByOfficeId(ISTI_OFFICE_ID, nextYear.toString(), + List epasLeavesNextList = epasLeavesService.getLeavesByOfficeId(OfficeConstants.ISTI_OFFICE_ID, nextYear.toString(), "true"); logger.debug("Next Year Leaves: {}", epasLeavesNextList); @@ -1495,7 +1495,7 @@ public class SyncService { logger.info("Reference: {}-{}", year, month); List epasPersonWorkingTimeDTOList = epasPersonWorkingTimeService - .getList(ISTI_OFFICE_ID); + .getList(OfficeConstants.ISTI_OFFICE_ID); if (epasPersonWorkingTimeDTOList == null || epasPersonWorkingTimeDTOList.isEmpty()) { logger.error("PersonWorkingTimeDTOList not found"); @@ -1632,7 +1632,7 @@ public class SyncService { logger.info("Reference: {}-{}", year, month); - EPASValidates epasValidates = epasValidatesService.getValidatesByOfficeCodeId(ISTI_OFFICE_CODEID, year, month); + EPASValidates epasValidates = epasValidatesService.getValidatesByOfficeCodeId(OfficeConstants.ISTI_OFFICE_CODEID, year, month); // if (!epasValidates.getAllCertificationsValidated()) { // logger.info("No month closed on EPAS: {}", nextMonthToSent); // return; diff --git a/src/main/resources/.h2.server.properties b/src/main/resources/.h2.server.properties index 49f4b00..07a5f48 100755 --- a/src/main/resources/.h2.server.properties +++ b/src/main/resources/.h2.server.properties @@ -1,5 +1,5 @@ #H2 Server Properties -#Mon Nov 14 15:08:07 CET 2022 +#Mon Feb 10 12:24:19 CET 2025 0=JHipster H2 (Disk)|org.h2.Driver|jdbc\:h2\:file\:./target/h2db/db/epasmed|epasmed webAllowOthers=true webPort=8082 diff --git a/src/test/java/it/cnr/isti/epasmed/web/rest/epas/EPASAbsenceTypesResourceIT.java b/src/test/java/it/cnr/isti/epasmed/web/rest/epas/EPASAbsenceTypesResourceIT.java index eda2ee9..6baa8c1 100644 --- a/src/test/java/it/cnr/isti/epasmed/web/rest/epas/EPASAbsenceTypesResourceIT.java +++ b/src/test/java/it/cnr/isti/epasmed/web/rest/epas/EPASAbsenceTypesResourceIT.java @@ -38,11 +38,6 @@ public class EPASAbsenceTypesResourceIT { private final Logger logger = LoggerFactory.getLogger(getClass()); - // private static final String OFFICE_DEFAULT_ID = "1"; - // private static final String OFFICE_DEFAULT_NAME = "ISTI - Pisa"; - // private static final String OFFICE_DEFAULT_CODE = "074000"; - // private static final String OFFICE_DEFAULT_CODEID = "225200"; - @Autowired private MockMvc restEPASAbsenceTypesMockMvc; diff --git a/src/test/java/it/cnr/isti/epasmed/web/rest/epas/EPASAffiliationsResourceIT.java b/src/test/java/it/cnr/isti/epasmed/web/rest/epas/EPASAffiliationsResourceIT.java index 531df36..95c1c35 100755 --- a/src/test/java/it/cnr/isti/epasmed/web/rest/epas/EPASAffiliationsResourceIT.java +++ b/src/test/java/it/cnr/isti/epasmed/web/rest/epas/EPASAffiliationsResourceIT.java @@ -33,6 +33,7 @@ import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; import it.cnr.isti.epasmed.EpasmedApp; +import it.cnr.isti.epasmed.OfficeConstants; import it.cnr.isti.epasmed.epas.dto.EPASAffiliationsDTO; import it.cnr.isti.epasmed.epas.mapper.EPASAffiliationsMapper; import it.cnr.isti.epasmed.epas.model.EPASAffiliations; @@ -52,10 +53,7 @@ public class EPASAffiliationsResourceIT { private final Logger log = LoggerFactory.getLogger(getClass()); - private static final String OFFICE_DEFAULT_ID = "1"; - //private static final String OFFICE_DEFAULT_NAME = "ISTI - Pisa"; - //private static final String OFFICE_DEFAULT_CODE = "074000"; - //private static final String OFFICE_DEFAULT_CODEID = "225200"; + private static final String PERSON_DEFAULT_FISCAL_CODE = "PNCGCR75S04L103G"; private static final String AFFILIATION_DEFAULT_ID = "1"; private static final String AFFILIATION_DEFAULT_BEGINDATE = "2021-01-01"; @@ -107,23 +105,23 @@ public class EPASAffiliationsResourceIT { @Test public void getAffiliationByGroup() throws Exception { - restEPASAffiliationsMockMvc.perform(get("/api/epas/affiliations/byGroup?id=" + 23)).andExpect(status().isOk()); + restEPASAffiliationsMockMvc.perform(get("/api/epas/affiliations/byGroup?id=" + 385)).andExpect(status().isOk()); } @Test public void getAffiliationByPersonId() throws Exception { - restEPASAffiliationsMockMvc.perform(get("/api/epas/affiliations/byPerson?id=" + 43)).andExpect(status().isOk()); + restEPASAffiliationsMockMvc.perform(get("/api/epas/affiliations/byPerson?id=" + 11694)).andExpect(status().isOk()); } @Test public void getAffiliationByPersonFiscalcode() throws Exception { - restEPASAffiliationsMockMvc.perform(get("/api/epas/affiliations/byPerson?fiscalCode=DZZPRZ79S23B832W")) + restEPASAffiliationsMockMvc.perform(get("/api/epas/affiliations/byPerson?fiscalCode="+PERSON_DEFAULT_FISCAL_CODE)) .andExpect(status().isOk()); } @Test public void getAffiliationList() throws Exception { - restEPASAffiliationsMockMvc.perform(get("/api/epas/affiliations?officeId=" + OFFICE_DEFAULT_ID)) + restEPASAffiliationsMockMvc.perform(get("/api/epas/affiliations?officeId=" + OfficeConstants.ISTI_OFFICE_ID)) .andExpect(status().isOk()); } @@ -210,7 +208,7 @@ public class EPASAffiliationsResourceIT { } private List retrieveEPASGroups() throws Exception { - MvcResult result = restEPASAffiliationsMockMvc.perform(get("/api/epas/groups?officeId=" + OFFICE_DEFAULT_ID)) + MvcResult result = restEPASAffiliationsMockMvc.perform(get("/api/epas/groups?officeId=" + OfficeConstants.ISTI_OFFICE_ID)) .andExpect(status().isOk()).andReturn(); ObjectMapper mapper = new ObjectMapper(); List epasGroups = mapper.readValue(result.getResponse().getContentAsString(), diff --git a/src/test/java/it/cnr/isti/epasmed/web/rest/epas/EPASCertificationsResourceIT.java b/src/test/java/it/cnr/isti/epasmed/web/rest/epas/EPASCertificationsResourceIT.java index 2d2102b..5910f2c 100755 --- a/src/test/java/it/cnr/isti/epasmed/web/rest/epas/EPASCertificationsResourceIT.java +++ b/src/test/java/it/cnr/isti/epasmed/web/rest/epas/EPASCertificationsResourceIT.java @@ -16,6 +16,7 @@ import org.springframework.test.context.junit.jupiter.EnabledIf; import org.springframework.test.web.servlet.MockMvc; import it.cnr.isti.epasmed.EpasmedApp; +import it.cnr.isti.epasmed.OfficeConstants; import it.cnr.isti.epasmed.security.AuthoritiesConstants; /** @@ -29,18 +30,14 @@ public class EPASCertificationsResourceIT { private final Logger log = LoggerFactory.getLogger(getClass()); - // private static final String OFFICE_DEFAULT_ID = "1"; - // private static final String OFFICE_DEFAULT_NAME = "ISTI - Pisa"; - // private static final String OFFICE_DEFAULT_CODE = "074000"; - private static final String OFFICE_DEFAULT_CODEID = "225200"; - + private static final String PERSON_DEFAULT_ID = "113"; - //private static final String PERSON_DEFAULT_NAME = "Giuseppe"; - //private static final String PERSON_DEFAULT_SURNAME = "Amato"; private static final String PERSON_DEFAULT_FISCAL_CODE = "MTAGPP68D15D976W"; private static final String PERSON_DEFAULT_EMAIL = "giuseppe.amato@cnr.it"; //private static final String PERSON_DEFAULT_QUALIFICATION = "2"; + private static final String YEAR_DEFAULT = "2025"; + private static final String MONTH_DEFAULT = "1"; @Autowired private MockMvc restEPASCertificationsMockMvc; @@ -59,7 +56,7 @@ public class EPASCertificationsResourceIT { @Test public void getEPASCertificationsByPersonId() throws Exception { - restEPASCertificationsMockMvc.perform(get("/api/epas/certifications/getMonthSituation?id=" + PERSON_DEFAULT_ID + "&year=2021&month=11")) + restEPASCertificationsMockMvc.perform(get("/api/epas/certifications/getMonthSituation?id=" + PERSON_DEFAULT_ID + "&year="+YEAR_DEFAULT+"&month="+MONTH_DEFAULT)) .andExpect(status().isOk()); } @@ -67,21 +64,21 @@ public class EPASCertificationsResourceIT { public void getEPASCertificationsByPersonFiscalcode() throws Exception { restEPASCertificationsMockMvc .perform( - get("/api/epas/certifications/getMonthSituation?fiscalCode=" + PERSON_DEFAULT_FISCAL_CODE + "&year=2021&month=11")) + get("/api/epas/certifications/getMonthSituation?fiscalCode=" + PERSON_DEFAULT_FISCAL_CODE + "&year="+YEAR_DEFAULT+"&month="+MONTH_DEFAULT)) .andExpect(status().isOk()); } @Test public void getEPASCertificationsByPersonEmail() throws Exception { restEPASCertificationsMockMvc - .perform(get("/api/epas/certifications/getMonthSituation?email=" + PERSON_DEFAULT_EMAIL + "&year=2021&month=11")) + .perform(get("/api/epas/certifications/getMonthSituation?email=" + PERSON_DEFAULT_EMAIL + "&year="+YEAR_DEFAULT+"&month="+MONTH_DEFAULT)) .andExpect(status().isOk()); } @Test public void getEPASCertificationsByOfficeCodeId() throws Exception { restEPASCertificationsMockMvc - .perform(get("/api/epas/certifications/getMonthSituationByOffice?officeCodeId=" + OFFICE_DEFAULT_CODEID + "&year=2021&month=10")) + .perform(get("/api/epas/certifications/getMonthSituationByOffice?officeCodeId=" + OfficeConstants.ISTI_OFFICE_CODEID + "&year="+YEAR_DEFAULT+"&month="+MONTH_DEFAULT)) .andExpect(status().isOk()); } diff --git a/src/test/java/it/cnr/isti/epasmed/web/rest/epas/EPASChildrenResourceIT.java b/src/test/java/it/cnr/isti/epasmed/web/rest/epas/EPASChildrenResourceIT.java index 55651d5..6abd96b 100755 --- a/src/test/java/it/cnr/isti/epasmed/web/rest/epas/EPASChildrenResourceIT.java +++ b/src/test/java/it/cnr/isti/epasmed/web/rest/epas/EPASChildrenResourceIT.java @@ -33,6 +33,7 @@ import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; import it.cnr.isti.epasmed.EpasmedApp; +import it.cnr.isti.epasmed.OfficeConstants; import it.cnr.isti.epasmed.epas.dto.EPASChildrenDTO; import it.cnr.isti.epasmed.epas.mapper.EPASChildrenMapper; import it.cnr.isti.epasmed.epas.model.EPASChildren; @@ -52,16 +53,10 @@ public class EPASChildrenResourceIT { private final Logger log = LoggerFactory.getLogger(getClass()); - private static final String OFFICE_DEFAULT_ID = "1"; - private static final String OFFICE_DEFAULT_NAME = "ISTI - Pisa"; - private static final String OFFICE_DEFAULT_CODE = "074000"; - private static final String OFFICE_DEFAULT_CODEID = "225200"; - + private static final String PERSON_DEFAULT_ID = "113"; - // private static final String PERSON_DEFAULT_NAME = "Giuseppe"; - // private static final String PERSON_DEFAULT_SURNAME = "Amato"; - private static final String PERSON_DEFAULT_FISCAL_CODE = "MTAGPP68D15D976W"; - private static final String PERSON_DEFAULT_EMAIL = "giuseppe.amato@cnr.it"; + private static final String PERSON_DEFAULT_FISCAL_CODE = "PNCGCR75S04L103G"; + private static final String PERSON_DEFAULT_EMAIL = "giancarlo.panichi@cnr.it"; // private static final String PERSON_DEFAULT_QUALIFICATION = "2"; private static final String CHILDREN_DEFAULT_ID = "xxx"; @@ -85,10 +80,10 @@ public class EPASChildrenResourceIT { public static EPASOffice createOffice() { EPASOffice epasOffice = new EPASOffice(); - epasOffice.setId(OFFICE_DEFAULT_ID); - epasOffice.setName(OFFICE_DEFAULT_NAME); - epasOffice.setCode(OFFICE_DEFAULT_CODE); - epasOffice.setCodeId(OFFICE_DEFAULT_CODEID); + epasOffice.setId(OfficeConstants.ISTI_OFFICE_ID); + epasOffice.setName(OfficeConstants.ISTI_OFFICE_NAME); + epasOffice.setCode(OfficeConstants.ISTI_OFFICE_CODE); + epasOffice.setCodeId(OfficeConstants.ISTI_OFFICE_CODEID); return epasOffice; } @@ -161,7 +156,7 @@ public class EPASChildrenResourceIT { List epasPersons = null; try { - MvcResult result = restEPASChildrenMockMvc.perform(get("/api/epas/persons?officeId=" + OFFICE_DEFAULT_ID)) + MvcResult result = restEPASChildrenMockMvc.perform(get("/api/epas/persons?officeId=" + OfficeConstants.ISTI_OFFICE_ID)) .andExpect(status().isOk()).andReturn(); ObjectMapper mapper = new ObjectMapper(); diff --git a/src/test/java/it/cnr/isti/epasmed/web/rest/epas/EPASContractsResourceIT.java b/src/test/java/it/cnr/isti/epasmed/web/rest/epas/EPASContractsResourceIT.java index 4c33185..e8bf81f 100755 --- a/src/test/java/it/cnr/isti/epasmed/web/rest/epas/EPASContractsResourceIT.java +++ b/src/test/java/it/cnr/isti/epasmed/web/rest/epas/EPASContractsResourceIT.java @@ -37,6 +37,7 @@ import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.ObjectMapper; import it.cnr.isti.epasmed.EpasmedApp; +import it.cnr.isti.epasmed.OfficeConstants; import it.cnr.isti.epasmed.epas.dto.EPASContractsDTO; import it.cnr.isti.epasmed.epas.mapper.EPASContractsMapper; import it.cnr.isti.epasmed.epas.model.EPASContracts; @@ -55,10 +56,6 @@ public class EPASContractsResourceIT { private final Logger logger = LoggerFactory.getLogger(getClass()); - private static final String OFFICE_DEFAULT_ID = "1"; - //private static final String OFFICE_DEFAULT_CODEID = "225200"; - - private static final String PERSON_DEFAULT_ID = "1"; private static final String PERSON_DEFAULT_NAME = "Giancarlo"; private static final String PERSON_DEFAULT_SURNAME = "Panichi"; @@ -157,7 +154,7 @@ public class EPASContractsResourceIT { @Test public void getContractMap() throws Exception { MvcResult result = restEPASContractsMockMvc - .perform(get("/api/epas/contracts/map?officeId=" + OFFICE_DEFAULT_ID)) + .perform(get("/api/epas/contracts/map?officeId=" + OfficeConstants.ISTI_OFFICE_ID)) .andExpect(status().isOk()).andReturn(); ObjectMapper mapper = new ObjectMapper(); diff --git a/src/test/java/it/cnr/isti/epasmed/web/rest/epas/EPASGroupsResourceIT.java b/src/test/java/it/cnr/isti/epasmed/web/rest/epas/EPASGroupsResourceIT.java index 8f206ce..c8a175e 100755 --- a/src/test/java/it/cnr/isti/epasmed/web/rest/epas/EPASGroupsResourceIT.java +++ b/src/test/java/it/cnr/isti/epasmed/web/rest/epas/EPASGroupsResourceIT.java @@ -28,6 +28,7 @@ import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; import it.cnr.isti.epasmed.EpasmedApp; +import it.cnr.isti.epasmed.OfficeConstants; import it.cnr.isti.epasmed.epas.dto.EPASGroupsDTO; import it.cnr.isti.epasmed.epas.mapper.EPASGroupsMapper; import it.cnr.isti.epasmed.epas.model.EPASGroups; @@ -47,10 +48,7 @@ public class EPASGroupsResourceIT { private final Logger log = LoggerFactory.getLogger(getClass()); - private static final String OFFICE_DEFAULT_ID = "1"; - private static final String OFFICE_DEFAULT_NAME = "ISTI - Pisa"; - private static final String OFFICE_DEFAULT_CODE = "074000"; - private static final String OFFICE_DEFAULT_CODEID = "225200"; + private static final String MANAGER_DEFAULT_ID = "1"; private static final String MANAGER_DEFAULT_FULLNAME = "Giancarlo Panichi"; @@ -113,10 +111,10 @@ public class EPASGroupsResourceIT { public static EPASOffice createOffice() { EPASOffice epasOffice = new EPASOffice(); - epasOffice.setId(OFFICE_DEFAULT_ID); - epasOffice.setName(OFFICE_DEFAULT_NAME); - epasOffice.setCode(OFFICE_DEFAULT_CODE); - epasOffice.setCodeId(OFFICE_DEFAULT_CODEID); + epasOffice.setId(OfficeConstants.ISTI_OFFICE_ID); + epasOffice.setName(OfficeConstants.ISTI_OFFICE_NAME); + epasOffice.setCode(OfficeConstants.ISTI_OFFICE_CODE); + epasOffice.setCodeId(OfficeConstants.ISTI_OFFICE_CODEID); return epasOffice; } @@ -199,7 +197,7 @@ public class EPASGroupsResourceIT { @Test public void getGroupList() throws Exception { - restEPASGroupsMockMvc.perform(get("/api/epas/groups?officeId=" + OFFICE_DEFAULT_ID)).andExpect(status().isOk()); + restEPASGroupsMockMvc.perform(get("/api/epas/groups?officeId=" + OfficeConstants.ISTI_OFFICE_ID)).andExpect(status().isOk()); } @Test @@ -222,7 +220,7 @@ public class EPASGroupsResourceIT { @Test public void istiUpdateGroups() throws Exception { - MvcResult result = restEPASGroupsMockMvc.perform(get("/api/epas/groups?officeId=" + OFFICE_DEFAULT_ID)) + MvcResult result = restEPASGroupsMockMvc.perform(get("/api/epas/groups?officeId=" + OfficeConstants.ISTI_OFFICE_ID)) .andExpect(status().isOk()).andReturn(); ObjectMapper mapper = new ObjectMapper(); List epasG = mapper.readValue(result.getResponse().getContentAsString(), @@ -263,7 +261,7 @@ public class EPASGroupsResourceIT { @Test public void getGroupByExternalId() throws Exception{ String externalId="29"; - MvcResult mvcResult=restEPASGroupsMockMvc.perform(get("/api/epas/groups?officeId=" + OFFICE_DEFAULT_ID)).andExpect(status().isOk()).andReturn(); + MvcResult mvcResult=restEPASGroupsMockMvc.perform(get("/api/epas/groups?officeId=" + OfficeConstants.ISTI_OFFICE_ID)).andExpect(status().isOk()).andReturn(); ObjectMapper mapper = new ObjectMapper(); List epasGroups = mapper.readValue(mvcResult.getResponse().getContentAsString(), diff --git a/src/test/java/it/cnr/isti/epasmed/web/rest/epas/EPASLeavesResourceIT.java b/src/test/java/it/cnr/isti/epasmed/web/rest/epas/EPASLeavesResourceIT.java index a33ef13..130761e 100755 --- a/src/test/java/it/cnr/isti/epasmed/web/rest/epas/EPASLeavesResourceIT.java +++ b/src/test/java/it/cnr/isti/epasmed/web/rest/epas/EPASLeavesResourceIT.java @@ -16,6 +16,7 @@ import org.springframework.test.context.junit.jupiter.EnabledIf; import org.springframework.test.web.servlet.MockMvc; import it.cnr.isti.epasmed.EpasmedApp; +import it.cnr.isti.epasmed.OfficeConstants; import it.cnr.isti.epasmed.security.AuthoritiesConstants; /** @@ -29,18 +30,14 @@ public class EPASLeavesResourceIT { private final Logger log = LoggerFactory.getLogger(getClass()); - private static final String OFFICE_DEFAULT_ID = "1"; - // private static final String OFFICE_DEFAULT_NAME = "ISTI - Pisa"; - // private static final String OFFICE_DEFAULT_CODE = "074000"; - // private static final String OFFICE_DEFAULT_CODEID = "225200"; - private static final String YEAR_DEFAULT = "2022"; + private static final String YEAR_DEFAULT = "2025"; private static final String INCLUDEDETAILS_DEFAULT = "false"; private static final String PERSON_DEFAULT_ID = "1"; - // private static final String PERSON_DEFAULT_NAME = "Giulio"; - // private static final String PERSON_DEFAULT_SURNAME = "Mori"; - private static final String PERSON_DEFAULT_FISCAL_CODE = "MROGLI68H29E625F"; - private static final String PERSON_DEFAULT_EMAIL = "giulio.mori@cnr.it"; + // private static final String PERSON_DEFAULT_NAME = "Maria"; + // private static final String PERSON_DEFAULT_SURNAME = "Picchi"; + private static final String PERSON_DEFAULT_FISCAL_CODE = "PCCMRA63M50G702W"; + private static final String PERSON_DEFAULT_EMAIL = "maria.picchi@cnr.it"; @Autowired private MockMvc restEPASLeavesMockMvc; @@ -77,7 +74,7 @@ public class EPASLeavesResourceIT { @Test public void getEPASLeavesByOfficeId() throws Exception { - restEPASLeavesMockMvc.perform(get("/api/epas/leaves/byOfficeAndYear?officeId=" + OFFICE_DEFAULT_ID + "&year=" + restEPASLeavesMockMvc.perform(get("/api/epas/leaves/byOfficeAndYear?officeId=" + OfficeConstants.ISTI_OFFICE_ID + "&year=" + YEAR_DEFAULT + "&includeDetails=" + INCLUDEDETAILS_DEFAULT)).andExpect(status().isOk()); } diff --git a/src/test/java/it/cnr/isti/epasmed/web/rest/epas/EPASOffSiteWorksResourceIT.java b/src/test/java/it/cnr/isti/epasmed/web/rest/epas/EPASOffSiteWorksResourceIT.java index bfc047f..522df98 100644 --- a/src/test/java/it/cnr/isti/epasmed/web/rest/epas/EPASOffSiteWorksResourceIT.java +++ b/src/test/java/it/cnr/isti/epasmed/web/rest/epas/EPASOffSiteWorksResourceIT.java @@ -16,6 +16,7 @@ import org.springframework.test.context.junit.jupiter.EnabledIf; import org.springframework.test.web.servlet.MockMvc; import it.cnr.isti.epasmed.EpasmedApp; +import it.cnr.isti.epasmed.OfficeConstants; import it.cnr.isti.epasmed.security.AuthoritiesConstants; /** @@ -29,20 +30,14 @@ public class EPASOffSiteWorksResourceIT { private final Logger log = LoggerFactory.getLogger(getClass()); - //private static final String OFFICE_DEFAULT_ID = "1"; - //private static final String OFFICE_DEFAULT_NAME = "ISTI - Pisa"; - //private static final String OFFICE_DEFAULT_CODE = "074000"; - private static final String OFFICE_DEFAULT_CODEID = "225200"; - private static final String PERSON_DEFAULT_ID = "113"; - //private static final String PERSON_DEFAULT_NAME = "Giuseppe"; - //private static final String PERSON_DEFAULT_SURNAME = "Amato"; - private static final String PERSON_DEFAULT_FISCAL_CODE = "MTAGPP68D15D976W"; - - - private static final String PERSON_DEFAULT_EMAIL = "giuseppe.amato@cnr.it"; + private static final String PERSON_DEFAULT_FISCAL_CODE = "RMNVTR73C05H224X"; + private static final String PERSON_DEFAULT_EMAIL = "vittorioenricocarlo.romano@cnr.it"; //private static final String PERSON_DEFAULT_QUALIFICATION = "2"; + private static final String YEAR_DEFAULT = "2025"; + private static final String MONTH_DEFAULT = "1"; + @Autowired private MockMvc restEPASTimeCardsMockMvc; @@ -59,22 +54,22 @@ public class EPASOffSiteWorksResourceIT { @Test public void getOffSiteWorksByPersonId() throws Exception { - restEPASTimeCardsMockMvc.perform(get("/api/epas/offsiteworks/byPerson?id="+PERSON_DEFAULT_ID+"&year=2022&month=6")).andExpect(status().isOk()); + restEPASTimeCardsMockMvc.perform(get("/api/epas/offsiteworks/byPerson?id="+PERSON_DEFAULT_ID+"&year="+YEAR_DEFAULT+"&month="+MONTH_DEFAULT)).andExpect(status().isOk()); } @Test public void getOffSiteWorksByPersonFiscalCode() throws Exception { - restEPASTimeCardsMockMvc.perform(get("/api/epas/offsiteworks/byPerson?fiscalCode="+PERSON_DEFAULT_FISCAL_CODE+"&year=2022&month=6")).andExpect(status().isOk()); + restEPASTimeCardsMockMvc.perform(get("/api/epas/offsiteworks/byPerson?fiscalCode="+PERSON_DEFAULT_FISCAL_CODE+"&year="+YEAR_DEFAULT+"&month="+MONTH_DEFAULT)).andExpect(status().isOk()); } @Test public void getOffSiteWorksByPersonEmail() throws Exception { - restEPASTimeCardsMockMvc.perform(get("/api/epas/offsiteworks/byPerson?email="+PERSON_DEFAULT_EMAIL+"&year=2022&month=6")).andExpect(status().isOk()); + restEPASTimeCardsMockMvc.perform(get("/api/epas/offsiteworks/byPerson?email="+PERSON_DEFAULT_EMAIL+"&year="+YEAR_DEFAULT+"&month="+MONTH_DEFAULT)).andExpect(status().isOk()); } @Test public void getOffSiteWorksByOfficeCodeId() throws Exception { - restEPASTimeCardsMockMvc.perform(get("/api/epas/offsiteworks/byOffice?codeId="+OFFICE_DEFAULT_CODEID+"&year=2022&month=6")).andExpect(status().isOk()); + restEPASTimeCardsMockMvc.perform(get("/api/epas/offsiteworks/byOffice?codeId="+OfficeConstants.ISTI_OFFICE_CODEID+"&year="+YEAR_DEFAULT+"&month="+MONTH_DEFAULT)).andExpect(status().isOk()); } } diff --git a/src/test/java/it/cnr/isti/epasmed/web/rest/epas/EPASPersonWorkingTimeIT.java b/src/test/java/it/cnr/isti/epasmed/web/rest/epas/EPASPersonWorkingTimeIT.java index 1eb7924..72bad00 100644 --- a/src/test/java/it/cnr/isti/epasmed/web/rest/epas/EPASPersonWorkingTimeIT.java +++ b/src/test/java/it/cnr/isti/epasmed/web/rest/epas/EPASPersonWorkingTimeIT.java @@ -22,6 +22,7 @@ import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; import it.cnr.isti.epasmed.EpasmedApp; +import it.cnr.isti.epasmed.OfficeConstants; import it.cnr.isti.epasmed.epas.dto.EPASPersonWorkingTimeDTO; import it.cnr.isti.epasmed.security.AuthoritiesConstants; @@ -37,16 +38,11 @@ public class EPASPersonWorkingTimeIT { private static final Logger logger = LoggerFactory.getLogger(EPASPersonWorkingTimeIT.class); - private static final String OFFICE_DEFAULT_ID = "1"; - // private static final String OFFICE_DEFAULT_NAME = "ISTI - Pisa"; - // private static final String OFFICE_DEFAULT_CODE = "074000"; - // private static final String OFFICE_DEFAULT_CODEID = "225200"; private static final String PERSON_DEFAULT_ID = "78"; - //private static final String PERSON_DEFAULT_FISCAL_CODE = "MROGLI68H29E625F"; - private static final String PERSON_DEFAULT_FISCAL_CODE = "PNCGCR75S04L103G"; + //private static final String PERSON_DEFAULT_FISCAL_CODE = "PNCGCR75S04L103G"; //private static final String PERSON_DEFAULT_FISCAL_CODE = "MLSDNL59T56E281S"; - //private static final String PERSON_DEFAULT_FISCAL_CODE = "PCCMRA63M50G702W"; + private static final String PERSON_DEFAULT_FISCAL_CODE = "PCCMRA63M50G702W"; //private static final String PERSON_DEFAULT_FISCAL_CODE = "LMBGNN59T09G702K"; //private static final String PERSON_DEFAULT_FISCAL_CODE = "MNGPLA70T22D612X"; @@ -94,7 +90,7 @@ public class EPASPersonWorkingTimeIT { @Test public void getPersonWorkingTimeList() throws Exception { MvcResult result = restEPASPersonWorkingTimeMockMvc - .perform(get("/api/epas/personworkingtime/list?officeId=" + OFFICE_DEFAULT_ID)).andExpect(status().isOk()) + .perform(get("/api/epas/personworkingtime/list?officeId=" + OfficeConstants.ISTI_OFFICE_ID)).andExpect(status().isOk()) .andReturn(); ObjectMapper mapper = new ObjectMapper(); List epasWTTList = mapper.readValue(result.getResponse().getContentAsString(), diff --git a/src/test/java/it/cnr/isti/epasmed/web/rest/epas/EPASPersonsResourceIT.java b/src/test/java/it/cnr/isti/epasmed/web/rest/epas/EPASPersonsResourceIT.java index 262dde3..8cdbfe8 100755 --- a/src/test/java/it/cnr/isti/epasmed/web/rest/epas/EPASPersonsResourceIT.java +++ b/src/test/java/it/cnr/isti/epasmed/web/rest/epas/EPASPersonsResourceIT.java @@ -33,6 +33,7 @@ import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; import it.cnr.isti.epasmed.EpasmedApp; +import it.cnr.isti.epasmed.OfficeConstants; import it.cnr.isti.epasmed.epas.dto.EPASPersonsDTO; import it.cnr.isti.epasmed.epas.mapper.EPASPersonsMapper; import it.cnr.isti.epasmed.epas.model.EPASOffice; @@ -51,15 +52,11 @@ public class EPASPersonsResourceIT { private final Logger log = LoggerFactory.getLogger(getClass()); - private static final String OFFICE_DEFAULT_ID = "1"; - private static final String OFFICE_DEFAULT_NAME = "ISTI - Pisa"; - private static final String OFFICE_DEFAULT_CODE = "074000"; - private static final String OFFICE_DEFAULT_CODEID = "225200"; - - private static final String PERSON_DEFAULT_ID = "113"; + + private static final String PERSON_DEFAULT_ID = "11694"; private static final String PERSON_DEFAULT_NAME = "nometest1"; private static final String PERSON_DEFAULT_SURNAME = "cognometest1"; - private static final String PERSON_DEFAULT_FISCAL_CODE = "codicefiscaletes"; + private static final String PERSON_DEFAULT_FISCAL_CODE = "codicefiscaletest"; private static final String PERSON_DEFAULT_EMAIL = "nometest1.cognometest1@test.it"; private static final String PERSON_DEFAULT_QUALIFICATION = "3"; @@ -97,10 +94,10 @@ public class EPASPersonsResourceIT { public static EPASOffice createOffice() { EPASOffice epasOffice = new EPASOffice(); - epasOffice.setId(OFFICE_DEFAULT_ID); - epasOffice.setName(OFFICE_DEFAULT_NAME); - epasOffice.setCode(OFFICE_DEFAULT_CODE); - epasOffice.setCodeId(OFFICE_DEFAULT_CODEID); + epasOffice.setId(OfficeConstants.ISTI_OFFICE_ID); + epasOffice.setName(OfficeConstants.ISTI_OFFICE_NAME); + epasOffice.setCode(OfficeConstants.ISTI_OFFICE_CODE); + epasOffice.setCodeId(OfficeConstants.ISTI_OFFICE_CODEID); return epasOffice; } @@ -126,7 +123,7 @@ public class EPASPersonsResourceIT { @Test public void getPersonList() throws Exception { - restEPASPersonsMockMvc.perform(get("/api/epas/persons?officeId=" + OFFICE_DEFAULT_ID)) + restEPASPersonsMockMvc.perform(get("/api/epas/persons?officeId=" + OfficeConstants.ISTI_OFFICE_ID)) .andExpect(status().isOk()); } @@ -155,7 +152,7 @@ public class EPASPersonsResourceIT { List epasPersons = null; try { - MvcResult result = restEPASPersonsMockMvc.perform(get("/api/epas/persons?officeId=" + OFFICE_DEFAULT_ID)) + MvcResult result = restEPASPersonsMockMvc.perform(get("/api/epas/persons?officeId=" + OfficeConstants.ISTI_OFFICE_ID)) .andExpect(status().isOk()).andReturn(); ObjectMapper mapper = new ObjectMapper(); diff --git a/src/test/java/it/cnr/isti/epasmed/web/rest/epas/EPASStampingsResourceIT.java b/src/test/java/it/cnr/isti/epasmed/web/rest/epas/EPASStampingsResourceIT.java index 32aa3ec..f1cd5cd 100755 --- a/src/test/java/it/cnr/isti/epasmed/web/rest/epas/EPASStampingsResourceIT.java +++ b/src/test/java/it/cnr/isti/epasmed/web/rest/epas/EPASStampingsResourceIT.java @@ -43,10 +43,6 @@ public class EPASStampingsResourceIT { private static final Logger logger = LoggerFactory.getLogger(EPASStampingsResourceIT.class); - // private static final String OFFICE_DEFAULT_ID = "1"; - // private static final String OFFICE_DEFAULT_NAME = "ISTI - Pisa"; - // private static final String OFFICE_DEFAULT_CODE = "074000"; - // private static final String OFFICE_DEFAULT_CODEID = "225200"; private static final String STAMPING_DEFAULT_WAYTYPE = "in"; private static final String STAMPING_DEFAULT_REASONTYPE = null; diff --git a/src/test/java/it/cnr/isti/epasmed/web/rest/epas/EPASTimeCardsResourceIT.java b/src/test/java/it/cnr/isti/epasmed/web/rest/epas/EPASTimeCardsResourceIT.java index 70997ad..5ada231 100755 --- a/src/test/java/it/cnr/isti/epasmed/web/rest/epas/EPASTimeCardsResourceIT.java +++ b/src/test/java/it/cnr/isti/epasmed/web/rest/epas/EPASTimeCardsResourceIT.java @@ -16,6 +16,7 @@ import org.springframework.test.context.junit.jupiter.EnabledIf; import org.springframework.test.web.servlet.MockMvc; import it.cnr.isti.epasmed.EpasmedApp; +import it.cnr.isti.epasmed.OfficeConstants; import it.cnr.isti.epasmed.security.AuthoritiesConstants; /** @@ -28,21 +29,14 @@ import it.cnr.isti.epasmed.security.AuthoritiesConstants; public class EPASTimeCardsResourceIT { private final Logger log = LoggerFactory.getLogger(getClass()); - - //private static final String OFFICE_DEFAULT_ID = "1"; - //private static final String OFFICE_DEFAULT_NAME = "ISTI - Pisa"; - //private static final String OFFICE_DEFAULT_CODE = "074000"; - private static final String OFFICE_DEFAULT_CODEID = "225200"; private static final String PERSON_DEFAULT_ID = "113"; - //private static final String PERSON_DEFAULT_NAME = "Giuseppe"; - //private static final String PERSON_DEFAULT_SURNAME = "Amato"; - //private static final String PERSON_DEFAULT_FISCAL_CODE = "MTAGPP68D15D976W"; - private static final String PERSON_DEFAULT_FISCAL_CODE = "BRTNTN60R56E974Z"; - + private static final String PERSON_DEFAULT_FISCAL_CODE = "RMNVTR73C05H224X"; + private static final String PERSON_DEFAULT_EMAIL = "giancarlo.panichi@cnr.it"; + + private static final String YEAR_DEFAULT = "2025"; + private static final String MONTH_DEFAULT = "1"; - private static final String PERSON_DEFAULT_EMAIL = "giuseppe.amato@cnr.it"; - //private static final String PERSON_DEFAULT_QUALIFICATION = "2"; @Autowired private MockMvc restEPASTimeCardsMockMvc; @@ -60,22 +54,22 @@ public class EPASTimeCardsResourceIT { @Test public void getTimeCardByPersonId() throws Exception { - restEPASTimeCardsMockMvc.perform(get("/api/epas/timecards/byPerson?id="+PERSON_DEFAULT_ID+"&year=2022&month=6")).andExpect(status().isOk()); + restEPASTimeCardsMockMvc.perform(get("/api/epas/timecards/byPerson?id="+PERSON_DEFAULT_ID+"&year="+YEAR_DEFAULT+"&month="+MONTH_DEFAULT)).andExpect(status().isOk()); } @Test public void getTimeCardByPersonFiscalCode() throws Exception { - restEPASTimeCardsMockMvc.perform(get("/api/epas/timecards/byPerson?fiscalCode="+PERSON_DEFAULT_FISCAL_CODE+"&year=2022&month=6")).andExpect(status().isOk()); + restEPASTimeCardsMockMvc.perform(get("/api/epas/timecards/byPerson?fiscalCode="+PERSON_DEFAULT_FISCAL_CODE+"&year="+YEAR_DEFAULT+"&month="+MONTH_DEFAULT)).andExpect(status().isOk()); } @Test public void getTimeCardByPersonEmail() throws Exception { - restEPASTimeCardsMockMvc.perform(get("/api/epas/timecards/byPerson?email="+PERSON_DEFAULT_EMAIL+"&year=2022&month=6")).andExpect(status().isOk()); + restEPASTimeCardsMockMvc.perform(get("/api/epas/timecards/byPerson?email="+PERSON_DEFAULT_EMAIL+"&year="+YEAR_DEFAULT+"&month="+MONTH_DEFAULT)).andExpect(status().isOk()); } @Test public void getTimeCardByOfficeCodeId() throws Exception { - restEPASTimeCardsMockMvc.perform(get("/api/epas/timecards/byOffice?codeId="+OFFICE_DEFAULT_CODEID+"&year=2022&month=6")).andExpect(status().isOk()); + restEPASTimeCardsMockMvc.perform(get("/api/epas/timecards/byOffice?codeId="+OfficeConstants.ISTI_OFFICE_CODEID+"&year="+YEAR_DEFAULT+"&month="+MONTH_DEFAULT)).andExpect(status().isOk()); } } diff --git a/src/test/java/it/cnr/isti/epasmed/web/rest/epas/EPASValidatesResourceIT.java b/src/test/java/it/cnr/isti/epasmed/web/rest/epas/EPASValidatesResourceIT.java index 65d499b..5b0d4fa 100755 --- a/src/test/java/it/cnr/isti/epasmed/web/rest/epas/EPASValidatesResourceIT.java +++ b/src/test/java/it/cnr/isti/epasmed/web/rest/epas/EPASValidatesResourceIT.java @@ -20,6 +20,7 @@ import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; import it.cnr.isti.epasmed.EpasmedApp; +import it.cnr.isti.epasmed.OfficeConstants; import it.cnr.isti.epasmed.epas.model.EPASValidates; import it.cnr.isti.epasmed.security.AuthoritiesConstants; @@ -35,11 +36,12 @@ public class EPASValidatesResourceIT { private final Logger log = LoggerFactory.getLogger(getClass()); - //private static final String OFFICE_DEFAULT_ID = "1"; - // private static final String OFFICE_DEFAULT_NAME = "ISTI - Pisa"; - // private static final String OFFICE_DEFAULT_CODE = "074000"; - private static final String OFFICE_DEFAULT_CODEID = "225200"; + private static final String PERSON_DEFAULT_EMAIL = "giancarlo.panichi@cnr.it"; + + private static final String YEAR_DEFAULT = "2025"; + private static final String MONTH_DEFAULT = "1"; + @Autowired private MockMvc restEPASValidatesMockMvc; @@ -55,8 +57,8 @@ public class EPASValidatesResourceIT { @Test public void isValidatesByPersonEmail() throws Exception { - MvcResult result = restEPASValidatesMockMvc.perform(get("/api/epas/validates/is?email=giancarlo.panichi@cnr.it&" - + "year=2021&month=11")).andExpect(status().isOk()).andReturn(); + MvcResult result = restEPASValidatesMockMvc.perform(get("/api/epas/validates/is?email="+PERSON_DEFAULT_EMAIL+"&" + + "year="+YEAR_DEFAULT+"&month="+MONTH_DEFAULT)).andExpect(status().isOk()).andReturn(); ObjectMapper mapper = new ObjectMapper(); String validated = mapper.readValue(result.getResponse().getContentAsString(), new TypeReference() { @@ -66,8 +68,8 @@ public class EPASValidatesResourceIT { @Test public void getEPASValidatesByOfficeCodeId() throws Exception { - MvcResult result = restEPASValidatesMockMvc.perform(get("/api/epas/validates?officeCodeId="+OFFICE_DEFAULT_CODEID+"&" - + "year=2021&month=11")).andExpect(status().isOk()).andReturn(); + MvcResult result = restEPASValidatesMockMvc.perform(get("/api/epas/validates?officeCodeId="+OfficeConstants.ISTI_OFFICE_CODEID+"&" + + "year="+YEAR_DEFAULT+"&month="+MONTH_DEFAULT)).andExpect(status().isOk()).andReturn(); ObjectMapper mapper = new ObjectMapper(); EPASValidates validates = mapper.readValue(result.getResponse().getContentAsString(), new TypeReference() { diff --git a/src/test/java/it/cnr/isti/epasmed/web/rest/epas/EPASWorkingTimeTypesResourceIT.java b/src/test/java/it/cnr/isti/epasmed/web/rest/epas/EPASWorkingTimeTypesResourceIT.java index abd2603..c861006 100755 --- a/src/test/java/it/cnr/isti/epasmed/web/rest/epas/EPASWorkingTimeTypesResourceIT.java +++ b/src/test/java/it/cnr/isti/epasmed/web/rest/epas/EPASWorkingTimeTypesResourceIT.java @@ -22,6 +22,7 @@ import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; import it.cnr.isti.epasmed.EpasmedApp; +import it.cnr.isti.epasmed.OfficeConstants; import it.cnr.isti.epasmed.epas.model.EPASWorkingTimeTypeDays; import it.cnr.isti.epasmed.epas.model.EPASWorkingTimeTypes; import it.cnr.isti.epasmed.security.AuthoritiesConstants; @@ -38,11 +39,6 @@ public class EPASWorkingTimeTypesResourceIT { private static final Logger logger = LoggerFactory.getLogger(EPASWorkingTimeTypesResourceIT.class); - // private static final String OFFICE_DEFAULT_ID = "1"; - // private static final String OFFICE_DEFAULT_NAME = "ISTI - Pisa"; - // private static final String OFFICE_DEFAULT_CODE = "074000"; - private static final String OFFICE_DEFAULT_CODEID = "225200"; - private static final String DEFAULT_WORKING_TIME_TYPE_ID = "1"; @Autowired @@ -76,7 +72,7 @@ public class EPASWorkingTimeTypesResourceIT { @Test public void getWorkingTimeTypesList() throws Exception { MvcResult result = restEPASWorkingTimeTypesMockMvc - .perform(get("/api/epas/workingtimetypes?officeCodeId=" + OFFICE_DEFAULT_CODEID)) + .perform(get("/api/epas/workingtimetypes?officeCodeId=" + OfficeConstants.ISTI_OFFICE_CODEID)) .andExpect(status().isOk()).andReturn(); ObjectMapper mapper = new ObjectMapper();