Package org.drools.guvnor.client.rpc

Examples of org.drools.guvnor.client.rpc.RuleAsset


            testManager.create();
            Contexts.getSessionContext().set( "roleBasedPermissionManager",
                                              testManager );

            // now lets see if we can access this asset with the permissions
            @SuppressWarnings("unused")
            RuleAsset asset = null;
            try {
                asset = assetRepositoryService.loadRuleAsset( uuid );
            } catch ( AuthorizationException e ) {
                fail( "User has permissions for the category" );
View Full Code Here


            Contexts.getSessionContext().set( "roleBasedPermissionManager",
                                              testManager );

            //now lets see if we can access this asset with the permissions
            try {
                RuleAsset asset = assetRepositoryService.loadRuleAsset( uuid );
                fail( "Did not catch expected exception" );
            } catch ( AuthorizationException e ) {
            }
        } finally {
            Lifecycle.endApplication();
View Full Code Here

                                          "this is a description",
                                          "testCheckinWithPackageReadonlyCat",
                                          "testCheckinWithPackageReadonlyPack",
                                          AssetFormats.DRL );

        RuleAsset asset = repositoryAssetService.loadRuleAsset( uuid );
        assertNotNull( asset.getLastModified() );
        asset.getMetaData().setCoverage( "boo" );
        asset.setContent( new RuleContentText() );
        ((RuleContentText) asset.getContent()).content = "yeah !";
        Thread.sleep( 100 );

        // Mock up SEAM contexts
        Map<String, Object> application = new HashMap<String, Object>();
        Lifecycle.beginApplication( application );
View Full Code Here

                                          "this is a description",
                                          "testCheckinPackageDeveloperCat1",
                                          "testCheckinPackageDeveloperPack1",
                                          AssetFormats.DRL );

        RuleAsset asset = repositoryAssetService.loadRuleAsset( uuid );
        assertNotNull( asset.getLastModified() );
        asset.getMetaData().setCoverage( "boo" );
        asset.setContent( new RuleContentText() );
        ((RuleContentText) asset.getContent()).content = "yeah !";
        Thread.sleep( 100 );

        // Mock up SEAM contexts
        Map<String, Object> application = new HashMap<String, Object>();
        Lifecycle.beginApplication( application );
View Full Code Here

            //this should trigger the fact that the original user edited something
            AssetItem as = impl.getRulesRepository().loadDefaultPackage().addAsset( "testLoadInbox",
                                                                                    "" );
            as.checkin( "" );
            RuleAsset ras = assetServiceImpl.loadRuleAsset( as.getUUID() );

            TableDataResult res = impl.loadInbox( ExplorerNodeConfig.RECENT_EDITED_ID );
            boolean found = false;
            for ( TableDataRow row : res.data ) {
                if ( row.id.equals( ras.uuid ) ) found = true;
View Full Code Here

        String uuidLink = impl.createNewImportedRule( "testLinkedAssetItemHistoryRelatedRule",
                                                      "testLinkedAssetItemHistoryRelatedPack" );
        assertTrue( uuidLink.equals( uuid ) );

        //create version 1.
        RuleAsset assetWrapper = repositoryAssetService.loadRuleAsset( uuidLink );
        assertEquals( assetWrapper.description,
                      "an initial desc" );
        assetWrapper.description = "version 1";
        String uuidLink1 = repositoryAssetService.checkinVersion( assetWrapper );

        //create version 2
        RuleAsset assetWrapper2 = repositoryAssetService.loadRuleAsset( uuidLink );
        assetWrapper2.description = "version 2";
        String uuidLink2 = repositoryAssetService.checkinVersion( assetWrapper2 );

        //create version head
        RuleAsset assetWrapper3 = repositoryAssetService.loadRuleAsset( uuidLink );
        assetWrapper3.description = "version head";
        @SuppressWarnings("unused")
        String uuidLink3 = repositoryAssetService.checkinVersion( assetWrapper3 );

        assertEquals( uuidLink,
                      uuidLink1 );
        assertEquals( uuidLink,
                      uuidLink2 );

        //verify the history info of LinkedAssetItem
        TableDataResult result = repositoryAssetService.loadItemHistory( uuidLink );
        assertNotNull( result );
        TableDataRow[] rows = result.data;
        assertEquals( 3,
                      rows.length );
        assertFalse( rows[0].id.equals( uuidLink ) );
        assertFalse( rows[1].id.equals( uuidLink ) );
        assertFalse( rows[2].id.equals( uuidLink ) );

        RuleAsset version1 = repositoryAssetService.loadRuleAsset( rows[0].id );
        RuleAsset version2 = repositoryAssetService.loadRuleAsset( rows[1].id );
        RuleAsset version3 = repositoryAssetService.loadRuleAsset( rows[2].id );
        RuleAsset versionHead = repositoryAssetService.loadRuleAsset( uuidLink );
        assertFalse( version1.versionNumber == version2.versionNumber );
        assertFalse( version1.versionNumber == versionHead.versionNumber );
        assertEquals( version1.description,
                      "an initial desc" );
        assertEquals( version2.description,
                      "version 1" );
        assertEquals( version3.description,
                      "version 2" );
        assertEquals( versionHead.description,
                      "version head" );

        //verify the history info of the original AssetItem
        result = repositoryAssetService.loadItemHistory( uuid );
        assertNotNull( result );
        rows = result.data;
        assertEquals( 3,
                      rows.length );
        assertFalse( rows[0].id.equals( uuid ) );
        assertFalse( rows[1].id.equals( uuid ) );

        version1 = repositoryAssetService.loadRuleAsset( rows[0].id );
        version2 = repositoryAssetService.loadRuleAsset( rows[1].id );
        versionHead = repositoryAssetService.loadRuleAsset( uuid );
        assertFalse( version1.versionNumber == version2.versionNumber );
        assertFalse( version1.versionNumber == versionHead.versionNumber );
        assertTrue( version1.description.equals( "an initial desc" ) );
        assertTrue( version2.description.equals( "version 1" ) );
        assertTrue( versionHead.description.equals( "version head" ) );

        //test restore
        repositoryAssetService.restoreVersion( version1.uuid,
                             versionHead.uuid,
                             "this was cause of a mistake" );

        RuleAsset newHead = repositoryAssetService.loadRuleAsset( uuid );

        assertEquals( "this was cause of a mistake",
                      newHead.checkinComment );
    }
