public void TestDeploySingle() { var module = _deploymentAdmin.Read("regression/test_module_9.epl"); var result = _deploymentAdmin.Deploy(module, new DeploymentOptions()); Assert.NotNull(result.DeploymentId); Assert.AreEqual(2, result.Statements.Count); Assert.AreEqual(2, _epService.EPAdministrator.StatementNames.Count); Assert.AreEqual("@Name(\"StmtOne\")" + Newline + "create schema MyEvent(id String, val1 int, val2 int)", _epService.EPAdministrator.GetStatement("StmtOne").Text); Assert.AreEqual("@Name(\"StmtTwo\")" + Newline + "select * from MyEvent", _epService.EPAdministrator.GetStatement("StmtTwo").Text); Assert.AreEqual(1, _deploymentAdmin.Deployments.Length); Assert.AreEqual(result.DeploymentId, _deploymentAdmin.Deployments[0]); // test deploy with variable var moduleStr = "create variable integer snapshotOutputSecs = 10; " + "create schema foo as (bar string); " + "select bar from foo output snapshot every snapshotOutputSecs seconds;"; _deploymentAdmin.ParseDeploy(moduleStr); }
public void TestParse() { Module module = _deploySvc.Read("regression/test_module_4.epl"); AssertModule(module, null, "abd", null, new String[] { "select * from ABC", "/* Final comment */" }, new bool[] { 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", } ); Assert.AreEqual("org.mycompany.events", _deploySvc.Parse("module org.mycompany.events; select * from System.Object;").Name); Assert.AreEqual("glob.Update.me", _deploySvc.Parse("module glob.Update.me; select * from System.Object;").Name); Assert.AreEqual("seconds.until.every.where", _deploySvc.Parse("uses seconds.until.every.where; select * from System.Object;").Uses.ToArray()[0]); Assert.AreEqual("seconds.until.every.where", _deploySvc.Parse("import seconds.until.every.where; select * from System.Object;").Imports.ToArray()[0]); // Test script square brackets module = _deploySvc.Read("regression/test_module_13.epl"); Assert.AreEqual(1, module.Items.Count); module = _deploySvc.Read("regression/test_module_14.epl"); Assert.AreEqual(4, module.Items.Count); module = _deploySvc.Read("regression/test_module_15.epl"); Assert.AreEqual(1, module.Items.Count); }