diff --git a/src/main/java/org/esupportail/esupsignature/config/extdb/ExtDbProperties.java b/src/main/java/org/esupportail/esupsignature/config/extdb/ExtDbProperties.java index 808b38ed5..7285035bb 100644 --- a/src/main/java/org/esupportail/esupsignature/config/extdb/ExtDbProperties.java +++ b/src/main/java/org/esupportail/esupsignature/config/extdb/ExtDbProperties.java @@ -3,17 +3,16 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties; import org.springframework.boot.context.properties.ConfigurationProperties; +import java.util.HashMap; +import java.util.Map; + @ConfigurationProperties(prefix="extdb") public class ExtDbProperties { - DataSourceProperties[] dataSources; + Map dataSources = new HashMap<>(); - public DataSourceProperties[] getDataSources() { + public Map getDataSources() { return dataSources; } - public void setDataSources(DataSourceProperties[] dataSources) { - this.dataSources = dataSources; - } - } \ No newline at end of file diff --git a/src/main/java/org/esupportail/esupsignature/repository/ldap/AliasLdapRepository.java b/src/main/java/org/esupportail/esupsignature/repository/ldap/AliasLdapRepository.java new file mode 100644 index 000000000..c986ab7fd --- /dev/null +++ b/src/main/java/org/esupportail/esupsignature/repository/ldap/AliasLdapRepository.java @@ -0,0 +1,13 @@ +package org.esupportail.esupsignature.repository.ldap; + +import org.esupportail.esupsignature.service.ldap.AliasLdap; +import org.springframework.data.ldap.repository.LdapRepository; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Repository +public interface AliasLdapRepository extends LdapRepository { + + List findByMailAliasStartingWithOrCnStartingWithAndMailAliasNotNull(String mailAlias, String cn); +} diff --git a/src/main/java/org/esupportail/esupsignature/repository/ldap/PersonLdapRepository.java b/src/main/java/org/esupportail/esupsignature/repository/ldap/PersonLdapRepository.java index 929e91ac9..a183ae3e0 100644 --- a/src/main/java/org/esupportail/esupsignature/repository/ldap/PersonLdapRepository.java +++ b/src/main/java/org/esupportail/esupsignature/repository/ldap/PersonLdapRepository.java @@ -10,8 +10,7 @@ public interface PersonLdapRepository extends LdapRepository { List findByEduPersonPrincipalName(String eppn); List findByMail(String mail); - List findByUid(String uid); - List findByUidOrEduPersonPrincipalNameOrSupannAliasLogin(String uid); List findByCnIgnoreCaseOrDisplayNameIgnoreCaseOrUidOrMail(String cn, String displayName, String uid, String mail); List findByDisplayNameStartingWithIgnoreCaseOrCnStartingWithIgnoreCaseOrUidStartingWithOrMailStartingWith(String displayName, String cn, String uid, String mail); } + diff --git a/src/main/java/org/esupportail/esupsignature/service/UserService.java b/src/main/java/org/esupportail/esupsignature/service/UserService.java index 084a38b6f..e3efdd193 100644 --- a/src/main/java/org/esupportail/esupsignature/service/UserService.java +++ b/src/main/java/org/esupportail/esupsignature/service/UserService.java @@ -1,6 +1,7 @@ package org.esupportail.esupsignature.service; import org.esupportail.esupsignature.config.GlobalProperties; +import org.esupportail.esupsignature.config.ldap.LdapProperties; import org.esupportail.esupsignature.config.security.WebSecurityProperties; import org.esupportail.esupsignature.entity.*; import org.esupportail.esupsignature.entity.enums.EmailAlertFrequency; @@ -50,6 +51,9 @@ public class UserService { @Resource private GlobalProperties globalProperties; + @Resource + private LdapProperties ldapProperties; + @Resource private UserRepository userRepository; @@ -193,7 +197,7 @@ public User createUserWithAuthentication(Authentication authentication) { throw new EsupSignatureRuntimeException("Creation of user not implemented without ldap configuration"); } logger.info("controle de l'utilisateur " + uid); - List personLdaps = ldapPersonService.getIfAvailable().getPersonLdapRepository().findByUidOrEduPersonPrincipalNameOrSupannAliasLogin(uid); + List personLdaps = ldapPersonService.getIfAvailable().getPersonLdap(uid); String eppn = personLdaps.get(0).getEduPersonPrincipalName(); if (eppn == null) { eppn = buildEppn(personLdaps.get(0).getUid()); @@ -204,7 +208,6 @@ public User createUserWithAuthentication(Authentication authentication) { return createUser(eppn, name, firstName, mail, UserType.ldap); } - @Transactional public User createUser(String eppn, String name, String firstName, String email, UserType userType) { User user; if (userRepository.countByEppn(eppn) > 0) { diff --git a/src/main/java/org/esupportail/esupsignature/service/extdb/ExtDbService.java b/src/main/java/org/esupportail/esupsignature/service/extdb/ExtDbService.java index 1652d14e0..67a54ab4f 100644 --- a/src/main/java/org/esupportail/esupsignature/service/extdb/ExtDbService.java +++ b/src/main/java/org/esupportail/esupsignature/service/extdb/ExtDbService.java @@ -1,7 +1,6 @@ package org.esupportail.esupsignature.service.extdb; import org.esupportail.esupsignature.config.extdb.ExtDbConfig; -import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.stereotype.Service; @@ -15,12 +14,7 @@ public class ExtDbService { private ExtDbConfig extDbConfigs; public DataSource getDataSourceByName(String name) { - for(DataSourceProperties dataSourceProperties : extDbConfigs.getExtDbProperties().getDataSources()) { - if(dataSourceProperties.getName().equals(name)) { - return dataSourceProperties.initializeDataSourceBuilder().build(); - } - } - return null; + return extDbConfigs.getExtDbProperties().getDataSources().get(name).initializeDataSourceBuilder().build(); } public JdbcTemplate getJdbcTemplateByName(String name) { diff --git a/src/main/java/org/esupportail/esupsignature/service/interfaces/fs/vfs/VfsAccessImpl.java b/src/main/java/org/esupportail/esupsignature/service/interfaces/fs/vfs/VfsAccessImpl.java index 5d769e4ff..4b42b91c5 100644 --- a/src/main/java/org/esupportail/esupsignature/service/interfaces/fs/vfs/VfsAccessImpl.java +++ b/src/main/java/org/esupportail/esupsignature/service/interfaces/fs/vfs/VfsAccessImpl.java @@ -24,13 +24,11 @@ import org.esupportail.esupsignature.service.interfaces.fs.FsAccessService; import org.esupportail.esupsignature.service.interfaces.fs.FsFile; import org.esupportail.esupsignature.service.interfaces.fs.UploadActionType; -import org.esupportail.esupsignature.service.utils.file.FileService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.DisposableBean; import org.springframework.util.FileCopyUtils; -import javax.annotation.Resource; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; @@ -41,9 +39,6 @@ public class VfsAccessImpl extends FsAccessService implements DisposableBean { private static final Logger logger = LoggerFactory.getLogger(VfsAccessImpl.class); - @Resource - private FileService fileService; - protected FileSystemManager fsManager; protected FileObject root; diff --git a/src/main/java/org/esupportail/esupsignature/service/ldap/AliasLdap.java b/src/main/java/org/esupportail/esupsignature/service/ldap/AliasLdap.java new file mode 100644 index 000000000..171daeb52 --- /dev/null +++ b/src/main/java/org/esupportail/esupsignature/service/ldap/AliasLdap.java @@ -0,0 +1,43 @@ +package org.esupportail.esupsignature.service.ldap; + +import org.springframework.ldap.odm.annotations.Attribute; +import org.springframework.ldap.odm.annotations.Entry; +import org.springframework.ldap.odm.annotations.Id; + +import javax.naming.Name; +import java.util.List; + +@Entry(objectClasses = {"nisMailAlias"}, base = "ou=aliases-list") +public class AliasLdap { + + @Id + private Name dn; + private @Attribute(name = "mail") String mailAlias; + private @Attribute(name = "rfc822MailMember") + List memberMails; + private @Attribute(name = "cn") String cn; + + public String getMailAlias() { + return mailAlias; + } + + public void setMailAlias(String mailAlias) { + this.mailAlias = mailAlias; + } + + public List getMemberMails() { + return memberMails; + } + + public void setMemberMails(List memberMails) { + this.memberMails = memberMails; + } + + public String getCn() { + return cn; + } + + public void setCn(String cn) { + this.cn = cn; + } +} diff --git a/src/main/java/org/esupportail/esupsignature/service/ldap/LdapAliasService.java b/src/main/java/org/esupportail/esupsignature/service/ldap/LdapAliasService.java new file mode 100644 index 000000000..26521b127 --- /dev/null +++ b/src/main/java/org/esupportail/esupsignature/service/ldap/LdapAliasService.java @@ -0,0 +1,19 @@ +package org.esupportail.esupsignature.service.ldap; + +import org.esupportail.esupsignature.repository.ldap.AliasLdapRepository; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class LdapAliasService { + + @Autowired(required = false) + private AliasLdapRepository aliasLdapRepository; + + + public List searchAlias(String searchString) { + return aliasLdapRepository.findByMailAliasStartingWithOrCnStartingWithAndMailAliasNotNull(searchString, searchString); + } +} diff --git a/src/main/java/org/esupportail/esupsignature/service/ldap/LdapPersonService.java b/src/main/java/org/esupportail/esupsignature/service/ldap/LdapPersonService.java index 5d7948612..9769193f5 100644 --- a/src/main/java/org/esupportail/esupsignature/service/ldap/LdapPersonService.java +++ b/src/main/java/org/esupportail/esupsignature/service/ldap/LdapPersonService.java @@ -2,11 +2,14 @@ import org.esupportail.esupsignature.config.ldap.LdapProperties; import org.esupportail.esupsignature.repository.ldap.PersonLdapRepository; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.ldap.core.LdapTemplate; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.text.MessageFormat; import java.util.List; @Service @@ -14,6 +17,12 @@ @EnableConfigurationProperties(LdapProperties.class) public class LdapPersonService { + @Autowired + private LdapTemplate ldapTemplate; + + @Resource + private LdapProperties ldapProperties; + @Resource private PersonLdapRepository personLdapRepository; @@ -26,4 +35,9 @@ public PersonLdapRepository getPersonLdapRepository() { return personLdapRepository; } + public List getPersonLdap(String uid) { + String formattedFilter = MessageFormat.format(ldapProperties.getUserIdSearchFilter(), new String[] { uid }); + return ldapTemplate.search(ldapProperties.getSearchBase(), formattedFilter, new PersonLdapAttributesMapper()); + } + } \ No newline at end of file diff --git a/src/main/java/org/esupportail/esupsignature/service/ldap/PersonLdapAttributesMapper.java b/src/main/java/org/esupportail/esupsignature/service/ldap/PersonLdapAttributesMapper.java new file mode 100644 index 000000000..f372504e1 --- /dev/null +++ b/src/main/java/org/esupportail/esupsignature/service/ldap/PersonLdapAttributesMapper.java @@ -0,0 +1,33 @@ +package org.esupportail.esupsignature.service.ldap; + +import org.springframework.ldap.core.AttributesMapper; + +import javax.naming.NamingException; +import javax.naming.directory.Attribute; +import javax.naming.directory.Attributes; + + +public class PersonLdapAttributesMapper implements AttributesMapper { + + public PersonLdap mapFromAttributes(Attributes attrs) throws NamingException { + PersonLdap person = new PersonLdap(); + person.setCn((String)attrs.get("cn").get()); + Attribute sn = attrs.get("sn"); + if (sn != null){ + person.setSn((String) sn.get()); + } + Attribute givenName = attrs.get("givenName"); + if (givenName != null){ + person.setGivenName((String) givenName.get()); + } + Attribute mail = attrs.get("mail"); + if (mail != null){ + person.setMail((String) mail.get()); + } + Attribute eduPersonPrincipalName = attrs.get("eduPersonPrincipalName"); + if (eduPersonPrincipalName != null){ + person.setEduPersonPrincipalName((String) eduPersonPrincipalName.get()); + } + return person; + } +} diff --git a/src/main/java/org/esupportail/esupsignature/service/list/UserList.java b/src/main/java/org/esupportail/esupsignature/service/list/UserList.java new file mode 100644 index 000000000..939e35816 --- /dev/null +++ b/src/main/java/org/esupportail/esupsignature/service/list/UserList.java @@ -0,0 +1,8 @@ +package org.esupportail.esupsignature.service.list; + +import java.util.List; + +public interface UserList { + public String getName(); + public List getUsersEmailFromList(String listName); +} diff --git a/src/main/java/org/esupportail/esupsignature/service/list/UserListService.java b/src/main/java/org/esupportail/esupsignature/service/list/UserListService.java new file mode 100644 index 000000000..547c5dba3 --- /dev/null +++ b/src/main/java/org/esupportail/esupsignature/service/list/UserListService.java @@ -0,0 +1,24 @@ +package org.esupportail.esupsignature.service.list; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; + +@Service +public class UserListService { + + @Autowired(required = false) + UserList userList; + + public List getUsersEmailFromList(String listName) { + if(userList != null) { + return userList.getUsersEmailFromList(listName); + } else { + return new ArrayList<>(); + } + + } + +} diff --git a/src/main/java/org/esupportail/esupsignature/service/list/impl/SympaUserList.java b/src/main/java/org/esupportail/esupsignature/service/list/impl/SympaUserList.java new file mode 100644 index 000000000..350725c28 --- /dev/null +++ b/src/main/java/org/esupportail/esupsignature/service/list/impl/SympaUserList.java @@ -0,0 +1,45 @@ +package org.esupportail.esupsignature.service.list.impl; + +import org.esupportail.esupsignature.service.extdb.ExtDbService; +import org.esupportail.esupsignature.service.list.UserList; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.stereotype.Component; + +import javax.annotation.PostConstruct; +import javax.annotation.Resource; +import java.sql.ResultSet; +import java.util.ArrayList; +import java.util.List; + +@Component +@ConditionalOnProperty(name = "extdb.datasources.userListDataSource.name", havingValue = "sympa") +public class SympaUserList implements UserList { + + JdbcTemplate jdbcTemplate; + + @Resource + ExtDbService extDbService; + + @PostConstruct + public void initJdbcTemplate() { + this.jdbcTemplate = extDbService.getJdbcTemplateByName("userListDataSource"); + } + + @Override + public String getName() { + return "sympa"; + } + + @Override + public List getUsersEmailFromList(String listName) { + List userEmails = new ArrayList<>(); + jdbcTemplate.query("select user_subscriber from subscriber_table where list_subscriber=" + "'" + listName.split("@")[0] + "'", (ResultSet rs) -> { + userEmails.add(rs.getString("user_subscriber")); + while (rs.next()) { + userEmails.add(rs.getString("user_subscriber")); + } + }); + return userEmails; + } +} diff --git a/src/main/java/org/esupportail/esupsignature/service/scheduler/ScheduledTaskService.java b/src/main/java/org/esupportail/esupsignature/service/scheduler/ScheduledTaskService.java index d08706ddb..f4677e94c 100644 --- a/src/main/java/org/esupportail/esupsignature/service/scheduler/ScheduledTaskService.java +++ b/src/main/java/org/esupportail/esupsignature/service/scheduler/ScheduledTaskService.java @@ -59,8 +59,9 @@ public class ScheduledTaskService { @Transactional public void scanAllSignbooksSources() { Iterable workflows = workflowService.getAllWorkflows(); + User userScheduler = userService.getSchedulerUser(); for(Workflow workflow : workflows) { - workflowService.importFilesFromSource(workflow, userService.getSchedulerUser(), userService.getSchedulerUser()); + workflowService.importFilesFromSource(workflow, userScheduler, userScheduler); } } diff --git a/src/main/java/org/esupportail/esupsignature/service/security/cas/CasSecurityServiceImpl.java b/src/main/java/org/esupportail/esupsignature/service/security/cas/CasSecurityServiceImpl.java index eacfa4425..cbe1aec13 100644 --- a/src/main/java/org/esupportail/esupsignature/service/security/cas/CasSecurityServiceImpl.java +++ b/src/main/java/org/esupportail/esupsignature/service/security/cas/CasSecurityServiceImpl.java @@ -1,6 +1,5 @@ package org.esupportail.esupsignature.service.security.cas; -import org.esupportail.esupsignature.config.GlobalProperties; import org.esupportail.esupsignature.config.ldap.LdapProperties; import org.esupportail.esupsignature.config.security.WebSecurityProperties; import org.esupportail.esupsignature.config.security.cas.CasProperties; @@ -48,9 +47,6 @@ public class CasSecurityServiceImpl implements SecurityService { @Resource private CasProperties casProperties; - @Resource - private GlobalProperties globalProperties; - @Resource private LdapProperties ldapProperties; diff --git a/src/main/java/org/esupportail/esupsignature/service/utils/pdf/PdfService.java b/src/main/java/org/esupportail/esupsignature/service/utils/pdf/PdfService.java index 7d4615c7e..7c59fd654 100644 --- a/src/main/java/org/esupportail/esupsignature/service/utils/pdf/PdfService.java +++ b/src/main/java/org/esupportail/esupsignature/service/utils/pdf/PdfService.java @@ -109,8 +109,8 @@ public InputStream stampImage(InputStream inputStream, SignRequest signRequest, float ty = 0; float xAdjusted = signRequestParams.getxPos(); float yAdjusted; - int widthAdjusted = Math.round((float) (bufferedSignImage.getWidth() / 3 * 0.75)); - int heightAdjusted = Math.round((float) (bufferedSignImage.getHeight() / 3 * 0.75)); + int widthAdjusted = Math.round((float) signRequestParams.getSignWidth()); + int heightAdjusted = Math.round((float) signRequestParams.getSignHeight()); if(pdfParameters.getRotation() == 0 || pdfParameters.getRotation() == 180) { yAdjusted = pdfParameters.getHeight() - signRequestParams.getyPos() - signRequestParams.getSignHeight() + pdPage.getCropBox().getLowerLeftY(); diff --git a/src/main/java/org/esupportail/esupsignature/web/controller/user/UserController.java b/src/main/java/org/esupportail/esupsignature/web/controller/user/UserController.java index 68b1ce4f1..75dbf0438 100644 --- a/src/main/java/org/esupportail/esupsignature/web/controller/user/UserController.java +++ b/src/main/java/org/esupportail/esupsignature/web/controller/user/UserController.java @@ -9,7 +9,10 @@ import org.esupportail.esupsignature.entity.enums.SignType; import org.esupportail.esupsignature.exception.EsupSignatureUserException; import org.esupportail.esupsignature.service.*; +import org.esupportail.esupsignature.service.ldap.AliasLdap; +import org.esupportail.esupsignature.service.ldap.LdapAliasService; import org.esupportail.esupsignature.service.ldap.PersonLdap; +import org.esupportail.esupsignature.service.list.UserListService; import org.esupportail.esupsignature.web.controller.ws.json.JsonMessage; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -70,6 +73,12 @@ public String getActiveMenu() { @Resource private MessageService messageService; + @Resource + private LdapAliasService ldapAliasService; + + @Resource + UserListService userListService; + @GetMapping public String updateForm(@ModelAttribute("authUserEppn") String authUserEppn, Model model, @RequestParam(value = "referer", required=false) String referer, HttpServletRequest request) { model.addAttribute("signTypes", Arrays.asList(SignType.values())); @@ -126,6 +135,19 @@ public List searchLdap(@RequestParam(value="searchString") String se return userService.getPersonLdaps(searchString).stream().sorted(Comparator.comparing(PersonLdap::getDisplayName)).collect(Collectors.toList()); } + @GetMapping(value = "/search-list") + @ResponseBody + public List searchList(@RequestParam(value="searchString") String searchString) { + logger.debug("ldap search for : " + searchString); + return ldapAliasService.searchAlias(searchString); + } + + @GetMapping(value = "/search-user-list") + @ResponseBody + public List searchUserList(@RequestParam(value="searchString") String searchString) { + return userListService.getUsersEmailFromList(searchString); + } + @GetMapping("/properties") public String properties(@ModelAttribute("authUserEppn") String authUserEppn, Model model) { List userProperties = userPropertieService.getUserPropertiesByUserEppn(authUserEppn); diff --git a/src/main/resources/static/js/modules/ui/signrequests/SignPosition.js b/src/main/resources/static/js/modules/ui/signrequests/SignPosition.js index f2929fbac..0383b988a 100644 --- a/src/main/resources/static/js/modules/ui/signrequests/SignPosition.js +++ b/src/main/resources/static/js/modules/ui/signrequests/SignPosition.js @@ -6,78 +6,90 @@ export class SignPosition extends EventFactory { constructor(signType, xPos, yPos, signPageNumber, signImages, userName) { super(); console.info("Starting sign positioning tools"); - this.cross = $('#cross'); - this.borders = $('#borders'); + this.cross = $('#cross_0'); + this.crossTools = $('#crossTools_0'); + this.borders = $('#borders_0'); this.signType = signType; this.currentScale = 1; - this.signScale = 1; this.fixRatio = .75; - this.extraWidth = 0; - this.currentSign = 0; + this.currentSign = "0"; let signRequestParams = new SignRequestParams(); this.signImages = signImages; if(this.signImages != null && this.signImages.length > 0) { signRequestParams.xPos = parseInt(xPos, 10) * this.currentScale; signRequestParams.yPos = parseInt(yPos, 10) * this.currentScale; signRequestParams.signPageNumber = signPageNumber; - signRequestParams.signImageNumber = 0; } - this.signRequestParamses = [signRequestParams]; + this.signRequestParamses = new Map(); + this.signRequestParamses.set("0", signRequestParams); this.userName = userName; this.pdf = $('#pdf'); this.pointItEnable = true; this.fontSize = 12; this.pointItMove = false; this.visualActive = true; - this.displayExtra = false; - this.signZoomOutButton = $('#signZoomOut'); - this.signZoomInButton = $('#signZoomIn'); - this.signNextImageButton = $('#signNextImage'); - this.signPrevImageButton = $('#signPrevImage'); + this.signZoomOutButton = $('#signZoomOut_0'); + this.signZoomInButton = $('#signZoomIn_0'); + this.signNextImageButton = $('#signNextImage_0'); + this.signPrevImageButton = $('#signPrevImage_0'); + this.signExtraButton = $('#signExtra_0'); + this.signDropButton = $('#signDrop_0'); this.addSignButton = $('#addSignButton'); - this.removeSignButton = $('#removeSignButton'); - this.initListeners(); if(xPos !== 0 && yPos !== 0) { this.updateCrossPosition(); this.cross.css("position", "absolute"); - this.updateSignButtons(); + // this.updateSignButtons(); this.addSignButton.removeAttr("disabled"); } else { this.cross.css("position", "fixed"); this.cross.css("margin-left", "270px"); this.cross.css("margin-top", "180px"); } - this.removeSignButton.attr("disabled", "disabled"); this.events = {}; if(this.signType === "visa") { this.addText(); $('#extraButton').hide(); } + if(this.signType !== "visa") { + $(document).ready(e => this.toggleExtraInfos()); + } + this.initListeners(); } initListeners() { window.addEventListener("touchmove", e => this.touchIt(e), {passive: false}); this.initCrossListeners(); + this.initCrossToolsListeners(); + this.addSignButton.on('click', e => this.addSign(e)); + } + + initCrossListeners() { + this.borders.on('mousedown', e => this.dragSignature()); + this.borders.on('touchstart', e => this.dragSignature()); + this.borders.on('mouseup', e => this.stopDragSignature()); + this.borders.on('touchend', e => this.stopDragSignature()); + } + + initCrossToolsListeners() { this.signZoomOutButton.on('click', e => this.signZoomOut(e)); this.signZoomInButton.on('click', e => this.signZoomIn(e)); this.signNextImageButton.on('click', e => this.signNextImage(e)); this.signPrevImageButton.on('click', e => this.signPrevImage(e)); - this.addSignButton.on('click', e => this.addSign(e)); - this.removeSignButton.on('click', e => this.removeSign(e)); - if(this.signType !== "visa") { - $(document).ready(e => this.toggleExtraInfos()); - } + this.signExtraButton.on('click', e => this.toggleExtraInfos()); + this.signDropButton.on('click', e => this.removeSign(e)); } - initCrossListeners() { - this.cross.on('mousedown', e => this.dragSignature()); - this.cross.on('touchstart', e => this.dragSignature()); - this.cross.on('mouseup', e => this.stopDragSignature()); - this.cross.on('touchend', e => this.stopDragSignature()); + unbindCrossToolsListeners() { + this.signZoomOutButton.unbind(); + this.signZoomInButton.unbind(); + this.signNextImageButton.unbind(); + this.signPrevImageButton.unbind(); + this.signExtraButton.unbind(); + this.signDropButton.unbind(); } getCurrentSignParams() { - return this.signRequestParamses[this.currentSign]; + return this.signRequestParamses.get(this.currentSign + ""); } getUiXpos() { @@ -102,28 +114,38 @@ export class SignPosition extends EventFactory { signRequestParams.xPos = 0; signRequestParams.yPos = 0; signRequestParams.signPageNumber = this.getCurrentSignParams().signPageNumber; - signRequestParams.signWidth = this.getCurrentSignParams().signWidth; - signRequestParams.signHeight = this.getCurrentSignParams().signHeight; - signRequestParams.signImageNumber = this.getCurrentSignParams().signImageNumber; + signRequestParams.addExtra = this.getCurrentSignParams().addExtra; + signRequestParams.extraWidth = this.getCurrentSignParams().extraWidth; + signRequestParams.signScale = this.getCurrentSignParams().signScale; signRequestParams.addDate = false; signRequestParams.addName = false; - this.signRequestParamses.push(signRequestParams); let okSign = this.cross.clone(); - okSign.attr("id", "sign_" + this.currentSign) + // okSign.attr("id", "cross_" + currentSign) okSign.css( "z-index", "2"); - okSign.children().attr("id", "border_" + this.currentSign); okSign.children().removeClass("anim-border"); - okSign.children().children().attr("id", "sign_adds_" + this.currentSign) okSign.appendTo(this.pdf); - this.currentSign++; + okSign.on("click", e => this.switchSignToTarget(e)); + let currentSign = Array.from(this.signRequestParamses.keys())[this.signRequestParamses.size - 1] + 1; + this.signRequestParamses.set(currentSign + "", signRequestParams); + this.currentSign = currentSign; this.updateCrossPosition(); this.cross.css("position", "fixed"); this.cross.css("margin-left", "270px"); this.cross.css("margin-top", "180px"); this.cross.css("margin-top", "180px"); - this.cross.children().children().remove(); + this.cross.attr("id", "cross_" + currentSign); + this.cross.children().each(function (e) { + $(this).attr("id", $(this).attr("id").split("_")[0] + "_" + currentSign); + }); + this.cross.children().children().each(function (e) { + $(this).attr("id", $(this).attr("id").split("_")[0] + "_" + currentSign); + }); + this.signZoomOutButton = $('#signZoomOut_' + currentSign); + this.signZoomInButton = $('#signZoomIn_' + currentSign); + this.signNextImageButton = $('#signNextImage_' + currentSign); + this.signPrevImageButton = $('#signPrevImage_' + currentSign); + this.signExtraButton = $('#signExtra_' + currentSign); this.addSignButton.attr("disabled", "disabled"); - this.removeSignButton.removeAttr("disabled"); this.hideButtons(); let dateButton = $('#dateButton'); dateButton.removeClass('btn-outline-success'); @@ -131,31 +153,45 @@ export class SignPosition extends EventFactory { let nameButton = $('#nameButton'); nameButton.removeClass('btn-outline-success'); nameButton.addClass('btn-outline-dark'); + this.changeSignImage(0); + } + + switchSignToTarget(e) { + let changeCross = $(e.currentTarget); + this.switchSign(changeCross.attr("id").split("_")[1]); } - removeSign() { - this.currentSign--; - console.info("rollback : sign_" + (this.currentSign)); - this.signRequestParamses.splice(-1,1); - if(this.signRequestParamses.length < 2) { - this.removeSignButton.attr("disabled", "disabled"); - } - $("#cross").remove(); - let oldSign = $("#sign_" + (this.currentSign)); - oldSign.attr("id", "cross"); - this.cross = oldSign; - this.cross.css( "z-index", "4"); - this.cross.children().attr("id", "borders"); - this.cross.children().addClass("anim-border"); - this.borders = this.cross.children(); - this.cross.css("position", "absolute"); - this.cross.children().children().remove(); - this.updateCrossPosition(); + switchSign(currentSign) { + console.info("switch to " + currentSign); + this.borders.removeClass("anim-border"); + this.borders.unbind(); + this.cross.on("click", e => this.switchSignToTarget(e)); + this.currentSign = currentSign; + this.cross = $('#cross_' + currentSign); + this.cross.unbind(); + this.crossTools = $('#crossTools_' + currentSign); + this.borders = $('#borders_' + currentSign); + this.borders.addClass("anim-border"); this.initCrossListeners(); - if(this.getCurrentSignParams().extraName) { - this.getCurrentSignParams().extraName = false; - this.toggleExtraInfos(); + this.unbindCrossToolsListeners(); + this.signZoomOutButton = $('#signZoomOut_' + currentSign); + this.signZoomInButton = $('#signZoomIn_' + currentSign); + this.signNextImageButton = $('#signNextImage_' + currentSign); + this.signPrevImageButton = $('#signPrevImage_' + currentSign); + this.signExtraButton = $('#signExtra_' + currentSign); + this.signDropButton = $('#signDrop_' + currentSign); + this.initCrossToolsListeners(); + } + + removeSign(e) { + if(this.signRequestParamses.size > 1) { + let dropCross = $(e.currentTarget); + let dropId = dropCross.attr("id").split("_")[1]; + console.info("drop : sign_" + (this.currentSign)); + this.signRequestParamses.delete(dropId); + $("#cross_" + dropId).remove(); + this.currentSign = Array.from(this.signRequestParamses.keys())[this.signRequestParamses.size - 1]; } } @@ -170,8 +206,8 @@ export class SignPosition extends EventFactory { } changeSignSize(result) { - this.getCurrentSignParams().signWidth = Math.round((result.w + this.extraWidth) * this.signScale * this.currentScale * this.fixRatio); - this.getCurrentSignParams().signHeight = Math.round((result.h) * this.signScale * this.currentScale * this.fixRatio); + this.getCurrentSignParams().signWidth = Math.round((result.w + this.getCurrentSignParams().extraWidth) * this.getCurrentSignParams().signScale * this.currentScale * this.fixRatio); + this.getCurrentSignParams().signHeight = Math.round((result.h) * this.getCurrentSignParams().signScale * this.currentScale * this.fixRatio); this.updateSignSize(); } @@ -204,20 +240,22 @@ export class SignPosition extends EventFactory { } signZoomOut(e) { - this.updateSignZoom(this.signScale - 0.1); + this.updateSignZoom(this.getCurrentSignParams().signScale - 0.1); } signZoomIn(e) { - this.updateSignZoom(this.signScale + 0.1); + this.updateSignZoom(this.getCurrentSignParams().signScale + 0.1); } updateSignZoom(signScale) { console.info("sign zoom to : " + signScale); - this.getCurrentSignParams().signWidth = Math.round(this.getCurrentSignParams().signWidth / this.signScale * signScale); - this.getCurrentSignParams().signHeight = Math.round(this.getCurrentSignParams().signHeight / this.signScale * signScale); - this.signScale = signScale; - this.updateSignSize(); - this.updateSignButtons(); + if(signScale > 0.2 && signScale < 2) { + this.getCurrentSignParams().signWidth = Math.round(this.getCurrentSignParams().signWidth / this.getCurrentSignParams().signScale * signScale); + this.getCurrentSignParams().signHeight = Math.round(this.getCurrentSignParams().signHeight / this.getCurrentSignParams().signScale * signScale); + this.getCurrentSignParams().signScale = signScale; + this.updateSignSize(); + // this.updateSignButtons(); + } } pointIt(e) { @@ -254,32 +292,16 @@ export class SignPosition extends EventFactory { updateScale(scale) { console.info("update sign scale from " + this.currentScale + " to " + scale); - // this.getCurrentSign().signWidth = this.getCurrentSign().signWidth / this.currentScale * scale; - // this.getCurrentSign().signHeight = this.getCurrentSign().signHeight / this.currentScale * scale; - // this.getCurrentSign().setxPos( this.getCurrentSign().xPos / this.currentScale * scale); - // this.getCurrentSign().setyPos( this.getCurrentSign().yPos / this.currentScale * scale); $('div[id^="sign_"]').each((index, e) => this.updateOtherSignPosition(e, scale)); this.currentScale = scale; this.updateCrossPosition(); } - - updateSignButtons() { - console.debug("update buttons"); - let signZoomIn = $("#signZoomIn"); - let signZoomOut = $("#signZoomOut"); - - signZoomIn.css('left', this.getUiXpos() - 35 + "px"); - signZoomIn.css('top', this.getUiYpos() + "px"); - signZoomOut.css('left', this.getUiXpos() - 35 + "px"); - signZoomOut.css('top', this.getUiYpos() + 32 + "px"); - - let signPrevImage = $("#signPrevImage"); - let signNextImage = $("#signNextImage"); - signPrevImage.css('left', this.getUiXpos() - 80 + "px"); - signPrevImage.css('top', this.getUiYpos() + "px"); - signNextImage.css('left', this.getUiXpos() - 80 + "px"); - signNextImage.css('top', this.getUiYpos() + 32 + "px"); - } + // + // updateSignButtons() { + // console.debug("update buttons"); + // this.crossTools.css('left', 0 + "px"); + // this.crossTools.css('top', -45 + "px"); + // } updateCrossPosition() { console.debug("update cross pos to : " + this.getUiXpos() + " " + this.getUiYpos()); @@ -311,19 +333,19 @@ export class SignPosition extends EventFactory { this.cross.css('height', (this.getCurrentSignParams().signHeight / this.fixRatio * this.currentScale)); this.borders.css('width', (this.getCurrentSignParams().signWidth / this.fixRatio * this.currentScale)); this.borders.css('height', (this.getCurrentSignParams().signHeight / this.fixRatio * this.currentScale)); - this.cross.css('background-size', (this.getCurrentSignParams().signWidth - (this.extraWidth * this.signScale * this.fixRatio)) * this.currentScale / this.fixRatio); - $('#textVisa').css('font-size', this.fontSize * this.currentScale * this.signScale + "px"); + this.cross.css('background-size', (this.getCurrentSignParams().signWidth - (this.getCurrentSignParams().extraWidth * this.getCurrentSignParams().signScale * this.fixRatio)) * this.currentScale / this.fixRatio); + $('#textVisa').css('font-size', this.fontSize * this.currentScale * this.getCurrentSignParams().signScale + "px"); let textDate = $('#textDate'); - textDate.css('font-size', this.fontSize * this.currentScale * this.signScale + "px"); - textDate.css('top', "-" + 30 * this.currentScale * this.signScale + "px"); + textDate.css('font-size', this.fontSize * this.currentScale * this.getCurrentSignParams().signScale + "px"); + textDate.css('top', "-" + 30 * this.currentScale * this.getCurrentSignParams().signScale + "px"); let textName = $('#textName'); - textName.css('font-size', this.fontSize * this.currentScale * this.signScale + "px"); - textName.css('top', "-" + 30 * this.currentScale * this.signScale + "px"); - let textExtra = $('#textExtra'); - textExtra.css('margin-left', (this.getCurrentSignParams().signWidth - (this.extraWidth * this.signScale * this.fixRatio)) * this.currentScale / this.fixRatio + "px"); - textExtra.css('font-size', this.fontSize * this.currentScale * this.signScale + "px"); - textExtra.css('top', "-" + 30 * this.currentScale * this.signScale + "px"); - this.updateSignButtons(); + textName.css('font-size', this.fontSize * this.currentScale * this.getCurrentSignParams().signScale + "px"); + textName.css('top', "-" + 30 * this.currentScale * this.getCurrentSignParams().signScale + "px"); + let textExtra = $('#textExtra_' + this.currentSign); + textExtra.css('margin-left', (this.getCurrentSignParams().signWidth - (this.getCurrentSignParams().extraWidth * this.getCurrentSignParams().signScale * this.fixRatio)) * this.currentScale / this.fixRatio + "px"); + textExtra.css('font-size', this.fontSize * this.currentScale * this.getCurrentSignParams().signScale + "px"); + textExtra.css('top', "-" + 30 * this.currentScale * this.getCurrentSignParams().signScale + "px"); + // this.updateSignButtons(); } stopDragSignature() { @@ -333,7 +355,7 @@ export class SignPosition extends EventFactory { this.cross.css('pointerEvents', "auto"); document.body.style.cursor = "default"; if(this.pointItEnable) { - this.updateSignButtons(); + // this.updateSignButtons(); this.showButtons(); } this.pointItEnable = false; @@ -362,17 +384,11 @@ export class SignPosition extends EventFactory { } hideButtons() { - $('#signZoomIn').addClass('d-none'); - $('#signZoomOut').addClass('d-none'); - $('#signNextImage').addClass('d-none'); - $('#signPrevImage').addClass('d-none'); + this.crossTools.addClass('d-none'); } showButtons() { - $('#signZoomIn').removeClass('d-none'); - $('#signZoomOut').removeClass('d-none'); - $('#signNextImage').removeClass('d-none'); - $('#signPrevImage').removeClass('d-none'); + this.crossTools.removeClass('d-none'); } toggleVisual() { @@ -390,30 +406,32 @@ export class SignPosition extends EventFactory { addText() { console.log("toggle date"); $('#dateButton').toggleClass('btn-outline-success btn-outline-dark'); - this.borders.append("" + + this.borders.append("" + "Visé par " + this.userName + ""); - this.borders.append("Le " + moment().format('DD/MM/YYYY HH:mm:ss') + ""); + this.borders.append("Le " + moment().format('DD/MM/YYYY HH:mm:ss') + ""); } toggleExtraInfos() { console.log("toggle extra"); $('#extraButton').toggleClass('btn-outline-success btn-outline-dark'); - if(this.displayExtra) { - this.displayExtra = false; + if(this.getCurrentSignParams().addExtra) { this.getCurrentSignParams().addExtra = false; - this.extraWidth = 0; + this.getCurrentSignParams().extraWidth = 0; this.getCurrentSignParams().signWidth = this.getCurrentSignParams().signWidth - 200; - document.getElementById("textExtra").remove(); + $("#textExtra_" + this.currentSign).remove(); } else { - this.displayExtra = true; this.getCurrentSignParams().addExtra = true; - this.extraWidth = 200; + this.getCurrentSignParams().extraWidth = 200; this.getCurrentSignParams().signWidth = this.getCurrentSignParams().signWidth + 200; let signTypeText = "Signature calligraphique"; if(this.signType === "certSign" || this.signType === "nexuSign") { signTypeText = "Signature électronique"; } - this.borders.append("" + + this.borders.append("" + signTypeText + "
" + "Signé par " + this.userName + @@ -421,7 +439,7 @@ export class SignPosition extends EventFactory { "Le " + moment().format('DD/MM/YYYY HH:mm:ss [GMT] Z') + "
"); } - this.changeSignImage(this.currentSign); + this.changeSignImage(this.getCurrentSignParams().signImageNumber); } } \ No newline at end of file diff --git a/src/main/resources/static/js/modules/ui/signrequests/SignUi.js b/src/main/resources/static/js/modules/ui/signrequests/SignUi.js index 2b9060b22..7b00b8c1c 100644 --- a/src/main/resources/static/js/modules/ui/signrequests/SignUi.js +++ b/src/main/resources/static/js/modules/ui/signrequests/SignUi.js @@ -83,7 +83,7 @@ export class SignUi { if(this.workspace != null) { this.signRequestUrlParams = "password=" + document.getElementById("password").value + "&sseId=" + sessionStorage.getItem("sseId") + - "&signRequestParams=" + JSON.stringify(this.workspace.signPosition.signRequestParamses) + + "&signRequestParams=" + JSON.stringify(Array.from(this.workspace.signPosition.signRequestParamses.values())) + "&visual=" + this.workspace.signPosition.visualActive + "&comment=" + this.signComment.val() + // "&formData=" + JSON.stringify(formData) + diff --git a/src/main/resources/static/js/modules/ui/signrequests/WorkspacePdf.js b/src/main/resources/static/js/modules/ui/signrequests/WorkspacePdf.js index 296c27e16..287747299 100644 --- a/src/main/resources/static/js/modules/ui/signrequests/WorkspacePdf.js +++ b/src/main/resources/static/js/modules/ui/signrequests/WorkspacePdf.js @@ -51,7 +51,6 @@ export class WorkspacePdf { visualButton.classList.remove("d-none"); visualButton.addEventListener('click', e => this.signPosition.toggleVisual()); } - document.getElementById('extraButton').addEventListener('click', e => this.signPosition.toggleExtraInfos()); } document.getElementById('hideComment').addEventListener('click', e => this.hideComment()); } @@ -369,10 +368,11 @@ export class WorkspacePdf { $('#signModeButton').removeClass('btn-outline-success'); $('#readModeButton').removeClass('btn-outline-secondary'); $('#signButtons').addClass('d-none'); - $('#signZoomIn').addClass('d-none'); - $('#signZoomOut').addClass('d-none'); - $('#signNextImage').addClass('d-none'); - $('#signPrevImage').addClass('d-none'); + this.signPosition.crossTools.addClass('d-none'); + // $('#signZoomIn').addClass('d-none'); + // $('#signZoomOut').addClass('d-none'); + // $('#signNextImage').addClass('d-none'); + // $('#signPrevImage').addClass('d-none'); $('#commentsTools').hide(); $('#signTools').hide(); diff --git a/src/main/resources/static/js/modules/utils/SelectUser.js b/src/main/resources/static/js/modules/utils/SelectUser.js index 87ba6bc12..5fcc862b9 100644 --- a/src/main/resources/static/js/modules/utils/SelectUser.js +++ b/src/main/resources/static/js/modules/utils/SelectUser.js @@ -5,16 +5,17 @@ export default class SelectUser { this.slimSelect = null; this.selectField = $("#" + selectName); this.signRequestId = signRequestId; - let valuePrefix = ""; + this.valuePrefix = ""; this.limit = 99; + this.flag = false; let selectNameSplit = selectName.split("_"); if(selectNameSplit.length === 2) { - valuePrefix = selectNameSplit[1] + "*"; + this.valuePrefix = selectNameSplit[1] + "*"; } if(limit != null) { this.limit = limit; } - this.createUserSelect(selectName, valuePrefix); + this.createUserSelect(selectName, this.valuePrefix); this.selectField.addClass("slim-select-hack"); this.initListeners(); } @@ -23,7 +24,7 @@ export default class SelectUser { } displayTempUsers(e) { - if(this.signRequestId != null) { + if (this.signRequestId != null) { let recipientEmails = this.slimSelect.selected() $.ajax({ url: "/user/signrequests/is-temp-users/" + this.signRequestId, @@ -34,6 +35,35 @@ export default class SelectUser { success: data => this.displayTempUsersSuccess(data) }); } + if (this.flag === true) { + if (!e[e.length - 1].text.includes('(')) { + $.ajax({ + url: "/user/users/search-user-list?searchString=" + e[e.length - 1].text, + type: 'GET', + dataType: 'json', + contentType: "application/json", + success: response => this.addListMembers(response, e[e.length - 1].text) + }); + } + } + } + + addListMembers(data, selectValue) { + this.flag = false; + let array = []; + let array2 = []; + for (let i = 0; i < this.slimSelect.data.data.length ; i++) { + if (this.slimSelect.data.data[i].text !== selectValue && this.slimSelect.data.data[i].value !== "undefined") { + array.push({text: this.slimSelect.data.data[i].text, value: this.slimSelect.data.data[i].value, display: true}); + array2.push(this.slimSelect.data.data[i].value); + } + } + for(let i = 0; i < data.length; i++) { + array.push({text: data[i], value: this.valuePrefix + data[i], display: true}) + array2.push(data[i]); + } + this.slimSelect.setData(array); + this.slimSelect.set(array2); } displayTempUsersSuccess(data) { @@ -77,7 +107,7 @@ export default class SelectUser { searchText: 'Aucun résultat', searchPlaceholder: 'Rechercher', searchHighlight: false, - hideSelectedOption: false, + hideSelectedOption: true, closeOnSelect: true, limit: this.limit, onChange : e => this.displayTempUsers(e), @@ -85,7 +115,7 @@ export default class SelectUser { searchFilter: (option, search) => { return true; }, - ajax: function (search, callback) { + ajax: (search, callback) => { callback('Recherche en cours'); controller.abort(); controller = new AbortController() @@ -97,15 +127,36 @@ export default class SelectUser { method: 'get', signal: signal, }) - .then(function (response) { + .then((response) => { return response.json() }) - .then(function (json) { - let data = [] - for (let i = 0; i < json.length; i++) { - data.push({text: json[i].displayName + ' (' + json[i].mail + ')', value: valuePrefix + json[i].mail}); + .then((json) => { + if (json.length > 0) { + let data = [] + for (let i = 0; i < json.length; i++) { + data.push({text: json[i].displayName + ' (' + json[i].mail + ')', value: valuePrefix + json[i].mail}); + } + callback(data); + } else { + this.flag = true; + controller.abort(); + controller = new AbortController() + signal = controller.signal + fetch('/user/users/search-list?searchString=' + search, { + method: 'get', + signal: signal, + }) + .then(function (response){ + return response.json() + }) + .then(function (json) { + let data = [] + for (let i = 0; i < json.length; i++) { + data.push({text: json[i].mailAlias, value: valuePrefix + json[i].mailAlias}); + } + callback(data); + }) } - callback(data); }) .catch(function () { callback("Recherche en cours"); diff --git a/src/main/resources/static/js/prototypes/SignRequestParams.js b/src/main/resources/static/js/prototypes/SignRequestParams.js index ba91612d8..d9fcfd868 100644 --- a/src/main/resources/static/js/prototypes/SignRequestParams.js +++ b/src/main/resources/static/js/prototypes/SignRequestParams.js @@ -2,13 +2,17 @@ export class SignRequestParams { constructor(signRequestParams) { this.pdSignatureFieldName; - this.signImageNumber; + this.signImageNumber = 0; this.signPageNumber; + this.signWidth; + this.signHeight; this.xPos; this.yPos; - this.addExtra; + this.addExtra = true; + this.extraWidth = 0; this.addName; this.addDate; + this.signScale = 1; Object.assign(this, signRequestParams); } diff --git a/src/main/resources/templates/user/signrequests/includes/workspace.html b/src/main/resources/templates/user/signrequests/includes/workspace.html index 057f263e1..9c1b37034 100644 --- a/src/main/resources/templates/user/signrequests/includes/workspace.html +++ b/src/main/resources/templates/user/signrequests/includes/workspace.html @@ -9,31 +9,48 @@
- - - - -
-
+ + + + + + +
+
diff --git a/src/main/resources/templates/user/signrequests/show.html b/src/main/resources/templates/user/signrequests/show.html index 3708bdb98..bee723375 100644 --- a/src/main/resources/templates/user/signrequests/show.html +++ b/src/main/resources/templates/user/signrequests/show.html @@ -148,23 +148,14 @@
-
- - - - -
+ +
diff --git a/src/test/java/org/esupportail/esupsignature/DSSTest.java b/src/test/java/org/esupportail/esupsignature/DSSTest.java index 210c3ea80..d8f99b4e0 100644 --- a/src/test/java/org/esupportail/esupsignature/DSSTest.java +++ b/src/test/java/org/esupportail/esupsignature/DSSTest.java @@ -1,13 +1,5 @@ package org.esupportail.esupsignature; -import static org.junit.Assume.assumeNotNull; -import static org.junit.Assume.assumeThat; -import static org.junit.Assume.assumeTrue; - -import java.io.IOException; - -import javax.annotation.Resource; - import org.esupportail.esupsignature.dss.service.OJService; import org.junit.Test; import org.junit.runner.RunWith; @@ -16,6 +8,12 @@ import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit4.SpringRunner; +import javax.annotation.Resource; +import java.io.IOException; + +import static org.junit.Assume.assumeNotNull; +import static org.junit.Assume.assumeTrue; + @RunWith(SpringRunner.class) @SpringBootTest(classes = EsupSignatureApplication.class) @TestPropertySource(properties = {"app.scheduling.enable=false"}) @@ -25,7 +23,7 @@ public class DSSTest { private ObjectProvider ojService; @Test - public void dssTest() throws IOException { + public void testDss() throws IOException { assumeNotNull(ojService.getIfAvailable()); ojService.getIfAvailable().getCertificats(); assumeTrue("dss cache not fresh !", !ojService.getIfAvailable().checkOjFreshness()); diff --git a/src/test/java/org/esupportail/esupsignature/FsAccessServiceTest.java b/src/test/java/org/esupportail/esupsignature/FsAccessServiceTest.java index 800b0db33..de9212e08 100644 --- a/src/test/java/org/esupportail/esupsignature/FsAccessServiceTest.java +++ b/src/test/java/org/esupportail/esupsignature/FsAccessServiceTest.java @@ -7,12 +7,12 @@ import org.esupportail.esupsignature.service.interfaces.fs.FsAccessService; import org.junit.Test; import org.junit.jupiter.api.MethodOrderer; -import org.junit.jupiter.api.Order; import org.junit.jupiter.api.TestMethodOrder; import org.junit.runner.RunWith; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.core.annotation.Order; import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit4.SpringRunner;