Search in sources :

Example 16 with TransferTarget

use of org.alfresco.service.cmr.transfer.TransferTarget in project alfresco-repository by Alfresco.

the class TransferServiceImplTest method testAsyncCancel.

// test async callback
/**
 * Test the transfer cancel method when it is running async.
 *
 * This is a unit test so it does some shenanigans to send to the same instance of alfresco.
 */
@Test
public void testAsyncCancel() throws Exception {
    final int MAX_SLEEPS = 5;
    final String CONTENT_TITLE = "ContentTitle";
    final String CONTENT_NAME_A = "Demo Node A";
    final String CONTENT_NAME_B = "Demo Node B";
    final Locale CONTENT_LOCALE = Locale.GERMAN;
    final String CONTENT_STRING = "Hello";
    final String targetName = "testAsyncCallback";
    final NodeRef guestHome = repositoryHelper.getGuestHome();
    class TestContext {

        TransferTarget transferMe;

        NodeRef nodeRefA = null;

        NodeRef nodeRefB = null;
    }
    ;
    /**
     * Unit test kludge to transfer from guest home to company home
     */
    final UnitTestTransferManifestNodeFactory testNodeFactory = unitTestKludgeToTransferGuestHomeToCompanyHome();
    RetryingTransactionCallback<TestContext> setupCB = new RetryingTransactionCallback<TestContext>() {

        @Override
        public TestContext execute() throws Throwable {
            TestContext ctx = new TestContext();
            ctx.nodeRefA = nodeService.getChildByName(guestHome, ContentModel.ASSOC_CONTAINS, CONTENT_NAME_A);
            if (ctx.nodeRefA == null) {
                /**
                 * Create a test node that we will read and write
                 */
                ChildAssociationRef child = nodeService.createNode(guestHome, ContentModel.ASSOC_CONTAINS, QName.createQName(GUID.generate()), ContentModel.TYPE_CONTENT);
                ctx.nodeRefA = child.getChildRef();
                nodeService.setProperty(ctx.nodeRefA, ContentModel.PROP_TITLE, CONTENT_TITLE);
                nodeService.setProperty(ctx.nodeRefA, ContentModel.PROP_NAME, CONTENT_NAME_A);
                ContentWriter writer = contentService.getWriter(ctx.nodeRefA, ContentModel.PROP_CONTENT, true);
                writer.setLocale(CONTENT_LOCALE);
                writer.putContent(CONTENT_STRING);
            }
            ctx.nodeRefB = nodeService.getChildByName(guestHome, ContentModel.ASSOC_CONTAINS, CONTENT_NAME_B);
            if (ctx.nodeRefB == null) {
                ChildAssociationRef child = nodeService.createNode(guestHome, ContentModel.ASSOC_CONTAINS, QName.createQName(GUID.generate()), ContentModel.TYPE_CONTENT);
                ctx.nodeRefB = child.getChildRef();
                nodeService.setProperty(ctx.nodeRefB, ContentModel.PROP_TITLE, CONTENT_TITLE);
                nodeService.setProperty(ctx.nodeRefB, ContentModel.PROP_NAME, CONTENT_NAME_B);
                ContentWriter writer = contentService.getWriter(ctx.nodeRefB, ContentModel.PROP_CONTENT, true);
                writer.setLocale(CONTENT_LOCALE);
                writer.putContent(CONTENT_STRING);
            }
            /**
             * Now go ahead and create our first transfer target
             */
            if (!transferService.targetExists(targetName)) {
                createTransferTarget(targetName);
            } else {
                transferService.getTransferTarget(targetName);
            }
            return ctx;
        }
    };
    final TestContext testContext = transactionService.getRetryingTransactionHelper().doInTransaction(setupCB, false, true);
    /**
     * The transfer report is a plain report of the transfer - no async shenanigans to worry about
     */
    final List<TransferEvent> transferReport = new ArrayList<TransferEvent>(50);
    RetryingTransactionCallback<Void> transferAsyncCB = new RetryingTransactionCallback<Void>() {

        @Override
        public Void execute() throws Throwable {
            /**
             * The poison callback will cancel the transfer after
             * the begin
             */
            TransferCallback poison = new TransferCallback() {

                String transferId = null;

                public void processEvent(TransferEvent event) {
                    logger.debug(event.toString());
                    if (event instanceof TransferEventBegin) {
                        TransferEventBegin beginEvent = (TransferEventBegin) event;
                        transferId = beginEvent.getTransferId();
                        transferService.cancelAsync(transferId);
                    }
                }
            };
            TestTransferCallback callback = new TestTransferCallback();
            Set<TransferCallback> callbacks = new HashSet<TransferCallback>();
            callbacks.add(callback);
            callbacks.add(poison);
            TransferDefinition definition = new TransferDefinition();
            Set<NodeRef> nodes = new HashSet<NodeRef>();
            nodes.add(testContext.nodeRefA);
            nodes.add(testContext.nodeRefB);
            definition.setNodes(nodes);
            transferService.transferAsync(targetName, definition, callbacks);
            logger.debug("transfer async has returned");
            /**
             * Need to poll the transfer events here until callback receives the last event
             */
            Queue<TransferEvent> events = callback.getEvents();
            int sleepCount = MAX_SLEEPS;
            boolean ended = false;
            TransferEvent event = events.poll();
            while (!ended) {
                logger.debug("polling loop:" + sleepCount);
                while (event != null) {
                    /**
                     * Got an event - reset the sleep counter
                     */
                    sleepCount = MAX_SLEEPS;
                    logger.debug("Got an event" + event.toString());
                    /**
                     * Squirrel away the event for analysis later
                     */
                    transferReport.add(event);
                    /**
                     * If we read the last record which will either be SUCCESS or ERROR then we we have finished
                     */
                    if (event.isLast()) {
                        logger.debug("got last event");
                        ended = true;
                    }
                    /**
                     * Try to get the next event
                     */
                    event = events.poll();
                }
                if (event == null && !ended) {
                    if (sleepCount <= 0) {
                        fail("timed out without receiving last event");
                        ended = true;
                    } else {
                        /**
                         *  No content - go to sleep to wait for some more
                         */
                        if (sleepCount-- > 0) {
                            // Sleep for 5 second
                            Thread.sleep(5000);
                        }
                    }
                    /**
                     * Try to get the next event
                     */
                    event = events.poll();
                }
            }
            return null;
        }
    };
    transactionService.getRetryingTransactionHelper().doInTransaction(transferAsyncCB);
    /**
     * Now validate the transferReport
     */
    assertTrue("transfer report is too small", transferReport.size() > 3);
    assertTrue("transfer report does not start with START", transferReport.get(0).getTransferState().equals(TransferEvent.TransferState.START));
    assertTrue("transfer report does not end with CANCELLED", transferReport.get(transferReport.size() - 1).getTransferState().equals(TransferEvent.TransferState.CANCELLED));
// last event is the transfer report event.
}
Also used : Locale(java.util.Locale) ArrayList(java.util.ArrayList) TransferTarget(org.alfresco.service.cmr.transfer.TransferTarget) TransferDefinition(org.alfresco.service.cmr.transfer.TransferDefinition) NodeRef(org.alfresco.service.cmr.repository.NodeRef) HashSet(java.util.HashSet) TransferEvent(org.alfresco.service.cmr.transfer.TransferEvent) TransferEventBegin(org.alfresco.service.cmr.transfer.TransferEventBegin) ChildAssociationRef(org.alfresco.service.cmr.repository.ChildAssociationRef) TransferCallback(org.alfresco.service.cmr.transfer.TransferCallback) ContentWriter(org.alfresco.service.cmr.repository.ContentWriter) RetryingTransactionCallback(org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback) BaseAlfrescoSpringTest(org.alfresco.util.BaseAlfrescoSpringTest) Test(org.junit.Test)

Example 17 with TransferTarget

use of org.alfresco.service.cmr.transfer.TransferTarget in project alfresco-repository by Alfresco.

the class TransferServiceImplTest method testCategoriesAndTags.

// testExistingNodes
/**
 * Test categories and tags (CRUD).
 *
 * Step 1: Create a new node with a tag
 * transfer
 *
 * Step 2: Add another tag
 * transfer
 *
 * Step 3: Delete a tag
 * transfer
 *
 * Step 4: Add a category
 * transfer
 *
 * Step 5: Add another category this one deep
 * transfer
 *
 * Step 6: Delete a category
 * transfer
 *
 * This is a unit test so it does some shenanigans to send to the same instance of alfresco.
 */
