mirror of
https://github.com/Alfresco/SearchServices.git
synced 2026-09-16 18:12:56 +00:00
SEARCH-2202 Make more list fields unmodifiable.
Also fix integration tests to honour the encapsulation.
This commit is contained in:
+8
-7
@@ -18,6 +18,8 @@
|
||||
*/
|
||||
package org.alfresco.solr.tracker;
|
||||
|
||||
import static java.util.Arrays.asList;
|
||||
|
||||
import static org.alfresco.solr.AlfrescoSolrUtils.ancestors;
|
||||
import static org.alfresco.solr.AlfrescoSolrUtils.createGUID;
|
||||
import static org.alfresco.solr.AlfrescoSolrUtils.getAcl;
|
||||
@@ -350,13 +352,11 @@ public class AlfrescoSolrTrackerExceptionIT extends AbstractAlfrescoSolrIT
|
||||
|
||||
logger.info("#################### Passed Fifteenth Test ##############################");
|
||||
|
||||
|
||||
List<String> readers = aclReaders.getReaders();
|
||||
readers.set(0, "andy"); // Change the aclReader
|
||||
// Change the aclReaders
|
||||
aclReaders.setReaders(asList("andy"));
|
||||
indexAclId(acl.getId());
|
||||
|
||||
List<String> readers2 = aclReaders2.getReaders();
|
||||
readers2.set(0, "ice"); // Change the aclReader
|
||||
aclReaders2.setReaders(asList("ice"));
|
||||
reindexAclId(acl2.getId());
|
||||
|
||||
|
||||
@@ -379,8 +379,9 @@ public class AlfrescoSolrTrackerExceptionIT extends AbstractAlfrescoSolrIT
|
||||
|
||||
logger.info("#################### Passed Seventeenth Test ##############################");
|
||||
|
||||
readers.set(0, "alan"); // Change the aclReader
|
||||
readers2.set(0, "paul"); // Change the aclReader
|
||||
// Change the aclReaders
|
||||
aclReaders.setReaders(asList("alan"));
|
||||
aclReaders2.setReaders(asList("paul"));
|
||||
|
||||
reindexAclChangeSetId(aclChangeSet.getId()); //This should replace "andy" and "ice" with "alan" and "paul"
|
||||
|
||||
|
||||
+8
-7
@@ -18,6 +18,8 @@
|
||||
*/
|
||||
package org.alfresco.solr.tracker;
|
||||
|
||||
import static java.util.Arrays.asList;
|
||||
|
||||
import static org.alfresco.solr.AlfrescoSolrUtils.ancestors;
|
||||
import static org.alfresco.solr.AlfrescoSolrUtils.createGUID;
|
||||
import static org.alfresco.solr.AlfrescoSolrUtils.getAcl;
|
||||
@@ -355,13 +357,11 @@ public class AlfrescoSolrTrackerIT extends AbstractAlfrescoSolrIT
|
||||
|
||||
logger.info("#################### Passed Fifteenth Test ##############################");
|
||||
|
||||
|
||||
List<String> readers = aclReaders.getReaders();
|
||||
readers.set(0, "andy"); // Change the aclReader
|
||||
// Change the aclReaders
|
||||
aclReaders.setReaders(asList("andy"));
|
||||
indexAclId(acl.getId());
|
||||
|
||||
List<String> readers2 = aclReaders2.getReaders();
|
||||
readers2.set(0, "ice"); // Change the aclReader
|
||||
aclReaders2.setReaders(asList("ice"));
|
||||
reindexAclId(acl2.getId());
|
||||
|
||||
|
||||
@@ -384,8 +384,9 @@ public class AlfrescoSolrTrackerIT extends AbstractAlfrescoSolrIT
|
||||
|
||||
logger.info("#################### Passed Seventeenth Test ##############################");
|
||||
|
||||
readers.set(0, "alan"); // Change the aclReader
|
||||
readers2.set(0, "paul"); // Change the aclReader
|
||||
// Change the aclReaders
|
||||
aclReaders.setReaders(asList("alan"));
|
||||
aclReaders2.setReaders(asList("paul"));
|
||||
|
||||
reindexAclChangeSetId(aclChangeSet.getId()); //This should replace "andy" and "ice" with "alan" and "paul"
|
||||
|
||||
|
||||
+29
-27
@@ -1,30 +1,32 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Solr Client
|
||||
* %%
|
||||
* 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%
|
||||
*/
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Solr Client
|
||||
* %%
|
||||
* 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.solr.client;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -41,14 +43,14 @@ public class AclChangeSets
|
||||
|
||||
AclChangeSets(List<AclChangeSet> aclChangeSets, Long maxChangeSetCommitTime, Long maxChangeSetId)
|
||||
{
|
||||
this.aclChangeSets = aclChangeSets;
|
||||
this.aclChangeSets = new ArrayList<>(aclChangeSets);
|
||||
this.maxChangeSetCommitTime = maxChangeSetCommitTime;
|
||||
this.maxChangeSetId = maxChangeSetId;
|
||||
}
|
||||
|
||||
public List<AclChangeSet> getAclChangeSets()
|
||||
{
|
||||
return aclChangeSets;
|
||||
return Collections.unmodifiableList(aclChangeSets);
|
||||
}
|
||||
|
||||
public Long getMaxChangeSetCommitTime()
|
||||
|
||||
+39
-30
@@ -1,30 +1,34 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Solr Client
|
||||
* %%
|
||||
* 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%
|
||||
*/
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Solr Client
|
||||
* %%
|
||||
* 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.solr.client;
|
||||
|
||||
import static java.util.Collections.unmodifiableList;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -36,7 +40,7 @@ public class AclReaders
|
||||
{
|
||||
private final long id;
|
||||
|
||||
private final List<String> readers;
|
||||
private List<String> readers;
|
||||
|
||||
private final List<String> denied;
|
||||
|
||||
@@ -47,8 +51,8 @@ public class AclReaders
|
||||
public AclReaders(long id, List<String> readers, List<String> denied, long aclChangeSetId, String tenantDomain)
|
||||
{
|
||||
this.id = id;
|
||||
this.readers = readers;
|
||||
this.denied = denied;
|
||||
this.readers = new ArrayList<>(readers);
|
||||
this.denied = new ArrayList<>(denied);
|
||||
this.aclChangeSetId = aclChangeSetId;
|
||||
this.tenantDomain = tenantDomain;
|
||||
}
|
||||
@@ -96,12 +100,17 @@ public class AclReaders
|
||||
|
||||
public List<String> getReaders()
|
||||
{
|
||||
return readers;
|
||||
return unmodifiableList(readers);
|
||||
}
|
||||
|
||||
public void setReaders(List readers)
|
||||
{
|
||||
this.readers = new ArrayList<>(readers);
|
||||
}
|
||||
|
||||
public List<String> getDenied()
|
||||
{
|
||||
return denied;
|
||||
return unmodifiableList(denied);
|
||||
}
|
||||
|
||||
public long getAclChangeSetId()
|
||||
|
||||
Reference in New Issue
Block a user