Package org.uberfire.java.nio.base.options

Examples of org.uberfire.java.nio.base.options.CommentedOption


    }

    @Test
    public void testOpenCloseFS() throws IOException, InterruptedException {
        Path init = ioService.get( URI.create( "git://open-close-repo-test/readme.txt" ) );
        ioService.write( init, "init!", new CommentedOption( "User Tester", "message1" ) );

        ioService.delete( init.getFileSystem().getPath( null ) );

        final URI repo = URI.create( "git://open-close-repo-test" );
        try {
            ioService.newFileSystem( repo, new HashMap<String, Object>() );
        } catch ( FileSystemAlreadyExistsException ex ) {
            fail( "FS doesn't exists!" );
        }

        ioService.write( init, "init!", new CommentedOption( "User Tester", "message1" ) );
        assertEquals( "init!", ioService.readAllString( init ) );

        init = ioService.get( URI.create( "git://open-close-repo-test/readme.txt" ) );
        ioService.delete( init.getFileSystem().getPath( null ) );
    }
View Full Code Here


    @Test
    public void testBatch() throws IOException, InterruptedException {
        final Path init = ioService.get( URI.create( "git://amend-repo-test/readme.txt" ) );
        final WatchService ws = init.getFileSystem().newWatchService();

        ioService.write( init, "init!", new CommentedOption( "User Tester", "message1" ) );
        ioService.write( init, "init 2!", new CommentedOption( "User Tester", "message2" ) );
        {
            List<WatchEvent<?>> events = ws.poll().pollEvents();
            assertEquals( 1, events.size() );//modify readme
        }

        final Path init2 = ioService.get( URI.create( "git://amend-repo-test/readme2.txt" ) );
        ioService.write( init2, "init 3!", new CommentedOption( "User Tester", "message3" ) );
        {
            List<WatchEvent<?>> events = ws.poll().pollEvents();
            assertEquals( 1, events.size() ); // add file
        }
        ioService.write( init2, "init 4!", new CommentedOption( "User Tester", "message4" ) );
        {
            List<WatchEvent<?>> events = ws.poll().pollEvents();
            assertEquals( 1, events.size() );// modify file
        }
View Full Code Here

    }

    @Test
    public void batchTest() throws IOException, InterruptedException {
        final Path init = ioService.get( URI.create( "git://amend-repo-test/readme.txt" ) );
        ioService.write( init, "init!", new CommentedOption( "User Tester", "message1" ) );

        assertFalse( fs1Batch.isOnBatch() );
        ioService.startBatch( new FileSystem[]{ fs1 } );
        assertTrue( fs1Batch.isOnBatch() );
        ioService.endBatch();
View Full Code Here

    }

    @Test
    public void justOneFSOnBatchTest() throws IOException, InterruptedException {
        Path init = ioService.get( URI.create( "git://amend-repo-test/readme.txt" ) );
        ioService.write( init, "init!", new CommentedOption( "User Tester", "message1" ) );

        init = ioService.get( URI.create( "git://check-amend-repo-test/readme.txt" ) );
        ioService.write( init, "init!", new CommentedOption( "User Tester", "message1" ) );

        assertFalse( fs1Batch.isOnBatch() );
        assertFalse( fs2Batch.isOnBatch() );
        ioService.startBatch( new FileSystem[]{ fs1 } );
        assertTrue( fs1Batch.isOnBatch() );
View Full Code Here

    }

    @Test
    public void testTwoStaredFsOnBatchByTheSameThread() throws IOException, InterruptedException {
        Path init = ioService.get( URI.create( "git://amend-repo-test/readme.txt" ) );
        ioService.write( init, "init!", new CommentedOption( "User Tester", "message1" ) );

        init = ioService.get( URI.create( "git://check-amend-repo-test/readme.txt" ) );
        ioService.write( init, "init!", new CommentedOption( "User Tester", "message1" ) );

        ioService.startBatch( new FileSystem[]{ fs1 } );
        try {
            ioService.startBatch( new FileSystem[]{ fs2 } );
            fail();
View Full Code Here

    }

    @Test
    public void testTwoFsOnBatchByTheSameThread() throws IOException, InterruptedException {
        Path init = ioService.get( URI.create( "git://amend-repo-test/readme.txt" ) );
        ioService.write( init, "init!", new CommentedOption( "User Tester", "message1" ) );

        init = ioService.get( URI.create( "git://check-amend-repo-test/readme.txt" ) );
        ioService.write( init, "init!", new CommentedOption( "User Tester", "message1" ) );

        ioService.startBatch( new FileSystem[]{ fs1 } );
        assertTrue( fs1Batch.isOnBatch() );
        ioService.endBatch();
        ioService.startBatch( new FileSystem[]{ fs2 } );
View Full Code Here

    }

    @Test
    public void iCanLockMultipleFS() throws IOException, InterruptedException {
        Path init = ioService.get( URI.create( "git://amend-repo-test/readme.txt" ) );
        ioService.write( init, "init!", new CommentedOption( "User Tester", "message1" ) );

        init = ioService.get( URI.create( "git://check-amend-repo-test/readme.txt" ) );
        ioService.write( init, "init!", new CommentedOption( "User Tester", "message1" ) );

        ioService.startBatch( new FileSystem[]{ fs1, fs2 } );
        assertTrue( fs1Batch.isOnBatch() );
        assertTrue( fs2Batch.isOnBatch() );
View Full Code Here

        assertThat( fs ).isNotNull();

        final SimpleDateFormat formatter = new SimpleDateFormat( "dd/MM/yyyy" );

        final CommentedOption op = new CommentedOption( "User Tester", "user.tester@example.com", "omg, is it the end?", formatter.parse( "31/12/2012" ) );

        final Path path = PROVIDER.getPath( URI.create( "git://user_branch@outstreamwithop-test-repo/some/path/myfile.txt" ) );

        final OutputStream outStream = PROVIDER.newOutputStream( path, op );
        assertThat( outStream ).isNotNull();
View Full Code Here

            fail( "dir not empty" );
        } catch ( final DirectoryNotEmptyException ignore ) {
        }

        try {
            final CommentedOption op = new CommentedOption( "User Tester", "user.tester@example.com", "omg, erase dir!" );

            PROVIDER.delete( dir, NON_EMPTY_DIRECTORIES, op );
        } catch ( final DirectoryNotEmptyException ignore ) {
            fail( "dir should be deleted!" );
        }
View Full Code Here

        }

        if ( !env.containsKey( GIT_DEFAULT_REMOTE_NAME ) && init ) {
            try {
                final URI initURI = URI.create( getScheme() + "://master@" + name + "/readme.md" );
                final CommentedOption op = setupOp( env );
                final OutputStream stream = newOutputStream( getPath( initURI ), op );
                final String _init = "Repository Init Content\n" +
                        "=======================\n" +
                        "\n" +
                        "Your project description here.";
View Full Code Here

TOP

Related Classes of org.uberfire.java.nio.base.options.CommentedOption

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.