Search in sources :

Example 11 with TransferDefinition

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

the class TransferServiceImplTest method testEmptyContent.

// test big content
/**
 * Test the transfer method with regard to an empty content property.  ALF-4865
 *
 * Step 1: create a node with an empty content property
 * transfer
 *
 * Step 2: add non empty content property
 * transfer
 *
 * Step 3: update from non empty content to empty content property
 * transfer
 *
 * This is a unit test so it does some shenanigans to send to the same instance of alfresco.
 */
@Test
public void testEmptyContent() throws Exception {
    final RetryingTransactionHelper tran = transactionService.getRetryingTransactionHelper();
    final String CONTENT_TITLE = "ContentTitle";
    final String CONTENT_TITLE_UPDATED = "ContentTitleUpdated";
    final Locale CONTENT_LOCALE = Locale.ENGLISH;
    final String CONTENT_ENCODING = "UTF-8";
    final String CONTENT_STRING = "The quick brown fox jumps over the lazy dog.";
    final String targetName = "testTransferEmptyContent";
    /**
     *  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.
     *
     *  Fake Repository Id
     */
    class TestContext {

        TransferTarget transferMe;

        NodeRef contentNodeRef;

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

        @Override
        public TestContext execute() throws Throwable {
            TestContext ctx = new TestContext();
            NodeRef guestHome = repositoryHelper.getGuestHome();
            /**
             * Create a test node with an empty content 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);
            ContentData cd = new ContentData(null, null, 0, null);
            nodeService.setProperty(ctx.contentNodeRef, ContentModel.PROP_CONTENT, cd);
            if (!transferService.targetExists(targetName)) {
                ctx.transferMe = createTransferTarget(targetName);
            } else {
                ctx.transferMe = transferService.getTransferTarget(targetName);
            }
            transferService.enableTransferTarget(targetName, true);
            return ctx;
        }
    };
    final TestContext testContext = tran.doInTransaction(setupCB);
    final SimpleDateFormat SDF = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
    /**
     * Step 1: Transfer our node which has empty content
     */
    logger.debug("testEmptyContent : First transfer - create new node (empty content)");
    RetryingTransactionCallback<Void> step1CB = new RetryingTransactionCallback<Void>() {

        @Override
        public Void execute() throws Throwable {
            ContentReader reader = contentService.getReader(testContext.contentNodeRef, ContentModel.PROP_CONTENT);
            assertNull("test setup content reader not null", reader);
            Map<QName, Serializable> props = nodeService.getProperties(testContext.contentNodeRef);
            assertTrue(props.containsKey(ContentModel.PROP_CONTENT));
            TransferDefinition definition = new TransferDefinition();
            Set<NodeRef> nodes = new HashSet<NodeRef>();
            nodes.add(testContext.contentNodeRef);
            definition.setNodes(nodes);
            transferService.transfer(targetName, definition);
            return null;
        }
    };
    tran.doInTransaction(step1CB);
    RetryingTransactionCallback<Void> validateStep1CB = new RetryingTransactionCallback<Void>() {

        @Override
        public Void execute() throws Throwable {
            Serializable modifiedDate = nodeService.getProperty(testContext.contentNodeRef, ContentModel.PROP_MODIFIED);
            if (modifiedDate instanceof Date) {
                logger.debug("srcModified: " + SDF.format(modifiedDate));
            }
            NodeRef destinationNodeRef = testNodeFactory.getMappedNodeRef(testContext.contentNodeRef);
            testContext.savedDestinationNodeRef = destinationNodeRef;
            assertTrue("content node (dest) does not exist", nodeService.exists(destinationNodeRef));
            ContentReader reader = contentService.getReader(destinationNodeRef, ContentModel.PROP_CONTENT);
            assertNull("content reader not null", reader);
            Map<QName, Serializable> props = nodeService.getProperties(destinationNodeRef);
            assertTrue(props.containsKey(ContentModel.PROP_CONTENT));
            return null;
        }
    };
    tran.doInTransaction(validateStep1CB);
    /**
     * Step 2: replace empty content with new content
     */
    logger.debug("testEmptyContent : Second transfer - replace empty content with some content");
    RetryingTransactionCallback<Void> step2CB = new RetryingTransactionCallback<Void>() {

        @Override
        public Void execute() throws Throwable {
            Serializable modifiedDate = nodeService.getProperty(testContext.contentNodeRef, ContentModel.PROP_MODIFIED);
            if (modifiedDate instanceof Date) {
                logger.debug("srcModified: " + SDF.format(modifiedDate));
            }
            ContentWriter writer = contentService.getWriter(testContext.contentNodeRef, ContentModel.PROP_CONTENT, true);
            writer.setLocale(CONTENT_LOCALE);
            writer.setEncoding(CONTENT_ENCODING);
            writer.putContent(CONTENT_STRING);
            return null;
        }
    };
    tran.doInTransaction(step2CB);
    RetryingTransactionCallback<Void> step2TransferCB = new RetryingTransactionCallback<Void>() {

        @Override
        public Void execute() throws Throwable {
            ContentReader reader = contentService.getReader(testContext.contentNodeRef, ContentModel.PROP_CONTENT);
            assertNotNull("test setup content reader not null", reader);
            Map<QName, Serializable> props = nodeService.getProperties(testContext.contentNodeRef);
            assertTrue(props.containsKey(ContentModel.PROP_CONTENT));
            /**
             * Step 2: replace empty content with new content
             */
            TransferDefinition definition = new TransferDefinition();
            Set<NodeRef> nodes = new HashSet<NodeRef>();
            nodes.add(testContext.contentNodeRef);
            definition.setNodes(nodes);
            transferService.transfer(targetName, definition);
            return null;
        }
    };
    tran.doInTransaction(step2TransferCB);
    RetryingTransactionCallback<Void> step2ValidateCB = new RetryingTransactionCallback<Void>() {

        @Override
        public Void execute() throws Throwable {
            NodeRef destinationNodeRef = testNodeFactory.getMappedNodeRef(testContext.contentNodeRef);
            assertEquals("test error destinationNodeRef not correct", testContext.savedDestinationNodeRef, destinationNodeRef);
            ContentReader reader = contentService.getReader(destinationNodeRef, ContentModel.PROP_CONTENT);
            assertNotNull("content reader is null", reader);
            assertTrue("content encoding is wrong", reader.getEncoding().equalsIgnoreCase(CONTENT_ENCODING));
            assertEquals("content locale is wrong", reader.getLocale(), CONTENT_LOCALE);
            assertTrue("content does not exist", reader.exists());
            String contentStr = reader.getContentString();
            assertEquals("Content is wrong", contentStr, CONTENT_STRING);
            return null;
        }
    };
    tran.doInTransaction(step2ValidateCB);
    /**
     * Step 3 - transition from a content property having content to one that is empty
     */
    logger.debug("testEmptyContent : Third transfer - remove existing content");
    RetryingTransactionCallback<Void> step3SetupCB = new RetryingTransactionCallback<Void>() {

        @Override
        public Void execute() throws Throwable {
            ContentData cd = new ContentData(null, null, 0, null);
            nodeService.setProperty(testContext.contentNodeRef, ContentModel.PROP_CONTENT, cd);
            return null;
        }
    };
    tran.doInTransaction(step3SetupCB);
    RetryingTransactionCallback<Void> step3TransferCB = new RetryingTransactionCallback<Void>() {

        @Override
        public Void execute() throws Throwable {
            ContentReader reader = contentService.getReader(testContext.contentNodeRef, ContentModel.PROP_CONTENT);
            assertNull("test setup content reader not null", reader);
            Map<QName, Serializable> props = nodeService.getProperties(testContext.contentNodeRef);
            assertTrue(props.containsKey(ContentModel.PROP_CONTENT));
            /**
             * Step 3: Transfer our node which has empty content to over-write existing
             * content
             */
            TransferDefinition definition = new TransferDefinition();
            Set<NodeRef> nodes = new HashSet<NodeRef>();
            nodes.add(testContext.contentNodeRef);
            definition.setNodes(nodes);
            transferService.transfer(targetName, definition);
            return null;
        }
    };
    tran.doInTransaction(step3TransferCB);
    RetryingTransactionCallback<Void> step3ValidateCB = new RetryingTransactionCallback<Void>() {

        @Override
        public Void execute() throws Throwable {
            NodeRef destinationNodeRef = testNodeFactory.getMappedNodeRef(testContext.contentNodeRef);
            assertTrue("content node (dest) does not exist", nodeService.exists(destinationNodeRef));
            ContentReader reader = contentService.getReader(destinationNodeRef, ContentModel.PROP_CONTENT);
            assertNull("content reader not null", reader);
            Map<QName, Serializable> props = nodeService.getProperties(destinationNodeRef);
            assertTrue(props.containsKey(ContentModel.PROP_CONTENT));
            return null;
        }
    };
    tran.doInTransaction(step3ValidateCB);
}
Also used : Locale(java.util.Locale) Serializable(java.io.Serializable) RetryingTransactionHelper(org.alfresco.repo.transaction.RetryingTransactionHelper) QName(org.alfresco.service.namespace.QName) ContentReader(org.alfresco.service.cmr.repository.ContentReader) TransferTarget(org.alfresco.service.cmr.transfer.TransferTarget) ChildAssociationRef(org.alfresco.service.cmr.repository.ChildAssociationRef) Date(java.util.Date) TransferDefinition(org.alfresco.service.cmr.transfer.TransferDefinition) NodeRef(org.alfresco.service.cmr.repository.NodeRef) ContentWriter(org.alfresco.service.cmr.repository.ContentWriter) ContentData(org.alfresco.service.cmr.repository.ContentData) RetryingTransactionCallback(org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback) DescriptorService(org.alfresco.service.descriptor.DescriptorService) SimpleDateFormat(java.text.SimpleDateFormat) HashSet(java.util.HashSet) BaseAlfrescoSpringTest(org.alfresco.util.BaseAlfrescoSpringTest) Test(org.junit.Test)

Example 12 with TransferDefinition

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

the class TransferServiceImplTest method testReplaceNode.

// test repeat update content
/**
 * Test the transfer method with regard to replacing a node.  ALF-5109
 *
 * Step 1: Create a new parent node and child node
 * transfer
 *
 * Step 2: Delete the parent node
 * transfer
 *
 * Step 3: Create new parent child node with same names and assocs.
 * transfer
 *
 * This is a unit test so it does some shenanigans to send to the same instance of alfresco.
 */
@Test
public void testReplaceNode() throws Exception {
    final RetryingTransactionHelper tran = transactionService.getRetryingTransactionHelper();
    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";
    /**
     *  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.
     *
     *  Fake Repository Id
     */
    TransferTransmitter transmitter = new UnitTestInProcessTransmitterImpl(receiver, contentService, transactionService);
    transferServiceImpl.setTransmitter(transmitter);
    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)));
    DescriptorService mockedDescriptorService = getMockDescriptorService(REPO_ID_A);
    transferServiceImpl.setDescriptorService(mockedDescriptorService);
    final NodeRef guestHome = repositoryHelper.getGuestHome();
    final String targetName = "testRepeatUpdateOfContent";
    class TestContext {

        TransferTarget transferMe;

        NodeRef parentNodeRef;

        NodeRef middleNodeRef;

        NodeRef childNodeRef;

        QName parentName;

        QName middleName;

        QName childName;
    }
    ;
    RetryingTransactionCallback<TestContext> setupCB = new RetryingTransactionCallback<TestContext>() {

        @Override
        public TestContext execute() throws Throwable {
            TestContext testContext = new TestContext();
            /**
             * Create a test node that we will read and write
             */
            String name = GUID.generate();
            testContext.parentName = QName.createQName(name);
            testContext.childName = QName.createQName("Ermintrude");
            testContext.middleName = QName.createQName("Matilda");
            ChildAssociationRef child = nodeService.createNode(guestHome, ContentModel.ASSOC_CONTAINS, testContext.parentName, ContentModel.TYPE_FOLDER);
            testContext.parentNodeRef = child.getChildRef();
            logger.debug("parentNodeRef created:" + testContext.parentNodeRef);
            nodeService.setProperty(testContext.parentNodeRef, ContentModel.PROP_TITLE, CONTENT_TITLE);
            nodeService.setProperty(testContext.parentNodeRef, ContentModel.PROP_NAME, testContext.parentName.getLocalName());
            ChildAssociationRef child2 = nodeService.createNode(testContext.parentNodeRef, ContentModel.ASSOC_CONTAINS, testContext.childName, ContentModel.TYPE_FOLDER);
            testContext.middleNodeRef = child2.getChildRef();
            logger.debug("middleNodeRef created:" + testContext.middleNodeRef);
            nodeService.setProperty(testContext.middleNodeRef, ContentModel.PROP_TITLE, CONTENT_TITLE);
            nodeService.setProperty(testContext.middleNodeRef, ContentModel.PROP_NAME, testContext.childName.getLocalName());
            ChildAssociationRef child3 = nodeService.createNode(testContext.middleNodeRef, ContentModel.ASSOC_CONTAINS, testContext.childName, ContentModel.TYPE_CONTENT);
            testContext.childNodeRef = child3.getChildRef();
            logger.debug("childNodeRef created:" + testContext.childNodeRef);
            nodeService.setProperty(testContext.childNodeRef, ContentModel.PROP_TITLE, CONTENT_TITLE);
            nodeService.setProperty(testContext.childNodeRef, ContentModel.PROP_NAME, testContext.childName.getLocalName());
            /**
             * Make sure the transfer target exists and is enabled.
             */
            if (!transferService.targetExists(targetName)) {
                testContext.transferMe = createTransferTarget(targetName);
            } else {
                testContext.transferMe = transferService.getTransferTarget(targetName);
            }
            transferService.enableTransferTarget(targetName, true);
            return testContext;
        }
    };
    final TestContext testContext = tran.doInTransaction(setupCB);
    RetryingTransactionCallback<Void> transferCB = new RetryingTransactionCallback<Void>() {

        @Override
        public Void execute() throws Throwable {
            TransferDefinition definition = new TransferDefinition();
            Collection<NodeRef> nodes = new ArrayList<NodeRef>();
            nodes.add(testContext.childNodeRef);
            nodes.add(testContext.parentNodeRef);
            nodes.add(testContext.middleNodeRef);
            definition.setSync(true);
            definition.setNodes(nodes);
            transferService.transfer(targetName, definition);
            return null;
        }
    };
    RetryingTransactionCallback<Void> checkTransferCB = new RetryingTransactionCallback<Void>() {

        @Override
        public Void execute() throws Throwable {
            return null;
        }
    };
    RetryingTransactionCallback<Void> replaceNodesCB = new RetryingTransactionCallback<Void>() {

        @Override
        public Void execute() throws Throwable {
            // Delete the old nodes
            nodeService.deleteNode(testContext.middleNodeRef);
            logger.debug("deleted node");
            ChildAssociationRef child2 = nodeService.createNode(testContext.parentNodeRef, ContentModel.ASSOC_CONTAINS, testContext.childName, ContentModel.TYPE_FOLDER);
            testContext.middleNodeRef = child2.getChildRef();
            logger.debug("middleNodeRef created:" + testContext.middleNodeRef);
            nodeService.setProperty(testContext.middleNodeRef, ContentModel.PROP_TITLE, CONTENT_TITLE);
            nodeService.setProperty(testContext.middleNodeRef, ContentModel.PROP_NAME, testContext.childName.getLocalName());
            ChildAssociationRef child3 = nodeService.createNode(testContext.middleNodeRef, ContentModel.ASSOC_CONTAINS, testContext.childName, ContentModel.TYPE_CONTENT);
            testContext.childNodeRef = child3.getChildRef();
            logger.debug("childNodeRef created:" + testContext.childNodeRef);
            nodeService.setProperty(testContext.childNodeRef, ContentModel.PROP_TITLE, CONTENT_TITLE);
            nodeService.setProperty(testContext.childNodeRef, ContentModel.PROP_NAME, testContext.childName.getLocalName());
            return null;
        }
    };
    // This is the test
    tran.doInTransaction(transferCB);
    tran.doInTransaction(replaceNodesCB);
    tran.doInTransaction(transferCB);
    tran.doInTransaction(checkTransferCB);
}
Also used : Locale(java.util.Locale) Path(org.alfresco.service.cmr.repository.Path) RetryingTransactionHelper(org.alfresco.repo.transaction.RetryingTransactionHelper) 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) Pair(org.alfresco.util.Pair) BaseAlfrescoSpringTest(org.alfresco.util.BaseAlfrescoSpringTest) Test(org.junit.Test)

