public List<StreamDefinition> getSiddhiStreams(
     String[] inputStreamDefinitions, String queryExpressions) throws SiddhiParserException {
   SiddhiManager siddhiManager = createMockSiddhiManager(inputStreamDefinitions, queryExpressions);
   List<org.wso2.siddhi.query.api.definition.StreamDefinition> streamDefinitions =
       siddhiManager.getStreamDefinitions();
   List<StreamDefinition> databridgeStreamDefinitions =
       new ArrayList<StreamDefinition>(streamDefinitions.size());
   for (org.wso2.siddhi.query.api.definition.StreamDefinition siddhiStreamDef :
       streamDefinitions) {
     StreamConfiguration streamConfig = new StreamConfiguration(siddhiStreamDef.getStreamId());
     StreamDefinition databridgeStreamDef =
         EventProcessorUtil.convertToDatabridgeStreamDefinition(siddhiStreamDef, streamConfig);
     databridgeStreamDefinitions.add(databridgeStreamDef);
   }
   siddhiManager.shutdown();
   return databridgeStreamDefinitions;
 }
  @Test
  public void testPatternWithinQuery1() throws InterruptedException {
    log.info("testPatternWithin1 - OUT 1");

    SiddhiManager siddhiManager = new SiddhiManager();

    siddhiManager.defineStream(
        QueryFactory.createStreamDefinition()
            .name("Stream1")
            .attribute("symbol", Attribute.Type.STRING)
            .attribute("price", Attribute.Type.FLOAT)
            .attribute("volume", Attribute.Type.INT));
    siddhiManager.defineStream(
        QueryFactory.createStreamDefinition()
            .name("Stream2")
            .attribute("symbol", Attribute.Type.STRING)
            .attribute("price", Attribute.Type.FLOAT)
            .attribute("volume", Attribute.Type.INT));

    Query query = QueryFactory.createQuery();
    query.from(
        QueryFactory.patternStream(
            Pattern.followedBy(
                Pattern.every(
                    QueryFactory.inputStream("e1", "Stream1")
                        .filter(
                            Condition.compare(
                                Expression.variable("price"),
                                Condition.Operator.GREATER_THAN,
                                Expression.value(20)))),
                QueryFactory.inputStream("e2", "Stream2")
                    .filter(
                        Condition.compare(
                            Expression.variable("price"),
                            Condition.Operator.GREATER_THAN,
                            Expression.variable("e1", "price")))),
            Expression.value(1000)));

    query.insertInto("OutStream");
    query.project(
        QueryFactory.outputProjector()
            .project("symbol1", Expression.variable("e1", "symbol"))
            .project("symbol2", Expression.variable("e2", "symbol")));

    String queryReference = siddhiManager.addQuery(query);
    siddhiManager.addCallback(
        queryReference,
        new QueryCallback() {
          @Override
          public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
            EventPrinter.print(timeStamp, inEvents, removeEvents);
            if (eventCount == 0) {
              Assert.assertArrayEquals(new Object[] {"GOOG", "IBM"}, inEvents[0].getData());
            } else {
              Assert.fail();
            }
            eventCount++;
            eventArrived = true;
          }
        });
    InputHandler stream1 = siddhiManager.getInputHandler("Stream1");
    InputHandler stream2 = siddhiManager.getInputHandler("Stream2");
    stream1.send(new Object[] {"WSO2", 55.6f, 100});
    Thread.sleep(1500);
    stream1.send(new Object[] {"GOOG", 54f, 100});
    Thread.sleep(500);
    stream2.send(new Object[] {"IBM", 55.7f, 100});
    Thread.sleep(500);

    siddhiManager.shutdown();

    Assert.assertEquals("Number of success events", 1, eventCount);
    Assert.assertEquals("Event arrived", true, eventArrived);
  }
 public boolean validateSiddhiQueries(String[] inputStreamDefinitions, String queryExpressions)
     throws SiddhiParserException {
   SiddhiManager siddhiManager = createMockSiddhiManager(inputStreamDefinitions, queryExpressions);
   siddhiManager.shutdown();
   return true;
 }