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;
|
package org.alfresco.solr.tracker;
|
||||||
|
|
||||||
|
import static java.util.Arrays.asList;
|
||||||
|
|
||||||
import static org.alfresco.solr.AlfrescoSolrUtils.ancestors;
|
import static org.alfresco.solr.AlfrescoSolrUtils.ancestors;
|
||||||
import static org.alfresco.solr.AlfrescoSolrUtils.createGUID;
|
import static org.alfresco.solr.AlfrescoSolrUtils.createGUID;
|
||||||
import static org.alfresco.solr.AlfrescoSolrUtils.getAcl;
|
import static org.alfresco.solr.AlfrescoSolrUtils.getAcl;
|
||||||
@@ -350,13 +352,11 @@ public class AlfrescoSolrTrackerExceptionIT extends AbstractAlfrescoSolrIT
|
|||||||
|
|
||||||
logger.info("#################### Passed Fifteenth Test ##############################");
|
logger.info("#################### Passed Fifteenth Test ##############################");
|
||||||
|
|
||||||
|
// Change the aclReaders
|
||||||
List<String> readers = aclReaders.getReaders();
|
aclReaders.setReaders(asList("andy"));
|
||||||
readers.set(0, "andy"); // Change the aclReader
|
|
||||||
indexAclId(acl.getId());
|
indexAclId(acl.getId());
|
||||||
|
|
||||||
List<String> readers2 = aclReaders2.getReaders();
|
aclReaders2.setReaders(asList("ice"));
|
||||||
readers2.set(0, "ice"); // Change the aclReader
|
|
||||||
reindexAclId(acl2.getId());
|
reindexAclId(acl2.getId());
|
||||||
|
|
||||||
|
|
||||||
@@ -379,8 +379,9 @@ public class AlfrescoSolrTrackerExceptionIT extends AbstractAlfrescoSolrIT
|
|||||||
|
|
||||||
logger.info("#################### Passed Seventeenth Test ##############################");
|
logger.info("#################### Passed Seventeenth Test ##############################");
|
||||||
|
|
||||||
readers.set(0, "alan"); // Change the aclReader
|
// Change the aclReaders
|
||||||
readers2.set(0, "paul"); // Change the aclReader
|
aclReaders.setReaders(asList("alan"));
|
||||||
|
aclReaders2.setReaders(asList("paul"));
|
||||||
|
|
||||||
reindexAclChangeSetId(aclChangeSet.getId()); //This should replace "andy" and "ice" with "alan" and "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;
|
package org.alfresco.solr.tracker;
|
||||||
|
|
||||||
|
import static java.util.Arrays.asList;
|
||||||
|
|
||||||
import static org.alfresco.solr.AlfrescoSolrUtils.ancestors;
|
import static org.alfresco.solr.AlfrescoSolrUtils.ancestors;
|
||||||
import static org.alfresco.solr.AlfrescoSolrUtils.createGUID;
|
import static org.alfresco.solr.AlfrescoSolrUtils.createGUID;
|
||||||
import static org.alfresco.solr.AlfrescoSolrUtils.getAcl;
|
import static org.alfresco.solr.AlfrescoSolrUtils.getAcl;
|
||||||
@@ -355,13 +357,11 @@ public class AlfrescoSolrTrackerIT extends AbstractAlfrescoSolrIT
|
|||||||
|
|
||||||
logger.info("#################### Passed Fifteenth Test ##############################");
|
logger.info("#################### Passed Fifteenth Test ##############################");
|
||||||
|
|
||||||
|
// Change the aclReaders
|
||||||
List<String> readers = aclReaders.getReaders();
|
aclReaders.setReaders(asList("andy"));
|
||||||
readers.set(0, "andy"); // Change the aclReader
|
|
||||||
indexAclId(acl.getId());
|
indexAclId(acl.getId());
|
||||||
|
|
||||||
List<String> readers2 = aclReaders2.getReaders();
|
aclReaders2.setReaders(asList("ice"));
|
||||||
readers2.set(0, "ice"); // Change the aclReader
|
|
||||||
reindexAclId(acl2.getId());
|
reindexAclId(acl2.getId());
|
||||||
|
|
||||||
|
|
||||||
@@ -384,8 +384,9 @@ public class AlfrescoSolrTrackerIT extends AbstractAlfrescoSolrIT
|
|||||||
|
|
||||||
logger.info("#################### Passed Seventeenth Test ##############################");
|
logger.info("#################### Passed Seventeenth Test ##############################");
|
||||||
|
|
||||||
readers.set(0, "alan"); // Change the aclReader
|
// Change the aclReaders
|
||||||
readers2.set(0, "paul"); // Change the aclReader
|
aclReaders.setReaders(asList("alan"));
|
||||||
|
aclReaders2.setReaders(asList("paul"));
|
||||||
|
|
||||||
reindexAclChangeSetId(aclChangeSet.getId()); //This should replace "andy" and "ice" with "alan" and "paul"
|
reindexAclChangeSetId(aclChangeSet.getId()); //This should replace "andy" and "ice" with "alan" and "paul"
|
||||||
|
|
||||||
|
|||||||
+29
-27
@@ -1,30 +1,32 @@
|
|||||||
/*
|
/*
|
||||||
* #%L
|
* #%L
|
||||||
* Alfresco Solr Client
|
* Alfresco Solr Client
|
||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This file is part of the Alfresco software.
|
* This file is part of the Alfresco software.
|
||||||
* If the software was purchased under a paid Alfresco license, the terms of
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
* the paid license agreement will prevail. Otherwise, the software is
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
* provided under the following open source license terms:
|
* provided under the following open source license terms:
|
||||||
*
|
*
|
||||||
* Alfresco is free software: you can redistribute it and/or modify
|
* 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
|
* 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
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* Alfresco is distributed in the hope that it will be useful,
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Lesser General Public License for more details.
|
* GNU Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
* #L%
|
* #L%
|
||||||
*/
|
*/
|
||||||
package org.alfresco.solr.client;
|
package org.alfresco.solr.client;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -41,14 +43,14 @@ public class AclChangeSets
|
|||||||
|
|
||||||
AclChangeSets(List<AclChangeSet> aclChangeSets, Long maxChangeSetCommitTime, Long maxChangeSetId)
|
AclChangeSets(List<AclChangeSet> aclChangeSets, Long maxChangeSetCommitTime, Long maxChangeSetId)
|
||||||
{
|
{
|
||||||
this.aclChangeSets = aclChangeSets;
|
this.aclChangeSets = new ArrayList<>(aclChangeSets);
|
||||||
this.maxChangeSetCommitTime = maxChangeSetCommitTime;
|
this.maxChangeSetCommitTime = maxChangeSetCommitTime;
|
||||||
this.maxChangeSetId = maxChangeSetId;
|
this.maxChangeSetId = maxChangeSetId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<AclChangeSet> getAclChangeSets()
|
public List<AclChangeSet> getAclChangeSets()
|
||||||
{
|
{
|
||||||
return aclChangeSets;
|
return Collections.unmodifiableList(aclChangeSets);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getMaxChangeSetCommitTime()
|
public Long getMaxChangeSetCommitTime()
|
||||||
|
|||||||
+39
-30
@@ -1,30 +1,34 @@
|
|||||||
/*
|
/*
|
||||||
* #%L
|
* #%L
|
||||||
* Alfresco Solr Client
|
* Alfresco Solr Client
|
||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This file is part of the Alfresco software.
|
* This file is part of the Alfresco software.
|
||||||
* If the software was purchased under a paid Alfresco license, the terms of
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
* the paid license agreement will prevail. Otherwise, the software is
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
* provided under the following open source license terms:
|
* provided under the following open source license terms:
|
||||||
*
|
*
|
||||||
* Alfresco is free software: you can redistribute it and/or modify
|
* 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
|
* 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
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* Alfresco is distributed in the hope that it will be useful,
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Lesser General Public License for more details.
|
* GNU Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
* #L%
|
* #L%
|
||||||
*/
|
*/
|
||||||
package org.alfresco.solr.client;
|
package org.alfresco.solr.client;
|
||||||
|
|
||||||
|
import static java.util.Collections.unmodifiableList;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -36,7 +40,7 @@ public class AclReaders
|
|||||||
{
|
{
|
||||||
private final long id;
|
private final long id;
|
||||||
|
|
||||||
private final List<String> readers;
|
private List<String> readers;
|
||||||
|
|
||||||
private final List<String> denied;
|
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)
|
public AclReaders(long id, List<String> readers, List<String> denied, long aclChangeSetId, String tenantDomain)
|
||||||
{
|
{
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.readers = readers;
|
this.readers = new ArrayList<>(readers);
|
||||||
this.denied = denied;
|
this.denied = new ArrayList<>(denied);
|
||||||
this.aclChangeSetId = aclChangeSetId;
|
this.aclChangeSetId = aclChangeSetId;
|
||||||
this.tenantDomain = tenantDomain;
|
this.tenantDomain = tenantDomain;
|
||||||
}
|
}
|
||||||
@@ -96,12 +100,17 @@ public class AclReaders
|
|||||||
|
|
||||||
public List<String> getReaders()
|
public List<String> getReaders()
|
||||||
{
|
{
|
||||||
return readers;
|
return unmodifiableList(readers);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReaders(List readers)
|
||||||
|
{
|
||||||
|
this.readers = new ArrayList<>(readers);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getDenied()
|
public List<String> getDenied()
|
||||||
{
|
{
|
||||||
return denied;
|
return unmodifiableList(denied);
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getAclChangeSetId()
|
public long getAclChangeSetId()
|
||||||
|
|||||||
Reference in New Issue
Block a user