Example 13 with TransferDefinition

use of org.alfresco.service.cmr.transfer.TransferDefinition 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 14 with TransferDefinition

use of org.alfresco.service.cmr.transfer.TransferDefinition 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 15 with TransferDefinition

use of org.alfresco.service.cmr.transfer.TransferDefinition 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)

Aggregations

TransferDefinition (org.alfresco.service.cmr.transfer.TransferDefinition)38 NodeRef (org.alfresco.service.cmr.repository.NodeRef)31 TransferTarget (org.alfresco.service.cmr.transfer.TransferTarget)25 ChildAssociationRef (org.alfresco.service.cmr.repository.ChildAssociationRef)24 BaseAlfrescoSpringTest (org.alfresco.util.BaseAlfrescoSpringTest)24 Test (org.junit.Test)24 HashSet (java.util.HashSet)21 Locale (java.util.Locale)19 DescriptorService (org.alfresco.service.descriptor.DescriptorService)18 ArrayList (java.util.ArrayList)17 Pair (org.alfresco.util.Pair)16 ContentWriter (org.alfresco.service.cmr.repository.ContentWriter)14 RetryingTransactionCallback (org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback)13 RetryingTransactionHelper (org.alfresco.repo.transaction.RetryingTransactionHelper)11 List (java.util.List)10 Path (org.alfresco.service.cmr.repository.Path)10 TransferEvent (org.alfresco.service.cmr.transfer.TransferEvent)8 Collection (java.util.Collection)7 QName (org.alfresco.service.namespace.QName)7 ContentReader (org.alfresco.service.cmr.repository.ContentReader)5