Examples of Problems


Examples of org.modeshape.jcr.api.Problems

        final File backupDirectory = new File(path);

        Repository repository = (Repository)getRepositoryFromJndi("java:/jcr/sample");
        org.modeshape.jcr.api.Session session = repository.login();
        final RepositoryManager repoMgr = session.getWorkspace().getRepositoryManager();
        Problems problems = repoMgr.backupRepository(backupDirectory);
        if (problems.hasProblems()) {
            throw new IllegalStateException("Errors while backing up repository:" + problems.toString());
        }

        problems = session.getWorkspace().getRepositoryManager().restoreRepository(backupDirectory);
        if (problems.hasProblems()) {
            throw new IllegalStateException("Errors while backing up repository:" + problems.toString());
        }
        backupRestoreSuccessful = true;
    }
View Full Code Here

Examples of org.modeshape.jcr.api.Problems

    @Test
    public void shouldPerformOneBackup() throws Exception {
        Stopwatch sw = new Stopwatch();
        sw.start();
        Problems problems = session().getWorkspace().getRepositoryManager().backupRepository(testDirectory);
        sw.stop();
        assertThat(problems.hasProblems(), is(false));
        System.out.println("Time to perform backup: " + sw.getMaximumDuration());
    }
View Full Code Here

Examples of org.modeshape.jcr.api.Problems

    public void shouldPerformMultipleBackups() throws Exception {
        for (int i = 0; i != 3; ++i) {
            File file = new File(testDirectory, "test" + i);
            Stopwatch sw = new Stopwatch();
            sw.start();
            Problems problems = session().getWorkspace().getRepositoryManager().backupRepository(file);
            sw.stop();
            assertThat(problems.hasProblems(), is(false));
            System.out.println("Time to perform backup: " + sw.getMaximumDuration());
        }
    }
View Full Code Here

