@Category(FlakyTest.class) @Test public void testMatchingCqs() throws Exception {
  final Host host=Host.getHost(0);
  VM server=host.getVM(0);
  VM client=host.getVM(1);
  cqDUnitTest.createServer(server);
  final int port=server.invoke(null);
  final String host0=NetworkUtils.getServerHostName(server.getHost());
  cqDUnitTest.createClient(client,port,host0);
  for (int i=0; i < 4; i++) {
    cqDUnitTest.createCQ(client,"testMatchingCqs_" + i,cqDUnitTest.cqs[0]);
    cqDUnitTest.executeCQ(client,"testMatchingCqs_" + i,false,null);
  }
  validateMatchingCqs(server,1,cqDUnitTest.cqs[0],4);
  int size=1;
  cqDUnitTest.createValues(server,cqDUnitTest.regions[0],size);
  cqDUnitTest.waitForCreated(client,"testMatchingCqs_0",CqQueryDUnitTest.KEY + size);
  cqDUnitTest.waitForCreated(client,"testMatchingCqs_3",CqQueryDUnitTest.KEY + size);
  cqDUnitTest.closeCQ(client,"testMatchingCqs_0");
  validateMatchingCqs(server,1,cqDUnitTest.cqs[0],3);
  cqDUnitTest.createValues(server,cqDUnitTest.regions[0],size);
  cqDUnitTest.waitForUpdated(client,"testMatchingCqs_3",CqQueryDUnitTest.KEY + size);
  cqDUnitTest.stopCQ(client,"testMatchingCqs_1");
  validateMatchingCqs(server,1,cqDUnitTest.cqs[0],2);
  cqDUnitTest.clearCQListenerEvents(client,"testMatchingCqs_3");
  cqDUnitTest.createValues(server,cqDUnitTest.regions[0],size);
  cqDUnitTest.waitForUpdated(client,"testMatchingCqs_3",CqQueryDUnitTest.KEY + size);
  cqDUnitTest.validateCQ(client,"testMatchingCqs_1",CqQueryDUnitTest.noTest,size,size,0,size,size,0,size * 2);
  cqDUnitTest.executeCQ(client,"testMatchingCqs_1",false,null);
  cqDUnitTest.clearCQListenerEvents(client,"testMatchingCqs_3");
  cqDUnitTest.createValues(server,cqDUnitTest.regions[0],size);
  cqDUnitTest.waitForUpdated(client,"testMatchingCqs_3",CqQueryDUnitTest.KEY + size);
  cqDUnitTest.validateCQ(client,"testMatchingCqs_1",CqQueryDUnitTest.noTest,size,size * 2,0,size,size * 2,0,size * 3);
  cqDUnitTest.createCQ(client,"testMatchingCqs_4",cqDUnitTest.cqs[1]);
  cqDUnitTest.executeCQ(client,"testMatchingCqs_4",false,null);
  cqDUnitTest.createCQ(client,"testMatchingCqs_5",cqDUnitTest.cqs[1]);
  cqDUnitTest.executeCQ(client,"testMatchingCqs_5",false,null);
  cqDUnitTest.createCQ(client,"testMatchingCqs_6",cqDUnitTest.cqs[2]);
  cqDUnitTest.executeCQ(client,"testMatchingCqs_6",false,null);
  validateMatchingCqs(server,3,cqDUnitTest.cqs[1],2);
  cqDUnitTest.closeCQ(client,"testMatchingCqs_6");
  validateMatchingCqs(server,2,cqDUnitTest.cqs[1],2);
  cqDUnitTest.closeCQ(client,"testMatchingCqs_5");
  cqDUnitTest.closeCQ(client,"testMatchingCqs_4");
  cqDUnitTest.closeCQ(client,"testMatchingCqs_3");
  cqDUnitTest.closeCQ(client,"testMatchingCqs_2");
  cqDUnitTest.closeCQ(client,"testMatchingCqs_1");
  validateMatchingCqs(server,0,null,0);
  cqDUnitTest.createValues(server,cqDUnitTest.regions[0],size);
  cqDUnitTest.closeClient(client);
  cqDUnitTest.closeServer(server);
}

