((List) session.getGlobal( "list" )).get( 0 ) );
}
@Test
public void testCell() throws Exception {
final Cell cell1 = new Cell( 9 );
final Cell cell = new Cell( 0 );
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "evalmodify.drl" ) ) );
if ( builder.hasErrors() ) {
fail( builder.getErrors().toString() );
}
RuleBase ruleBase = getRuleBase();
Package pkg = builder.getPackage();
ruleBase.addPackage( pkg );
ruleBase = SerializationHelper.serializeObject( ruleBase );
Environment env = EnvironmentFactory.newEnvironment();
env.set( EnvironmentName.OBJECT_MARSHALLING_STRATEGIES,
new ObjectMarshallingStrategy[]{
new IdentityPlaceholderResolverStrategy( ClassObjectMarshallingStrategyAcceptor.DEFAULT )} );
StatefulSession session = ruleBase.newStatefulSession( null,
env );
session.insert( cell1 );
FactHandle cellHandle = session.insert( cell );
StatefulKnowledgeSession ksession = SerializationHelper.getSerialisedStatefulKnowledgeSession( new StatefulKnowledgeSessionImpl( (ReteooWorkingMemory) session ),
// MarshallerFactory.newIdentityMarshallingStrategy(),
false );
session.fireAllRules();
assertEquals( 9,
cell.getValue() );
}