Exemple #1
0
  public void testInvalidStreamUsed() {
    String stmtText =
        "insert into Event_1 (delta, product) "
            + "select intPrimitive - intBoxed as deltaTag, intPrimitive * intBoxed as productTag "
            + "from "
            + SupportBean.class.getName()
            + ".win:length(100)";
    epService.getEPAdministrator().createEPL(stmtText);

    try {
      stmtText =
          "insert into Event_1(delta) "
              + "select (intPrimitive - intBoxed) as deltaTag "
              + "from "
              + SupportBean.class.getName()
              + ".win:length(100)";
      epService.getEPAdministrator().createEPL(stmtText);
      fail();
    } catch (EPStatementException ex) {
      // expected
      assertEquals(
          "Error starting statement: Event type named 'Event_1' has already been declared with differing column name or type information: Type by name 'Event_1' expects 2 properties but receives 1 properties [insert into Event_1(delta) select (intPrimitive - intBoxed) as deltaTag from com.espertech.esper.support.bean.SupportBean.win:length(100)]",
          ex.getMessage());
    }
  }
 private void tryInvalid(String stmtText, String expectedMsg) {
   try {
     epService.getEPAdministrator().createEPL(stmtText);
     fail();
   } catch (EPStatementException ex) {
     assertEquals(expectedMsg, ex.getMessage());
   }
 }