@ Category ( FlakyTest . class ) @ Test public void testMatchingCqs ( ) throws Exception { final Host host = Host . getHost ( 0 ) ; VM server = host . getVM ( 0 ) ; VM client = host . getVM ( 1 ) ; cqDUnitTest . createServer ( server ) ; final int port = server . invoke ( null ) ; final String host0 = NetworkUtils . getServerHostName ( server . getHost ( ) ) ; cqDUnitTest . createClient ( client , port , host0 ) ; for ( int i = 0 ; i < 4 ; i ++ ) { cqDUnitTest . createCQ ( client , "testMatchingCqs_" + i , cqDUnitTest . cqs [ 0 ] ) ; cqDUnitTest . executeCQ ( client , "testMatchingCqs_" + i , false , null ) ; } validateMatchingCqs ( server , 1 , cqDUnitTest . cqs [ 0 ] , 4 ) ; int size = 1 ; cqDUnitTest . createValues ( server , cqDUnitTest . regions [ 0 ] , size ) ; cqDUnitTest . waitForCreated ( client , "testMatchingCqs_0" , CqQueryDUnitTest . KEY + size ) ; cqDUnitTest . waitForCreated ( client , "testMatchingCqs_3" , CqQueryDUnitTest . KEY + size ) ; cqDUnitTest . closeCQ ( client , "testMatchingCqs_0" ) ; validateMatchingCqs ( server , 1 , cqDUnitTest . cqs [ 0 ] , 3 ) ; cqDUnitTest . createValues ( server , cqDUnitTest . regions [ 0 ] , size ) ; cqDUnitTest . waitForUpdated ( client , "testMatchingCqs_3" , CqQueryDUnitTest . KEY + size ) ; cqDUnitTest . stopCQ ( client , "testMatchingCqs_1" ) ; validateMatchingCqs ( server , 1 , cqDUnitTest . cqs [ 0 ] , 2 ) ; cqDUnitTest . clearCQListenerEvents ( client , "testMatchingCqs_3" ) ; cqDUnitTest . createValues ( server , cqDUnitTest . regions [ 0 ] , size ) ; cqDUnitTest . waitForUpdated ( client , "testMatchingCqs_3" , CqQueryDUnitTest . KEY + size ) ; cqDUnitTest . validateCQ ( client , "testMatchingCqs_1" , CqQueryDUnitTest . noTest , size , size , 0 , size , size , 0 , size * 2 ) ; cqDUnitTest . executeCQ ( client , "testMatchingCqs_1" , false , null ) ; cqDUnitTest . clearCQListenerEvents ( client , "testMatchingCqs_3" ) ; cqDUnitTest . createValues ( server , cqDUnitTest . regions [ 0 ] , size ) ; cqDUnitTest . waitForUpdated ( client , "testMatchingCqs_3" , CqQueryDUnitTest . KEY + size ) ; cqDUnitTest . validateCQ ( client , "testMatchingCqs_1" , CqQueryDUnitTest . noTest , size , size * 2 , 0 , size , size * 2 , 0 , size * 3 ) ; cqDUnitTest . createCQ ( client , "testMatchingCqs_4" , cqDUnitTest . cqs [ 1 ] ) ; cqDUnitTest . executeCQ ( client , "testMatchingCqs_4" , false , null ) ; cqDUnitTest . createCQ ( client , "testMatchingCqs_5" , cqDUnitTest . cqs [ 1 ] ) ; cqDUnitTest . executeCQ ( client , "testMatchingCqs_5" , false , null ) ; cqDUnitTest . createCQ ( client , "testMatchingCqs_6" , cqDUnitTest . cqs [ 2 ] ) ; cqDUnitTest . executeCQ ( client , "testMatchingCqs_6" , false , null ) ; validateMatchingCqs ( server , 3 , cqDUnitTest . cqs [ 1 ] , 2 ) ; cqDUnitTest . closeCQ ( client , "testMatchingCqs_6" ) ; validateMatchingCqs ( server , 2 , cqDUnitTest . cqs [ 1 ] , 2 ) ; cqDUnitTest . closeCQ ( client , "testMatchingCqs_5" ) ; cqDUnitTest . closeCQ ( client , "testMatchingCqs_4" ) ; cqDUnitTest . closeCQ ( client , "testMatchingCqs_3" ) ; cqDUnitTest . closeCQ ( client , "testMatchingCqs_2" ) ; cqDUnitTest . closeCQ ( client , "testMatchingCqs_1" ) ; validateMatchingCqs ( server , 0 , null , 0 ) ; cqDUnitTest . createValues ( server , cqDUnitTest . regions [ 0 ] , size ) ; cqDUnitTest . closeClient ( client ) ; cqDUnitTest . closeServer ( server ) ; }
test for common cqs . to test the changes relating to , executing cq only once for all similar cqs .