View Full Code Here

        } catch ( SerializationException e ) {
            //assertTrue( e.getMessage().indexOf( "'testCreateNewRuleContains' character' is not a valid path. ''' not a valid name character" ) >= 0 );
        }

        RepositoryAssetService repositoryAssetService = getRepositoryAssetService();
        RuleAsset assetWrapper = repositoryAssetService.loadRuleAsset( uuid );
        assertEquals( assetWrapper.description,
                      "an initial desc" );
        assertEquals( assetWrapper.name,
                      "testCreateNewRuleContains' character" );
View Full Code Here

        assertFalse( res.hasNext );

        TableDataRow row = res.data[0];
        String uuid = row.id;
        RepositoryAssetService repositoryAssetService = getRepositoryAssetService();
        RuleAsset asset = repositoryAssetService.loadRuleAsset( uuid );
        assertNotNull( asset );

        assertEquals( uuid,
                      asset.uuid );
View Full Code Here

                                            "desc",
                                            "testTrackRecentOpenedChanged",
                                            "testTrackRecentOpenedChanged",
                                            "drl" );
            RepositoryAssetService repositoryAssetService = getRepositoryAssetService();
            RuleAsset ass = repositoryAssetService.loadRuleAsset( id );

            repositoryAssetService.checkinVersion( ass );

            List<InboxEntry> es = ib.loadRecentEdited();
            assertEquals( 1,
View Full Code Here

                                          "testLoadAssetHistory",
                                          AssetFormats.DRL );
        long nowTime3 = System.currentTimeMillis();
        System.out.println( "CreateNewRule: " + (nowTime3 - nowTime2) );
        RepositoryAssetService repositoryAssetService = getRepositoryAssetService();
        RuleAsset asset = repositoryAssetService.loadRuleAsset( uuid );
        repositoryAssetService.checkinVersion( asset ); // 1
        long nowTime4 = System.currentTimeMillis();
        System.out.println( "Checkin 1: " + (nowTime4 - nowTime3) );
        asset = repositoryAssetService.loadRuleAsset( uuid );
        long nowTime5 = System.currentTimeMillis();
        System.out.println( "load ruleasset: " + (nowTime5 - nowTime4) );
        repositoryAssetService.checkinVersion( asset ); // 2
        long nowTime6 = System.currentTimeMillis();
        System.out.println( "Checkin 2: " + (nowTime6 - nowTime5) );
        asset = repositoryAssetService.loadRuleAsset( uuid );
        repositoryAssetService.checkinVersion( asset ); // HEAD

        TableDataResult result = repositoryAssetService.loadItemHistory( uuid );
        assertNotNull( result );
        TableDataRow[] rows = result.data;
        assertEquals( 2,
                      rows.length );
        assertFalse( rows[0].id.equals( uuid ) );
        assertFalse( rows[1].id.equals( uuid ) );

        RuleAsset old = repositoryAssetService.loadRuleAsset( rows[0].id );
        RuleAsset newer = repositoryAssetService.loadRuleAsset( rows[1].id );
        assertFalse( old.versionNumber == newer.versionNumber );

        RuleAsset head = repositoryAssetService.loadRuleAsset( uuid );

        long oldVersion = old.versionNumber;
        assertFalse( oldVersion == head.versionNumber );

        repositoryAssetService.restoreVersion( old.uuid,
                             head.uuid,
                             "this was cause of a mistake" );

        RuleAsset newHead = repositoryAssetService.loadRuleAsset( uuid );

        assertEquals( "this was cause of a mistake",
                      newHead.checkinComment );

    }
View Full Code Here

TOP

Related Classes of org.drools.guvnor.client.rpc.RuleAsset

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.