mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
RM-3132 (Update license headers)
This commit is contained in:
@@ -5,21 +5,21 @@
|
|||||||
* 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%
|
||||||
@@ -30,21 +30,20 @@ package org.alfresco.module.org_alfresco_module_rm.test.integration.issue;
|
|||||||
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase;
|
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Integration test for RM-1887
|
* Integration test for RM-1887
|
||||||
*
|
*
|
||||||
* @author Roy Wetherall
|
* @author Roy Wetherall
|
||||||
* @since 2.3
|
* @since 2.3
|
||||||
*/
|
*/
|
||||||
public class RM1887Test extends BaseRMTestCase
|
public class RM1887Test extends BaseRMTestCase
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
protected boolean isRecordTest()
|
protected boolean isRecordTest()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Given that a record is unfiled
|
* Given that a record is unfiled
|
||||||
* And an unfiled folder has been created
|
* And an unfiled folder has been created
|
||||||
@@ -54,38 +53,38 @@ public class RM1887Test extends BaseRMTestCase
|
|||||||
public void testMoveUnfiledRecord() throws Exception
|
public void testMoveUnfiledRecord() throws Exception
|
||||||
{
|
{
|
||||||
doBehaviourDrivenTest(new BehaviourDrivenTest()
|
doBehaviourDrivenTest(new BehaviourDrivenTest()
|
||||||
{
|
{
|
||||||
private NodeRef unfiledRecordFolder;
|
private NodeRef unfiledRecordFolder;
|
||||||
private NodeRef unfiledRecord;
|
private NodeRef unfiledRecord;
|
||||||
|
|
||||||
public void given() throws Exception
|
public void given() throws Exception
|
||||||
{
|
{
|
||||||
// create unfiled folder
|
// create unfiled folder
|
||||||
unfiledRecordFolder = fileFolderService.create(filePlanService.getUnfiledContainer(filePlan), "my test folder", TYPE_UNFILED_RECORD_FOLDER).getNodeRef();
|
unfiledRecordFolder = fileFolderService.create(filePlanService.getUnfiledContainer(filePlan), "my test folder", TYPE_UNFILED_RECORD_FOLDER).getNodeRef();
|
||||||
|
|
||||||
// crate unfiled record
|
// crate unfiled record
|
||||||
unfiledRecord = recordService.createRecordFromContent(filePlan, "test.txt", TYPE_CONTENT, null, null);
|
unfiledRecord = recordService.createRecordFromContent(filePlan, "test.txt", TYPE_CONTENT, null, null);
|
||||||
|
|
||||||
// check the record
|
// check the record
|
||||||
assertTrue(recordService.isRecord(unfiledRecord));
|
assertTrue(recordService.isRecord(unfiledRecord));
|
||||||
assertFalse(recordService.isFiled(unfiledRecord));
|
assertFalse(recordService.isFiled(unfiledRecord));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void when() throws Exception
|
public void when() throws Exception
|
||||||
{
|
{
|
||||||
// move the record into the unfiled folder
|
// move the record into the unfiled folder
|
||||||
fileFolderService.move(unfiledRecord, unfiledRecordFolder, null);
|
fileFolderService.move(unfiledRecord, unfiledRecordFolder, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void then()
|
public void then()
|
||||||
{
|
{
|
||||||
// check the record
|
// check the record
|
||||||
assertTrue(recordService.isRecord(unfiledRecord));
|
assertTrue(recordService.isRecord(unfiledRecord));
|
||||||
assertFalse(recordService.isFiled(unfiledRecord));
|
assertFalse(recordService.isFiled(unfiledRecord));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -5,21 +5,21 @@
|
|||||||
* 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%
|
||||||
@@ -41,111 +41,110 @@ import org.alfresco.service.cmr.rule.Rule;
|
|||||||
import org.alfresco.service.cmr.rule.RuleService;
|
import org.alfresco.service.cmr.rule.RuleService;
|
||||||
import org.alfresco.service.cmr.rule.RuleType;
|
import org.alfresco.service.cmr.rule.RuleType;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* System test for RM-2072: Concurrency exceptions and deadlocks on Records Management "File to" rule
|
* System test for RM-2072: Concurrency exceptions and deadlocks on Records Management "File to" rule
|
||||||
*
|
*
|
||||||
* @author Roy Wetherall
|
* @author Roy Wetherall
|
||||||
* @since 2.2.1.1
|
* @since 2.2.1.1
|
||||||
*/
|
*/
|
||||||
public class RM2072Test extends BaseRMTestCase
|
public class RM2072Test extends BaseRMTestCase
|
||||||
{
|
{
|
||||||
private static final int NUMBER_OF_BATCHES = 1;
|
private static final int NUMBER_OF_BATCHES = 1;
|
||||||
private static final int NUMBER_IN_BATCH = 500;
|
private static final int NUMBER_IN_BATCH = 500;
|
||||||
|
|
||||||
private RuleService ruleService;
|
private RuleService ruleService;
|
||||||
private NodeRef ruleFolder;
|
private NodeRef ruleFolder;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void initServices()
|
protected void initServices()
|
||||||
{
|
{
|
||||||
super.initServices();
|
super.initServices();
|
||||||
|
|
||||||
ruleService = (RuleService)applicationContext.getBean("RuleService");
|
ruleService = (RuleService)applicationContext.getBean("RuleService");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isCollaborationSiteTest()
|
protected boolean isCollaborationSiteTest()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isRecordTest()
|
protected boolean isRecordTest()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Given that I have auto declare configured
|
* Given that I have auto declare configured
|
||||||
* And that I have auto file configured to a path where only the record folder needs to be created
|
* And that I have auto file configured to a path where only the record folder needs to be created
|
||||||
* When I add lots of documents in the same transaction
|
* When I add lots of documents in the same transaction
|
||||||
* Then the rules should fire
|
* Then the rules should fire
|
||||||
* And the documents should be filed in the new record folder
|
* And the documents should be filed in the new record folder
|
||||||
*/
|
*/
|
||||||
public void testAutoDeclareAutoFileCreateRecordFolderOnly() throws Exception
|
public void testAutoDeclareAutoFileCreateRecordFolderOnly() throws Exception
|
||||||
{
|
{
|
||||||
doTestInTransaction(new Test<Void>()
|
doTestInTransaction(new Test<Void>()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public Void run()
|
public Void run()
|
||||||
{
|
{
|
||||||
// create the folder
|
// create the folder
|
||||||
ruleFolder = fileFolderService.create(documentLibrary, "mytestfolder", ContentModel.TYPE_FOLDER).getNodeRef();
|
ruleFolder = fileFolderService.create(documentLibrary, "mytestfolder", ContentModel.TYPE_FOLDER).getNodeRef();
|
||||||
|
|
||||||
// create record category
|
// create record category
|
||||||
NodeRef nodeRefA = filePlanService.createRecordCategory(filePlan, "A");
|
NodeRef nodeRefA = filePlanService.createRecordCategory(filePlan, "A");
|
||||||
NodeRef nodeRefB = filePlanService.createRecordCategory(nodeRefA, "B");
|
NodeRef nodeRefB = filePlanService.createRecordCategory(nodeRefA, "B");
|
||||||
filePlanService.createRecordCategory(nodeRefB, "C");
|
filePlanService.createRecordCategory(nodeRefB, "C");
|
||||||
|
|
||||||
Action action = actionService.createAction(CreateRecordAction.NAME);
|
Action action = actionService.createAction(CreateRecordAction.NAME);
|
||||||
action.setParameterValue(CreateRecordAction.PARAM_FILE_PLAN, filePlan);
|
action.setParameterValue(CreateRecordAction.PARAM_FILE_PLAN, filePlan);
|
||||||
|
|
||||||
Rule rule = new Rule();
|
Rule rule = new Rule();
|
||||||
rule.setRuleType(RuleType.INBOUND);
|
rule.setRuleType(RuleType.INBOUND);
|
||||||
rule.setTitle("my rule");
|
rule.setTitle("my rule");
|
||||||
rule.setAction(action);
|
rule.setAction(action);
|
||||||
rule.setExecuteAsynchronously(true);
|
rule.setExecuteAsynchronously(true);
|
||||||
ruleService.saveRule(ruleFolder, rule);
|
ruleService.saveRule(ruleFolder, rule);
|
||||||
|
|
||||||
Action fileAction = actionService.createAction(FileToAction.NAME);
|
Action fileAction = actionService.createAction(FileToAction.NAME);
|
||||||
fileAction.setParameterValue(FileToAction.PARAM_PATH, "/A/B/C/{date.year.long}/{date.month.long}/{date.day.month}");
|
fileAction.setParameterValue(FileToAction.PARAM_PATH, "/A/B/C/{date.year.long}/{date.month.long}/{date.day.month}");
|
||||||
fileAction.setParameterValue(FileToAction.PARAM_CREATE_RECORD_PATH, true);
|
fileAction.setParameterValue(FileToAction.PARAM_CREATE_RECORD_PATH, true);
|
||||||
|
|
||||||
Rule fileRule = new Rule();
|
Rule fileRule = new Rule();
|
||||||
fileRule.setRuleType(RuleType.INBOUND);
|
fileRule.setRuleType(RuleType.INBOUND);
|
||||||
fileRule.setTitle("my rule");
|
fileRule.setTitle("my rule");
|
||||||
fileRule.setAction(fileAction);
|
fileRule.setAction(fileAction);
|
||||||
fileRule.setExecuteAsynchronously(true);
|
fileRule.setExecuteAsynchronously(true);
|
||||||
ruleService.saveRule(filePlanService.getUnfiledContainer(filePlan), fileRule);
|
ruleService.saveRule(filePlanService.getUnfiledContainer(filePlan), fileRule);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void test(Void result) throws Exception
|
public void test(Void result) throws Exception
|
||||||
{
|
{
|
||||||
assertFalse(ruleService.getRules(ruleFolder).isEmpty());
|
assertFalse(ruleService.getRules(ruleFolder).isEmpty());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
List<NodeRef> records = new ArrayList<NodeRef>(NUMBER_OF_BATCHES*NUMBER_IN_BATCH);
|
List<NodeRef> records = new ArrayList<NodeRef>(NUMBER_OF_BATCHES*NUMBER_IN_BATCH);
|
||||||
|
|
||||||
for (int i = 0; i < NUMBER_OF_BATCHES; i++)
|
for (int i = 0; i < NUMBER_OF_BATCHES; i++)
|
||||||
{
|
{
|
||||||
final int finali = i;
|
final int finali = i;
|
||||||
records.addAll(doTestInTransaction(new Test<List<NodeRef>>()
|
records.addAll(doTestInTransaction(new Test<List<NodeRef>>()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public List<NodeRef> run() throws Exception
|
public List<NodeRef> run() throws Exception
|
||||||
{
|
{
|
||||||
List<NodeRef> records = new ArrayList<NodeRef>(NUMBER_IN_BATCH);
|
List<NodeRef> records = new ArrayList<NodeRef>(NUMBER_IN_BATCH);
|
||||||
for (int j = 0; j < NUMBER_IN_BATCH; j++)
|
for (int j = 0; j < NUMBER_IN_BATCH; j++)
|
||||||
{
|
{
|
||||||
int count = (finali+1)*(j+1);
|
int count = (finali+1)*(j+1);
|
||||||
String name = "content" + count + ".txt";
|
String name = "content" + count + ".txt";
|
||||||
System.out.println(name + " - creating");
|
System.out.println(name + " - creating");
|
||||||
|
|
||||||
NodeRef record = fileFolderService.create(ruleFolder, name, ContentModel.TYPE_CONTENT).getNodeRef();
|
NodeRef record = fileFolderService.create(ruleFolder, name, ContentModel.TYPE_CONTENT).getNodeRef();
|
||||||
records.add(record);
|
records.add(record);
|
||||||
}
|
}
|
||||||
@@ -153,13 +152,13 @@ public class RM2072Test extends BaseRMTestCase
|
|||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
while(!records.isEmpty())
|
while(!records.isEmpty())
|
||||||
{
|
{
|
||||||
Thread.sleep(1000);
|
Thread.sleep(1000);
|
||||||
|
|
||||||
final Iterator<NodeRef> temp = records.iterator();
|
final Iterator<NodeRef> temp = records.iterator();
|
||||||
doTestInTransaction(new Test<Void>()
|
doTestInTransaction(new Test<Void>()
|
||||||
{
|
{
|
||||||
@@ -176,7 +175,7 @@ public class RM2072Test extends BaseRMTestCase
|
|||||||
temp.remove();
|
temp.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@@ -5,21 +5,21 @@
|
|||||||
* 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%
|
||||||
@@ -31,39 +31,38 @@ import org.alfresco.error.AlfrescoRuntimeException;
|
|||||||
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase;
|
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.test.util.TestService;
|
import org.alfresco.module.org_alfresco_module_rm.test.util.TestService;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* System test for RM-452
|
* System test for RM-452
|
||||||
*
|
*
|
||||||
* See alfresco.extension.rm-method-security.properties
|
* See alfresco.extension.rm-method-security.properties
|
||||||
*
|
*
|
||||||
* @author Roy Wetherall
|
* @author Roy Wetherall
|
||||||
* @since 2.1
|
* @since 2.1
|
||||||
*/
|
*/
|
||||||
public class RM452Test extends BaseRMTestCase
|
public class RM452Test extends BaseRMTestCase
|
||||||
{
|
{
|
||||||
private TestService testService;
|
private TestService testService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void initServices()
|
protected void initServices()
|
||||||
{
|
{
|
||||||
super.initServices();
|
super.initServices();
|
||||||
|
|
||||||
testService = (TestService)applicationContext.getBean("TestService");
|
testService = (TestService)applicationContext.getBean("TestService");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isCollaborationSiteTest()
|
protected boolean isCollaborationSiteTest()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isRecordTest()
|
protected boolean isRecordTest()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testRM452() throws Exception
|
public void testRM452() throws Exception
|
||||||
{
|
{
|
||||||
doTestInTransaction(new Test<Void>()
|
doTestInTransaction(new Test<Void>()
|
||||||
@@ -75,27 +74,27 @@ public class RM452Test extends BaseRMTestCase
|
|||||||
assertNotNull(recordOne);
|
assertNotNull(recordOne);
|
||||||
assertFalse(filePlanService.isFilePlanComponent(folder));
|
assertFalse(filePlanService.isFilePlanComponent(folder));
|
||||||
assertTrue(filePlanService.isFilePlanComponent(recordOne));
|
assertTrue(filePlanService.isFilePlanComponent(recordOne));
|
||||||
|
|
||||||
// call methodOne with non-RM artifact .. expect success
|
// call methodOne with non-RM artifact .. expect success
|
||||||
testService.testMethodOne(folder);
|
testService.testMethodOne(folder);
|
||||||
|
|
||||||
// call methodTwo with non-RM artifact .. expect success
|
// call methodTwo with non-RM artifact .. expect success
|
||||||
testService.testMethodTwo(folder);
|
testService.testMethodTwo(folder);
|
||||||
|
|
||||||
// call methodOne with an RM artifact .. expect success
|
// call methodOne with an RM artifact .. expect success
|
||||||
testService.testMethodOne(recordOne);
|
testService.testMethodOne(recordOne);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
doTestInTransaction(new FailureTest
|
doTestInTransaction(new FailureTest
|
||||||
(
|
(
|
||||||
"Shouldn't be able to call testMethodTwo on TestService, because override RM security for method is not configred.",
|
"Shouldn't be able to call testMethodTwo on TestService, because override RM security for method is not configred.",
|
||||||
AlfrescoRuntimeException.class
|
AlfrescoRuntimeException.class
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() throws Exception
|
public void run() throws Exception
|
||||||
{
|
{
|
||||||
|
@@ -5,21 +5,21 @@
|
|||||||
* 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%
|
||||||
@@ -33,7 +33,6 @@ import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase;
|
|||||||
import org.alfresco.service.cmr.security.AccessStatus;
|
import org.alfresco.service.cmr.security.AccessStatus;
|
||||||
import org.alfresco.service.cmr.site.SiteRole;
|
import org.alfresco.service.cmr.site.SiteRole;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unit test for RM-804 .. site managers are able to delete file plans
|
* Unit test for RM-804 .. site managers are able to delete file plans
|
||||||
*
|
*
|
||||||
|
@@ -5,21 +5,21 @@
|
|||||||
* 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%
|
||||||
@@ -32,33 +32,32 @@ import org.alfresco.module.org_alfresco_module_rm.vital.VitalRecordDefinition;
|
|||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.alfresco.service.cmr.repository.Period;
|
import org.alfresco.service.cmr.repository.Period;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* System test for RM-994
|
* System test for RM-994
|
||||||
*
|
*
|
||||||
* @author Roy Wetherall
|
* @author Roy Wetherall
|
||||||
* @since 2.1
|
* @since 2.1
|
||||||
*/
|
*/
|
||||||
public class RM994Test extends BaseRMTestCase
|
public class RM994Test extends BaseRMTestCase
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
protected void initServices()
|
protected void initServices()
|
||||||
{
|
{
|
||||||
super.initServices();
|
super.initServices();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isCollaborationSiteTest()
|
protected boolean isCollaborationSiteTest()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isRecordTest()
|
protected boolean isRecordTest()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testRM944() throws Exception
|
public void testRM944() throws Exception
|
||||||
{
|
{
|
||||||
doTestInTransaction(new Test<Void>()
|
doTestInTransaction(new Test<Void>()
|
||||||
@@ -68,51 +67,51 @@ public class RM994Test extends BaseRMTestCase
|
|||||||
{
|
{
|
||||||
checkVitalRecordNotSet(rmContainer);
|
checkVitalRecordNotSet(rmContainer);
|
||||||
checkVitalRecordNotSet(rmFolder);
|
checkVitalRecordNotSet(rmFolder);
|
||||||
checkVitalRecordNotSet(recordOne);
|
checkVitalRecordNotSet(recordOne);
|
||||||
assertNull(nodeService.getProperty(recordOne, PROP_REVIEW_AS_OF));
|
assertNull(nodeService.getProperty(recordOne, PROP_REVIEW_AS_OF));
|
||||||
|
|
||||||
vitalRecordService.setVitalRecordDefintion(rmContainer, true, new Period("month|1"));
|
vitalRecordService.setVitalRecordDefintion(rmContainer, true, new Period("month|1"));
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
doTestInTransaction(new Test<Void>()
|
doTestInTransaction(new Test<Void>()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public Void run() throws Exception
|
public Void run() throws Exception
|
||||||
{
|
{
|
||||||
checkVitalRecordSet(rmContainer);
|
checkVitalRecordSet(rmContainer);
|
||||||
checkVitalRecordSet(rmFolder);
|
checkVitalRecordSet(rmFolder);
|
||||||
checkVitalRecordSet(recordOne);
|
checkVitalRecordSet(recordOne);
|
||||||
assertNotNull(nodeService.getProperty(recordOne, PROP_REVIEW_AS_OF));
|
assertNotNull(nodeService.getProperty(recordOne, PROP_REVIEW_AS_OF));
|
||||||
|
|
||||||
recordService.createRecord(filePlan, dmDocument, true);
|
recordService.createRecord(filePlan, dmDocument, true);
|
||||||
|
|
||||||
assertTrue(recordService.isRecord(dmDocument));
|
assertTrue(recordService.isRecord(dmDocument));
|
||||||
checkVitalRecordNotSet(dmDocument);
|
checkVitalRecordNotSet(dmDocument);
|
||||||
|
|
||||||
fileFolderService.move(dmDocument, rmFolder, null);
|
fileFolderService.move(dmDocument, rmFolder, null);
|
||||||
|
|
||||||
checkVitalRecordSet(dmDocument);
|
checkVitalRecordSet(dmDocument);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}, "admin");
|
}, "admin");
|
||||||
|
|
||||||
doTestInTransaction(new Test<Void>()
|
doTestInTransaction(new Test<Void>()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public Void run() throws Exception
|
public Void run() throws Exception
|
||||||
{
|
{
|
||||||
checkVitalRecordSet(dmDocument);
|
checkVitalRecordSet(dmDocument);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkVitalRecordSet(NodeRef nodeRef)
|
private void checkVitalRecordSet(NodeRef nodeRef)
|
||||||
{
|
{
|
||||||
VitalRecordDefinition def = vitalRecordService.getVitalRecordDefinition(nodeRef);
|
VitalRecordDefinition def = vitalRecordService.getVitalRecordDefinition(nodeRef);
|
||||||
@@ -121,14 +120,14 @@ public class RM994Test extends BaseRMTestCase
|
|||||||
assertEquals("month", def.getReviewPeriod().getPeriodType());
|
assertEquals("month", def.getReviewPeriod().getPeriodType());
|
||||||
assertEquals("1", def.getReviewPeriod().getExpression());
|
assertEquals("1", def.getReviewPeriod().getExpression());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkVitalRecordNotSet(NodeRef nodeRef)
|
private void checkVitalRecordNotSet(NodeRef nodeRef)
|
||||||
{
|
{
|
||||||
VitalRecordDefinition recordDef = vitalRecordService.getVitalRecordDefinition(nodeRef);
|
VitalRecordDefinition recordDef = vitalRecordService.getVitalRecordDefinition(nodeRef);
|
||||||
if (recordDef != null)
|
if (recordDef != null)
|
||||||
{
|
{
|
||||||
assertFalse(recordDef.isEnabled());
|
assertFalse(recordDef.isEnabled());
|
||||||
assertEquals("none", recordDef.getReviewPeriod().getPeriodType());
|
assertEquals("none", recordDef.getReviewPeriod().getPeriodType());
|
||||||
assertNull(recordDef.getNextReviewDate());
|
assertNull(recordDef.getNextReviewDate());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -5,21 +5,21 @@
|
|||||||
* 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%
|
||||||
@@ -38,15 +38,14 @@ import org.alfresco.service.cmr.version.VersionHistory;
|
|||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
import org.alfresco.util.GUID;
|
import org.alfresco.util.GUID;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test recorded version histories when interacting with cm:versionable aspect
|
* Test recorded version histories when interacting with cm:versionable aspect
|
||||||
* and the auto-version behvaiour.
|
* and the auto-version behvaiour.
|
||||||
*
|
*
|
||||||
* @author Roy Wetherall
|
* @author Roy Wetherall
|
||||||
* @since 2.3.1
|
* @since 2.3.1
|
||||||
*/
|
*/
|
||||||
public class AutoVersionTest extends RecordableVersionsBaseTest
|
public class AutoVersionTest extends RecordableVersionsBaseTest
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Given a versionable document
|
* Given a versionable document
|
||||||
@@ -59,36 +58,36 @@ public class AutoVersionTest extends RecordableVersionsBaseTest
|
|||||||
doBehaviourDrivenTest(new BehaviourDrivenTest(dmCollaborator)
|
doBehaviourDrivenTest(new BehaviourDrivenTest(dmCollaborator)
|
||||||
{
|
{
|
||||||
private NodeRef myDocument;
|
private NodeRef myDocument;
|
||||||
|
|
||||||
public void given() throws Exception
|
public void given() throws Exception
|
||||||
{
|
{
|
||||||
// create a document
|
// create a document
|
||||||
myDocument = fileFolderService.create(dmFolder, GUID.generate(), ContentModel.TYPE_CONTENT).getNodeRef();
|
myDocument = fileFolderService.create(dmFolder, GUID.generate(), ContentModel.TYPE_CONTENT).getNodeRef();
|
||||||
|
|
||||||
// make versionable
|
// make versionable
|
||||||
nodeService.addAspect(myDocument, ContentModel.ASPECT_VERSIONABLE, null);
|
nodeService.addAspect(myDocument, ContentModel.ASPECT_VERSIONABLE, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void when()
|
public void when()
|
||||||
{
|
{
|
||||||
// specialise document
|
// specialise document
|
||||||
nodeService.setType(myDocument, TYPE_CUSTOM_TYPE);
|
nodeService.setType(myDocument, TYPE_CUSTOM_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void then()
|
public void then()
|
||||||
{
|
{
|
||||||
VersionHistory versionHistory = versionService.getVersionHistory(myDocument);
|
VersionHistory versionHistory = versionService.getVersionHistory(myDocument);
|
||||||
|
|
||||||
assertNotNull(versionHistory);
|
assertNotNull(versionHistory);
|
||||||
assertEquals(1, versionHistory.getAllVersions().size());
|
assertEquals(1, versionHistory.getAllVersions().size());
|
||||||
|
|
||||||
NodeRef frozenState = versionHistory.getHeadVersion().getFrozenStateNodeRef();
|
NodeRef frozenState = versionHistory.getHeadVersion().getFrozenStateNodeRef();
|
||||||
assertEquals(ContentModel.TYPE_CONTENT, nodeService.getType(frozenState));
|
assertEquals(ContentModel.TYPE_CONTENT, nodeService.getType(frozenState));
|
||||||
assertEquals(TYPE_CUSTOM_TYPE, nodeService.getType(myDocument));
|
assertEquals(TYPE_CUSTOM_TYPE, nodeService.getType(myDocument));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Given a versionable document with initial version turned off
|
* Given a versionable document with initial version turned off
|
||||||
* When I specialise the type of the document
|
* When I specialise the type of the document
|
||||||
@@ -99,32 +98,32 @@ public class AutoVersionTest extends RecordableVersionsBaseTest
|
|||||||
doBehaviourDrivenTest(new BehaviourDrivenTest(dmCollaborator)
|
doBehaviourDrivenTest(new BehaviourDrivenTest(dmCollaborator)
|
||||||
{
|
{
|
||||||
private NodeRef myDocument;
|
private NodeRef myDocument;
|
||||||
|
|
||||||
public void given() throws Exception
|
public void given() throws Exception
|
||||||
{
|
{
|
||||||
// create a document
|
// create a document
|
||||||
myDocument = fileFolderService.create(dmFolder, GUID.generate(), ContentModel.TYPE_CONTENT).getNodeRef();
|
myDocument = fileFolderService.create(dmFolder, GUID.generate(), ContentModel.TYPE_CONTENT).getNodeRef();
|
||||||
|
|
||||||
// make versionable
|
// make versionable
|
||||||
Map<QName, Serializable> props = new HashMap<QName, Serializable>(1);
|
Map<QName, Serializable> props = new HashMap<QName, Serializable>(1);
|
||||||
props.put(ContentModel.PROP_INITIAL_VERSION, false);
|
props.put(ContentModel.PROP_INITIAL_VERSION, false);
|
||||||
nodeService.addAspect(myDocument, ContentModel.ASPECT_VERSIONABLE, props);
|
nodeService.addAspect(myDocument, ContentModel.ASPECT_VERSIONABLE, props);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void when()
|
public void when()
|
||||||
{
|
{
|
||||||
// specialise document
|
// specialise document
|
||||||
nodeService.setType(myDocument, TYPE_CUSTOM_TYPE);
|
nodeService.setType(myDocument, TYPE_CUSTOM_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void then()
|
public void then()
|
||||||
{
|
{
|
||||||
VersionHistory versionHistory = versionService.getVersionHistory(myDocument);
|
VersionHistory versionHistory = versionService.getVersionHistory(myDocument);
|
||||||
assertNull(versionHistory);
|
assertNull(versionHistory);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Given a versionable document with initial version turned off
|
* Given a versionable document with initial version turned off
|
||||||
* And auto version on type change is set on
|
* And auto version on type change is set on
|
||||||
@@ -137,48 +136,48 @@ public class AutoVersionTest extends RecordableVersionsBaseTest
|
|||||||
{
|
{
|
||||||
private ExtendedVersionableAspect extendedVersionableAspect;
|
private ExtendedVersionableAspect extendedVersionableAspect;
|
||||||
private NodeRef myDocument;
|
private NodeRef myDocument;
|
||||||
|
|
||||||
public void given() throws Exception
|
public void given() throws Exception
|
||||||
{
|
{
|
||||||
// turn auto version on type change on
|
// turn auto version on type change on
|
||||||
extendedVersionableAspect = (ExtendedVersionableAspect)applicationContext.getBean("rm.extendedVersionableAspect");
|
extendedVersionableAspect = (ExtendedVersionableAspect)applicationContext.getBean("rm.extendedVersionableAspect");
|
||||||
assertNotNull(extendedVersionableAspect);
|
assertNotNull(extendedVersionableAspect);
|
||||||
extendedVersionableAspect.setAutoVersionOnTypeChange(true);
|
extendedVersionableAspect.setAutoVersionOnTypeChange(true);
|
||||||
|
|
||||||
// create a document
|
// create a document
|
||||||
myDocument = fileFolderService.create(dmFolder, GUID.generate(), ContentModel.TYPE_CONTENT).getNodeRef();
|
myDocument = fileFolderService.create(dmFolder, GUID.generate(), ContentModel.TYPE_CONTENT).getNodeRef();
|
||||||
|
|
||||||
// make versionable
|
// make versionable
|
||||||
Map<QName, Serializable> props = new HashMap<QName, Serializable>(1);
|
Map<QName, Serializable> props = new HashMap<QName, Serializable>(1);
|
||||||
props.put(ContentModel.PROP_INITIAL_VERSION, false);
|
props.put(ContentModel.PROP_INITIAL_VERSION, false);
|
||||||
nodeService.addAspect(myDocument, ContentModel.ASPECT_VERSIONABLE, props);
|
nodeService.addAspect(myDocument, ContentModel.ASPECT_VERSIONABLE, props);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void when()
|
public void when()
|
||||||
{
|
{
|
||||||
// specialise document
|
// specialise document
|
||||||
nodeService.setType(myDocument, TYPE_CUSTOM_TYPE);
|
nodeService.setType(myDocument, TYPE_CUSTOM_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void then()
|
public void then()
|
||||||
{
|
{
|
||||||
VersionHistory versionHistory = versionService.getVersionHistory(myDocument);
|
VersionHistory versionHistory = versionService.getVersionHistory(myDocument);
|
||||||
assertNotNull(versionHistory);
|
assertNotNull(versionHistory);
|
||||||
assertEquals(1, versionHistory.getAllVersions().size());
|
assertEquals(1, versionHistory.getAllVersions().size());
|
||||||
|
|
||||||
NodeRef frozenState = versionHistory.getHeadVersion().getFrozenStateNodeRef();
|
NodeRef frozenState = versionHistory.getHeadVersion().getFrozenStateNodeRef();
|
||||||
assertEquals(TYPE_CUSTOM_TYPE, nodeService.getType(frozenState));
|
assertEquals(TYPE_CUSTOM_TYPE, nodeService.getType(frozenState));
|
||||||
assertEquals(TYPE_CUSTOM_TYPE, nodeService.getType(myDocument));
|
assertEquals(TYPE_CUSTOM_TYPE, nodeService.getType(myDocument));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void after() throws Exception
|
public void after() throws Exception
|
||||||
{
|
{
|
||||||
// reset auto version on type to default off
|
// reset auto version on type to default off
|
||||||
extendedVersionableAspect.setAutoVersionOnTypeChange(false);
|
extendedVersionableAspect.setAutoVersionOnTypeChange(false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Given a versionable document with initial version turned on
|
* Given a versionable document with initial version turned on
|
||||||
* And auto version on type change is set on
|
* And auto version on type change is set on
|
||||||
@@ -191,51 +190,51 @@ public class AutoVersionTest extends RecordableVersionsBaseTest
|
|||||||
{
|
{
|
||||||
private ExtendedVersionableAspect extendedVersionableAspect;
|
private ExtendedVersionableAspect extendedVersionableAspect;
|
||||||
private NodeRef myDocument;
|
private NodeRef myDocument;
|
||||||
|
|
||||||
public void given() throws Exception
|
public void given() throws Exception
|
||||||
{
|
{
|
||||||
// turn auto version on type change on
|
// turn auto version on type change on
|
||||||
extendedVersionableAspect = (ExtendedVersionableAspect)applicationContext.getBean("rm.extendedVersionableAspect");
|
extendedVersionableAspect = (ExtendedVersionableAspect)applicationContext.getBean("rm.extendedVersionableAspect");
|
||||||
assertNotNull(extendedVersionableAspect);
|
assertNotNull(extendedVersionableAspect);
|
||||||
extendedVersionableAspect.setAutoVersionOnTypeChange(true);
|
extendedVersionableAspect.setAutoVersionOnTypeChange(true);
|
||||||
|
|
||||||
// create a document
|
// create a document
|
||||||
myDocument = fileFolderService.create(dmFolder, GUID.generate(), ContentModel.TYPE_CONTENT).getNodeRef();
|
myDocument = fileFolderService.create(dmFolder, GUID.generate(), ContentModel.TYPE_CONTENT).getNodeRef();
|
||||||
|
|
||||||
// make versionable
|
// make versionable
|
||||||
Map<QName, Serializable> props = new HashMap<QName, Serializable>(1);
|
Map<QName, Serializable> props = new HashMap<QName, Serializable>(1);
|
||||||
props.put(ContentModel.PROP_INITIAL_VERSION, true);
|
props.put(ContentModel.PROP_INITIAL_VERSION, true);
|
||||||
nodeService.addAspect(myDocument, ContentModel.ASPECT_VERSIONABLE, props);
|
nodeService.addAspect(myDocument, ContentModel.ASPECT_VERSIONABLE, props);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void when()
|
public void when()
|
||||||
{
|
{
|
||||||
// specialise document
|
// specialise document
|
||||||
nodeService.setType(myDocument, TYPE_CUSTOM_TYPE);
|
nodeService.setType(myDocument, TYPE_CUSTOM_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void then()
|
public void then()
|
||||||
{
|
{
|
||||||
VersionHistory versionHistory = versionService.getVersionHistory(myDocument);
|
VersionHistory versionHistory = versionService.getVersionHistory(myDocument);
|
||||||
assertNotNull(versionHistory);
|
assertNotNull(versionHistory);
|
||||||
assertEquals(2, versionHistory.getAllVersions().size());
|
assertEquals(2, versionHistory.getAllVersions().size());
|
||||||
|
|
||||||
NodeRef frozenState = versionHistory.getHeadVersion().getFrozenStateNodeRef();
|
NodeRef frozenState = versionHistory.getHeadVersion().getFrozenStateNodeRef();
|
||||||
assertEquals(TYPE_CUSTOM_TYPE, nodeService.getType(frozenState));
|
assertEquals(TYPE_CUSTOM_TYPE, nodeService.getType(frozenState));
|
||||||
assertEquals(TYPE_CUSTOM_TYPE, nodeService.getType(myDocument));
|
assertEquals(TYPE_CUSTOM_TYPE, nodeService.getType(myDocument));
|
||||||
|
|
||||||
frozenState = versionHistory.getVersion("1.0").getFrozenStateNodeRef();
|
frozenState = versionHistory.getVersion("1.0").getFrozenStateNodeRef();
|
||||||
assertEquals(ContentModel.TYPE_CONTENT, nodeService.getType(frozenState));
|
assertEquals(ContentModel.TYPE_CONTENT, nodeService.getType(frozenState));
|
||||||
assertEquals(TYPE_CUSTOM_TYPE, nodeService.getType(myDocument));
|
assertEquals(TYPE_CUSTOM_TYPE, nodeService.getType(myDocument));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void after() throws Exception
|
public void after() throws Exception
|
||||||
{
|
{
|
||||||
// reset auto version on type to default off
|
// reset auto version on type to default off
|
||||||
extendedVersionableAspect.setAutoVersionOnTypeChange(false);
|
extendedVersionableAspect.setAutoVersionOnTypeChange(false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -5,21 +5,21 @@
|
|||||||
* 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%
|
||||||
@@ -50,14 +50,13 @@ import org.alfresco.service.cmr.version.VersionHistory;
|
|||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
import org.alfresco.util.GUID;
|
import org.alfresco.util.GUID;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Recordable version history integration tests.
|
* Recordable version history integration tests.
|
||||||
*
|
*
|
||||||
* @author Roy Wetherall
|
* @author Roy Wetherall
|
||||||
* @since 2.3.1
|
* @since 2.3.1
|
||||||
*/
|
*/
|
||||||
public class DeleteRecordVersionTest extends RecordableVersionsBaseTest
|
public class DeleteRecordVersionTest extends RecordableVersionsBaseTest
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Given that a document is created
|
* Given that a document is created
|
||||||
@@ -65,78 +64,78 @@ public class DeleteRecordVersionTest extends RecordableVersionsBaseTest
|
|||||||
* When I delete the version record
|
* When I delete the version record
|
||||||
* Then the version is deleted
|
* Then the version is deleted
|
||||||
* And the version history is not deleted
|
* And the version history is not deleted
|
||||||
*
|
*
|
||||||
* @see https://issues.alfresco.com/jira/browse/RM-2562
|
* @see https://issues.alfresco.com/jira/browse/RM-2562
|
||||||
*/
|
*/
|
||||||
public void testDeleteFirstRecordedVersion()
|
public void testDeleteFirstRecordedVersion()
|
||||||
{
|
{
|
||||||
doBehaviourDrivenTest(new BehaviourDrivenTest()
|
doBehaviourDrivenTest(new BehaviourDrivenTest()
|
||||||
{
|
{
|
||||||
private NodeRef myDocument;
|
private NodeRef myDocument;
|
||||||
|
|
||||||
public void given() throws Exception
|
public void given() throws Exception
|
||||||
{
|
{
|
||||||
// create a document
|
// create a document
|
||||||
myDocument = fileFolderService.create(dmFolder, GUID.generate(), ContentModel.TYPE_CONTENT).getNodeRef();
|
myDocument = fileFolderService.create(dmFolder, GUID.generate(), ContentModel.TYPE_CONTENT).getNodeRef();
|
||||||
|
|
||||||
// make versionable
|
// make versionable
|
||||||
Map<QName, Serializable> props = new HashMap<QName, Serializable>(2);
|
Map<QName, Serializable> props = new HashMap<QName, Serializable>(2);
|
||||||
props.put(RecordableVersionModel.PROP_RECORDABLE_VERSION_POLICY, RecordableVersionPolicy.ALL);
|
props.put(RecordableVersionModel.PROP_RECORDABLE_VERSION_POLICY, RecordableVersionPolicy.ALL);
|
||||||
props.put(RecordableVersionModel.PROP_FILE_PLAN, filePlan);
|
props.put(RecordableVersionModel.PROP_FILE_PLAN, filePlan);
|
||||||
nodeService.addAspect(myDocument, RecordableVersionModel.ASPECT_VERSIONABLE, props);
|
nodeService.addAspect(myDocument, RecordableVersionModel.ASPECT_VERSIONABLE, props);
|
||||||
nodeService.addAspect(myDocument, ContentModel.ASPECT_VERSIONABLE, null);
|
nodeService.addAspect(myDocument, ContentModel.ASPECT_VERSIONABLE, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void when()
|
public void when()
|
||||||
{
|
{
|
||||||
// check the initial version label
|
// check the initial version label
|
||||||
assertEquals("1.0", nodeService.getProperty(myDocument, ContentModel.PROP_VERSION_LABEL));
|
assertEquals("1.0", nodeService.getProperty(myDocument, ContentModel.PROP_VERSION_LABEL));
|
||||||
|
|
||||||
// check that the version history contains a single version that is recorded
|
// check that the version history contains a single version that is recorded
|
||||||
VersionHistory versionHistory = versionService.getVersionHistory(myDocument);
|
VersionHistory versionHistory = versionService.getVersionHistory(myDocument);
|
||||||
assertNotNull(versionHistory);
|
assertNotNull(versionHistory);
|
||||||
assertEquals(1, versionHistory.getAllVersions().size());
|
assertEquals(1, versionHistory.getAllVersions().size());
|
||||||
|
|
||||||
// check the recorded version is not marked as destroyed
|
// check the recorded version is not marked as destroyed
|
||||||
Version head = versionHistory.getHeadVersion();
|
Version head = versionHistory.getHeadVersion();
|
||||||
assertNotNull(head);
|
assertNotNull(head);
|
||||||
assertFalse(recordableVersionService.isRecordedVersionDestroyed(head));
|
assertFalse(recordableVersionService.isRecordedVersionDestroyed(head));
|
||||||
|
|
||||||
// check the version record
|
// check the version record
|
||||||
NodeRef record = recordableVersionService.getVersionRecord(head);
|
NodeRef record = recordableVersionService.getVersionRecord(head);
|
||||||
assertTrue(recordService.isRecord(record));
|
assertTrue(recordService.isRecord(record));
|
||||||
|
|
||||||
// record should not have a version history because it is immutable
|
// record should not have a version history because it is immutable
|
||||||
assertFalse(nodeService.hasAspect(record, ContentModel.ASPECT_VERSIONABLE));
|
assertFalse(nodeService.hasAspect(record, ContentModel.ASPECT_VERSIONABLE));
|
||||||
VersionHistory recordVersionHistory = versionService.getVersionHistory(record);
|
VersionHistory recordVersionHistory = versionService.getVersionHistory(record);
|
||||||
assertNull(recordVersionHistory);
|
assertNull(recordVersionHistory);
|
||||||
|
|
||||||
// destroy record
|
// destroy record
|
||||||
nodeService.deleteNode(record);
|
nodeService.deleteNode(record);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void then()
|
public void then()
|
||||||
{
|
{
|
||||||
// document is still versionable
|
// document is still versionable
|
||||||
assertTrue(nodeService.hasAspect(myDocument, ContentModel.ASPECT_VERSIONABLE));
|
assertTrue(nodeService.hasAspect(myDocument, ContentModel.ASPECT_VERSIONABLE));
|
||||||
|
|
||||||
// check the initial version label
|
// check the initial version label
|
||||||
assertEquals("1.0", nodeService.getProperty(myDocument, ContentModel.PROP_VERSION_LABEL));
|
assertEquals("1.0", nodeService.getProperty(myDocument, ContentModel.PROP_VERSION_LABEL));
|
||||||
|
|
||||||
// still has a version history, but the version is marked as destroyed
|
// still has a version history, but the version is marked as destroyed
|
||||||
VersionHistory versionHistory = versionService.getVersionHistory(myDocument);
|
VersionHistory versionHistory = versionService.getVersionHistory(myDocument);
|
||||||
assertNotNull(versionHistory);
|
assertNotNull(versionHistory);
|
||||||
assertEquals(1, versionHistory.getAllVersions().size());
|
assertEquals(1, versionHistory.getAllVersions().size());
|
||||||
|
|
||||||
// check the recorded version is marked as destroyed and the record version is not longer available
|
// check the recorded version is marked as destroyed and the record version is not longer available
|
||||||
Version version = versionHistory.getHeadVersion();
|
Version version = versionHistory.getHeadVersion();
|
||||||
assertNotNull(version);
|
assertNotNull(version);
|
||||||
assertTrue(recordableVersionService.isRecordedVersionDestroyed(version));
|
assertTrue(recordableVersionService.isRecordedVersionDestroyed(version));
|
||||||
assertNull(recordableVersionService.getVersionRecord(version));
|
assertNull(recordableVersionService.getVersionRecord(version));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Given that a document is created
|
* Given that a document is created
|
||||||
* And the initial version is record
|
* And the initial version is record
|
||||||
@@ -144,15 +143,15 @@ public class DeleteRecordVersionTest extends RecordableVersionsBaseTest
|
|||||||
* When a new version is created
|
* When a new version is created
|
||||||
* Then a new associated version record is created
|
* Then a new associated version record is created
|
||||||
* And the version is 1.1 (not 1.0 since this was deleted, but the version history maintained)
|
* And the version is 1.1 (not 1.0 since this was deleted, but the version history maintained)
|
||||||
*
|
*
|
||||||
* @see https://issues.alfresco.com/jira/browse/RM-2562
|
* @see https://issues.alfresco.com/jira/browse/RM-2562
|
||||||
*/
|
*/
|
||||||
public void testDeleteFirstRecordedVersionAndCreateNewVersion()
|
public void testDeleteFirstRecordedVersionAndCreateNewVersion()
|
||||||
{
|
{
|
||||||
doBehaviourDrivenTest(new BehaviourDrivenTest()
|
doBehaviourDrivenTest(new BehaviourDrivenTest()
|
||||||
{
|
{
|
||||||
private NodeRef myDocument;
|
private NodeRef myDocument;
|
||||||
|
|
||||||
public void given() throws Exception
|
public void given() throws Exception
|
||||||
{
|
{
|
||||||
// create a document
|
// create a document
|
||||||
@@ -161,67 +160,67 @@ public class DeleteRecordVersionTest extends RecordableVersionsBaseTest
|
|||||||
writer.setEncoding("UTF-8");
|
writer.setEncoding("UTF-8");
|
||||||
writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN);
|
writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN);
|
||||||
writer.putContent(GUID.generate());
|
writer.putContent(GUID.generate());
|
||||||
|
|
||||||
// make versionable
|
// make versionable
|
||||||
Map<QName, Serializable> props = new HashMap<QName, Serializable>(2);
|
Map<QName, Serializable> props = new HashMap<QName, Serializable>(2);
|
||||||
props.put(RecordableVersionModel.PROP_RECORDABLE_VERSION_POLICY, RecordableVersionPolicy.ALL);
|
props.put(RecordableVersionModel.PROP_RECORDABLE_VERSION_POLICY, RecordableVersionPolicy.ALL);
|
||||||
props.put(RecordableVersionModel.PROP_FILE_PLAN, filePlan);
|
props.put(RecordableVersionModel.PROP_FILE_PLAN, filePlan);
|
||||||
nodeService.addAspect(myDocument, RecordableVersionModel.ASPECT_VERSIONABLE, props);
|
nodeService.addAspect(myDocument, RecordableVersionModel.ASPECT_VERSIONABLE, props);
|
||||||
nodeService.addAspect(myDocument, ContentModel.ASPECT_VERSIONABLE, null);
|
nodeService.addAspect(myDocument, ContentModel.ASPECT_VERSIONABLE, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void when()
|
public void when()
|
||||||
{
|
{
|
||||||
// get the created version record
|
// get the created version record
|
||||||
VersionHistory versionHistory = versionService.getVersionHistory(myDocument);
|
VersionHistory versionHistory = versionService.getVersionHistory(myDocument);
|
||||||
Version head = versionHistory.getHeadVersion();
|
Version head = versionHistory.getHeadVersion();
|
||||||
NodeRef record = recordableVersionService.getVersionRecord(head);
|
NodeRef record = recordableVersionService.getVersionRecord(head);
|
||||||
|
|
||||||
// destroy record
|
// destroy record
|
||||||
nodeService.deleteNode(record);
|
nodeService.deleteNode(record);
|
||||||
|
|
||||||
// update the content to create a new version (and version record)
|
// update the content to create a new version (and version record)
|
||||||
ContentWriter writer = fileFolderService.getWriter(myDocument);
|
ContentWriter writer = fileFolderService.getWriter(myDocument);
|
||||||
writer.putContent(GUID.generate());
|
writer.putContent(GUID.generate());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void then()
|
public void then()
|
||||||
{
|
{
|
||||||
// document is still versionable
|
// document is still versionable
|
||||||
assertTrue(nodeService.hasAspect(myDocument, ContentModel.ASPECT_VERSIONABLE));
|
assertTrue(nodeService.hasAspect(myDocument, ContentModel.ASPECT_VERSIONABLE));
|
||||||
|
|
||||||
// check the version number has been incremented
|
// check the version number has been incremented
|
||||||
assertEquals("1.1", nodeService.getProperty(myDocument, ContentModel.PROP_VERSION_LABEL));
|
assertEquals("1.1", nodeService.getProperty(myDocument, ContentModel.PROP_VERSION_LABEL));
|
||||||
|
|
||||||
// still has a version history, with 2 enties
|
// still has a version history, with 2 enties
|
||||||
VersionHistory versionHistory = versionService.getVersionHistory(myDocument);
|
VersionHistory versionHistory = versionService.getVersionHistory(myDocument);
|
||||||
assertNotNull(versionHistory);
|
assertNotNull(versionHistory);
|
||||||
assertEquals(2, versionHistory.getAllVersions().size());
|
assertEquals(2, versionHistory.getAllVersions().size());
|
||||||
|
|
||||||
// latest version is current
|
// latest version is current
|
||||||
Version head = versionHistory.getHeadVersion();
|
Version head = versionHistory.getHeadVersion();
|
||||||
assertFalse(recordableVersionService.isRecordedVersionDestroyed(head));
|
assertFalse(recordableVersionService.isRecordedVersionDestroyed(head));
|
||||||
assertNotNull(recordableVersionService.getVersionRecord(head));
|
assertNotNull(recordableVersionService.getVersionRecord(head));
|
||||||
|
|
||||||
// first version is destroyed
|
// first version is destroyed
|
||||||
Version destroyed = versionHistory.getPredecessor(head);
|
Version destroyed = versionHistory.getPredecessor(head);
|
||||||
assertTrue(recordableVersionService.isRecordedVersionDestroyed(destroyed));
|
assertTrue(recordableVersionService.isRecordedVersionDestroyed(destroyed));
|
||||||
assertNull(recordableVersionService.getVersionRecord(destroyed));
|
assertNull(recordableVersionService.getVersionRecord(destroyed));
|
||||||
|
|
||||||
// get the version record for the current version
|
// get the version record for the current version
|
||||||
NodeRef versionRecord = recordableVersionService.getVersionRecord(head);
|
NodeRef versionRecord = recordableVersionService.getVersionRecord(head);
|
||||||
assertNotNull(versionRecord);
|
assertNotNull(versionRecord);
|
||||||
assertTrue(nodeService.exists(versionRecord));
|
assertTrue(nodeService.exists(versionRecord));
|
||||||
|
|
||||||
Set<Relationship> from = relationshipService.getRelationshipsFrom(versionRecord);
|
Set<Relationship> from = relationshipService.getRelationshipsFrom(versionRecord);
|
||||||
assertTrue(from.isEmpty());
|
assertTrue(from.isEmpty());
|
||||||
|
|
||||||
Set<Relationship> to = relationshipService.getRelationshipsTo(versionRecord);
|
Set<Relationship> to = relationshipService.getRelationshipsTo(versionRecord);
|
||||||
assertTrue(to.isEmpty());
|
assertTrue(to.isEmpty());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Given a chain of version records (1.0, 1.1, 1.2) which are all related
|
* Given a chain of version records (1.0, 1.1, 1.2) which are all related
|
||||||
* When I delete version record 1.0
|
* When I delete version record 1.0
|
||||||
@@ -230,26 +229,26 @@ public class DeleteRecordVersionTest extends RecordableVersionsBaseTest
|
|||||||
public void testDeleteOldestVersion()
|
public void testDeleteOldestVersion()
|
||||||
{
|
{
|
||||||
final NodeRef myDocument = createDocumentWithRecordVersions();
|
final NodeRef myDocument = createDocumentWithRecordVersions();
|
||||||
|
|
||||||
doBehaviourDrivenTest(new BehaviourDrivenTest()
|
doBehaviourDrivenTest(new BehaviourDrivenTest()
|
||||||
{
|
{
|
||||||
private VersionHistory versionHistory;
|
private VersionHistory versionHistory;
|
||||||
|
|
||||||
public void given() throws Exception
|
public void given() throws Exception
|
||||||
{
|
{
|
||||||
// get version history
|
// get version history
|
||||||
versionHistory = versionService.getVersionHistory(myDocument);
|
versionHistory = versionService.getVersionHistory(myDocument);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void when()
|
public void when()
|
||||||
{
|
{
|
||||||
Version version10 = versionHistory.getVersion("1.0");
|
Version version10 = versionHistory.getVersion("1.0");
|
||||||
NodeRef recordVersion10 = recordableVersionService.getVersionRecord(version10);
|
NodeRef recordVersion10 = recordableVersionService.getVersionRecord(version10);
|
||||||
|
|
||||||
// delete record version 1.0
|
// delete record version 1.0
|
||||||
nodeService.deleteNode(recordVersion10);
|
nodeService.deleteNode(recordVersion10);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void then()
|
public void then()
|
||||||
{
|
{
|
||||||
// check the deleted version
|
// check the deleted version
|
||||||
@@ -258,33 +257,33 @@ public class DeleteRecordVersionTest extends RecordableVersionsBaseTest
|
|||||||
assertTrue(recordableVersionService.isRecordedVersionDestroyed(version10));
|
assertTrue(recordableVersionService.isRecordedVersionDestroyed(version10));
|
||||||
NodeRef recordVersion10 = recordableVersionService.getVersionRecord(version10);
|
NodeRef recordVersion10 = recordableVersionService.getVersionRecord(version10);
|
||||||
assertNull(recordVersion10);
|
assertNull(recordVersion10);
|
||||||
|
|
||||||
// verify 1.2 setup as expected
|
// verify 1.2 setup as expected
|
||||||
Version version12 = versionHistory.getHeadVersion();
|
Version version12 = versionHistory.getHeadVersion();
|
||||||
assertEquals("1.2", version12.getVersionLabel());
|
assertEquals("1.2", version12.getVersionLabel());
|
||||||
NodeRef recordVersion12 = recordableVersionService.getVersionRecord(version12);
|
NodeRef recordVersion12 = recordableVersionService.getVersionRecord(version12);
|
||||||
assertNotNull(recordVersion12);
|
assertNotNull(recordVersion12);
|
||||||
|
|
||||||
assertTrue(relationshipService.getRelationshipsTo(recordVersion12, RelationshipService.RELATIONSHIP_VERSIONS).isEmpty());
|
assertTrue(relationshipService.getRelationshipsTo(recordVersion12, RelationshipService.RELATIONSHIP_VERSIONS).isEmpty());
|
||||||
|
|
||||||
Set<Relationship> from12 = relationshipService.getRelationshipsFrom(recordVersion12, RelationshipService.RELATIONSHIP_VERSIONS);
|
Set<Relationship> from12 = relationshipService.getRelationshipsFrom(recordVersion12, RelationshipService.RELATIONSHIP_VERSIONS);
|
||||||
assertEquals(1, from12.size());
|
assertEquals(1, from12.size());
|
||||||
|
|
||||||
// verify 1.1 setup as expected
|
// verify 1.1 setup as expected
|
||||||
Version version11 = versionHistory.getPredecessor(version12);
|
Version version11 = versionHistory.getPredecessor(version12);
|
||||||
assertEquals("1.1", version11.getVersionLabel());
|
assertEquals("1.1", version11.getVersionLabel());
|
||||||
NodeRef recordVersion11 = recordableVersionService.getVersionRecord(version11);
|
NodeRef recordVersion11 = recordableVersionService.getVersionRecord(version11);
|
||||||
assertNotNull(recordVersion11);
|
assertNotNull(recordVersion11);
|
||||||
|
|
||||||
Set<Relationship> to11 = relationshipService.getRelationshipsTo(recordVersion11, RelationshipService.RELATIONSHIP_VERSIONS);
|
Set<Relationship> to11 = relationshipService.getRelationshipsTo(recordVersion11, RelationshipService.RELATIONSHIP_VERSIONS);
|
||||||
assertEquals(1, to11.size());
|
assertEquals(1, to11.size());
|
||||||
assertEquals(recordVersion12, to11.iterator().next().getSource());
|
assertEquals(recordVersion12, to11.iterator().next().getSource());
|
||||||
|
|
||||||
assertTrue(relationshipService.getRelationshipsFrom(recordVersion11, RelationshipService.RELATIONSHIP_VERSIONS).isEmpty());
|
assertTrue(relationshipService.getRelationshipsFrom(recordVersion11, RelationshipService.RELATIONSHIP_VERSIONS).isEmpty());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Given a chain of version records (1.0, 1.1, 1.2) which are all related
|
* Given a chain of version records (1.0, 1.1, 1.2) which are all related
|
||||||
* When I delete version record 1.1
|
* When I delete version record 1.1
|
||||||
@@ -293,26 +292,26 @@ public class DeleteRecordVersionTest extends RecordableVersionsBaseTest
|
|||||||
public void testDeleteMiddleVersion()
|
public void testDeleteMiddleVersion()
|
||||||
{
|
{
|
||||||
final NodeRef myDocument = createDocumentWithRecordVersions();
|
final NodeRef myDocument = createDocumentWithRecordVersions();
|
||||||
|
|
||||||
doBehaviourDrivenTest(new BehaviourDrivenTest()
|
doBehaviourDrivenTest(new BehaviourDrivenTest()
|
||||||
{
|
{
|
||||||
private VersionHistory versionHistory;
|
private VersionHistory versionHistory;
|
||||||
|
|
||||||
public void given() throws Exception
|
public void given() throws Exception
|
||||||
{
|
{
|
||||||
// get version history
|
// get version history
|
||||||
versionHistory = versionService.getVersionHistory(myDocument);
|
versionHistory = versionService.getVersionHistory(myDocument);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void when()
|
public void when()
|
||||||
{
|
{
|
||||||
Version version11 = versionHistory.getVersion("1.1");
|
Version version11 = versionHistory.getVersion("1.1");
|
||||||
NodeRef recordVersion11 = recordableVersionService.getVersionRecord(version11);
|
NodeRef recordVersion11 = recordableVersionService.getVersionRecord(version11);
|
||||||
|
|
||||||
// delete record version 1.1
|
// delete record version 1.1
|
||||||
nodeService.deleteNode(recordVersion11);
|
nodeService.deleteNode(recordVersion11);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void then()
|
public void then()
|
||||||
{
|
{
|
||||||
// check the deleted version
|
// check the deleted version
|
||||||
@@ -321,34 +320,34 @@ public class DeleteRecordVersionTest extends RecordableVersionsBaseTest
|
|||||||
assertTrue(recordableVersionService.isRecordedVersionDestroyed(version11));
|
assertTrue(recordableVersionService.isRecordedVersionDestroyed(version11));
|
||||||
NodeRef recordVersion11 = recordableVersionService.getVersionRecord(version11);
|
NodeRef recordVersion11 = recordableVersionService.getVersionRecord(version11);
|
||||||
assertNull(recordVersion11);
|
assertNull(recordVersion11);
|
||||||
|
|
||||||
// verify 1.2 setup as expected
|
// verify 1.2 setup as expected
|
||||||
Version version12 = versionHistory.getHeadVersion();
|
Version version12 = versionHistory.getHeadVersion();
|
||||||
assertEquals("1.2", version12.getVersionLabel());
|
assertEquals("1.2", version12.getVersionLabel());
|
||||||
NodeRef recordVersion12 = recordableVersionService.getVersionRecord(version12);
|
NodeRef recordVersion12 = recordableVersionService.getVersionRecord(version12);
|
||||||
assertNotNull(recordVersion12);
|
assertNotNull(recordVersion12);
|
||||||
|
|
||||||
assertTrue(relationshipService.getRelationshipsTo(recordVersion12, RelationshipService.RELATIONSHIP_VERSIONS).isEmpty());
|
assertTrue(relationshipService.getRelationshipsTo(recordVersion12, RelationshipService.RELATIONSHIP_VERSIONS).isEmpty());
|
||||||
|
|
||||||
Set<Relationship> from12 = relationshipService.getRelationshipsFrom(recordVersion12, RelationshipService.RELATIONSHIP_VERSIONS);
|
Set<Relationship> from12 = relationshipService.getRelationshipsFrom(recordVersion12, RelationshipService.RELATIONSHIP_VERSIONS);
|
||||||
assertEquals(1, from12.size());
|
assertEquals(1, from12.size());
|
||||||
|
|
||||||
// verify 1.0 setup as expected
|
// verify 1.0 setup as expected
|
||||||
Version version10 = versionHistory.getVersion("1.0");
|
Version version10 = versionHistory.getVersion("1.0");
|
||||||
assertEquals("1.0", version10.getVersionLabel());
|
assertEquals("1.0", version10.getVersionLabel());
|
||||||
NodeRef recordVersion10 = recordableVersionService.getVersionRecord(version10);
|
NodeRef recordVersion10 = recordableVersionService.getVersionRecord(version10);
|
||||||
assertNotNull(recordVersion10);
|
assertNotNull(recordVersion10);
|
||||||
|
|
||||||
Set<Relationship> to10 = relationshipService.getRelationshipsTo(recordVersion10, RelationshipService.RELATIONSHIP_VERSIONS);
|
Set<Relationship> to10 = relationshipService.getRelationshipsTo(recordVersion10, RelationshipService.RELATIONSHIP_VERSIONS);
|
||||||
assertEquals(1, to10.size());
|
assertEquals(1, to10.size());
|
||||||
assertEquals(recordVersion12, to10.iterator().next().getSource());
|
assertEquals(recordVersion12, to10.iterator().next().getSource());
|
||||||
|
|
||||||
assertTrue(relationshipService.getRelationshipsFrom(recordVersion10, RelationshipService.RELATIONSHIP_VERSIONS).isEmpty());
|
assertTrue(relationshipService.getRelationshipsFrom(recordVersion10, RelationshipService.RELATIONSHIP_VERSIONS).isEmpty());
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Given a chain of version records (1.0, 1.1, 1.2) which are all related
|
* Given a chain of version records (1.0, 1.1, 1.2) which are all related
|
||||||
* When I delete version record 1.2
|
* When I delete version record 1.2
|
||||||
@@ -357,26 +356,26 @@ public class DeleteRecordVersionTest extends RecordableVersionsBaseTest
|
|||||||
public void testDeleteCurrentVersion()
|
public void testDeleteCurrentVersion()
|
||||||
{
|
{
|
||||||
final NodeRef myDocument = createDocumentWithRecordVersions();
|
final NodeRef myDocument = createDocumentWithRecordVersions();
|
||||||
|
|
||||||
doBehaviourDrivenTest(new BehaviourDrivenTest()
|
doBehaviourDrivenTest(new BehaviourDrivenTest()
|
||||||
{
|
{
|
||||||
private VersionHistory versionHistory;
|
private VersionHistory versionHistory;
|
||||||
|
|
||||||
public void given() throws Exception
|
public void given() throws Exception
|
||||||
{
|
{
|
||||||
// get version history
|
// get version history
|
||||||
versionHistory = versionService.getVersionHistory(myDocument);
|
versionHistory = versionService.getVersionHistory(myDocument);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void when()
|
public void when()
|
||||||
{
|
{
|
||||||
Version version12 = versionHistory.getVersion("1.2");
|
Version version12 = versionHistory.getVersion("1.2");
|
||||||
NodeRef recordVersion12 = recordableVersionService.getVersionRecord(version12);
|
NodeRef recordVersion12 = recordableVersionService.getVersionRecord(version12);
|
||||||
|
|
||||||
// delete record version 1.2
|
// delete record version 1.2
|
||||||
nodeService.deleteNode(recordVersion12);
|
nodeService.deleteNode(recordVersion12);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void then()
|
public void then()
|
||||||
{
|
{
|
||||||
// check 1.2
|
// check 1.2
|
||||||
@@ -384,33 +383,33 @@ public class DeleteRecordVersionTest extends RecordableVersionsBaseTest
|
|||||||
assertNotNull(version12);
|
assertNotNull(version12);
|
||||||
assertTrue(recordableVersionService.isRecordedVersionDestroyed(version12));
|
assertTrue(recordableVersionService.isRecordedVersionDestroyed(version12));
|
||||||
assertNull(recordableVersionService.getVersionRecord(version12));
|
assertNull(recordableVersionService.getVersionRecord(version12));
|
||||||
|
|
||||||
// verify 1.1
|
// verify 1.1
|
||||||
Version version11 = versionHistory.getVersion("1.1");
|
Version version11 = versionHistory.getVersion("1.1");
|
||||||
assertNotNull(version11);
|
assertNotNull(version11);
|
||||||
NodeRef recordVersion11 = recordableVersionService.getVersionRecord(version11);
|
NodeRef recordVersion11 = recordableVersionService.getVersionRecord(version11);
|
||||||
assertNotNull(recordVersion11);
|
assertNotNull(recordVersion11);
|
||||||
|
|
||||||
assertTrue(relationshipService.getRelationshipsTo(recordVersion11, RelationshipService.RELATIONSHIP_VERSIONS).isEmpty());
|
assertTrue(relationshipService.getRelationshipsTo(recordVersion11, RelationshipService.RELATIONSHIP_VERSIONS).isEmpty());
|
||||||
|
|
||||||
Set<Relationship> from11 = relationshipService.getRelationshipsFrom(recordVersion11, RelationshipService.RELATIONSHIP_VERSIONS);
|
Set<Relationship> from11 = relationshipService.getRelationshipsFrom(recordVersion11, RelationshipService.RELATIONSHIP_VERSIONS);
|
||||||
assertEquals(1, from11.size());
|
assertEquals(1, from11.size());
|
||||||
|
|
||||||
// verify 1.0
|
// verify 1.0
|
||||||
Version version10 = versionHistory.getVersion("1.0");
|
Version version10 = versionHistory.getVersion("1.0");
|
||||||
assertNotNull(version10);
|
assertNotNull(version10);
|
||||||
NodeRef recordVersion10 = recordableVersionService.getVersionRecord(version10);
|
NodeRef recordVersion10 = recordableVersionService.getVersionRecord(version10);
|
||||||
assertNotNull(recordVersion10);
|
assertNotNull(recordVersion10);
|
||||||
|
|
||||||
Set<Relationship> to10 = relationshipService.getRelationshipsTo(recordVersion10, RelationshipService.RELATIONSHIP_VERSIONS);
|
Set<Relationship> to10 = relationshipService.getRelationshipsTo(recordVersion10, RelationshipService.RELATIONSHIP_VERSIONS);
|
||||||
assertEquals(1, to10.size());
|
assertEquals(1, to10.size());
|
||||||
assertEquals(recordVersion11, to10.iterator().next().getSource());
|
assertEquals(recordVersion11, to10.iterator().next().getSource());
|
||||||
|
|
||||||
assertTrue(relationshipService.getRelationshipsFrom(recordVersion10, RelationshipService.RELATIONSHIP_VERSIONS).isEmpty());
|
assertTrue(relationshipService.getRelationshipsFrom(recordVersion10, RelationshipService.RELATIONSHIP_VERSIONS).isEmpty());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Given that a version record
|
* Given that a version record
|
||||||
* When the version record is destroyed whilst retaining the meta data
|
* When the version record is destroyed whilst retaining the meta data
|
||||||
@@ -419,23 +418,23 @@ public class DeleteRecordVersionTest extends RecordableVersionsBaseTest
|
|||||||
public void testDestroyVersionRecordWithMetadata()
|
public void testDestroyVersionRecordWithMetadata()
|
||||||
{
|
{
|
||||||
final NodeRef myDocument = createDocumentWithRecordVersions();
|
final NodeRef myDocument = createDocumentWithRecordVersions();
|
||||||
|
|
||||||
doBehaviourDrivenTest(new BehaviourDrivenTest()
|
doBehaviourDrivenTest(new BehaviourDrivenTest()
|
||||||
{
|
{
|
||||||
private VersionHistory versionHistory;
|
private VersionHistory versionHistory;
|
||||||
private NodeRef recordVersion11;
|
private NodeRef recordVersion11;
|
||||||
|
|
||||||
public void given() throws Exception
|
public void given() throws Exception
|
||||||
{
|
{
|
||||||
// create file plan structure
|
// create file plan structure
|
||||||
NodeRef myCategory = filePlanService.createRecordCategory(filePlan, GUID.generate());
|
NodeRef myCategory = filePlanService.createRecordCategory(filePlan, GUID.generate());
|
||||||
utils.createBasicDispositionSchedule(myCategory, GUID.generate(), GUID.generate(), true, true);
|
utils.createBasicDispositionSchedule(myCategory, GUID.generate(), GUID.generate(), true, true);
|
||||||
|
|
||||||
NodeRef myRecordFolder = recordFolderService.createRecordFolder(myCategory, GUID.generate());
|
NodeRef myRecordFolder = recordFolderService.createRecordFolder(myCategory, GUID.generate());
|
||||||
|
|
||||||
// get version history
|
// get version history
|
||||||
versionHistory = versionService.getVersionHistory(myDocument);
|
versionHistory = versionService.getVersionHistory(myDocument);
|
||||||
|
|
||||||
// file and complete all the version records into my record folder
|
// file and complete all the version records into my record folder
|
||||||
for (Version version : versionHistory.getAllVersions())
|
for (Version version : versionHistory.getAllVersions())
|
||||||
{
|
{
|
||||||
@@ -444,29 +443,29 @@ public class DeleteRecordVersionTest extends RecordableVersionsBaseTest
|
|||||||
utils.completeRecord(record);
|
utils.completeRecord(record);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void when()
|
public void when()
|
||||||
{
|
{
|
||||||
Version version11 = versionHistory.getVersion("1.1");
|
Version version11 = versionHistory.getVersion("1.1");
|
||||||
recordVersion11 = recordableVersionService.getVersionRecord(version11);
|
recordVersion11 = recordableVersionService.getVersionRecord(version11);
|
||||||
|
|
||||||
Map<String, Serializable> params = new HashMap<String, Serializable>(1);
|
Map<String, Serializable> params = new HashMap<String, Serializable>(1);
|
||||||
params.put(CompleteEventAction.PARAM_EVENT_NAME, CommonRMTestUtils.DEFAULT_EVENT_NAME);
|
params.put(CompleteEventAction.PARAM_EVENT_NAME, CommonRMTestUtils.DEFAULT_EVENT_NAME);
|
||||||
rmActionService.executeRecordsManagementAction(recordVersion11, CompleteEventAction.NAME, params);
|
rmActionService.executeRecordsManagementAction(recordVersion11, CompleteEventAction.NAME, params);
|
||||||
|
|
||||||
rmActionService.executeRecordsManagementAction(recordVersion11, CutOffAction.NAME);
|
rmActionService.executeRecordsManagementAction(recordVersion11, CutOffAction.NAME);
|
||||||
|
|
||||||
rmActionService.executeRecordsManagementAction(recordVersion11, DestroyAction.NAME);
|
rmActionService.executeRecordsManagementAction(recordVersion11, DestroyAction.NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void then()
|
public void then()
|
||||||
{
|
{
|
||||||
// verify that the version history looks as expected
|
// verify that the version history looks as expected
|
||||||
VersionHistory versionHistory = versionService.getVersionHistory(myDocument);
|
VersionHistory versionHistory = versionService.getVersionHistory(myDocument);
|
||||||
assertNotNull(versionHistory);
|
assertNotNull(versionHistory);
|
||||||
Collection<Version> versions = versionHistory.getAllVersions();
|
Collection<Version> versions = versionHistory.getAllVersions();
|
||||||
assertEquals(3, versions.size());
|
assertEquals(3, versions.size());
|
||||||
|
|
||||||
// verify 1.2 setup as expected
|
// verify 1.2 setup as expected
|
||||||
Version version12 = versionHistory.getHeadVersion();
|
Version version12 = versionHistory.getHeadVersion();
|
||||||
assertEquals("1.2", version12.getVersionLabel());
|
assertEquals("1.2", version12.getVersionLabel());
|
||||||
@@ -474,26 +473,26 @@ public class DeleteRecordVersionTest extends RecordableVersionsBaseTest
|
|||||||
NodeRef recordVersion12 = recordableVersionService.getVersionRecord(version12);
|
NodeRef recordVersion12 = recordableVersionService.getVersionRecord(version12);
|
||||||
assertNotNull(recordVersion12);
|
assertNotNull(recordVersion12);
|
||||||
assertFalse(recordService.isMetadataStub(recordVersion12));
|
assertFalse(recordService.isMetadataStub(recordVersion12));
|
||||||
|
|
||||||
assertTrue(relationshipService.getRelationshipsTo(recordVersion12, "versions").isEmpty());
|
assertTrue(relationshipService.getRelationshipsTo(recordVersion12, "versions").isEmpty());
|
||||||
|
|
||||||
Set<Relationship> from12 = relationshipService.getRelationshipsFrom(recordVersion12, "versions");
|
Set<Relationship> from12 = relationshipService.getRelationshipsFrom(recordVersion12, "versions");
|
||||||
assertEquals(1, from12.size());
|
assertEquals(1, from12.size());
|
||||||
|
|
||||||
// verify 1.1 setup as expected
|
// verify 1.1 setup as expected
|
||||||
Version version11 = versionHistory.getPredecessor(version12);
|
Version version11 = versionHistory.getPredecessor(version12);
|
||||||
assertEquals("1.1", version11.getVersionLabel());
|
assertEquals("1.1", version11.getVersionLabel());
|
||||||
assertTrue(recordableVersionService.isRecordedVersionDestroyed(version11));
|
assertTrue(recordableVersionService.isRecordedVersionDestroyed(version11));
|
||||||
assertNotNull(recordVersion11);
|
assertNotNull(recordVersion11);
|
||||||
assertTrue(recordService.isMetadataStub(recordVersion11));
|
assertTrue(recordService.isMetadataStub(recordVersion11));
|
||||||
|
|
||||||
Set<Relationship> to11 = relationshipService.getRelationshipsTo(recordVersion11, "versions");
|
Set<Relationship> to11 = relationshipService.getRelationshipsTo(recordVersion11, "versions");
|
||||||
assertEquals(1, to11.size());
|
assertEquals(1, to11.size());
|
||||||
assertEquals(recordVersion12, to11.iterator().next().getSource());
|
assertEquals(recordVersion12, to11.iterator().next().getSource());
|
||||||
|
|
||||||
Set<Relationship> from11 = relationshipService.getRelationshipsFrom(recordVersion11, "versions");
|
Set<Relationship> from11 = relationshipService.getRelationshipsFrom(recordVersion11, "versions");
|
||||||
assertEquals(1, from11.size());
|
assertEquals(1, from11.size());
|
||||||
|
|
||||||
// verify 1.0 setup as expected
|
// verify 1.0 setup as expected
|
||||||
Version version10 = versionHistory.getPredecessor(version11);
|
Version version10 = versionHistory.getPredecessor(version11);
|
||||||
assertEquals("1.0", version10.getVersionLabel());
|
assertEquals("1.0", version10.getVersionLabel());
|
||||||
@@ -501,14 +500,14 @@ public class DeleteRecordVersionTest extends RecordableVersionsBaseTest
|
|||||||
NodeRef recordVersion10 = recordableVersionService.getVersionRecord(version10);
|
NodeRef recordVersion10 = recordableVersionService.getVersionRecord(version10);
|
||||||
assertNotNull(recordVersion10);
|
assertNotNull(recordVersion10);
|
||||||
assertFalse(recordService.isMetadataStub(recordVersion10));
|
assertFalse(recordService.isMetadataStub(recordVersion10));
|
||||||
|
|
||||||
Set<Relationship> to10 = relationshipService.getRelationshipsTo(recordVersion10, "versions");
|
Set<Relationship> to10 = relationshipService.getRelationshipsTo(recordVersion10, "versions");
|
||||||
assertEquals(1, to10.size());
|
assertEquals(1, to10.size());
|
||||||
assertEquals(recordVersion11, to10.iterator().next().getSource());
|
assertEquals(recordVersion11, to10.iterator().next().getSource());
|
||||||
|
|
||||||
assertTrue(relationshipService.getRelationshipsFrom(recordVersion10, "versions").isEmpty());
|
assertTrue(relationshipService.getRelationshipsFrom(recordVersion10, "versions").isEmpty());
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -5,21 +5,21 @@
|
|||||||
* 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%
|
||||||
@@ -38,7 +38,6 @@ import org.alfresco.service.cmr.repository.NodeRef;
|
|||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
import org.alfresco.util.GUID;
|
import org.alfresco.util.GUID;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Records management service test.
|
* Records management service test.
|
||||||
*
|
*
|
||||||
|
@@ -5,21 +5,21 @@
|
|||||||
* 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%
|
||||||
@@ -40,7 +40,6 @@ import org.alfresco.util.GUID;
|
|||||||
import org.springframework.extensions.webscripts.Status;
|
import org.springframework.extensions.webscripts.Status;
|
||||||
import org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest;
|
import org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest;
|
||||||
|
|
||||||
|
|
||||||
public class AuditRestApiTest extends BaseRMWebScriptTestCase
|
public class AuditRestApiTest extends BaseRMWebScriptTestCase
|
||||||
{
|
{
|
||||||
/** URL for the REST APIs */
|
/** URL for the REST APIs */
|
||||||
|
@@ -5,21 +5,21 @@
|
|||||||
* 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%
|
||||||
@@ -39,7 +39,6 @@ import org.alfresco.service.cmr.repository.NodeRef;
|
|||||||
import org.alfresco.util.GUID;
|
import org.alfresco.util.GUID;
|
||||||
import org.alfresco.util.PropertyMap;
|
import org.alfresco.util.PropertyMap;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notification helper (system) test
|
* Notification helper (system) test
|
||||||
*
|
*
|
||||||
|
@@ -5,21 +5,21 @@
|
|||||||
* 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%
|
||||||
@@ -34,7 +34,6 @@ import java.util.Set;
|
|||||||
import org.alfresco.module.org_alfresco_module_rm.capability.Capability;
|
import org.alfresco.module.org_alfresco_module_rm.capability.Capability;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.capability.Group;
|
import org.alfresco.module.org_alfresco_module_rm.capability.Group;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility test case to generate a report of the capabilities in the system.
|
* Utility test case to generate a report of the capabilities in the system.
|
||||||
*
|
*
|
||||||
@@ -53,7 +52,7 @@ public class GenerateCapabilityReport extends BaseRMTestCase
|
|||||||
FileWriter writer = new FileWriter("c:\\mywork\\capabilityReport.csv");
|
FileWriter writer = new FileWriter("c:\\mywork\\capabilityReport.csv");
|
||||||
BufferedWriter out = new BufferedWriter(writer);
|
BufferedWriter out = new BufferedWriter(writer);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Set<Capability> capabilities = capabilityService.getCapabilities(true);
|
Set<Capability> capabilities = capabilityService.getCapabilities(true);
|
||||||
for (Capability capability : capabilities)
|
for (Capability capability : capabilities)
|
||||||
{
|
{
|
||||||
@@ -63,7 +62,7 @@ public class GenerateCapabilityReport extends BaseRMTestCase
|
|||||||
{
|
{
|
||||||
groupId = group.getId();
|
groupId = group.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
out.write(groupId);
|
out.write(groupId);
|
||||||
out.write(",");
|
out.write(",");
|
||||||
out.write(capability.getName());
|
out.write(capability.getName());
|
||||||
@@ -76,7 +75,7 @@ public class GenerateCapabilityReport extends BaseRMTestCase
|
|||||||
{
|
{
|
||||||
out.close();
|
out.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@@ -5,21 +5,21 @@
|
|||||||
* 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%
|
||||||
@@ -41,10 +41,9 @@ import org.alfresco.util.EqualsHelper;
|
|||||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||||
import org.springframework.extensions.webscripts.TestWebScriptServer;
|
import org.springframework.extensions.webscripts.TestWebScriptServer;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stand-alone Web Script Test Server
|
* Stand-alone Web Script Test Server
|
||||||
*
|
*
|
||||||
* @author davidc
|
* @author davidc
|
||||||
*/
|
*/
|
||||||
public class TestWebScriptRepoServer extends TestWebScriptServer
|
public class TestWebScriptRepoServer extends TestWebScriptServer
|
||||||
@@ -79,15 +78,15 @@ public class TestWebScriptRepoServer extends TestWebScriptServer
|
|||||||
"classpath:alfresco/web-scripts-application-context.xml",
|
"classpath:alfresco/web-scripts-application-context.xml",
|
||||||
"classpath:alfresco/web-scripts-application-context-test.xml"
|
"classpath:alfresco/web-scripts-application-context-test.xml"
|
||||||
};
|
};
|
||||||
|
|
||||||
/** A static reference to the application context being used */
|
/** A static reference to the application context being used */
|
||||||
private static ClassPathXmlApplicationContext ctx;
|
private static ClassPathXmlApplicationContext ctx;
|
||||||
private static String appendedTestConfiguration;
|
private static String appendedTestConfiguration;
|
||||||
|
|
||||||
private RetryingTransactionHelper retryingTransactionHelper;
|
private RetryingTransactionHelper retryingTransactionHelper;
|
||||||
private AuthenticationService authenticationService;
|
private AuthenticationService authenticationService;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets helper that provides transaction callbacks
|
* Sets helper that provides transaction callbacks
|
||||||
*/
|
*/
|
||||||
@@ -95,7 +94,7 @@ public class TestWebScriptRepoServer extends TestWebScriptServer
|
|||||||
{
|
{
|
||||||
this.retryingTransactionHelper = retryingTransactionHelper;
|
this.retryingTransactionHelper = retryingTransactionHelper;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param authenticationService
|
* @param authenticationService
|
||||||
*/
|
*/
|
||||||
@@ -119,13 +118,13 @@ public class TestWebScriptRepoServer extends TestWebScriptServer
|
|||||||
{
|
{
|
||||||
return getTestServer(null);
|
return getTestServer(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start up a context and get the server bean.
|
* Start up a context and get the server bean.
|
||||||
* <p>
|
* <p>
|
||||||
* This method will close and restart the application context only if the configuration has
|
* This method will close and restart the application context only if the configuration has
|
||||||
* changed.
|
* changed.
|
||||||
*
|
*
|
||||||
* @param appendTestConfigLocation additional context file to include in the application context
|
* @param appendTestConfigLocation additional context file to include in the application context
|
||||||
* @return Test Server
|
* @return Test Server
|
||||||
*/
|
*/
|
||||||
@@ -154,7 +153,7 @@ public class TestWebScriptRepoServer extends TestWebScriptServer
|
|||||||
// There is already a context with the required configuration
|
// There is already a context with the required configuration
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if we need to start/restart the context
|
// Check if we need to start/restart the context
|
||||||
if (TestWebScriptRepoServer.ctx == null)
|
if (TestWebScriptRepoServer.ctx == null)
|
||||||
{
|
{
|
||||||
@@ -173,15 +172,15 @@ public class TestWebScriptRepoServer extends TestWebScriptServer
|
|||||||
TestWebScriptRepoServer.ctx = new ClassPathXmlApplicationContext(configLocations);
|
TestWebScriptRepoServer.ctx = new ClassPathXmlApplicationContext(configLocations);
|
||||||
TestWebScriptRepoServer.appendedTestConfiguration = appendTestConfigLocation;
|
TestWebScriptRepoServer.appendedTestConfiguration = appendTestConfigLocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the bean
|
// Get the bean
|
||||||
TestWebScriptServer testServer = (org.alfresco.repo.web.scripts.TestWebScriptRepoServer)TestWebScriptRepoServer.ctx.getBean("webscripts.test");
|
TestWebScriptServer testServer = (org.alfresco.repo.web.scripts.TestWebScriptRepoServer)TestWebScriptRepoServer.ctx.getBean("webscripts.test");
|
||||||
return testServer;
|
return testServer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interpret a single command using the BufferedReader passed in for any data needed.
|
* Interpret a single command using the BufferedReader passed in for any data needed.
|
||||||
*
|
*
|
||||||
* @param line The unparsed command
|
* @param line The unparsed command
|
||||||
* @return The textual output of the command.
|
* @return The textual output of the command.
|
||||||
*/
|
*/
|
||||||
@@ -215,7 +214,7 @@ public class TestWebScriptRepoServer extends TestWebScriptServer
|
|||||||
{
|
{
|
||||||
executeCommand("user " + getDefaultUserName());
|
executeCommand("user " + getDefaultUserName());
|
||||||
}
|
}
|
||||||
|
|
||||||
// execute command in context of currently selected user
|
// execute command in context of currently selected user
|
||||||
return AuthenticationUtil.runAs(new RunAsWork<String>()
|
return AuthenticationUtil.runAs(new RunAsWork<String>()
|
||||||
{
|
{
|
||||||
|
@@ -5,21 +5,21 @@
|
|||||||
* 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%
|
||||||
@@ -65,7 +65,6 @@ import org.mockito.Spy;
|
|||||||
import org.mockito.invocation.InvocationOnMock;
|
import org.mockito.invocation.InvocationOnMock;
|
||||||
import org.mockito.stubbing.Answer;
|
import org.mockito.stubbing.Answer;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hold service implementation unit test
|
* Hold service implementation unit test
|
||||||
*
|
*
|
||||||
|
@@ -5,21 +5,21 @@
|
|||||||
* 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%
|
||||||
@@ -40,10 +40,9 @@ import org.mockito.Mock;
|
|||||||
import org.springframework.beans.factory.config.BeanDefinition;
|
import org.springframework.beans.factory.config.BeanDefinition;
|
||||||
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dictionary bootstrap post processor unit test.
|
* Dictionary bootstrap post processor unit test.
|
||||||
*
|
*
|
||||||
* @author Roy Wetherall
|
* @author Roy Wetherall
|
||||||
* @since 2.2
|
* @since 2.2
|
||||||
*/
|
*/
|
||||||
@@ -52,31 +51,31 @@ public class DictionaryBootstrapPostProcessorUnitTest extends BaseUnitTest
|
|||||||
/** bean id's */
|
/** bean id's */
|
||||||
private static final String BEAN_SITESERVICE_BOOTSTRAP = "siteService_dictionaryBootstrap";
|
private static final String BEAN_SITESERVICE_BOOTSTRAP = "siteService_dictionaryBootstrap";
|
||||||
private static final String BEAN_RM_DICTIONARY_BOOTSTRAP = "org_alfresco_module_rm_dictionaryBootstrap";
|
private static final String BEAN_RM_DICTIONARY_BOOTSTRAP = "org_alfresco_module_rm_dictionaryBootstrap";
|
||||||
|
|
||||||
@Mock private ConfigurableListableBeanFactory mockedBeanFactory;
|
@Mock private ConfigurableListableBeanFactory mockedBeanFactory;
|
||||||
@Mock private BeanDefinition mockedBeanDefinition;
|
@Mock private BeanDefinition mockedBeanDefinition;
|
||||||
|
|
||||||
@InjectMocks private DictionaryBootstrapPostProcessor postProcessor;
|
@InjectMocks private DictionaryBootstrapPostProcessor postProcessor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* given the bean factory does not contain the site service bootstrap bean then ensure that it is
|
* given the bean factory does not contain the site service bootstrap bean then ensure that it is
|
||||||
* not added as a dependency
|
* not added as a dependency
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void noSiteServiceBootstrapBeanAvailable()
|
public void noSiteServiceBootstrapBeanAvailable()
|
||||||
{
|
{
|
||||||
// === given ====
|
// === given ====
|
||||||
doReturn(false).when(mockedBeanFactory).containsBean(BEAN_SITESERVICE_BOOTSTRAP);
|
doReturn(false).when(mockedBeanFactory).containsBean(BEAN_SITESERVICE_BOOTSTRAP);
|
||||||
|
|
||||||
// === when ===
|
// === when ===
|
||||||
postProcessor.postProcessBeanFactory(mockedBeanFactory);
|
postProcessor.postProcessBeanFactory(mockedBeanFactory);
|
||||||
|
|
||||||
// === then ===
|
// === then ===
|
||||||
verify(mockedBeanFactory, times(1)).containsBean(BEAN_SITESERVICE_BOOTSTRAP);
|
verify(mockedBeanFactory, times(1)).containsBean(BEAN_SITESERVICE_BOOTSTRAP);
|
||||||
verifyNoMoreInteractions(mockedBeanFactory);
|
verifyNoMoreInteractions(mockedBeanFactory);
|
||||||
verifyZeroInteractions(mockedBeanDefinition);
|
verifyZeroInteractions(mockedBeanDefinition);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* given that the site service bootstrap bean is contained within the bean factory, ensure that
|
* given that the site service bootstrap bean is contained within the bean factory, ensure that
|
||||||
* it is added as a dependency
|
* it is added as a dependency
|
||||||
@@ -84,22 +83,22 @@ public class DictionaryBootstrapPostProcessorUnitTest extends BaseUnitTest
|
|||||||
@Test
|
@Test
|
||||||
public void siteServiceBootstrapBeanAvailable()
|
public void siteServiceBootstrapBeanAvailable()
|
||||||
{
|
{
|
||||||
// === given ====
|
// === given ====
|
||||||
doReturn(true).when(mockedBeanFactory).containsBean(BEAN_SITESERVICE_BOOTSTRAP);
|
doReturn(true).when(mockedBeanFactory).containsBean(BEAN_SITESERVICE_BOOTSTRAP);
|
||||||
doReturn(true).when(mockedBeanFactory).containsBean(BEAN_RM_DICTIONARY_BOOTSTRAP);
|
doReturn(true).when(mockedBeanFactory).containsBean(BEAN_RM_DICTIONARY_BOOTSTRAP);
|
||||||
doReturn(mockedBeanDefinition).when(mockedBeanFactory).getBeanDefinition(BEAN_RM_DICTIONARY_BOOTSTRAP);
|
doReturn(mockedBeanDefinition).when(mockedBeanFactory).getBeanDefinition(BEAN_RM_DICTIONARY_BOOTSTRAP);
|
||||||
|
|
||||||
// === when ===
|
// === when ===
|
||||||
postProcessor.postProcessBeanFactory(mockedBeanFactory);
|
postProcessor.postProcessBeanFactory(mockedBeanFactory);
|
||||||
|
|
||||||
// === then ===
|
// === then ===
|
||||||
verify(mockedBeanFactory, times(1)).containsBean(BEAN_SITESERVICE_BOOTSTRAP);
|
verify(mockedBeanFactory, times(1)).containsBean(BEAN_SITESERVICE_BOOTSTRAP);
|
||||||
verify(mockedBeanFactory, times(1)).containsBean(BEAN_RM_DICTIONARY_BOOTSTRAP);
|
verify(mockedBeanFactory, times(1)).containsBean(BEAN_RM_DICTIONARY_BOOTSTRAP);
|
||||||
|
|
||||||
verify(mockedBeanFactory, times(1)).getBeanDefinition(BEAN_RM_DICTIONARY_BOOTSTRAP);
|
verify(mockedBeanFactory, times(1)).getBeanDefinition(BEAN_RM_DICTIONARY_BOOTSTRAP);
|
||||||
verify(mockedBeanDefinition, times(1)).setDependsOn(new String[]{BEAN_SITESERVICE_BOOTSTRAP});
|
verify(mockedBeanDefinition, times(1)).setDependsOn(new String[]{BEAN_SITESERVICE_BOOTSTRAP});
|
||||||
|
|
||||||
verifyNoMoreInteractions(mockedBeanFactory, mockedBeanDefinition);
|
verifyNoMoreInteractions(mockedBeanFactory, mockedBeanDefinition);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user