Package org.drools.guvnor.client.modeldriven.testing

Examples of org.drools.guvnor.client.modeldriven.testing.Scenario


        assertTrue( sc.wasSuccessful() );
    }

    public void testIntegrationWithFailure() throws Exception {
        Scenario sc = new Scenario();
        Expectation[] assertions = populateScenarioForFailure(sc);

        TypeResolver resolver = new ClassTypeResolver( new HashSet<String>(),
                                                       Thread.currentThread().getContextClassLoader() );
        resolver.addImport( "org.drools.Cheese" );
        resolver.addImport( "org.drools.Person" );

        WorkingMemory wm = getWorkingMemory( "test_rules2.drl" );

        ScenarioRunner run = new ScenarioRunner( sc,
                                                 resolver,
                                                 (InternalWorkingMemory) wm );

        assertSame( run.scenario,
                    sc );

        assertFalse( sc.wasSuccessful() );

        VerifyFact vf = (VerifyFact) assertions[1];
        assertFalse( ((VerifyField) vf.fieldValues.get( 0 )).successResult );
        assertEquals( "XXX",
                      ((VerifyField) vf.fieldValues.get( 0 )).expected );
View Full Code Here


                      vr.actualResult.intValue() );

    }

    public void testRunAsString() throws Exception {
      Scenario sc = new Scenario();
      populateScenarioForFailure(sc);
      String xml = ScenarioXMLPersistence.getInstance().marshal(sc);
      WorkingMemory wm = getWorkingMemory( "test_rules2.drl" );
      ScenarioRunner runner = new ScenarioRunner(xml, wm.getRuleBase());
      assertFalse(runner.wasSuccess());
View Full Code Here

    //needed when running stand alone to make sure the converters get loaded.
    DroolsMVELFactory d = new DroolsMVELFactory();
  }

    public void testPopulateFactsWithInterfaces() throws Exception {
        Scenario sc = new Scenario();
        List facts = ls( new FactData( "List",
                                       "ls",
                                       new ArrayList(),
                                       false ) );
View Full Code Here


    }

    public void testPopulateFacts() throws Exception {
        Scenario sc = new Scenario();
        List facts = ls( new FactData( "Cheese",
                                       "c1",
                                       ls( new FieldData( "type",
                                                          "cheddar" ),
                                           new FieldData( "price",
View Full Code Here

                      p.getAge() );

    }

    public void testPopulateNested() throws Exception {
        Scenario sc = new Scenario();
        List facts = ls( new FactData( "Cheese",
                                       "c1",
                                       ls( new FieldData( "type",
                                                          "cheddar" ),
                                           new FieldData( "price",
View Full Code Here

        assertNotNull(o.getInnerFact());

    }

    public void testPopulateEmpty() throws Exception {
        Scenario sc = new Scenario();
        List facts = ls( new FactData( "Cheese",
                                       "c1", new ArrayList(), false));
        sc.fixtures.addAll( facts );
        TypeResolver resolver = new ClassTypeResolver( new HashSet<String>(),
                                                       Thread.currentThread().getContextClassLoader() );
View Full Code Here

        assertTrue( runner.populatedData.containsKey( "c1" ) );
        assertTrue(runner.populatedData.get("c1") instanceof Cheese);
    }

    public void testDateField() throws Exception {
        Scenario sc = new Scenario();
        List facts = ls( new FactData( "Cheese",
                                       "c1",
                                       ls( new FieldData( "type",
                                                          "cheddar" ),
                                           new FieldData( "usedBy",
View Full Code Here

        assertNotNull(c.getUsedBy());

    }

    public void testPopulateFactsWithExpressions() throws Exception {
        Scenario sc = new Scenario();
        List facts = ls( new FactData( "Cheese",
                                       "c1",
                                       ls( new FieldData( "type",
                                                          "cheddar" ),
                                           new FieldData( "price",
View Full Code Here

    public void testPopulateNoData() throws Exception {
        TypeResolver resolver = new ClassTypeResolver( new HashSet<String>(),
                                                       Thread.currentThread().getContextClassLoader() );
        resolver.addImport( "org.drools.Cheese" );
        ScenarioRunner run = new ScenarioRunner( new Scenario(),
                                                 resolver,
                                                 new MockWorkingMemory() );
        run.populatedData.clear();
        Cheese c = new Cheese();
        c.setType( "whee" );
View Full Code Here

                      c.getPrice() );
    }

    public void testVerifyFacts() throws Exception {

        ScenarioRunner runner = new ScenarioRunner( new Scenario(),
                                                    null,
                                                    new MockWorkingMemory() );
        Cheese f1 = new Cheese( "cheddar",
                                42 );
        runner.populatedData.put( "f1",
View Full Code Here

TOP

Related Classes of org.drools.guvnor.client.modeldriven.testing.Scenario

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.