Search in sources :

Example 1 with CMISGroup

use of it.cnr.cool.security.service.impl.alfresco.CMISGroup in project cool-jconon by consiglionazionaledellericerche.

the class CommonRestTest method testGetMd5Single.

@Test
public void testGetMd5Single() throws Exception {
    List<CMISGroup> groups = new ArrayList<>();
    groups.add(new CMISGroup("foo", "bar"));
    String md5 = CommonRest.getMd5(groups);
    assertEquals("acbd18db4cc2f85cedef654fccc4a4d8", md5);
}
Also used : CMISGroup(it.cnr.cool.security.service.impl.alfresco.CMISGroup) ArrayList(java.util.ArrayList) Test(org.junit.jupiter.api.Test)

Example 2 with CMISGroup

use of it.cnr.cool.security.service.impl.alfresco.CMISGroup in project cool-jconon by consiglionazionaledellericerche.

the class CommonRestTest method testGetMd5Multiple.

@Test
public void testGetMd5Multiple() throws Exception {
    List<CMISGroup> groups = new ArrayList<>();
    groups.add(new CMISGroup("baz", "baz"));
    groups.add(new CMISGroup("foo", "foo"));
    groups.add(new CMISGroup("bar", "bar"));
    String md5 = CommonRest.getMd5(groups);
    assertEquals("f08a3a47141ec5368b0ff672c7e14dee", md5);
}
Also used : CMISGroup(it.cnr.cool.security.service.impl.alfresco.CMISGroup) ArrayList(java.util.ArrayList) Test(org.junit.jupiter.api.Test)

Example 3 with CMISGroup

use of it.cnr.cool.security.service.impl.alfresco.CMISGroup in project cool-jconon by consiglionazionaledellericerche.

the class CommonRest method getMd5.

static String getMd5(List<CMISGroup> cmisGroups) {
    if (cmisGroups == null) {
        return "";
    }
    List<String> groups = new ArrayList<>();
    for (CMISGroup group : cmisGroups) {
        String group_name = group.getGroup_name();
        LOGGER.debug(group_name);
        groups.add(group_name);
    }
    Collections.sort(groups);
    String groupsConcatenation = StringUtils.collectionToDelimitedString(groups, "-");
    LOGGER.debug(groupsConcatenation);
    String md5 = StringUtil.getMd5(groupsConcatenation.getBytes());
    LOGGER.debug(md5);
    return md5;
}
Also used : CMISGroup(it.cnr.cool.security.service.impl.alfresco.CMISGroup)

Aggregations

CMISGroup (it.cnr.cool.security.service.impl.alfresco.CMISGroup)3 ArrayList (java.util.ArrayList)2 Test (org.junit.jupiter.api.Test)2