Examples of org.modeshape.jcr.api.Problems

        new Thread(new Runnable() {
            @Override
            public void run() {
                sw.start();
                try {
                    Problems backupProblems = session().getWorkspace().getRepositoryManager().backupRepository(testDirectory);
                    problems.set(backupProblems);
                } catch (RepositoryException e) {
                    throw new RuntimeException(e);
                }
                sw.stop();
View Full Code Here

Examples of org.modeshape.jcr.api.Problems

    }

    @Test
    public void shouldBackupRepositoryWithMultipleWorkspaces() throws Exception {
        loadContent();
        Problems problems = session().getWorkspace().getRepositoryManager().backupRepository(backupDirectory);
        assertNoProblems(problems);

        // Make some changes that will not be in the backup ...
        session().getRootNode().addNode("node-not-in-backup");
        session().save();

        assertContentInWorkspace(repository(), "default", "/node-not-in-backup");
        assertContentInWorkspace(repository(), "ws2");
        assertContentInWorkspace(repository(), "ws3");

        // Start up a new repository
        ((LocalEnvironment)environment).setShared(true);
        RepositoryConfiguration config = RepositoryConfiguration.read("config/restore-repo-config.json").with(environment);
        JcrRepository newRepository = new JcrRepository(config);
        try {
            newRepository.start();

            // And restore it from the contents ...
            JcrSession newSession = newRepository.login();
            try {
                Problems restoreProblems = newSession.getWorkspace().getRepositoryManager().restoreRepository(backupDirectory);
                assertNoProblems(restoreProblems);
            } finally {
                newSession.logout();
            }

            // Check that the node that was added *after* the backup is not there ...
            assertContentNotInWorkspace(newRepository, "default", "/node-not-in-backup");

            // Before we assert the content, create a backup of it (for comparison purposes when debugging) ...
            newSession = newRepository.login();
            try {
                Problems backupProblems = newSession.getWorkspace().getRepositoryManager().backupRepository(backupDirectory2);
                assertNoProblems(backupProblems);
            } finally {
                newSession.logout();
            }

View Full Code Here

Examples of org.modeshape.jcr.api.Problems

        assertContentInWorkspace(repository(), "default");
        assertContentInWorkspace(repository(), "ws2");
        assertContentInWorkspace(repository(), "ws3");

        // Make the backup, and check that there are no problems ...
        Problems problems = session().getWorkspace().getRepositoryManager().backupRepository(backupDirectory);
        assertNoProblems(problems);

        // Make some changes that will not be in the backup ...
        session().getRootNode().addNode("node-not-in-backup");
        session().save();

        // Check the content again ...
        assertContentInWorkspace(repository(), "default", "/node-not-in-backup");
        assertContentInWorkspace(repository(), "ws2");
        assertContentInWorkspace(repository(), "ws3");

        // Restore the content from the backup into our current repository ...
        JcrSession newSession = repository().login();
        try {
            Problems restoreProblems = newSession.getWorkspace().getRepositoryManager().restoreRepository(backupDirectory);
            assertNoProblems(restoreProblems);
        } finally {
            newSession.logout();
        }
View Full Code Here

Examples of org.modeshape.jcr.api.Problems

        prius.setProperty("crlfproperty", "test\r\ntest\r\ntest");
        prius.setProperty("lfprop", "value\nvalue\nvalue");
        session().save();

        // Make the backup, and check that there are no problems ...
        Problems problems = session().getWorkspace().getRepositoryManager().backupRepository(backupDirectory);
        assertNoProblems(problems);

        // Make some changes that will not be in the backup ...
        session().getRootNode().addNode("node-not-in-backup");
        session().save();

        // Check the content again ...
        assertContentInWorkspace(repository(), "default", "/node-not-in-backup");

        // Restore the content from the backup into our current repository ...
        JcrSession newSession = repository().login();
        try {
            Problems restoreProblems = newSession.getWorkspace().getRepositoryManager().restoreRepository(backupDirectory);
            assertNoProblems(restoreProblems);
        } finally {
            newSession.logout();
        }
View Full Code Here

Examples of org.modeshape.jcr.api.Problems

    public void shouldBackupAndRestoreWithExistingUserTransaction() throws Exception {
        loadContent();

        startTransaction();

        Problems problems = session().getWorkspace().getRepositoryManager().backupRepository(backupDirectory);
        assertNoProblems(problems);
        problems = session().getWorkspace().getRepositoryManager().restoreRepository(backupDirectory);
        assertNoProblems(problems);

        rollbackTransaction();
View Full Code Here

Examples of org.netbeans.validation.api.Problems

            String label = NbBundle.getMessage( NodeJSProject.class, "LBL_PROJECT_RENAME" ); //NOI18N
            NotifyDescriptor.InputLine l = new NotifyDescriptor.InputLine( label, NbBundle.getMessage( NodeJSProject.class, "TTL_PROJECT_RENAME" ) ); //NOI18N
            if (DialogDisplayer.getDefault().notify( l ).equals( NotifyDescriptor.OK_OPTION )) {
                String txt = l.getInputText();
                Validator<String> v = ValidatorUtils.merge( StringValidators.REQUIRE_NON_EMPTY_STRING, StringValidators.REQUIRE_VALID_FILENAME );
                Problems p = new Problems();
                v.validate( p, label, txt );
                if (p.hasFatal()) {
                    NotifyDescriptor.Message msg = new NotifyDescriptor.Message( p.getLeadProblem().getMessage(), NotifyDescriptor.ERROR_MESSAGE );
                    DialogDisplayer.getDefault().notify( msg );
                    return;
                }
                DefaultProjectOperations.performDefaultRenameOperation( this, l.getInputText() );
            }
View Full Code Here

Examples of org.netbeans.validation.api.Problems

* @author Tim Boudreau
*/
public class HostNameValidatorTest {

    private Problem check(Validator<String> v, String str){
        Problems p = new Problems();
        v.validate(p, "", str);
        return p.getLeadProblem();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.