"40"));
person.getFieldData().add( new FieldData( "name",
"michael" ) );
sc.getFixtures().add( person );
sc.getFixtures().add( new ExecutionTrace() );
VerifyRuleFired vr = new VerifyRuleFired( "rule1",
1,
null );
sc.getFixtures().add( vr );
VerifyFact vf = new VerifyFact();
vf.setName( "p" );
vf.getFieldValues().add(new VerifyField("name",
"michael",
"=="));
vf.getFieldValues().add( new VerifyField( "age",
"42",
"==" ) );
sc.getFixtures().add( vf );
FactData cheese = new FactData();
cheese.setName( "cheese" );
cheese.setType("Cheese");
cheese.getFieldData().add(new FieldData("price",
"42"));
sc.getGlobals().add( cheese );
ScenarioRunResult res = testScenarioServiceImplementation.runScenario(pkg.getName(),
sc).getResult();
assertNull(res.getErrors() );
assertNotNull(res.getScenario());
assertTrue(vf.wasSuccessful());
assertTrue( vr.wasSuccessful() );
res = testScenarioServiceImplementation.runScenario(pkg.getName(),
sc).getResult();
assertNull(res.getErrors() );
assertNotNull(res.getScenario());
assertTrue(vf.wasSuccessful());
assertTrue(vr.wasSuccessful() );
RuleBaseCache.getInstance().clearCache();
res = testScenarioServiceImplementation.runScenario(pkg.getName(),
sc).getResult();
assertNull(res.getErrors() );
assertNotNull(res.getScenario());
assertTrue(vf.wasSuccessful());
assertTrue( vr.wasSuccessful() );
//BuilderResult[] results = impl.buildPackage(pkg.getUUID(), null, true);
//assertNull(results);
rule1.updateContent( "Junk" );
rule1.checkin("");
RuleBaseCache.getInstance().clearCache();
pkg.updateBinaryUpToDate(false);
rulesRepository.save();
res = testScenarioServiceImplementation.runScenario(pkg.getName(),
sc).getResult();
assertNotNull( res.getErrors() );
assertNull(res.getScenario());
assertTrue(res.getErrors().size() > 0);
repositoryCategoryService.createCategory("/",
"sc",
"");
String scenarioId = serviceImplementation.createNewRule( "sc1",
"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();