ACS-5371 Exclude xpp3 dependency to avoid conflict in JDK9+ (#3049)

* ACS-5371 Exclude xpp3 dependency

* ACS-5371 Set compiler compliance to 17

* ACS-5371 Update xmlpull version

* ACS-5371 Update xmlpull version

* ACS-5371 Use kxml2

* ACS-5371 Refactor
This commit is contained in:
Damian Ujma
2024-11-25 09:49:47 +01:00
committed by GitHub
parent b6fb8725ce
commit 4a91132226
5 changed files with 154 additions and 139 deletions

View File

@@ -1,136 +1,137 @@
/*
* #%L
* Alfresco Repository
* %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
package org.alfresco.repo.site;
import static org.junit.Assert.assertEquals;
import java.util.UUID;
import org.alfresco.service.cmr.site.SiteInfo;
import org.alfresco.service.cmr.site.SiteVisibility;
import org.junit.Before;
import org.junit.Test;
/**
* Test Membership constructor logs. Based on REPO-2520
*
* @author Alexandru Epure
*/
public class SiteMembershipTest
{
SiteInfo siteInfo;
SiteMembership siteMember;
String personId = UUID.randomUUID().toString();
String firstName = UUID.randomUUID().toString();
String lastName = UUID.randomUUID().toString();
String role = "Consumer";
String idErrorMessage = "Id required building site membership";
String firstNameErrorMessage = "FirstName required building site membership of ";
String lastNameErrorMessage = "LastName required building site membership of ";
String roleErrorMessage = "Role required building site membership";
@Before
public void createSite()
{
String sitePreset = "testSiteMembershipPreset";
String shortName = "testSiteMembershipShortName";
String title = "testSiteMembershipTile";
String description = "testSiteMembershipDescription";
siteInfo = new SiteInfoImpl(sitePreset, shortName, title, description,
SiteVisibility.PUBLIC, null);
}
@Test
public void testNullpersonInfo() throws Exception
{
try
{
siteMember = new SiteMembership(siteInfo, null, firstName, lastName, role);
}
catch (IllegalArgumentException e)
{
assertEquals(idErrorMessage, e.getMessage());
}
try
{
siteMember = new SiteMembership(siteInfo, null, role);
}
catch (IllegalArgumentException e)
{
assertEquals(idErrorMessage, e.getMessage());
}
}
@Test
public void testNullRole() throws Exception
{
try
{
siteMember = new SiteMembership(siteInfo, personId, firstName, lastName, null);
}
catch (IllegalArgumentException e)
{
assertEquals(roleErrorMessage, e.getMessage());
}
try
{
siteMember = new SiteMembership(siteInfo, personId, null);
}
catch (IllegalArgumentException e)
{
assertEquals(roleErrorMessage, e.getMessage());
}
}
@Test
public void testNullFirstName() throws Exception
{
try
{
siteMember = new SiteMembership(siteInfo, personId, null, lastName, role);
}
catch (IllegalArgumentException e)
{
assertEquals(firstNameErrorMessage + siteInfo.getShortName(), e.getMessage());
}
}
@Test
public void testNullLastName() throws Exception
{
try
{
siteMember = new SiteMembership(siteInfo, personId, firstName, null, role);
}
catch (IllegalArgumentException e)
{
assertEquals(lastNameErrorMessage + siteInfo.getShortName(), e.getMessage());
}
}
}
/*
* #%L
* Alfresco Repository
* %%
* Copyright (C) 2005 - 2024 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
package org.alfresco.repo.site;
import static org.junit.Assert.assertEquals;
import java.util.UUID;
import org.junit.Before;
import org.junit.Test;
import org.alfresco.service.cmr.site.SiteInfo;
import org.alfresco.service.cmr.site.SiteVisibility;
/**
* Test Membership constructor logs. Based on REPO-2520
*
* @author Alexandru Epure
*/
public class SiteMembershipTest
{
SiteInfo siteInfo;
SiteMembership siteMember;
String personId = UUID.randomUUID().toString();
String firstName = UUID.randomUUID().toString();
String lastName = UUID.randomUUID().toString();
String role = "Consumer";
String idErrorMessage = "Id required building site membership";
String firstNameErrorMessage = "FirstName required building site membership of ";
String lastNameErrorMessage = "LastName required building site membership of ";
String roleErrorMessage = "Role required building site membership";
@Before
public void createSite()
{
var sitePreset = "testSiteMembershipPreset";
var shortName = "testSiteMembershipShortName";
var title = "testSiteMembershipTile";
var description = "testSiteMembershipDescription";
siteInfo = new SiteInfoImpl(sitePreset, shortName, title, description,
SiteVisibility.PUBLIC, null);
}
@Test
public void testNullpersonInfo() throws Exception
{
try
{
siteMember = new SiteMembership(siteInfo, null, firstName, lastName, role);
}
catch (IllegalArgumentException e)
{
assertEquals(idErrorMessage, e.getMessage());
}
try
{
siteMember = new SiteMembership(siteInfo, null, role);
}
catch (IllegalArgumentException e)
{
assertEquals(idErrorMessage, e.getMessage());
}
}
@Test
public void testNullRole() throws Exception
{
try
{
siteMember = new SiteMembership(siteInfo, personId, firstName, lastName, null);
}
catch (IllegalArgumentException e)
{
assertEquals(roleErrorMessage, e.getMessage());
}
try
{
siteMember = new SiteMembership(siteInfo, personId, null);
}
catch (IllegalArgumentException e)
{
assertEquals(roleErrorMessage, e.getMessage());
}
}
@Test
public void testNullFirstName() throws Exception
{
try
{
siteMember = new SiteMembership(siteInfo, personId, null, lastName, role);
}
catch (IllegalArgumentException e)
{
assertEquals(firstNameErrorMessage + siteInfo.getShortName(), e.getMessage());
}
}
@Test
public void testNullLastName() throws Exception
{
try
{
siteMember = new SiteMembership(siteInfo, personId, firstName, null, role);
}
catch (IllegalArgumentException e)
{
assertEquals(lastNameErrorMessage + siteInfo.getShortName(), e.getMessage());
}
}
}