[ 
https://issues.apache.org/jira/browse/SYNCOPE-866?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15314014#comment-15314014
 ] 

ASF GitHub Bot commented on SYNCOPE-866:
----------------------------------------

Github user ilgrosso commented on the issue:

    https://github.com/apache/syncope/pull/18
  
    Ok, the changes are just fine.
    
    Now, you need to add a couple of methods like as follows
    
    ```java
    @Test
    public void issueSYNCOPE866() {
    
    }
    ```
    
    to the two classes mentioned above.
    
    In the body of such methods you will, by taking reference with other 
methods in the same class, essentially:
    
    1. create a report template with an existing key
    1. assert that such creation operation fails with
    
    The following is a working sample - that you can just grab and put there - 
for report template:
    
    ```java
        @Test
        public void issueSYNCOPE866() {
            ReportTemplateTO reportTemplateTO = new ReportTemplateTO();
            reportTemplateTO.setKey("empty");
            try {
                reportTemplateService.create(reportTemplateTO);
                fail();
            } catch (SyncopeClientException e) {
                assertEquals(ClientExceptionType.EntityExists, e.getType());
            }
        }
    ```


> Check for existence of key before adding template
> -------------------------------------------------
>
>                 Key: SYNCOPE-866
>                 URL: https://issues.apache.org/jira/browse/SYNCOPE-866
>             Project: Syncope
>          Issue Type: Improvement
>          Components: core
>            Reporter: Tushar Mishra
>             Fix For: 2.0.0
>
>
> The create(String key) method in the MailTemplateLogic and 
> ReportTemplateLogic classes of the org.apache.syncope.core.logic package 
> should check if the key being added to the MailTemplateDAO instance is 
> already present. If such a key already exists, it should throw an appropriate 
> exception for the same.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to