Package org.drools.guvnor.client.rpc

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


        assertTrue( pkg.getNode().getProperty( "drools:binaryUpToDate" ).getBoolean() );
        assertTrue( pkg.isBinaryUpToDate() );
        assertFalse( impl.ruleBaseCache.containsKey( pkg.getUUID() ) );

        RuleAsset asset = impl.loadRuleAsset( rule1.getUUID() );
        impl.checkinVersion( asset );

        assertFalse( pkg.getNode().getProperty( "drools:binaryUpToDate" ).getBoolean() );
        assertFalse( impl.ruleBaseCache.containsKey( pkg.getUUID() ) );
View Full Code Here


                                                "s",
                                                "sc",
                                                pkg.getName(),
                                                AssetFormats.TEST_SCENARIO );

        RuleAsset asset = impl.loadRuleAsset( scenarioId );
        assertNotNull( asset.content );
        assertTrue( asset.content instanceof Scenario );

        Scenario sc_ = (Scenario) asset.content;
        sc_.fixtures.add( new ExecutionTrace() );
View Full Code Here

        String uid = impl.createNewRule( "decTable",
                                         "",
                                         "decisiontables",
                                         pkg.getName(),
                                         AssetFormats.DECISION_TABLE_GUIDED );
        RuleAsset ass = impl.loadRuleAsset( uid );
        ass.content = dt;
        impl.checkinVersion( ass );

        BuilderResult results = impl.buildPackage( pkg.getUUID(),
                                                   true );
View Full Code Here

                      impl.listSnapshots( "testSnapshotDiff" ).length );
        assertEquals( 4,
                      impl.listRulesInPackage( "testSnapshotDiff" ).length );

        // Change the rule, archive one, delete one and create a new one
        RuleAsset asset = impl.loadRuleAsset( modifiedRuleUuid );
        String uuid = impl.checkinVersion( asset );
        assertNotNull( uuid );

        impl.removeAsset( deletedRuleUuid );
