model.lhs = new IPattern[1];
FactPattern fp0 = new FactPattern();
fp0.setBoundName( "$t0" );
fp0.setFactType( "FT0" );
fp0.setNegated( true );
CEPWindow cepWindow0 = new CEPWindow();
cepWindow0.setOperator( SuggestionCompletionEngine.getCEPWindowOperators().get( 0 ) );
cepWindow0.setParameter( "cepWindow0P0",
"cepWindow0P0Value" );
cepWindow0.setParameter( "cepWindow0P1",
"cepWindow0P1Value" );
fp0.setWindow( cepWindow0 );
model.lhs[0] = fp0;
RuleModelCloneVisitor cloneVisitor = new RuleModelCloneVisitor();
RuleModel clone = cloneVisitor.visitRuleModel( model );
assertEquals( 1,
clone.lhs.length );
assertNotSame( model.lhs[0],
clone.lhs[0] );
assertNotNull( clone.lhs[0] );
assertTrue( clone.lhs[0] instanceof FactPattern );
FactPattern fp0Clone = (FactPattern) clone.lhs[0];
assertEquals( fp0.getBoundName(),
fp0Clone.getBoundName() );
assertEquals( fp0.getFactType(),
fp0Clone.getFactType() );
assertEquals( fp0.isNegated(),
fp0Clone.isNegated() );
assertNotSame( fp0.getWindow(),
fp0Clone.getWindow() );
assertNotNull( fp0Clone.getWindow() );
assertTrue( fp0Clone.getWindow() instanceof CEPWindow );
CEPWindow cepWindow0Clone = (CEPWindow) fp0Clone.getWindow();
assertEquals( cepWindow0.getOperator(),
cepWindow0Clone.getOperator() );
assertEquals( cepWindow0.getParameters().size(),
cepWindow0Clone.getParameters().size() );
assertNotNull( cepWindow0Clone.getParameter( "cepWindow0P0" ) );
assertEquals( cepWindow0.getParameter( "cepWindow0P0" ),
cepWindow0Clone.getParameter( "cepWindow0P0" ) );
assertNotNull( cepWindow0Clone.getParameter( "cepWindow0P1" ) );
assertEquals( cepWindow0.getParameter( "cepWindow0P1" ),
cepWindow0Clone.getParameter( "cepWindow0P1" ) );
}