use of org.drools.workbench.models.testscenarios.shared.Scenario in project drools by kiegroup.
the class ScenarioXMLPersistence method unmarshal.
public Scenario unmarshal(String xml) {
if (xml == null)
return new Scenario();
if (xml.trim().equals(""))
return new Scenario();
Object o = xt.fromXML(xml);
Scenario scenario = (Scenario) o;
if (scenario.getImports() == null) {
scenario.setImports(new Imports());
}
return scenario;
}
use of org.drools.workbench.models.testscenarios.shared.Scenario in project drools by kiegroup.
the class ScenarioRunner4JUnitTest method testBasic.
@Test
public void testBasic() throws Exception {
HashMap<String, KieSession> ksessions = new HashMap<String, KieSession>();
ksessions.put("someId", ksession);
Scenario scenario = new Scenario();
scenario.getKSessions().add("someId");
ScenarioRunner4JUnit runner4JUnit = new ScenarioRunner4JUnit(scenario, ksessions);
RunNotifier notifier = new RunNotifier();
RunListener runListener = spy(new RunListener());
notifier.addListener(runListener);
runner4JUnit.run(notifier);
verify(runListener, never()).testFailure(any(Failure.class));
verify(runListener).testFinished(any(Description.class));
verify(ksession).reset();
}
use of org.drools.workbench.models.testscenarios.shared.Scenario in project drools by kiegroup.
the class ScenarioRunner4JUnitTest method testIDNotSet.
@Test
public void testIDNotSet() throws Exception {
HashMap<String, KieSession> ksessions = new HashMap<String, KieSession>();
ksessions.put(null, ksession);
ScenarioRunner4JUnit runner4JUnit = new ScenarioRunner4JUnit(new Scenario(), ksessions);
RunNotifier notifier = new RunNotifier();
RunListener runListener = spy(new RunListener());
notifier.addListener(runListener);
runner4JUnit.run(notifier);
verify(runListener, never()).testFailure(any(Failure.class));
verify(runListener).testFinished(any(Description.class));
verify(ksession).reset();
}
use of org.drools.workbench.models.testscenarios.shared.Scenario in project drools by kiegroup.
the class ScenarioRunner4JUnitTest method testNoKieSession.
@Test
public void testNoKieSession() throws Exception {
ScenarioRunner4JUnit runner4JUnit = new ScenarioRunner4JUnit(new Scenario(), new HashMap<String, KieSession>());
RunNotifier notifier = new RunNotifier();
RunListener runListener = spy(new RunListener());
notifier.addListener(runListener);
runner4JUnit.run(notifier);
verify(runListener).testFailure(any(Failure.class));
}
use of org.drools.workbench.models.testscenarios.shared.Scenario in project drools by kiegroup.
the class ScenarioRunnerTest method testImports.
@Test
public void testImports() throws Exception {
Scenario scenario = new Scenario();
scenario.setPackageName("org.drools.workbench.models.testscenarios.backend");
ScenarioRunner runner = new ScenarioRunner(ksession);
scenario.getFixtures().add(new FactData("Cheese", "f1", Collections.EMPTY_LIST, false));
runner.run(scenario);
assertTrue(scenario.wasSuccessful());
}
Aggregations