@Category(RedundantTests.class)
@Test
public void testCategoriesAndTags() throws Exception {
    final String CONTENT_TITLE = "ContentTitle";
    final String CONTENT_TITLE_UPDATED = "ContentTitleUpdated";
    final Locale CONTENT_LOCALE = Locale.GERMAN;
    final String CONTENT_STRING = "Hello World";
    final String CONTENT_UPDATE_STRING = "Foo Bar";
    final String targetName = "testCategoriesAndTags";
    final String TAG_1_NAME = "tag1";
    final String TAG_2_NAME = "tag2";
    class TestContext {

        TransferTarget transferMe;

        NodeRef contentNodeRef;

        NodeRef destNodeRef;
    }
    ;
    /**
     * Unit test kludge to transfer from guest home to company home
     */
    final UnitTestTransferManifestNodeFactory testNodeFactory = unitTestKludgeToTransferGuestHomeToCompanyHome();
    DescriptorService mockedDescriptorService = getMockDescriptorService(REPO_ID_A);
    transferServiceImpl.setDescriptorService(mockedDescriptorService);
    RetryingTransactionCallback<TestContext> setupCB = new RetryingTransactionCallback<TestContext>() {

        @Override
        public TestContext execute() throws Throwable {
            TestContext ctx = new TestContext();
            NodeRef guestHome = repositoryHelper.getGuestHome();
            /**
             * Create a test node that we will read and write
             */
            String name = GUID.generate();
            ChildAssociationRef child = nodeService.createNode(guestHome, ContentModel.ASSOC_CONTAINS, QName.createQName(name), ContentModel.TYPE_CONTENT);
            ctx.contentNodeRef = child.getChildRef();
            nodeService.setProperty(ctx.contentNodeRef, ContentModel.PROP_TITLE, CONTENT_TITLE);
            nodeService.setProperty(ctx.contentNodeRef, ContentModel.PROP_NAME, name);
            // Add the TAG to be transferred
            taggingService.addTag(ctx.contentNodeRef, TAG_1_NAME);
            if (!transferService.targetExists(targetName)) {
                ctx.transferMe = createTransferTarget(targetName);
            } else {
                ctx.transferMe = transferService.getTransferTarget(targetName);
            }
            transferService.enableTransferTarget(targetName, true);
            return ctx;
        }
    };
    final TestContext testContext = transactionService.getRetryingTransactionHelper().doInTransaction(setupCB);
    /**
     * Step 1: Transfer our which has a tag
     */
    logger.debug("First transfer - create new node with a tag");
    RetryingTransactionCallback<Void> transferCB = new RetryingTransactionCallback<Void>() {

        @Override
        public Void execute() throws Throwable {
            TransferDefinition definition = new TransferDefinition();
            Set<NodeRef> nodes = new HashSet<NodeRef>();
            nodes.add(testContext.contentNodeRef);
            definition.setNodes(nodes);
            transferService.transfer(targetName, definition);
            return null;
        }
    };
    transactionService.getRetryingTransactionHelper().doInTransaction(transferCB);
    RetryingTransactionCallback<Void> validateStep1CB = new RetryingTransactionCallback<Void>() {

        @Override
        public Void execute() throws Throwable {
            // Now validate that the target node exists and has similar properties to the source
            testContext.destNodeRef = testNodeFactory.getMappedNodeRef(testContext.contentNodeRef);
            assertFalse("unit test stuffed up - comparing with self", testContext.destNodeRef.equals(testContext.transferMe.getNodeRef()));
            assertTrue("dest node ref does not exist", nodeService.exists(testContext.destNodeRef));
            assertEquals("title is wrong", (String) nodeService.getProperty(testContext.destNodeRef, ContentModel.PROP_TITLE), CONTENT_TITLE);
            assertEquals("type is wrong", nodeService.getType(testContext.contentNodeRef), nodeService.getType(testContext.destNodeRef));
            List<String> tags = taggingService.getTags(testContext.contentNodeRef);
            assertNotNull(tags);
            assertEquals(1, tags.size());
            assertTrue(tags.contains(TAG_1_NAME));
            // Now add another tag for step number 2
            taggingService.addTag(testContext.contentNodeRef, TAG_2_NAME);
            return null;
        }
    };
    transactionService.getRetryingTransactionHelper().doInTransaction(validateStep1CB);
    /**
     * Step 2:
     * Transfer our node again - With another tag
     */
    logger.debug("Second transfer - add a second tag");
    transactionService.getRetryingTransactionHelper().doInTransaction(transferCB);
    RetryingTransactionCallback<Void> validateStep2CB = new RetryingTransactionCallback<Void>() {

        @Override
        public Void execute() throws Throwable {
            // Now validate that the target node exists and has similar properties to the source
            assertFalse("unit test stuffed up - comparing with self", testContext.destNodeRef.equals(testContext.transferMe.getNodeRef()));
            assertTrue("dest node ref does not exist", nodeService.exists(testContext.destNodeRef));
            List<String> tags = taggingService.getTags(testContext.contentNodeRef);
            assertNotNull(tags);
            assertTrue(tags.size() == 2);
            assertTrue(tags.contains(TAG_1_NAME));
            assertTrue(tags.contains(TAG_2_NAME));
            return null;
        }
    };
    transactionService.getRetryingTransactionHelper().doInTransaction(validateStep2CB);
    /**
     * Step 3 - delete a tag
     */
    RetryingTransactionCallback<Void> deleteTagCB = new RetryingTransactionCallback<Void>() {

        @Override
        public Void execute() throws Throwable {
            taggingService.removeTag(testContext.contentNodeRef, TAG_2_NAME);
            return null;
        }
    };
    transactionService.getRetryingTransactionHelper().doInTransaction(deleteTagCB);
    logger.debug("Transfer again - this is to delete a tag");
    transactionService.getRetryingTransactionHelper().doInTransaction(transferCB);
    // should probably be in contentModel
    final QName ASPECT_GENERAL_CLASSIFIABLE = ContentModel.ASPECT_GEN_CLASSIFIABLE;
    RetryingTransactionCallback<Void> validateStep3CB = new RetryingTransactionCallback<Void>() {

        @Override
        public Void execute() throws Throwable {
            assertFalse("unit test stuffed up - comparing with self", testContext.destNodeRef.equals(testContext.transferMe.getNodeRef()));
            assertTrue("dest node ref does not exist", nodeService.exists(testContext.destNodeRef));
            List<String> tags = taggingService.getTags(testContext.destNodeRef);
            assertNotNull(tags);
            assertTrue(tags.size() == 1);
            assertTrue(tags.contains(TAG_1_NAME));
            return null;
        }
    };
    transactionService.getRetryingTransactionHelper().doInTransaction(validateStep3CB);
    /**
     * Step 4 - update to add a category that already exists
     */
    logger.debug("Step 4 - add a category");
    RetryingTransactionCallback<Void> step4WriteContentCB = new RetryingTransactionCallback<Void>() {

        @Override
        public Void execute() throws Throwable {
            // 
            StoreRef workspaceSpacesStore = new StoreRef("workspace", "SpacesStore");
            Collection<ChildAssociationRef> rootCategories = categoryService.getRootCategories(workspaceSpacesStore, ASPECT_GENERAL_CLASSIFIABLE);
            NodeRef languageCategory = null;
            for (ChildAssociationRef ref : rootCategories) {
                if (ref.getQName().getLocalName().equalsIgnoreCase("LANGUAGES")) {
                    languageCategory = ref.getChildRef();
                }
            }
            assertNotNull("language category is null", languageCategory);
            ChildAssociationRef categoryRef = categoryService.getCategory(languageCategory, ASPECT_GENERAL_CLASSIFIABLE, "English");
            // Collection<ChildAssociationRef> allCategories = categoryService.getCategories(workspaceSpacesStore, ASPECT_GENERAL_CLASSIFIABLE, Depth.ANY);
            assertNotNull("ENGLISH CATEGORY REF is null", categoryRef);
            List<NodeRef> newCats = new ArrayList<NodeRef>();
            newCats.add(categoryRef.getChildRef());
            nodeService.setProperty(testContext.contentNodeRef, ContentModel.PROP_CATEGORIES, (Serializable) newCats);
            return null;
        }
    };
    RetryingTransactionCallback<Void> validateStep4CB = new RetryingTransactionCallback<Void>() {

        @Override
        public Void execute() throws Throwable {
            assertFalse("unit test stuffed up - comparing with self", testContext.destNodeRef.equals(testContext.transferMe.getNodeRef()));
            assertTrue("dest node ref does not exist", nodeService.exists(testContext.destNodeRef));
            assertTrue("destination node is missing aspect general classifiable", nodeService.hasAspect(testContext.destNodeRef, ContentModel.ASPECT_GEN_CLASSIFIABLE));
            Serializable categories = nodeService.getProperty(testContext.destNodeRef, ContentModel.PROP_CATEGORIES);
            assertNotNull("categories is missing on destination node", categories);
            return null;
        }
    };
    transactionService.getRetryingTransactionHelper().doInTransaction(step4WriteContentCB);
    transactionService.getRetryingTransactionHelper().doInTransaction(transferCB);
    transactionService.getRetryingTransactionHelper().doInTransaction(validateStep4CB);
}
Also used : Locale(java.util.Locale) StoreRef(org.alfresco.service.cmr.repository.StoreRef) Serializable(java.io.Serializable) QName(org.alfresco.service.namespace.QName) ArrayList(java.util.ArrayList) TransferTarget(org.alfresco.service.cmr.transfer.TransferTarget) ChildAssociationRef(org.alfresco.service.cmr.repository.ChildAssociationRef) TransferDefinition(org.alfresco.service.cmr.transfer.TransferDefinition) NodeRef(org.alfresco.service.cmr.repository.NodeRef) RetryingTransactionCallback(org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback) DescriptorService(org.alfresco.service.descriptor.DescriptorService) HashSet(java.util.HashSet) Category(org.junit.experimental.categories.Category) BaseSpringTestsCategory(org.alfresco.test_category.BaseSpringTestsCategory) BaseAlfrescoSpringTest(org.alfresco.util.BaseAlfrescoSpringTest) Test(org.junit.Test)

