diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/HideInplaceRecordTest.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/HideInplaceRecordTest.java
new file mode 100644
index 0000000000..5ca049d849
--- /dev/null
+++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/HideInplaceRecordTest.java
@@ -0,0 +1,98 @@
+/*
+ * Copyright (C) 2005-2014 Alfresco Software Limited.
+ *
+ * This file is part of Alfresco
+ *
+ * Alfresco is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Alfresco is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
+ */
+package org.alfresco.module.org_alfresco_module_rm.test.integration.record;
+
+import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase;
+import org.alfresco.repo.security.authentication.AuthenticationUtil;
+import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
+
+/**
+ * Hide Inplace Record Test
+ *
+ * @author Tuna Aksoy
+ * @since 2.3
+ */
+public class HideInplaceRecordTest extends BaseRMTestCase
+{
+ /**
+ * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#isCollaborationSiteTest()
+ */
+ @Override
+ protected boolean isCollaborationSiteTest()
+ {
+ return true;
+ }
+
+ /**
+ * Tests hiding inplace records
+ */
+ public void testHideInplaceRecord()
+ {
+ doBehaviourDrivenTest(new BehaviourDrivenTest()
+ {
+ public void given()
+ {
+ // Check that the document is not a record
+ assertFalse(recordService.isRecord(dmDocument));
+
+ // Check that the record has one parent association
+ assertEquals(1, nodeService.getParentAssocs(dmDocument).size());
+
+ // Declare the document as a record
+ AuthenticationUtil.runAs(new RunAsWork()
+ {
+ public Void doWork() throws Exception
+ {
+ // Declare record
+ recordService.createRecord(filePlan, dmDocument);
+
+ return null;
+ }
+ }, dmCollaborator);
+
+ // Check that the document is a record
+ assertTrue(recordService.isRecord(dmDocument));
+
+ // Check that the record has two parent associations
+ assertEquals(2, nodeService.getParentAssocs(dmDocument).size());
+ }
+
+ public void when()
+ {
+ // Hide the document
+ AuthenticationUtil.runAs(new RunAsWork()
+ {
+ public Void doWork() throws Exception
+ {
+ // Hide record
+ inplaceRecordService.hideRecord(dmDocument);
+
+ return null;
+ }
+ }, dmCollaborator);
+ }
+
+ public void then()
+ {
+ // Check that the record has one parent association
+ assertEquals(1, nodeService.getParentAssocs(dmDocument).size());
+ }
+ });
+ }
+}
diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/MoveInplaceRecordTest.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/MoveInplaceRecordTest.java
new file mode 100644
index 0000000000..a0e5dfc6b9
--- /dev/null
+++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/MoveInplaceRecordTest.java
@@ -0,0 +1,106 @@
+/*
+ * Copyright (C) 2005-2014 Alfresco Software Limited.
+ *
+ * This file is part of Alfresco
+ *
+ * Alfresco is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Alfresco is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
+ */
+package org.alfresco.module.org_alfresco_module_rm.test.integration.record;
+
+import java.util.List;
+
+import org.alfresco.model.ContentModel;
+import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase;
+import org.alfresco.repo.security.authentication.AuthenticationUtil;
+import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
+import org.alfresco.service.cmr.repository.ChildAssociationRef;
+import org.alfresco.service.cmr.repository.NodeRef;
+
+/**
+ * Move Inplace Record Test
+ *
+ * @author Tuna Aksoy
+ * @since 2.3
+ */
+public class MoveInplaceRecordTest extends BaseRMTestCase
+{
+ /**
+ * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#isCollaborationSiteTest()
+ */
+ @Override
+ protected boolean isCollaborationSiteTest()
+ {
+ return true;
+ }
+
+ /**
+ * Tests moving inplace records
+ */
+ public void testMoveInplaceRecord()
+ {
+ doBehaviourDrivenTest(new BehaviourDrivenTest()
+ {
+ // The destination folder in collaboration site
+ private NodeRef destinationDmFolder;
+
+ public void given()
+ {
+ // Create the destination folder
+ destinationDmFolder = fileFolderService.create(documentLibrary, "destinationCollabFolder", ContentModel.TYPE_FOLDER).getNodeRef();
+
+ // Check that the document is not a record
+ assertFalse(recordService.isRecord(dmDocument));
+
+ // Declare the document as a record
+ AuthenticationUtil.runAs(new RunAsWork()
+ {
+ public Void doWork() throws Exception
+ {
+ // Declare record
+ recordService.createRecord(filePlan, dmDocument);
+
+ return null;
+ }
+ }, dmCollaborator);
+
+ // Check that the document is a record now
+ assertTrue(recordService.isRecord(dmDocument));
+ }
+
+ public void when()
+ {
+ // Move the document
+ AuthenticationUtil.runAs(new RunAsWork()
+ {
+ public Void doWork() throws Exception
+ {
+ // Move record
+ inplaceRecordService.moveRecord(dmDocument, destinationDmFolder);
+
+ return null;
+ }
+ }, dmCollaborator);
+ }
+
+ public void then()
+ {
+ // Check that the source folder is empty now and the destination folder has the document
+ assertEquals(0, nodeService.getChildAssocs(dmFolder).size());
+ List destinationFolderChildAssocs = nodeService.getChildAssocs(destinationDmFolder);
+ assertEquals(1, destinationFolderChildAssocs.size());
+ assertEquals(dmDocument, destinationFolderChildAssocs.get(0).getChildRef());
+ }
+ });
+ }
+}
diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/RecordTestSuite.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/RecordTestSuite.java
index 6e7e7d97c8..7394d0d767 100644
--- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/RecordTestSuite.java
+++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/RecordTestSuite.java
@@ -33,7 +33,9 @@ import org.junit.runners.Suite.SuiteClasses;
{
RejectRecordTest.class,
CreateRecordTest.class,
- MoveRecordTest.class
+ MoveRecordTest.class,
+ HideInplaceRecordTest.class,
+ MoveInplaceRecordTest.class
})
public class RecordTestSuite
{
diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseRMTestCase.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseRMTestCase.java
index 0aa92eb510..077d86c61d 100644
--- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseRMTestCase.java
+++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseRMTestCase.java
@@ -39,6 +39,7 @@ import org.alfresco.module.org_alfresco_module_rm.hold.HoldService;
import org.alfresco.module.org_alfresco_module_rm.identifier.IdentifierService;
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
import org.alfresco.module.org_alfresco_module_rm.model.rma.type.RmSiteType;
+import org.alfresco.module.org_alfresco_module_rm.record.InplaceRecordService;
import org.alfresco.module.org_alfresco_module_rm.record.RecordService;
import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService;
import org.alfresco.module.org_alfresco_module_rm.report.ReportService;
@@ -106,7 +107,7 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase
protected QName TYPE_CUSTOM_TYPE = QName.createQName(URI, "customType");
protected QName ASPECT_CUSTOM_ASPECT = QName.createQName(URI, "customAspect");
protected QName ASPECT_RECORD_META_DATA = QName.createQName(URI, "recordMetaData");
-
+
/** test data */
protected String NAME_DM_DOCUMENT = "collabDocument.txt";
@@ -156,6 +157,7 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase
protected RecordsManagementAuditService rmAuditService;
protected IdentifierService identifierService;
protected HoldService holdService;
+ protected InplaceRecordService inplaceRecordService;
/** test data */
protected String siteId;
@@ -391,6 +393,7 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase
rmAuditService = (RecordsManagementAuditService) applicationContext.getBean("RecordsManagementAuditService");
identifierService = (IdentifierService) applicationContext.getBean("recordsManagementIdentifierService");
holdService = (HoldService) applicationContext.getBean("HoldService");
+ inplaceRecordService = (InplaceRecordService) applicationContext.getBean("InplaceRecordService");
}
/**
@@ -825,7 +828,7 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase
{
/** run in transaction */
protected boolean runInTransactionTests = true;
-
+
/** run as user */
protected String runAsUser = AuthenticationUtil.getAdminUserName();
@@ -843,7 +846,7 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase
{
this.expectedException = expectedException;
}
-
+
public BehaviourDrivenTest(Class> expectedException, String runAsUser)
{
this.expectedException = expectedException;
@@ -854,7 +857,7 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase
{
this.runAsUser = runAsUser;
}
-
+
public BehaviourDrivenTest(String runAsUser, boolean runInTransactionTests)
{
this.runInTransactionTests = runInTransactionTests;