Package org.drools.guvnor.client.rpc

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


        vf.getFieldValues().add( new VerifyField( "age",
                                                  "42",
                                                  "==" ) );
        sc.getFixtures().add( vf );

        SingleScenarioResult res_ = repositoryPackageService.runScenario( pkg.getName(),
                                                                          sc );
        assertTrue( res_.auditLog.size() > 0 );

        String[] logEntry = res_.auditLog.get( 0 );
        assertNotNull( logEntry[0],
View Full Code Here


        vf.getFieldValues().add( new VerifyField( "age",
                                                  "42",
                                                  "==" ) );
        sc.getFixtures().add( vf );

        SingleScenarioResult res_ = repositoryPackageService.runScenario( pkg.getName(),
                                                                          sc );
        assertTrue( res_.auditLog.size() > 0 );

        String[] logEntry = res_.auditLog.get( 0 );
        assertNotNull( logEntry[0],
View Full Code Here

    private SingleScenarioResult runScenario(String packageName,
                                             Scenario scenario,
                                             RuleCoverageListener coverage) throws SerializableException {
        PackageItem item = this.repository.loadPackage( packageName );
        SingleScenarioResult result = null;
        // nasty classloader needed to make sure we use the same tree the whole
        // time.
        ClassLoader originalCL = Thread.currentThread().getContextClassLoader();
        try {
            final RuleBase rb = loadCacheRuleBase( item );
            //            if ( item.isBinaryUpToDate() && this.ruleBaseCache.containsKey( item.getUUID() ) ) {
            //                rb = this.ruleBaseCache.get( item.getUUID() );
            //            } else {
            //                // load up the classloader we are going to use
            //                List<JarInputStream> jars = BRMSPackageBuilder.getJars( item );
            //                ClassLoader buildCl = BRMSPackageBuilder.createClassLoader( jars );
            //
            //                // we have to build the package, and try again.
            //                if ( item.isBinaryUpToDate() ) {
            //                    rb = loadRuleBase( item,
            //                                       buildCl );
            //                    this.ruleBaseCache.put( item.getUUID(),
            //                                            rb );
            //                } else {
            //                    BuilderResult[] errs = this.buildPackage( null,
            //                                                              false,
            //                                                              item );
            //                    if ( errs == null || errs.length == 0 ) {
            //                        rb = loadRuleBase( item,
            //                                           buildCl );
            //                        this.ruleBaseCache.put( item.getUUID(),
            //                                                rb );
            //                    } else {
            //                        SingleScenarioResult r = new SingleScenarioResult();
            //                        r.result = new ScenarioRunResult( errs,
            //                                                          null );
            //                        return r;
            //                    }
            //                }
            //            }

            ClassLoader cl = ((InternalRuleBase) this.ruleBaseCache.get( item.getUUID() )).getRootClassLoader();
            Thread.currentThread().setContextClassLoader( cl );
            result = runScenario( scenario,
                                  item,
                                  cl,
                                  rb,
                                  coverage );
        } catch ( Exception e ) {
            if ( e instanceof DetailedSerializableException ) {
                DetailedSerializableException err = (DetailedSerializableException) e;
                result = new SingleScenarioResult();
                if ( err.getErrs() != null ) {
                    result.result = new ScenarioRunResult( err.getErrs(),
                                                           null );
                } else {
                    throw err;
View Full Code Here

        try {
            AuditLogReporter logger = new AuditLogReporter( workingMemory );
            new ScenarioRunner( scenario,
                                res,
                                workingMemory );
            SingleScenarioResult r = new SingleScenarioResult();
            r.auditLog = logger.buildReport();
            r.result = new ScenarioRunResult( null,
                                              scenario );
            return r;
        } catch ( ClassNotFoundException e ) {
View Full Code Here

    private SingleScenarioResult runScenario(String packageName,
                                             Scenario scenario,
                                             RuleCoverageListener coverage) throws SerializationException {
        PackageItem item = this.repository.loadPackage( packageName );
        SingleScenarioResult result = null;
        // nasty classloader needed to make sure we use the same tree the whole
        // time.
        ClassLoader originalCL = Thread.currentThread().getContextClassLoader();
        try {
            final RuleBase rb = loadCacheRuleBase( item );
            //            if ( item.isBinaryUpToDate() && this.ruleBaseCache.containsKey( item.getUUID() ) ) {
            //                rb = this.ruleBaseCache.get( item.getUUID() );
            //            } else {
            //                // load up the classloader we are going to use
            //                List<JarInputStream> jars = BRMSPackageBuilder.getJars( item );
            //                ClassLoader buildCl = BRMSPackageBuilder.createClassLoader( jars );
            //
            //                // we have to build the package, and try again.
            //                if ( item.isBinaryUpToDate() ) {
            //                    rb = loadRuleBase( item,
            //                                       buildCl );
            //                    this.ruleBaseCache.put( item.getUUID(),
            //                                            rb );
            //                } else {
            //                    BuilderResult[] errs = this.buildPackage( null,
            //                                                              false,
            //                                                              item );
            //                    if ( errs == null || errs.length == 0 ) {
            //                        rb = loadRuleBase( item,
            //                                           buildCl );
            //                        this.ruleBaseCache.put( item.getUUID(),
            //                                                rb );
            //                    } else {
            //                        SingleScenarioResult r = new SingleScenarioResult();
            //                        r.result = new ScenarioRunResult( errs,
            //                                                          null );
            //                        return r;
            //                    }
            //                }
            //            }

            ClassLoader cl = ((InternalRuleBase) this.ruleBaseCache.get( item.getUUID() )).getRootClassLoader();
            Thread.currentThread().setContextClassLoader( cl );
            result = runScenario( scenario,
                                  item,
                                  cl,
                                  rb,
                                  coverage );
        } catch ( Exception e ) {
            if ( e instanceof DetailedSerializationException ) {
                DetailedSerializationException err = (DetailedSerializationException) e;
                result = new SingleScenarioResult();
                if ( err.getErrs() != null ) {
                    result.result = new ScenarioRunResult( err.getErrs(),
                                                           null );
                } else {
                    throw err;
View Full Code Here

        try {
            AuditLogReporter logger = new AuditLogReporter( workingMemory );
            new ScenarioRunner( scenario,
                                res,
                                workingMemory );
            SingleScenarioResult r = new SingleScenarioResult();
            r.auditLog = logger.buildReport();
            r.result = new ScenarioRunResult( null,
                                              scenario );
            return r;
        } catch ( ClassNotFoundException e ) {
View Full Code Here

                    coverage);
        } catch (Exception e) {
            if (e instanceof DetailedSerializationException) {
                DetailedSerializationException exception = (DetailedSerializationException) e;
                if (exception.getErrs() != null) {
                    return new SingleScenarioResult(new ScenarioRunResult(exception.getErrs()));
                } else {
                    throw exception;
                }
            } else {
                throw new DetailedSerializationException("Unable to run the scenario.",
View Full Code Here

                            classLoader),
                    classLoader,
                    workingMemory
            ).run(scenario);

            return new SingleScenarioResult(
                    new ScenarioRunResult(scenario),
                    logger.buildReport());
        } catch (ClassNotFoundException e) {
            log.error("Unable to load a required class.",
                    e);
View Full Code Here

        vf.getFieldValues().add( new VerifyField( "age",
                                                  "42",
                                                  "==" ) );
        sc.getFixtures().add( vf );

        SingleScenarioResult res_ = repositoryPackageService.runScenario( pkg.getName(),
                                                                          sc );
        assertTrue( res_.getAuditLog().size() > 0 );

        String[] logEntry = res_.getAuditLog().get(0);
        assertNotNull( logEntry[0],
                       logEntry[1] );

        ScenarioRunResult res = res_.getResult();

        assertNull( res.getErrors() );
        assertNotNull( res.getScenario() );
        assertTrue( vf.wasSuccessful() );
        assertTrue( vr.wasSuccessful() );
View Full Code Here

        vf.getFieldValues().add( new VerifyField( "age",
                                                  "42",
                                                  "==" ) );
        sc.getFixtures().add( vf );

        SingleScenarioResult res_ = testScenarioServiceImplementation.runScenario( pkg.getName(),
                                                                          sc );
        assertTrue( res_.getAuditLog().size() > 0 );

        String[] logEntry = res_.getAuditLog().get(0);
        assertNotNull( logEntry[0],
                       logEntry[1] );

        ScenarioRunResult res = res_.getResult();

        assertNull( res.getErrors() );
        assertNotNull( res.getScenario() );
        assertTrue( vf.wasSuccessful() );
        assertTrue( vr.wasSuccessful() );
View Full Code Here

TOP

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

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.