Example 18 with TransferTarget

use of org.alfresco.service.cmr.transfer.TransferTarget in project alfresco-repository by Alfresco.

the class TransferServiceImplTest method testALF6565.

/**
 * Test that if someone copies a transfer group using a client app then the getTransferTarget operations still succeed
 *
 * @throws Exception
 */
@Test
public void testALF6565() throws Exception {
    String nameA = GUID.generate();
    String nameB = GUID.generate();
    String title = "title";
    String description = "description";
    String endpointProtocol = "http";
    String endpointHost = "localhost";
    int endpointPort = 8080;
    String endpointPath = "rhubarb";
    String username = "admin";
    char[] password = "password".toCharArray();
    /**
     * Now go ahead and create our first transfer target
     */
    TransferTarget targetA = transferService.createAndSaveTransferTarget(nameA, title, description, endpointProtocol, endpointHost, endpointPort, endpointPath, username, password);
    TransferTarget targetB = transferService.createAndSaveTransferTarget(nameB, title, description, endpointProtocol, endpointHost, endpointPort, endpointPath, username, password);
    NodeRef transferHome = transferServiceImpl.getTransferHome();
    NodeRef defaultGroup = transferServiceImpl.getDefaultGroup();
    assertNotNull(defaultGroup);
    copyService.copyAndRename(defaultGroup, transferHome, ContentModel.ASSOC_CONTAINS, QName.createQName("test"), true);
    Set<TransferTarget> targets = transferService.getTransferTargets();
    int targetACount = 0;
    int targetBCount = 0;
    for (TransferTarget target : targets) {
        if (target.getName().equals(nameA))
            ++targetACount;
        if (target.getName().equals(nameB))
            ++targetBCount;
    }
    assertEquals(2, targetACount);
    assertEquals(2, targetBCount);
    assertEquals(targetA.getNodeRef(), transferService.getTransferTarget(nameA).getNodeRef());
    assertEquals(targetB.getNodeRef(), transferService.getTransferTarget(nameB).getNodeRef());
}
Also used : NodeRef(org.alfresco.service.cmr.repository.NodeRef) TransferTarget(org.alfresco.service.cmr.transfer.TransferTarget) BaseAlfrescoSpringTest(org.alfresco.util.BaseAlfrescoSpringTest) Test(org.junit.Test)

Example 19 with TransferTarget

use of org.alfresco.service.cmr.transfer.TransferTarget in project alfresco-repository by Alfresco.

the class TransferServiceToBeRefactoredTest method testTransferInvadedByLocalAlienNodes.

/**
 * Test the transfer method behaviour with respect to sync with (local) alien nodes.
 *
 * So we have Repository A transferring content and Repository B is the local repo that we
 * add and delete alien nodes.
 *
 * In general an alien node will prevent deletion of the parent folders
 *
 * <pre>
 * Tree of nodes
 *
 *      A1
 *      |      |                      |
 *      A2     A3 (Content Node)      B9 (Alien Content Node)
 *      |
 *   A4 A5 B10 (Alien Content Node)   A6
 *   |                                |
 *   A7 B11 (Alien Content Node)      A8 B12 B13 (Alien Content Node)
 *                                        |
 *                                       B14
 * </pre>
 * Test steps -
 * <ol>
 * <li>add A1, A2, A3, A4, A5, A6, A7, A8
 *   transfer(sync)</li>
 * <li>add Alien node B9.  A1 becomes Alien.</li>
 * <li>remove alien node B9.  A1 becomes non Alien.</li>
 * <li>add Alien node B10. A1 and A2 become Alien</li>
 * <li>remove Alien node B10.  A1 and A2 become non Alien</li>
 * <li>add B12 and B14 A6, A2, A1 becomes Alien</li>
 * <li>remove B14, B12, A6, A2, A1 remain Alien</li>
 * <li>add B13 A6, A2, A1 remains Alien</li>
 * <li>remove B13 A6, A2, A1 remains Alien</li>
 * <li>remove B12 A6, A2, A1 becomes non Alien.</li>
 * <li>add B9 and B10 A1 and A2 become Alien</li>
 * <li>remove B10 A2 becomes non alien A1 remains alien.</li>
 * <li>Add B11, delete A2
 * transfer sync</li>
 * (A5, A6, A7 and A8 should be deleted A2 and A4 remain since they contain alien content.)</li>
 * </ol>
 */
