use of org.drools.testcoverage.common.model.Promotion in project drools by kiegroup.
the class LogicalInsertionsSerializationTest method testSerializeAndDeserializeSession.
@Test
public void testSerializeAndDeserializeSession() throws Exception {
KieSession ksession = session.getStateful();
File tempFile = File.createTempFile(name.getMethodName(), null);
ksession.fireAllRules();
try (OutputStream fos = new FileOutputStream(tempFile)) {
Marshaller marshaller = getServices().getMarshallers().newMarshaller(getKbase());
marshaller.marshall(fos, ksession);
}
try (InputStream fis = new FileInputStream(tempFile)) {
Marshaller marshaller = getServices().getMarshallers().newMarshaller(getKbase());
marshaller.unmarshall(fis, ksession);
}
ksession.insert(new Promotion("Claire", "Scientist"));
int firedRules = ksession.fireAllRules();
Assertions.assertThat(firedRules).isEqualTo(1);
}
Aggregations