Package org.fcrepo.server.journal

Examples of org.fcrepo.server.journal.JournalConsumer


            createJournalFileFromString(getSimpleIngestString());
            createJournalFileFromString(getSimpleIngestString());
            createJournalFileFromString(getSimpleIngestString());

            // create the JournalConsumer and run it.
            JournalConsumer consumer =
                    new JournalConsumer(parameters, role, server);
            startConsumerThread(consumer);
            waitWhileThreadRuns(WAIT_INTERVAL);
            consumer.shutdown();

            assertEquals("Expected to see 3 ingests", 3, delegate
                    .getCallCount());
            assertEquals("Journal files not all gone",
                         0,
View Full Code Here


            createJournalFileFromString(getSimpleIngestString());
            createJournalFileFromString(getSimpleIngestString());
            createLockRequest();

            // create the JournalConsumer and run it.
            JournalConsumer consumer =
                    new JournalConsumer(parameters, role, server);
            startConsumerThread(consumer);

            // we should see the lock accepted and no processing going on.
            waitForLockAccepted();
            waitWhileThreadRuns(WAIT_INTERVAL);
            assertEquals("Journal files should not be processed", 0, delegate
                    .getCallCount());
            assertEquals("Journal files should not be processed",
                         3,
                         howManyFilesInDirectory(journalDirectory));
            assertEquals("Journal files should not be processed",
                         0,
                         howManyFilesInDirectory(archiveDirectory));
            int lockMessageIndex = assertLockMessageInLog();

            // remove the request. We should see the lock released and
            // processing should run to completion.
            removeLockRequest();
            waitForLockReleased();
            waitWhileThreadRuns(WAIT_INTERVAL);
            consumer.shutdown();

            assertEquals("Expected to see 3 ingests", 3, delegate
                    .getCallCount());
            assertEquals("Journal files not all gone",
                         0,
View Full Code Here

            // a lock request will be created while the second file is being
            // processed.
            delegate.setIngestOperation(new LockAfterSecondIngest());

            // create the JournalConsumer and run it.
            JournalConsumer consumer =
                    new JournalConsumer(parameters, role, server);
            startConsumerThread(consumer);

            // we should see the lock accepted and processing stop after the
            // second file.
            waitForLockAccepted();
            waitWhileThreadRuns(WAIT_INTERVAL);
            assertEquals("We should stop after the second ingest", 2, delegate
                    .getCallCount());
            assertEquals("One Journal file should not be processed",
                         1,
                         howManyFilesInDirectory(journalDirectory));
            assertEquals("Only two Journal files should be processed",
                         2,
                         howManyFilesInDirectory(archiveDirectory));
            int lockMessageIndex = assertLockMessageInLog();

            // remove the request. We should see the lock released and
            // processing should run to completion.
            removeLockRequest();
            waitForLockReleased();
            waitWhileThreadRuns(WAIT_INTERVAL);
            consumer.shutdown();

            assertEquals("Expected to see 3 ingests", 3, delegate
                    .getCallCount());
            assertEquals("Journal files not all gone",
                         0,
View Full Code Here

        try {
            // create 1 file, with an ingest
            createJournalFileFromString(getSimpleIngestString());

            // create the JournalConsumer and run it.
            JournalConsumer consumer =
                    new JournalConsumer(parameters, role, server);
            startConsumerThread(consumer);

            // the file should be processed and we being polling.
            waitWhileThreadRuns(WAIT_INTERVAL);
            assertEquals("The first file should have been processed.",
                         1,
                         delegate.getCallCount());
            assertEquals("The first file should have been processed.",
                         0,
                         howManyFilesInDirectory(journalDirectory));
            assertEquals("The first file should have been processed.",
                         1,
                         howManyFilesInDirectory(archiveDirectory));

            // create a lock request and wait for the acceptance.
            createLockRequest();
            waitForLockAccepted();

            // create another Journal file, but it won't be processed.
            createJournalFileFromString(getSimpleIngestString());
            waitWhileThreadRuns(WAIT_INTERVAL);
            assertEquals("The second file should not have been processed.",
                         1,
                         delegate.getCallCount());
            assertEquals("The second file should not have been processed.",
                         1,
                         howManyFilesInDirectory(journalDirectory));
            assertEquals("The second file should not have been processed.",
                         1,
                         howManyFilesInDirectory(archiveDirectory));
            int lockMessageIndex = assertLockMessageInLog();

            // remove the lock and the file is processed.
            removeLockRequest();
            waitForLockReleased();
            waitWhileThreadRuns(WAIT_INTERVAL);
            consumer.shutdown();

            assertEquals("Expected to see 2 ingests", 2, delegate
                    .getCallCount());
            assertEquals("Journal files not all gone",
                         0,
View Full Code Here

TOP

Related Classes of org.fcrepo.server.journal.JournalConsumer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.