@Test
public void testTransferInvadedByLocalAlienNodes() throws Exception {
    final String CONTENT_TITLE = "ContentTitle";
    final Locale CONTENT_LOCALE = Locale.JAPAN;
    final String CONTENT_STRING = "Hello";
    /**
     *  For unit test
     *  - replace the HTTP transport with the in-process transport
     *  - replace the node factory with one that will map node refs, paths etc.
     *
     * Mock the transfer service to be from Repo A
     */
    TransferTransmitter transmitter = new UnitTestInProcessTransmitterImpl(receiver, contentService, transactionService);
    transferServiceImpl.setTransmitter(transmitter);
    final UnitTestTransferManifestNodeFactory testNodeFactory = new UnitTestTransferManifestNodeFactory(this.transferManifestNodeFactory);
    transferServiceImpl.setTransferManifestNodeFactory(testNodeFactory);
    List<Pair<Path, Path>> pathMap = testNodeFactory.getPathMap();
    // Map company_home/guest_home to company_home so tranferred nodes and moved "up" one level.
    pathMap.add(new Pair<Path, Path>(PathHelper.stringToPath(GUEST_HOME_XPATH_QUERY), PathHelper.stringToPath(COMPANY_HOME_XPATH_QUERY)));
    final String localRepositoryId = descriptorService.getCurrentRepositoryDescriptor().getId();
    DescriptorService mockedDescriptorService = getMockDescriptorService(REPO_ID_A);
    transferServiceImpl.setDescriptorService(mockedDescriptorService);
    /**
     * Now go ahead and create our first transfer target
     */
    final String targetName = "testSyncWithAlienNodes";
    class TestData {

        TransferTarget transferMe;

        NodeRef A1NodeRef;

        NodeRef A2NodeRef;

        NodeRef A3NodeRef;

        NodeRef A4NodeRef;

        NodeRef A5NodeRef;

        NodeRef A6NodeRef;

        NodeRef A7NodeRef;

        NodeRef A8NodeRef;

        NodeRef B9NodeRef;

        NodeRef B10NodeRef;

        NodeRef B11NodeRef;

        NodeRef B12NodeRef;

        NodeRef B13NodeRef;

        NodeRef B14NodeRef;

        NodeRef destNodeRef;
    }
    final TestData testData = new TestData();
    transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Void>() {

        @Override
        public Void execute() throws Throwable {
            NodeRef guestHome = repositoryHelper.getGuestHome();
            /**
             * Create a test nodes A1 through A8 that we will read and write
             */
            {
                // Node A1
                String name = GUID.generate();
                ChildAssociationRef child = nodeService.createNode(guestHome, ContentModel.ASSOC_CONTAINS, QName.createQName(name), ContentModel.TYPE_FOLDER);
                testData.A1NodeRef = child.getChildRef();
                nodeService.setProperty(testData.A1NodeRef, ContentModel.PROP_TITLE, CONTENT_TITLE);
                nodeService.setProperty(testData.A1NodeRef, ContentModel.PROP_NAME, name);
            }
            {
                // Node A2
                ChildAssociationRef child = nodeService.createNode(testData.A1NodeRef, ContentModel.ASSOC_CONTAINS, QName.createQName("A2"), ContentModel.TYPE_FOLDER);
                testData.A2NodeRef = child.getChildRef();
                nodeService.setProperty(testData.A2NodeRef, ContentModel.PROP_TITLE, CONTENT_TITLE);
                nodeService.setProperty(testData.A2NodeRef, ContentModel.PROP_NAME, "A2");
            }
            {
                // Node A3
                ChildAssociationRef child = nodeService.createNode(testData.A1NodeRef, ContentModel.ASSOC_CONTAINS, QName.createQName("A3"), ContentModel.TYPE_CONTENT);
                testData.A3NodeRef = child.getChildRef();
                nodeService.setProperty(testData.A3NodeRef, ContentModel.PROP_TITLE, CONTENT_TITLE);
                nodeService.setProperty(testData.A3NodeRef, ContentModel.PROP_NAME, "A3");
                ContentWriter writer = contentService.getWriter(testData.A3NodeRef, ContentModel.PROP_CONTENT, true);
                writer.setLocale(CONTENT_LOCALE);
                writer.putContent(CONTENT_STRING);
            }
            {
                // Node A4
                ChildAssociationRef child = nodeService.createNode(testData.A2NodeRef, ContentModel.ASSOC_CONTAINS, QName.createQName("A4"), ContentModel.TYPE_FOLDER);
                testData.A4NodeRef = child.getChildRef();
                nodeService.setProperty(testData.A4NodeRef, ContentModel.PROP_TITLE, CONTENT_TITLE);
                nodeService.setProperty(testData.A4NodeRef, ContentModel.PROP_NAME, "A4");
            }
            {
                // Node A5
                ChildAssociationRef child = nodeService.createNode(testData.A2NodeRef, ContentModel.ASSOC_CONTAINS, QName.createQName("A5"), ContentModel.TYPE_CONTENT);
                testData.A5NodeRef = child.getChildRef();
                nodeService.setProperty(testData.A5NodeRef, ContentModel.PROP_TITLE, CONTENT_TITLE);
                nodeService.setProperty(testData.A5NodeRef, ContentModel.PROP_NAME, "A5");
                ContentWriter writer = contentService.getWriter(testData.A5NodeRef, ContentModel.PROP_CONTENT, true);
                writer.setLocale(CONTENT_LOCALE);
                writer.putContent(CONTENT_STRING);
            }
            {
                // Node A6
                ChildAssociationRef child = nodeService.createNode(testData.A2NodeRef, ContentModel.ASSOC_CONTAINS, QName.createQName("A6"), ContentModel.TYPE_FOLDER);
                testData.A6NodeRef = child.getChildRef();
                nodeService.setProperty(testData.A6NodeRef, ContentModel.PROP_TITLE, CONTENT_TITLE);
                nodeService.setProperty(testData.A6NodeRef, ContentModel.PROP_NAME, "A6");
            }
            {
                // Node A7
                ChildAssociationRef child = nodeService.createNode(testData.A4NodeRef, ContentModel.ASSOC_CONTAINS, QName.createQName("A7"), ContentModel.TYPE_CONTENT);
                testData.A7NodeRef = child.getChildRef();
                nodeService.setProperty(testData.A7NodeRef, ContentModel.PROP_TITLE, CONTENT_TITLE);
                nodeService.setProperty(testData.A7NodeRef, ContentModel.PROP_NAME, "A7");
                ContentWriter writer = contentService.getWriter(testData.A7NodeRef, ContentModel.PROP_CONTENT, true);
                writer.setLocale(CONTENT_LOCALE);
                writer.putContent(CONTENT_STRING);
            }
            {
                // Node A8
                ChildAssociationRef child = nodeService.createNode(testData.A6NodeRef, ContentModel.ASSOC_CONTAINS, QName.createQName("A8"), ContentModel.TYPE_CONTENT);
                testData.A8NodeRef = child.getChildRef();
                nodeService.setProperty(testData.A8NodeRef, ContentModel.PROP_TITLE, CONTENT_TITLE);
                nodeService.setProperty(testData.A8NodeRef, ContentModel.PROP_NAME, "A8");
                ContentWriter writer = contentService.getWriter(testData.A8NodeRef, ContentModel.PROP_CONTENT, true);
                writer.setLocale(CONTENT_LOCALE);
                writer.putContent(CONTENT_STRING);
            }
            // Create the transfer target if it does not already exist
            if (!transferService.targetExists(targetName)) {
                testData.transferMe = createTransferTarget(targetName);
            } else {
                testData.transferMe = transferService.getTransferTarget(targetName);
            }
            return null;
        }
    });
    /**
     * Step 1. add A1, A2, A3, A4, A5, A6, A7, A8 transfer(sync)
     */
    transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Void>() {

        @Override
        public Void execute() throws Throwable {
            /**
             * Transfer Nodes A1 through A8
             */
            {
                TransferDefinition definition = new TransferDefinition();
                Set<NodeRef> nodes = new HashSet<NodeRef>();
                nodes.add(testData.A1NodeRef);
                nodes.add(testData.A2NodeRef);
                nodes.add(testData.A3NodeRef);
                nodes.add(testData.A4NodeRef);
                nodes.add(testData.A5NodeRef);
                nodes.add(testData.A6NodeRef);
                nodes.add(testData.A7NodeRef);
                nodes.add(testData.A8NodeRef);
                definition.setNodes(nodes);
                definition.setSync(true);
                transferService.transfer(targetName, definition);
            }
            return null;
        }
    });
    transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Void>() {

        @Override
        public Void execute() throws Throwable {
            // Now validate that the target node exists and has similar properties to the source
            NodeRef A1destNodeRef = testNodeFactory.getMappedNodeRef(testData.A1NodeRef);
            assertFalse("unit test stuffed up - comparing with self", A1destNodeRef.equals(testData.transferMe.getNodeRef()));
            assertTrue("dest node ref does not exist", nodeService.exists(A1destNodeRef));
            assertEquals("title is wrong", (String) nodeService.getProperty(A1destNodeRef, ContentModel.PROP_TITLE), CONTENT_TITLE);
            assertEquals("type is wrong", nodeService.getType(testData.A1NodeRef), nodeService.getType(A1destNodeRef));
            assertFalse("A1 is alien", nodeService.hasAspect(A1destNodeRef, TransferModel.ASPECT_ALIEN));
            // Check injected transferred aspect.
            assertNotNull("transferredAspect", (String) nodeService.getProperty(A1destNodeRef, TransferModel.PROP_REPOSITORY_ID));
            return null;
        }
    });
    /**
     * Step 2 add Alien node B9 child of A1(dest). A1(dest) becomes Alien because it contains an alien child.
     */
    transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Void>() {

        @Override
        public Void execute() throws Throwable {
            testData.destNodeRef = testNodeFactory.getMappedNodeRef(testData.A1NodeRef);
            ChildAssociationRef child = nodeService.createNode(testData.destNodeRef, ContentModel.ASSOC_CONTAINS, QName.createQName("B9"), ContentModel.TYPE_CONTENT);
            testData.B9NodeRef = child.getChildRef();
            nodeService.setProperty(testData.B9NodeRef, ContentModel.PROP_TITLE, CONTENT_TITLE);
            nodeService.setProperty(testData.B9NodeRef, ContentModel.PROP_NAME, "B9");
            ContentWriter writer = contentService.getWriter(testData.B9NodeRef, ContentModel.PROP_CONTENT, true);
            writer.setLocale(CONTENT_LOCALE);
            writer.putContent(CONTENT_STRING);
            return null;
        }
    });
    transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Void>() {

        @Override
        public Void execute() throws Throwable {
            // Now validate that the target node exists and has similar properties to the source
            NodeRef A1destNodeRef = testNodeFactory.getMappedNodeRef(testData.A1NodeRef);
            assertTrue("dest node ref does not exist", nodeService.exists(A1destNodeRef));
            // Check injected transferred aspect.
            assertTrue("node A1 is not alien aspect", (Boolean) nodeService.hasAspect(A1destNodeRef, TransferModel.ASPECT_ALIEN));
            assertNotNull("repository id is null", (String) nodeService.getProperty(A1destNodeRef, TransferModel.PROP_REPOSITORY_ID));
            assertNotNull("from repository id is null", (String) nodeService.getProperty(A1destNodeRef, TransferModel.PROP_FROM_REPOSITORY_ID));
            assertTrue("node B9 is not alien", (Boolean) nodeService.hasAspect(testData.B9NodeRef, TransferModel.ASPECT_ALIEN));
            // Temp code
            @SuppressWarnings("unchecked") List<String> invaders = (List<String>) nodeService.getProperty(A1destNodeRef, TransferModel.PROP_INVADED_BY);
            assertTrue("invaders contains local repository Id", invaders.contains(localRepositoryId));
            assertFalse("invaders contains REPO_ID_A", invaders.contains(REPO_ID_A));
            return null;
        }
    });
    /**
     * Step 3 remove alien node B9. A1 becomes non Alien.
     */
    transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Void>() {

        @Override
        public Void execute() throws Throwable {
            logger.debug("delete node B9");
            nodeService.deleteNode(testData.B9NodeRef);
            return null;
        }
    });
    transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Void>() {

        @Override
        public Void execute() throws Throwable {
            NodeRef A1destNodeRef = testNodeFactory.getMappedNodeRef(testData.A1NodeRef);
            NodeRef A3destNodeRef = testNodeFactory.getMappedNodeRef(testData.A3NodeRef);
            @SuppressWarnings({ "unused", "unchecked" }) List<String> invaders = (List<String>) nodeService.getProperty(A1destNodeRef, TransferModel.PROP_INVADED_BY);
            assertTrue("dest node ref does not exist", nodeService.exists(A1destNodeRef));
            assertFalse("node A1 is still alien", (Boolean) nodeService.hasAspect(A1destNodeRef, TransferModel.ASPECT_ALIEN));
            assertFalse("node A3 is alien", (Boolean) nodeService.hasAspect(A3destNodeRef, TransferModel.ASPECT_ALIEN));
            assertNotNull("repository id is null", (String) nodeService.getProperty(A1destNodeRef, TransferModel.PROP_REPOSITORY_ID));
            assertNotNull("from repository id is null", (String) nodeService.getProperty(A1destNodeRef, TransferModel.PROP_FROM_REPOSITORY_ID));
            return null;
        }
    });
    /**
     * 4 add Alien node B10 child of A2. A1 and A2 become Alien
     */
    transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Void>() {

        @Override
        public Void execute() throws Throwable {
            testData.destNodeRef = testNodeFactory.getMappedNodeRef(testData.A2NodeRef);
            ChildAssociationRef child = nodeService.createNode(testData.destNodeRef, ContentModel.ASSOC_CONTAINS, QName.createQName("B10"), ContentModel.TYPE_CONTENT);
            testData.B10NodeRef = child.getChildRef();
            nodeService.setProperty(testData.B10NodeRef, ContentModel.PROP_TITLE, CONTENT_TITLE);
            nodeService.setProperty(testData.B10NodeRef, ContentModel.PROP_NAME, "B10");
            ContentWriter writer = contentService.getWriter(testData.B10NodeRef, ContentModel.PROP_CONTENT, true);
            writer.setLocale(CONTENT_LOCALE);
            writer.putContent(CONTENT_STRING);
            return null;
        }
    });
    transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Void>() {

        @Override
        public Void execute() throws Throwable {
            // Now validate that the target node exists and has similar properties to the source
            NodeRef A1destNodeRef = testNodeFactory.getMappedNodeRef(testData.A1NodeRef);
            NodeRef A2destNodeRef = testNodeFactory.getMappedNodeRef(testData.A2NodeRef);
            assertTrue("node A1 is not alien aspect", (Boolean) nodeService.hasAspect(A1destNodeRef, TransferModel.ASPECT_ALIEN));
            assertTrue("node A2 is not alien aspect", (Boolean) nodeService.hasAspect(A2destNodeRef, TransferModel.ASPECT_ALIEN));
            return null;
        }
    });
    /**
     * 5 remove Alien node B10. A1 and A2 become non Alien
     */
    transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Void>() {

        @Override
        public Void execute() throws Throwable {
            logger.debug("delete node B10");
            nodeService.deleteNode(testData.B10NodeRef);
            return null;
        }
    });
    transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Void>() {

        @Override
        public Void execute() throws Throwable {
            // Now validate that the target node exists and has similar properties to the source
            NodeRef A1destNodeRef = testNodeFactory.getMappedNodeRef(testData.A1NodeRef);
            NodeRef A2destNodeRef = testNodeFactory.getMappedNodeRef(testData.A2NodeRef);
            assertFalse("node A1 is still alien aspect", (Boolean) nodeService.hasAspect(A1destNodeRef, TransferModel.ASPECT_ALIEN));
            assertFalse("node A2 is still alien aspect", (Boolean) nodeService.hasAspect(A2destNodeRef, TransferModel.ASPECT_ALIEN));
            return null;
        }
    });
    /**
     * Step 6 add B12 (child of A6) and B14 A6, A2, A1 becomes Alien
     */
    transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Void>() {

        @Override
        public Void execute() throws Throwable {
            testData.destNodeRef = testNodeFactory.getMappedNodeRef(testData.A6NodeRef);
            ChildAssociationRef child = nodeService.createNode(testData.destNodeRef, ContentModel.ASSOC_CONTAINS, QName.createQName("B12"), ContentModel.TYPE_FOLDER);
            testData.B12NodeRef = child.getChildRef();
            nodeService.setProperty(testData.B12NodeRef, ContentModel.PROP_TITLE, CONTENT_TITLE);
            nodeService.setProperty(testData.B12NodeRef, ContentModel.PROP_NAME, "B12");
            child = nodeService.createNode(testData.B12NodeRef, ContentModel.ASSOC_CONTAINS, QName.createQName("B14"), ContentModel.TYPE_CONTENT);
            testData.B14NodeRef = child.getChildRef();
            nodeService.setProperty(testData.B14NodeRef, ContentModel.PROP_TITLE, CONTENT_TITLE);
            nodeService.setProperty(testData.B14NodeRef, ContentModel.PROP_NAME, "B14");
            return null;
        }
    });
    transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Void>() {

        @Override
        public Void execute() throws Throwable {
            // Now validate that the target node exists and has similar properties to the source
            NodeRef A1destNodeRef = testNodeFactory.getMappedNodeRef(testData.A1NodeRef);
            NodeRef A2destNodeRef = testNodeFactory.getMappedNodeRef(testData.A2NodeRef);
            NodeRef A6destNodeRef = testNodeFactory.getMappedNodeRef(testData.A6NodeRef);
            assertTrue("node A1 is not alien", (Boolean) nodeService.hasAspect(A1destNodeRef, TransferModel.ASPECT_ALIEN));
            assertTrue("node A2 is not alien", (Boolean) nodeService.hasAspect(A2destNodeRef, TransferModel.ASPECT_ALIEN));
            assertTrue("node A6 is not alien", (Boolean) nodeService.hasAspect(A6destNodeRef, TransferModel.ASPECT_ALIEN));
            assertTrue("node B14 is not alien", (Boolean) nodeService.hasAspect(testData.B14NodeRef, TransferModel.ASPECT_ALIEN));
            assertTrue("node B12 is not alien", (Boolean) nodeService.hasAspect(testData.B12NodeRef, TransferModel.ASPECT_ALIEN));
            return null;
        }
    });
    /**
     * Step 7 Delete B14. B12 remains alien
     */
    transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Void>() {

        @Override
        public Void execute() throws Throwable {
            nodeService.deleteNode(testData.B14NodeRef);
            return null;
        }
    });
    transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Void>() {

        @Override
        public Void execute() throws Throwable {
            // Now validate that the target node exists and has similar properties to the source
            NodeRef A1destNodeRef = testNodeFactory.getMappedNodeRef(testData.A1NodeRef);
            NodeRef A2destNodeRef = testNodeFactory.getMappedNodeRef(testData.A2NodeRef);
            NodeRef A6destNodeRef = testNodeFactory.getMappedNodeRef(testData.A6NodeRef);
            assertTrue("node A1 is not alien", (Boolean) nodeService.hasAspect(A1destNodeRef, TransferModel.ASPECT_ALIEN));
            assertTrue("node A2 is not alien", (Boolean) nodeService.hasAspect(A2destNodeRef, TransferModel.ASPECT_ALIEN));
            assertTrue("node A6 is not alien", (Boolean) nodeService.hasAspect(A6destNodeRef, TransferModel.ASPECT_ALIEN));
            assertTrue("node B12 is not alien", (Boolean) nodeService.hasAspect(testData.B12NodeRef, TransferModel.ASPECT_ALIEN));
            return null;
        }
    });
    /**
     * Step 8 add B13 A6, A2, A1 remains Alien
     */
    transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Void>() {

        @Override
        public Void execute() throws Throwable {
            testData.destNodeRef = testNodeFactory.getMappedNodeRef(testData.A6NodeRef);
            ChildAssociationRef child = nodeService.createNode(testData.destNodeRef, ContentModel.ASSOC_CONTAINS, QName.createQName("B13"), ContentModel.TYPE_CONTENT);
            testData.B13NodeRef = child.getChildRef();
            nodeService.setProperty(testData.B13NodeRef, ContentModel.PROP_TITLE, CONTENT_TITLE);
            nodeService.setProperty(testData.B13NodeRef, ContentModel.PROP_NAME, "B13");
            ContentWriter writer = contentService.getWriter(testData.B13NodeRef, ContentModel.PROP_CONTENT, true);
            writer.setLocale(CONTENT_LOCALE);
            writer.putContent(CONTENT_STRING);
            return null;
        }
    });
    transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Void>() {

        @Override
        public Void execute() throws Throwable {
            // Now validate that the target node exists and has similar properties to the source
            NodeRef A1destNodeRef = testNodeFactory.getMappedNodeRef(testData.A1NodeRef);
            NodeRef A2destNodeRef = testNodeFactory.getMappedNodeRef(testData.A2NodeRef);
            NodeRef A6destNodeRef = testNodeFactory.getMappedNodeRef(testData.A6NodeRef);
            assertTrue("node A1 is not alien", (Boolean) nodeService.hasAspect(A1destNodeRef, TransferModel.ASPECT_ALIEN));
            assertTrue("node A2 is not alien", (Boolean) nodeService.hasAspect(A2destNodeRef, TransferModel.ASPECT_ALIEN));
            assertTrue("node A6 is not alien", (Boolean) nodeService.hasAspect(A6destNodeRef, TransferModel.ASPECT_ALIEN));
            return null;
        }
    });
    /**
     * Step 9 remove B13 A6, A2, A1 remains Alien Due to B12
     */
    transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Void>() {

        @Override
        public Void execute() throws Throwable {
            nodeService.deleteNode(testData.B13NodeRef);
            return null;
        }
    });
    transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Void>() {

        @Override
        public Void execute() throws Throwable {
            // Now validate that the target node exists and has similar properties to the source
            NodeRef A1destNodeRef = testNodeFactory.getMappedNodeRef(testData.A1NodeRef);
            NodeRef A2destNodeRef = testNodeFactory.getMappedNodeRef(testData.A2NodeRef);
            NodeRef A6destNodeRef = testNodeFactory.getMappedNodeRef(testData.A6NodeRef);
            assertTrue("node A1 is not alien", (Boolean) nodeService.hasAspect(A1destNodeRef, TransferModel.ASPECT_ALIEN));
            assertTrue("node A2 is not alien", (Boolean) nodeService.hasAspect(A2destNodeRef, TransferModel.ASPECT_ALIEN));
            assertTrue("node A6 is not alien", (Boolean) nodeService.hasAspect(A6destNodeRef, TransferModel.ASPECT_ALIEN));
            return null;
        }
    });
    /**
     * Step 10 remove B12 A6, A2, A1 becomes non Alien.
     */
    transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Void>() {

        @Override
        public Void execute() throws Throwable {
            nodeService.deleteNode(testData.B12NodeRef);
            return null;
        }
    });
    transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Void>() {

        @Override
        public Void execute() throws Throwable {
            // Now validate that the target node exists and has similar properties to the source
            NodeRef A1destNodeRef = testNodeFactory.getMappedNodeRef(testData.A1NodeRef);
            NodeRef A2destNodeRef = testNodeFactory.getMappedNodeRef(testData.A2NodeRef);
            NodeRef A6destNodeRef = testNodeFactory.getMappedNodeRef(testData.A6NodeRef);
            assertFalse("node A1 is still alien", (Boolean) nodeService.hasAspect(A1destNodeRef, TransferModel.ASPECT_ALIEN));
            assertFalse("node A2 is still alien", (Boolean) nodeService.hasAspect(A2destNodeRef, TransferModel.ASPECT_ALIEN));
            assertFalse("node A6 is still alien", (Boolean) nodeService.hasAspect(A6destNodeRef, TransferModel.ASPECT_ALIEN));
            return null;
        }
    });
    /**
     * Step 11 add B9 and B10 A1 and A2 become Alien
     */
    transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Void>() {

        @Override
        public Void execute() throws Throwable {
            testData.destNodeRef = testNodeFactory.getMappedNodeRef(testData.A1NodeRef);
            ChildAssociationRef child = nodeService.createNode(testData.destNodeRef, ContentModel.ASSOC_CONTAINS, QName.createQName("B9"), ContentModel.TYPE_CONTENT);
            testData.B9NodeRef = child.getChildRef();
            nodeService.setProperty(testData.B9NodeRef, ContentModel.PROP_TITLE, CONTENT_TITLE);
            nodeService.setProperty(testData.B9NodeRef, ContentModel.PROP_NAME, "B9");
            ContentWriter writer = contentService.getWriter(testData.B9NodeRef, ContentModel.PROP_CONTENT, true);
            writer.setLocale(CONTENT_LOCALE);
            writer.putContent(CONTENT_STRING);
            testData.destNodeRef = testNodeFactory.getMappedNodeRef(testData.A2NodeRef);
            child = nodeService.createNode(testData.destNodeRef, ContentModel.ASSOC_CONTAINS, QName.createQName("B10"), ContentModel.TYPE_CONTENT);
            testData.B10NodeRef = child.getChildRef();
            nodeService.setProperty(testData.B10NodeRef, ContentModel.PROP_TITLE, CONTENT_TITLE);
            nodeService.setProperty(testData.B10NodeRef, ContentModel.PROP_NAME, "B10");
            writer = contentService.getWriter(testData.B10NodeRef, ContentModel.PROP_CONTENT, true);
            writer.setLocale(CONTENT_LOCALE);
            writer.putContent(CONTENT_STRING);
            return null;
        }
    });
    transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Void>() {

        @Override
        public Void execute() throws Throwable {
            // Now validate that the target node exists and has similar properties to the source
            NodeRef A1destNodeRef = testNodeFactory.getMappedNodeRef(testData.A1NodeRef);
            NodeRef A2destNodeRef = testNodeFactory.getMappedNodeRef(testData.A2NodeRef);
            assertTrue("node A1 is not alien", (Boolean) nodeService.hasAspect(A1destNodeRef, TransferModel.ASPECT_ALIEN));
            assertTrue("node A2 is not alien", (Boolean) nodeService.hasAspect(A2destNodeRef, TransferModel.ASPECT_ALIEN));
            return null;
        }
    });
    /**
     * Step 12 remove B10 A2 becomes non alien A1 remains alien.
     */
    transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Void>() {

        @Override
        public Void execute() throws Throwable {
            nodeService.deleteNode(testData.B10NodeRef);
            return null;
        }
    });
    transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Void>() {

        @Override
        public Void execute() throws Throwable {
            // Now validate that the target node exists and has similar properties to the source
            NodeRef A1destNodeRef = testNodeFactory.getMappedNodeRef(testData.A1NodeRef);
            NodeRef A2destNodeRef = testNodeFactory.getMappedNodeRef(testData.A2NodeRef);
            // BUGBUG
            assertTrue("node A1 is still alien", (Boolean) nodeService.hasAspect(A1destNodeRef, TransferModel.ASPECT_ALIEN));
            assertFalse("node A2 is still alien", (Boolean) nodeService.hasAspect(A2destNodeRef, TransferModel.ASPECT_ALIEN));
            return null;
        }
    });
    /**
     * 13 Add Alien node B11.
     */
    logger.debug("Step 12 Add Node B11, Delete A2 and sync");
    transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Void>() {

        @Override
        public Void execute() throws Throwable {
            testData.destNodeRef = testNodeFactory.getMappedNodeRef(testData.A4NodeRef);
            ChildAssociationRef child = nodeService.createNode(testData.destNodeRef, ContentModel.ASSOC_CONTAINS, QName.createQName("B11"), ContentModel.TYPE_CONTENT);
            testData.B11NodeRef = child.getChildRef();
            nodeService.setProperty(testData.B11NodeRef, ContentModel.PROP_TITLE, CONTENT_TITLE);
            nodeService.setProperty(testData.B11NodeRef, ContentModel.PROP_NAME, "B11");
            ContentWriter writer = contentService.getWriter(testData.B11NodeRef, ContentModel.PROP_CONTENT, true);
            writer.setLocale(CONTENT_LOCALE);
            writer.putContent(CONTENT_STRING);
            nodeService.deleteNode(testData.A2NodeRef);
            return null;
        }
    });
    /**
     * Step 14 delete A2 (will cascade delete A4, A5, A6, A7, A8 transfer sync (A5, A6, A7, A8 and should be deleted
     * A2 and A4 remain since they contain alien content.)
     */
    transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Void>() {

        @Override
        public Void execute() throws Throwable {
            // Now validate A1, A2 and A4 are alien
            NodeRef A1destNodeRef = testNodeFactory.getMappedNodeRef(testData.A1NodeRef);
            NodeRef A2destNodeRef = testNodeFactory.getMappedNodeRef(testData.A2NodeRef);
            NodeRef A4destNodeRef = testNodeFactory.getMappedNodeRef(testData.A4NodeRef);
            assertTrue("node A1 is not alien", (Boolean) nodeService.hasAspect(A1destNodeRef, TransferModel.ASPECT_ALIEN));
            assertTrue("node A2 is not alien", (Boolean) nodeService.hasAspect(A2destNodeRef, TransferModel.ASPECT_ALIEN));
            assertTrue("node A4 is not alien", (Boolean) nodeService.hasAspect(A4destNodeRef, TransferModel.ASPECT_ALIEN));
            assertFalse("test error: node A2 not deleted", nodeService.exists(testData.A2NodeRef));
            assertFalse("test error: node A4 not deleted", nodeService.exists(testData.A4NodeRef));
            assertFalse("test error: node A5 not deleted", nodeService.exists(testData.A5NodeRef));
            assertFalse("test error: node A6 not deleted", nodeService.exists(testData.A6NodeRef));
            assertFalse("test error: node A7 not deleted", nodeService.exists(testData.A7NodeRef));
            assertFalse("test error: node A8 not deleted", nodeService.exists(testData.A8NodeRef));
            assertTrue("test error: node does not exist", nodeService.exists(testData.A3NodeRef));
            /**
             * Transfer Nodes A1 through A8
             */
            {
                TransferDefinition definition = new TransferDefinition();
                Set<NodeRef> nodes = new HashSet<NodeRef>();
                nodes.add(testData.A1NodeRef);
                nodes.add(testData.A3NodeRef);
                definition.setNodes(nodes);
                definition.setSync(true);
                transferService.transfer(targetName, definition);
            }
            return null;
        }
    });
    transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Void>() {

        @Override
        public Void execute() throws Throwable {
            // Now validate that the target node exists and has similar properties to the source
            NodeRef A1destNodeRef = testNodeFactory.getMappedNodeRef(testData.A1NodeRef);
            NodeRef A2destNodeRef = testNodeFactory.getMappedNodeRef(testData.A2NodeRef);
            NodeRef A3destNodeRef = testNodeFactory.getMappedNodeRef(testData.A3NodeRef);
            NodeRef A4destNodeRef = testNodeFactory.getMappedNodeRef(testData.A4NodeRef);
            NodeRef A5destNodeRef = testNodeFactory.getMappedNodeRef(testData.A5NodeRef);
            NodeRef A6destNodeRef = testNodeFactory.getMappedNodeRef(testData.A6NodeRef);
            NodeRef A7destNodeRef = testNodeFactory.getMappedNodeRef(testData.A7NodeRef);
            NodeRef A8destNodeRef = testNodeFactory.getMappedNodeRef(testData.A8NodeRef);
            assertTrue("node A1 not alien", (Boolean) nodeService.hasAspect(A1destNodeRef, TransferModel.ASPECT_ALIEN));
            assertTrue("node A2 not alien", (Boolean) nodeService.hasAspect(A2destNodeRef, TransferModel.ASPECT_ALIEN));
            assertTrue("node A4 not alien", (Boolean) nodeService.hasAspect(A4destNodeRef, TransferModel.ASPECT_ALIEN));
            assertTrue("node B11 does not exist", nodeService.exists(testData.B11NodeRef));
            assertTrue("node A3 deleted", nodeService.exists(A3destNodeRef));
            assertFalse("node A5 not deleted", nodeService.exists(A5destNodeRef));
            assertFalse("node A6 not deleted", nodeService.exists(A6destNodeRef));
            assertFalse("node A7 not deleted", nodeService.exists(A7destNodeRef));
            assertFalse("node A8 not deleted", nodeService.exists(A8destNodeRef));
            return null;
        }
    });
}
Also used : Locale(java.util.Locale) Path(org.alfresco.service.cmr.repository.Path) TransferTarget(org.alfresco.service.cmr.transfer.TransferTarget) ChildAssociationRef(org.alfresco.service.cmr.repository.ChildAssociationRef) TransferDefinition(org.alfresco.service.cmr.transfer.TransferDefinition) NodeRef(org.alfresco.service.cmr.repository.NodeRef) ContentWriter(org.alfresco.service.cmr.repository.ContentWriter) List(java.util.List) ArrayList(java.util.ArrayList) DescriptorService(org.alfresco.service.descriptor.DescriptorService) Pair(org.alfresco.util.Pair) HashSet(java.util.HashSet) BaseAlfrescoSpringTest(org.alfresco.util.BaseAlfrescoSpringTest) Test(org.junit.Test)

