private QueryDTO createQuery() {
    QueryDTO query = new QueryDTO();
    query.setName("Conditional Stocks Detector");

    ExpressionDTO expression = new ExpressionDTO();
    expression.setType("inline");
    expression.setText("from allStockQuotes[price>100] " + "insert into OutStream symbol, price;");

    query.setExpression(expression);
    return query;
  }
  @Test(groups = {"wso2.cep"})
  public void siddhiBucketCreationTest()
      throws CEPAdminServiceCEPConfigurationException, RemoteException,
          CEPAdminServiceCEPAdminException, InterruptedException {

    int numberOfBuckets = cepAdminServiceStub.getAllBucketCount();

    BucketDTO bucket = createBucket();

    InputDTO input = createInput();
    QueryDTO query = createQuery();
    OutputDTO output = createOutput();
    query.setOutput(output);
    bucket.setInputs(new InputDTO[] {input});
    bucket.setQueries(new QueryDTO[] {query});

    cepAdminServiceStub.addBucket(bucket);

    /* extra time for all the services to be properly deployed */
    Thread.sleep(5000);
    Assert.assertEquals(++numberOfBuckets, cepAdminServiceStub.getAllBucketCount());
  }