View Full Code Here

            //this should trigger the fact that the first 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.getUuid() ) ) found = true;
            }
            assertTrue( found );

            //but should not be in "incoming" yet
            found = false;
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.getDescription(),
                      "an initial desc" );
        assertEquals( assetWrapper.getName(),
                      "testCreateNewRuleContains' character" );

    }
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,
                          es.size() );
            assertEquals( ass.getUuid(),
                          es.get( 0 ).assetUUID );
            assertEquals( ass.getName(),
                          es.get( 0 ).note );

            ib.clearAll();

            repositoryAssetService.loadRuleAsset( ass.getUuid() );
            es = ib.loadRecentEdited();
            assertEquals( 0,
                          es.size() );

            //now check they have it in their opened list...
            es = ib.loadRecentOpened();
            assertEquals( 1,
                          es.size() );
            assertEquals( ass.getUuid(),
                          es.get( 0 ).assetUUID );
            assertEquals( ass.getName(),
                          es.get( 0 ).note );

            assertEquals( 0,
                          ib.loadRecentEdited().size() );
        } finally {
View Full Code Here

                                              "this is a description",
                                              "testCheckinCategory",
                                              RulesRepository.DEFAULT_PACKAGE,
                                              AssetFormats.DRL );
            RepositoryAssetService repositoryAssetService = getRepositoryAssetService();
            RuleAsset asset = repositoryAssetService.loadRuleAsset( uuid );

            assertNotNull( asset.getLastModified() );

            asset.getMetaData().setCoverage( "boo" );
            asset.setContent( new RuleContentText() );
            ((RuleContentText) asset.getContent()).content = "yeah !";
            asset.setDescription( "Description 1" );

            Date start = new Date();
            Thread.sleep( 100 );

            String uuid2 = repositoryAssetService.checkinVersion( asset );
            assertEquals( uuid,
                          uuid2 );

            assertTrue( ib.loadRecentEdited().size() > inbox.size() );

            RuleAsset asset2 = repositoryAssetService.loadRuleAsset( uuid );
            assertNotNull( asset2.getLastModified() );
            assertTrue( asset2.getLastModified().after( start ) );

            assertEquals( "boo",
                          asset2.getMetaData().getCoverage() );
            assertEquals( 1,
                          asset2.getVersionNumber() );

            assertEquals( "yeah !",
                          ((RuleContentText) asset2.getContent()).content );

            assertEquals( "Description 1",
                          asset2.getDescription() );

            asset2.getMetaData().setCoverage( "ya" );
            asset2.setCheckinComment( "checked in" );

            String cat = asset2.getMetaData().getCategories()[0];
            asset2.getMetaData().setCategories( new String[3] );
            asset2.getMetaData().getCategories()[0] = cat;
            asset2.getMetaData().getCategories()[1] = "testCheckinCategory2";
            asset2.getMetaData().getCategories()[2] = "testCheckinCategory/deeper";
            asset2.setDescription( "Description 2" );

            repositoryAssetService.checkinVersion( asset2 );

            asset2 = repositoryAssetService.loadRuleAsset( uuid );
            assertEquals( "ya",
                          asset2.getMetaData().getCoverage() );
            assertEquals( 2,
                          asset2.getVersionNumber() );
            assertEquals( "checked in",
                          asset2.getCheckinComment() );
            assertEquals( 3,
                          asset2.getMetaData().getCategories().length );
            assertEquals( "testCheckinCategory",
                          asset2.getMetaData().getCategories()[0] );
            assertEquals( "testCheckinCategory2",
                          asset2.getMetaData().getCategories()[1] );
            assertEquals( "testCheckinCategory/deeper",
                          asset2.getMetaData().getCategories()[2] );
            assertEquals( "Description 2",
                          asset2.getDescription() );

            // now lets try a concurrent edit of an asset.
            // asset3 will be loaded and edited, and then asset2 will try to
            // clobber, it, which should fail.
            // as it is optimistically locked.
            RuleAsset asset3 = repositoryAssetService.loadRuleAsset( asset2.getUuid() );
            asset3.getMetaData().setSubject( "new sub" );
            repositoryAssetService.checkinVersion( asset3 );

            asset3 = repositoryAssetService.loadRuleAsset( asset2.getUuid() );
            assertFalse( asset3.getVersionNumber() == asset2.getVersionNumber() );

            String result = repositoryAssetService.checkinVersion( asset2 );
            assertTrue( result.startsWith( "ERR" ) );
            System.err.println( result.substring( 5 ) );
        } finally {
View Full Code Here

                                               null,
                                               "testStatus",
                                               AssetFormats.DRL );
        impl.createState( "testState" );
        RepositoryAssetService repositoryAssetService = getRepositoryAssetService();
        RuleAsset asset = repositoryAssetService.loadRuleAsset( ruleUUID );
        assertEquals( StateItem.DRAFT_STATE_NAME,
                      asset.getState() );
        repositoryAssetService.changeState( ruleUUID,
                                            "testState" );
        asset = repositoryAssetService.loadRuleAsset( ruleUUID );
        assertEquals( "testState",
                      asset.getState() );
        asset = repositoryAssetService.loadRuleAsset( ruleUUID2 );
        assertEquals( StateItem.DRAFT_STATE_NAME,
                      asset.getState() );

        impl.createState( "testState2" );
        repositoryAssetService.changePackageState( packagUUID,
                                                   "testState2" );

        PackageConfigData pkg = repositoryPackageService.loadPackageConfig( packagUUID );
        assertEquals( "testState2",
                      pkg.getState() );

        asset = repositoryAssetService.loadRuleAsset( ruleUUID2 );
        assertEquals( "testState2",
                      asset.getState() );

        repositoryAssetService.checkinVersion( asset );
        asset = repositoryAssetService.loadRuleAsset( asset.getUuid() );
        assertEquals( "testState2",
                      asset.getState() );

    }
View Full Code Here

        assertTrue( pkg.getNode().getProperty( "drools:binaryUpToDate" ).getBoolean() );
        assertTrue( pkg.isBinaryUpToDate() );
        assertFalse( RuleBaseCache.getInstance().contains( pkg.getUUID() ) );
        RepositoryAssetService repositoryAssetService = getRepositoryAssetService();
        RuleAsset asset = repositoryAssetService.loadRuleAsset( rule1.getUUID() );
        repositoryAssetService.checkinVersion( asset );

        assertFalse( pkg.getNode().getProperty( "drools:binaryUpToDate" ).getBoolean() );
        assertFalse( RuleBaseCache.getInstance().contains( pkg.getUUID() ) );
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.