Example 20 with TransferTarget

use of org.alfresco.service.cmr.transfer.TransferTarget in project alfresco-repository by Alfresco.

the class TransferServiceToBeRefactoredTest method testLocalAlienRestore.

/**
 * Test restore of a local node.
 * <pre>
 * Tree of nodes
 *     A1   B1
 *     |
 *     B2
 *     |
 *     B3
 * <pre>
 * <ol>
 *     <li>Add B2.   A1 is alien.</li>
 *     <li>Delete B2.  A1 not alien</li>
 *     <li>Restore B2. A1 is alien</li>
 *     <li>Add B3.  A1 is alien</li>
 *     <li>Delete B2.  A1 not alien</li>
 *     <li>Restore to B1.  B2 and B3 not alien.</li>
 * </ol>
 * @throws Exception
 */
@Test
public void testLocalAlienRestore() throws Exception {
    final String CONTENT_TITLE = "ContentTitle";
    /**
     * Now go ahead and create our first transfer target
     */
    final String targetName = "testRestoreOfAlienNodes";
    class TestData {

        @SuppressWarnings("unused")
        TransferTarget transferMe;

        NodeRef S0NodeRef;

        NodeRef A0NodeRef;

        NodeRef A1NodeRef;

        NodeRef B1NodeRef;

        NodeRef B2NodeRef;

        NodeRef B3NodeRef;

        NodeRef destNodeRef;
    }
    final TestData testData = new TestData();
    transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Void>() {

        @Override
        public Void execute() throws Throwable {
            NodeRef guestHome = repositoryHelper.getGuestHome();
            /**
             * Create a test nodes A1 through A8 that we will read and write
             */
            {
                // Node S0
                String name = GUID.generate();
                ChildAssociationRef child = nodeService.createNode(guestHome, ContentModel.ASSOC_CONTAINS, QName.createQName(name), ContentModel.TYPE_FOLDER);
                testData.S0NodeRef = child.getChildRef();
                nodeService.setProperty(testData.S0NodeRef, ContentModel.PROP_TITLE, CONTENT_TITLE);
                nodeService.setProperty(testData.S0NodeRef, ContentModel.PROP_NAME, name);
            }
            {
                // Node A1
                ChildAssociationRef child = nodeService.createNode(testData.S0NodeRef, ContentModel.ASSOC_CONTAINS, QName.createQName("A0"), ContentModel.TYPE_FOLDER);
                testData.A0NodeRef = child.getChildRef();
                nodeService.setProperty(testData.A0NodeRef, ContentModel.PROP_TITLE, CONTENT_TITLE);
                nodeService.setProperty(testData.A0NodeRef, ContentModel.PROP_NAME, "A0");
            }
            {
                // Node A1
                ChildAssociationRef child = nodeService.createNode(testData.A0NodeRef, ContentModel.ASSOC_CONTAINS, QName.createQName("A1"), ContentModel.TYPE_FOLDER);
                testData.A1NodeRef = child.getChildRef();
                nodeService.setProperty(testData.A1NodeRef, ContentModel.PROP_TITLE, CONTENT_TITLE);
                nodeService.setProperty(testData.A1NodeRef, ContentModel.PROP_NAME, "A1");
            }
            {
                // Node B1
                ChildAssociationRef child = nodeService.createNode(testData.S0NodeRef, ContentModel.ASSOC_CONTAINS, QName.createQName("B1"), ContentModel.TYPE_FOLDER);
                testData.B1NodeRef = child.getChildRef();
                nodeService.setProperty(testData.B1NodeRef, ContentModel.PROP_TITLE, CONTENT_TITLE);
                nodeService.setProperty(testData.B1NodeRef, ContentModel.PROP_NAME, "B1");
            }
            // Create the transfer target if it does not already exist
            if (!transferService.targetExists(targetName)) {
                testData.transferMe = createTransferTarget(targetName);
            } else {
                testData.transferMe = transferService.getTransferTarget(targetName);
            }
            return null;
        }
    });
    /**
     *  For unit test
     *  - replace the HTTP transport with the in-process transport
     *  - replace the node factory with one that will map node refs, paths etc.
     *
     * Mock the transfer service to be from Repo A
     */
    TransferTransmitter transmitter = new UnitTestInProcessTransmitterImpl(receiver, contentService, transactionService);
    transferServiceImpl.setTransmitter(transmitter);
    final UnitTestTransferManifestNodeFactory testNodeFactory = new UnitTestTransferManifestNodeFactory(this.transferManifestNodeFactory);
    transferServiceImpl.setTransferManifestNodeFactory(testNodeFactory);
    final List<Pair<Path, Path>> pathMap = testNodeFactory.getPathMap();
    transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Void>() {

        @Override
        public Void execute() throws Throwable {
            pathMap.add(new Pair<Path, Path>(nodeService.getPath(testData.A0NodeRef), nodeService.getPath(testData.B1NodeRef)));
            return null;
        }
    });
    DescriptorService mockedDescriptorService = getMockDescriptorService(REPO_ID_A);
    transferServiceImpl.setDescriptorService(mockedDescriptorService);
    /**
     * Step 1. add A1 transfer(sync)
     */
    transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Void>() {

        @Override
        public Void execute() throws Throwable {
            /**
             * Transfer Nodes A1
             */
            {
                TransferDefinition definition = new TransferDefinition();
                Set<NodeRef> nodes = new HashSet<NodeRef>();
                nodes.add(testData.A1NodeRef);
                definition.setNodes(nodes);
                definition.setSync(true);
                transferService.transfer(targetName, definition);
            }
            return null;
        }
    });
    transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Void>() {

        @Override
        public Void execute() throws Throwable {
            // Now validate that the target node exists and has similar properties to the source
            NodeRef A1destNodeRef = testNodeFactory.getMappedNodeRef(testData.A1NodeRef);
            assertTrue("dest node ref does not exist", nodeService.exists(A1destNodeRef));
            assertFalse("A1 is alien", nodeService.hasAspect(A1destNodeRef, TransferModel.ASPECT_ALIEN));
            // Check injected transferred aspect.
            assertNotNull("transferredAspect", (String) nodeService.getProperty(A1destNodeRef, TransferModel.PROP_REPOSITORY_ID));
            return null;
        }
    });
    /**
     * Step 2 add Alien node B1 child of A1(dest).
     */
    transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Void>() {

        @Override
        public Void execute() throws Throwable {
            testData.destNodeRef = testNodeFactory.getMappedNodeRef(testData.A1NodeRef);
            ChildAssociationRef child = nodeService.createNode(testData.destNodeRef, ContentModel.ASSOC_CONTAINS, QName.createQName("B2"), ContentModel.TYPE_FOLDER);
            testData.B2NodeRef = child.getChildRef();
            nodeService.setProperty(testData.B2NodeRef, ContentModel.PROP_TITLE, CONTENT_TITLE);
            nodeService.setProperty(testData.B2NodeRef, ContentModel.PROP_NAME, "B2");
            return null;
        }
    });
    transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Void>() {

        @Override
        public Void execute() throws Throwable {
            // Now validate that the target node exists and has similar properties to the source
            NodeRef A1destNodeRef = testNodeFactory.getMappedNodeRef(testData.A1NodeRef);
            assertTrue("dest node ref does not exist", nodeService.exists(A1destNodeRef));
            // Check injected transferred aspect.
            assertTrue("node A1 is not alien aspect", (Boolean) nodeService.hasAspect(A1destNodeRef, TransferModel.ASPECT_ALIEN));
            assertNotNull("repository id is null", (String) nodeService.getProperty(A1destNodeRef, TransferModel.PROP_REPOSITORY_ID));
            assertNotNull("from repository id is null", (String) nodeService.getProperty(A1destNodeRef, TransferModel.PROP_FROM_REPOSITORY_ID));
            assertTrue("node B2 is not alien", (Boolean) nodeService.hasAspect(testData.B2NodeRef, TransferModel.ASPECT_ALIEN));
            return null;
        }
    });
    /**
     * Step 3 remove alien node B2. A1 becomes non Alien.
     */
    transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Void>() {

        @Override
        public Void execute() throws Throwable {
            logger.debug("delete node B2");
            nodeService.deleteNode(testData.B2NodeRef);
            return null;
        }
    });
    transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Void>() {

        @Override
        public Void execute() throws Throwable {
            NodeRef A1destNodeRef = testNodeFactory.getMappedNodeRef(testData.A1NodeRef);
            @SuppressWarnings({ "unchecked", "unused" }) List<String> invaders = (List<String>) nodeService.getProperty(A1destNodeRef, TransferModel.PROP_INVADED_BY);
            assertTrue("dest node ref does not exist", nodeService.exists(A1destNodeRef));
            assertFalse("node A1 is still alien", (Boolean) nodeService.hasAspect(A1destNodeRef, TransferModel.ASPECT_ALIEN));
            assertNotNull("repository id is null", (String) nodeService.getProperty(A1destNodeRef, TransferModel.PROP_REPOSITORY_ID));
            assertNotNull("from repository id is null", (String) nodeService.getProperty(A1destNodeRef, TransferModel.PROP_FROM_REPOSITORY_ID));
            return null;
        }
    });
    /**
     * Step 4 restore alien node B2. A1 becomes Alien again
     */
    transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Void>() {

        @Override
        public Void execute() throws Throwable {
            logger.debug("restore node B2");
            NodeRef B2ArchiveNodeRef = new NodeRef(StoreRef.STORE_REF_ARCHIVE_SPACESSTORE, testData.B2NodeRef.getId());
            nodeService.restoreNode(B2ArchiveNodeRef, testNodeFactory.getMappedNodeRef(testData.A1NodeRef), ContentModel.ASSOC_CONTAINS, QName.createQName("B2"));
            return null;
        }
    });
    transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Void>() {

        @Override
        public Void execute() throws Throwable {
            NodeRef A1destNodeRef = testNodeFactory.getMappedNodeRef(testData.A1NodeRef);
            assertTrue("dest node ref does not exist", nodeService.exists(A1destNodeRef));
            assertTrue("node A1 is not alien", (Boolean) nodeService.hasAspect(A1destNodeRef, TransferModel.ASPECT_ALIEN));
            assertNotNull("repository id is null", (String) nodeService.getProperty(A1destNodeRef, TransferModel.PROP_REPOSITORY_ID));
            assertNotNull("from repository id is null", (String) nodeService.getProperty(A1destNodeRef, TransferModel.PROP_FROM_REPOSITORY_ID));
            return null;
        }
    });
    /**
     * Step 5 - add B3
     */
    transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Void>() {

        @Override
        public Void execute() throws Throwable {
            ChildAssociationRef child = nodeService.createNode(testData.B2NodeRef, ContentModel.ASSOC_CONTAINS, QName.createQName("B3"), ContentModel.TYPE_FOLDER);
            testData.B3NodeRef = child.getChildRef();
            nodeService.setProperty(testData.B3NodeRef, ContentModel.PROP_TITLE, CONTENT_TITLE);
            nodeService.setProperty(testData.B3NodeRef, ContentModel.PROP_NAME, "B3");
            return null;
        }
    });
    transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Void>() {

        @Override
        public Void execute() throws Throwable {
            assertTrue("node B3 is not alien", (Boolean) nodeService.hasAspect(testData.B3NodeRef, TransferModel.ASPECT_ALIEN));
            return null;
        }
    });
    /**
     * Step 5 remove alien node B2. A1 becomes non Alien (again).
     */
    transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Void>() {

        @Override
        public Void execute() throws Throwable {
            logger.debug("delete node B2");
            nodeService.deleteNode(testData.B2NodeRef);
            return null;
        }
    });
    transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Void>() {

        @Override
        public Void execute() throws Throwable {
            NodeRef A1destNodeRef = testNodeFactory.getMappedNodeRef(testData.A1NodeRef);
            @SuppressWarnings({ "unused", "unchecked" }) List<String> invaders = (List<String>) nodeService.getProperty(A1destNodeRef, TransferModel.PROP_INVADED_BY);
            assertTrue("dest node ref does not exist", nodeService.exists(A1destNodeRef));
            assertFalse("node A1 is still alien", (Boolean) nodeService.hasAspect(A1destNodeRef, TransferModel.ASPECT_ALIEN));
            assertNotNull("repository id is null", (String) nodeService.getProperty(A1destNodeRef, TransferModel.PROP_REPOSITORY_ID));
            assertNotNull("from repository id is null", (String) nodeService.getProperty(A1destNodeRef, TransferModel.PROP_FROM_REPOSITORY_ID));
            return null;
        }
    });
    /**
     * Step6 restore B2 and B3 to B1.
     */
    transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Void>() {

        @Override
        public Void execute() throws Throwable {
            logger.debug("restore node B2");
            NodeRef B2ArchiveNodeRef = new NodeRef(StoreRef.STORE_REF_ARCHIVE_SPACESSTORE, testData.B2NodeRef.getId());
            nodeService.restoreNode(B2ArchiveNodeRef, testData.B1NodeRef, ContentModel.ASSOC_CONTAINS, QName.createQName("B2"));
            return null;
        }
    });
    transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Void>() {

        @Override
        public Void execute() throws Throwable {
            assertFalse("node A1 is still alien", (Boolean) nodeService.hasAspect(testNodeFactory.getMappedNodeRef(testData.A1NodeRef), TransferModel.ASPECT_ALIEN));
            assertFalse("node A2 is still alien", (Boolean) nodeService.hasAspect(testData.B2NodeRef, TransferModel.ASPECT_ALIEN));
            assertFalse("node A3 is still alien", (Boolean) nodeService.hasAspect(testData.B3NodeRef, TransferModel.ASPECT_ALIEN));
            return null;
        }
    });
}
Also used : TransferTarget(org.alfresco.service.cmr.transfer.TransferTarget) ChildAssociationRef(org.alfresco.service.cmr.repository.ChildAssociationRef) TransferDefinition(org.alfresco.service.cmr.transfer.TransferDefinition) NodeRef(org.alfresco.service.cmr.repository.NodeRef) List(java.util.List) ArrayList(java.util.ArrayList) DescriptorService(org.alfresco.service.descriptor.DescriptorService) Pair(org.alfresco.util.Pair) HashSet(java.util.HashSet) BaseAlfrescoSpringTest(org.alfresco.util.BaseAlfrescoSpringTest) Test(org.junit.Test)

Aggregations

TransferTarget (org.alfresco.service.cmr.transfer.TransferTarget)48 BaseAlfrescoSpringTest (org.alfresco.util.BaseAlfrescoSpringTest)30 Test (org.junit.Test)30 NodeRef (org.alfresco.service.cmr.repository.NodeRef)29 TransferDefinition (org.alfresco.service.cmr.transfer.TransferDefinition)26 ChildAssociationRef (org.alfresco.service.cmr.repository.ChildAssociationRef)25 HashSet (java.util.HashSet)22 Locale (java.util.Locale)18 DescriptorService (org.alfresco.service.descriptor.DescriptorService)16 Pair (org.alfresco.util.Pair)14 ContentWriter (org.alfresco.service.cmr.repository.ContentWriter)13 RetryingTransactionCallback (org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback)12 TransferException (org.alfresco.service.cmr.transfer.TransferException)12 ArrayList (java.util.ArrayList)10 RetryingTransactionHelper (org.alfresco.repo.transaction.RetryingTransactionHelper)10 IOException (java.io.IOException)8 Path (org.alfresco.service.cmr.repository.Path)8 List (java.util.List)7 QName (org.alfresco.service.namespace.QName)7 HostConfiguration (org.apache.commons.httpclient.HostConfiguration)7