Package org.drools.guvnor.client.rpc

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


        UserInbox ib = new UserInbox( rulesRepository );

        ib.clearAll();

        @SuppressWarnings("unused")
        Asset asset;
        String uuid;
        rulesRepository.createModule( "testLoadInboxFullResults",
                                      "testLoadInboxDescription" );
        repositoryCategoryService.createCategory( "",
View Full Code Here


        assertEquals( 1,
                      response.getPageRowList().size() );
        String uuid = response.getPageRowList().get( 0 ).getUuid();

        // create version 4.
        Asset ai = repositoryAssetService.loadRuleAsset( uuid );
        ai.setCheckinComment( "version 4" );
        repositoryAssetService.checkinVersion( ai );

        // create version 5.
        ai = repositoryAssetService.loadRuleAsset( uuid );
        ai.setCheckinComment( "version 5" );
        repositoryAssetService.checkinVersion( ai );

        System.out.println( "old uuid: " + uuid );

        //NOTE: Have not figured out the reason, but if we dont create a random package here,
View Full Code Here

        String uuid1 = serviceImplementation.createNewRule( "workItem1",
                                                            "workItem1description",
                                                            "testLoadingWorkDefinitionsFromPackageAssetsCategory",
                                                            "testLoadingWorkDefinitionsFromPackageAssets",
                                                            "wid" );
        Asset asset1 = repositoryAssetService.loadRuleAsset( uuid1 );
        RuleContentText content1 = new RuleContentText();
        content1.content = ""
                           + "import org.drools.process.core.datatype.impl.type.StringDataType;\n"
                           + "[\n"
                           + "[\n"
                           + "\"name\" : \"MyTask1\",\n"
                           + "\"parameters\" : [\n"
                           + "\"StringParam\" : new StringDataType()\n"
                           + "],\n"
                           + "\"results\" : [\n"
                           + "\"StringResult\" : new StringDataType()\n"
                           + "],\n"
                           + "\"displayName\" : \"My Task1\","
                           + "\"icon\" : \"\",\n"
                           + "]\n"
                           + "]";

        asset1.setContent( content1 );
        repositoryAssetService.checkinVersion( asset1 );

        //Create #2 Work Item definition
        String uuid2 = serviceImplementation.createNewRule( "workItem2",
                                                            "workItem2description",
                                                            "testLoadingWorkDefinitionsFromPackageAssetsCategory",
                                                            "testLoadingWorkDefinitionsFromPackageAssets",
                                                            "wid" );
        Asset asset2 = repositoryAssetService.loadRuleAsset( uuid2 );
        RuleContentText content2 = new RuleContentText();
        content2.content = ""
                           + "import org.drools.process.core.datatype.impl.type.IntegerDataType;\n"
                           + "[\n"
                           + "[\n"
                           + "\"name\" : \"MyTask2\",\n"
                           + "\"parameters\" : [\n"
                           + "\"IntegerParam\" : new IntegerDataType()\n"
                           + "],\n"
                           + "\"results\" : [\n"
                           + "\"IntegerResult\" : new IntegerDataType()\n"
                           + "],\n"
                           + "\"displayName\" : \"My Task2\","
                           + "\"icon\" : \"\",\n"
                           + "]\n"
                           + "]";

        asset2.setContent( content2 );
        repositoryAssetService.checkinVersion( asset2 );

        //Create #3 Work Item definition
        String uuid3 = serviceImplementation.createNewRule( "workItem3",
                                                            "workItem3description",
                                                            "testLoadingWorkDefinitionsFromPackageAssetsCategory",
                                                            "testLoadingWorkDefinitionsFromPackageAssets",
                                                            "wid" );
        Asset asset3 = repositoryAssetService.loadRuleAsset( uuid3 );
        RuleContentText content3 = new RuleContentText();
        content3.content = ""
                           + "import org.drools.process.core.datatype.impl.type.ObjectDataType;\n"
                           + "[\n"
                           + "[\n"
                           + "\"name\" : \"MyTask3\",\n"
                           + "\"parameters\" : [\n"
                           + "\"ObjectParam\" : new ObjectDataType()\n"
                           + "],\n"
                           + "\"results\" : [\n"
                           + "\"ObjectResult\" : new ObjectDataType()\n"
                           + "],\n"
                           + "\"displayName\" : \"My Task3\","
                           + "\"icon\" : \"\",\n"
                           + "]\n"
                           + "]";

        asset3.setContent( content3 );
        repositoryAssetService.checkinVersion( asset3 );

        try {
            AssetWorkDefinitionsLoader loader = new AssetWorkDefinitionsLoader( repositoryAssetService,
                                                                                packageUUID );
View Full Code Here

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

        Asset asset = repositoryAssetService.loadRuleAsset( scenarioId );
        assertNotNull( asset.getContent() );
        assertTrue( asset.getContent() instanceof Scenario );

        Scenario sc_ = (Scenario) asset.getContent();
        sc_.getFixtures().add( new ExecutionTrace() );
        repositoryAssetService.checkinVersion( asset );
        asset = repositoryAssetService.loadRuleAsset( scenarioId );
        assertNotNull( asset.getContent() );
        assertTrue( asset.getContent() instanceof Scenario );
        sc_ = (Scenario) asset.getContent();
        assertEquals( 1,
                      sc_.getFixtures().size() );

    }
View Full Code Here

                                        "" );
        asset.updateFormat( "model.drl" );
        asset.updateContent( "declare Foo\n name: String\n end" );
        asset.checkin( "" );

        Asset ass = new Asset();
        ch.retrieveAssetContent( ass,
                                 asset );
        assertTrue( ass.getContent() instanceof FactModels );
        FactModels fm = (FactModels) ass.getContent();

        assertEquals( 1,
                      fm.models.size() );
        FactMetaModel mm = (FactMetaModel) fm.models.get( 0 );
        assertEquals( 1,
                      mm.getFields().size() );
        assertEquals( "Foo",
                      mm.getName() );

        FieldMetaModel fmm = (FieldMetaModel) mm.getFields().get( 0 );
        assertEquals( "name",
                      fmm.name );

        mm.getFields().add( new FieldMetaModel( "age",
                                                "int" ) );

        ch.storeAssetContent( ass,
                              asset );

        assertTrue( asset.getContent().indexOf( "age: int" ) > -1 );

        asset.updateContent( "rubbish here" );
        asset.checkin( "" );

        ch.retrieveAssetContent( ass,
                                 asset );
        assertTrue( ass.getContent() instanceof RuleContentText );

        ch.storeAssetContent( ass,
                              asset );

        assertEquals( "rubbish here",
View Full Code Here

                                           "testLoadRuleAssetAnalystCat1" ) );
        roleBasedPermissionManager.create(); // HACK flushes the permission cache

        try {
            //now lets see if we can access this asset with the permissions
            @SuppressWarnings("unused")
            Asset asset = repositoryAssetService.loadRuleAsset( uuid1 );
            try {
                asset = repositoryAssetService.loadRuleAsset( uuid2 );
                fail( "Did not catch expected exception" );
            } catch ( AuthorizationException e ) {
View Full Code Here

                                           null ) );
        roleBasedPermissionManager.create(); // HACK flushes the permission cache

        try {
            //now lets see if we can access this asset with the permissions
            @SuppressWarnings("unused")
            Asset asset = repositoryAssetService.loadRuleAsset( uuid1 );
            try {
                asset = repositoryAssetService.loadRuleAsset( uuid2 );
                fail( "Did not catch expected exception" );
            } catch ( AuthorizationException e ) {
View Full Code Here

                                          AssetFormats.DRL );

        // Like this by default: roleBasedPermissionResolver.setEnableRoleBasedAuthorization(false);

        // now lets see if we can access this asset with the permissions
        Asset asset = repositoryAssetService.loadRuleAsset( uuid );
        assertNotNull( asset );
    }
View Full Code Here

                                           null ) );
        roleBasedPermissionManager.create(); // HACK flushes the permission cache

        try {
            //now lets see if we can access this asset with the permissions
            Asset asset = repositoryAssetService.loadRuleAsset( uuid );
            assertNotNull( asset );
        } finally {
            roleBasedPermissionStore.clearAllRoleBasedPermissionsForTesting(USER_NAME);
            roleBasedPermissionResolver.setEnableRoleBasedAuthorization(false);
        }
View Full Code Here

                                           "testLoadRuleAssetNoCategoryAnalystCat2" ) );
        roleBasedPermissionManager.create(); // HACK flushes the permission cache

        try {
            //now lets see if we can access this asset with the permissions
            @SuppressWarnings("unused")
            Asset asset2 = repositoryAssetService.loadRuleAsset( uuid2 );
            try {
                @SuppressWarnings("unused")
                Asset asset1 = repositoryAssetService.loadRuleAsset( uuid1 );
                fail( "Did not catch expected exception" );
            } catch ( AuthorizationException e ) {
            }
        } finally {
View Full Code Here

TOP

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

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.