Пример #1
0
 private void tryInvalidParse(String resource, String message) throws IOException {
   try {
     deploySvc.read(resource);
     fail();
   } catch (ParseException ex) {
     assertEquals(message, ex.getMessage());
   }
 }
  public void setUp() throws Exception {
    Configuration configuration = SupportConfigFactory.getConfiguration();
    configuration.addEventType(MyEventA.class);
    configuration.addEventType(MyEventB.class);
    service = EPServiceProviderManager.getDefaultProvider(configuration);
    service.initialize();

    String epl =
        "create window A.std:unique(key) as MyEventA;\n"
            + "create window B.std:unique(key) as MyEventB;\n"
            + "insert into A select * from MyEventA;\n"
            + "insert into B select * from MyEventB;\n"
            + "\n"
            + "@Name('stmt') select sum(A.data) as aTotal,sum(B.data) as bTotal "
            + "from A unidirectional, B where A.key = B.key;\n";
    EPDeploymentAdmin deployment = service.getEPAdministrator().getDeploymentAdmin();
    deployment.parseDeploy(epl);
  }
Пример #3
0
  public void testParse() throws Exception {
    Module module = deploySvc.read("regression/test_module_4.epl");
    assertModule(
        module,
        null,
        "abd",
        null,
        new String[] {"select * from ABC", "/* Final comment */"},
        new boolean[] {false, true},
        new int[] {3, 8},
        new int[] {12, 0},
        new int[] {37, 0});

    module = deploySvc.read("regression/test_module_1.epl");
    assertModule(
        module,
        "abc",
        "def,jlk",
        null,
        new String[] {
          "select * from A",
          "select * from B" + newline + "where C=d",
          "/* Test ; Comment */" + newline + "update ';' where B=C",
          "update D"
        });

    module = deploySvc.read("regression/test_module_2.epl");
    assertModule(
        module,
        "abc.def.hij",
        "def.hik,jlk.aja",
        null,
        new String[] {
          "// Note 4 white spaces after * and before from" + newline + "select * from A",
          "select * from B",
          "select *    " + newline + "    from C",
        });

    module = deploySvc.read("regression/test_module_3.epl");
    assertModule(module, null, null, null, new String[] {"create window ABC", "select * from ABC"});

    module = deploySvc.read("regression/test_module_5.epl");
    assertModule(module, "abd.def", null, null, new String[0]);

    module = deploySvc.read("regression/test_module_6.epl");
    assertModule(module, null, null, null, new String[0]);

    module = deploySvc.read("regression/test_module_7.epl");
    assertModule(module, null, null, null, new String[0]);

    module = deploySvc.read("regression/test_module_8.epl");
    assertModule(module, "def.jfk", null, null, new String[0]);

    module = deploySvc.parse("module mymodule; uses mymodule2; import abc; select * from MyEvent;");
    assertModule(module, "mymodule", "mymodule2", "abc", new String[] {"select * from MyEvent"});

    module = deploySvc.read("regression/test_module_11.epl");
    assertModule(module, null, null, "com.mycompany.pck1", new String[0]);

    module = deploySvc.read("regression/test_module_10.epl");
    assertModule(
        module,
        "abd.def",
        "one.use,two.use",
        "com.mycompany.pck1,com.mycompany.*",
        new String[] {
          "select * from A",
        });

    assertEquals(
        "org.mycompany.events",
        deploySvc.parse("module org.mycompany.events; select * from java.lang.Object;").getName());
    assertEquals(
        "glob.update.me",
        deploySvc.parse("module glob.update.me; select * from java.lang.Object;").getName());
    assertEquals(
        "seconds.until.every.where",
        deploySvc
            .parse("uses seconds.until.every.where; select * from java.lang.Object;")
            .getUses()
            .toArray()[0]);
    assertEquals(
        "seconds.until.every.where",
        deploySvc
            .parse("import seconds.until.every.where; select * from java.lang.Object;")
            .getImports()
            .toArray()[0]);

    // Test script square brackets
    module = deploySvc.read("regression/test_module_13.epl");
    assertEquals(1, module.getItems().size());

    module = deploySvc.read("regression/test_module_14.epl");
    assertEquals(4, module.getItems().size());

    module = deploySvc.read("regression/test_module_15.epl");
    assertEquals(1, module.getItems().size());
  }