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 SetUp() { Configuration configuration = SupportConfigFactory.GetConfiguration(); configuration.AddEventType(typeof(MyEventA)); configuration.AddEventType(typeof(MyEventB)); _service = EPServiceProviderManager.GetDefaultProvider(configuration); _service.Initialize(); string epl = "create window A#unique(key) as MyEventA;\n" + "create window B#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.EPAdministrator.DeploymentAdmin; deployment.ParseDeploy(epl); }
public void TestCreateSchemaNamedWindowInsert() { String text = "module test.test1;\n" + "create schema MyTypeOne(col1 string, col2 int);" + "create window MyWindowOne#keepall as select * from MyTypeOne;" + "insert into MyWindowOne select * from MyTypeOne;"; DeploymentResult resultOne = _deploySvc.ParseDeploy(text, "uri1", "arch1", null); _deploySvc.UndeployRemove(resultOne.DeploymentId); DeploymentResult resultTwo = _deploySvc.ParseDeploy(text, "uri2", "arch2", null); _deploySvc.UndeployRemove(resultTwo.DeploymentId); text = "module test.test1;\n" + "create schema MyTypeOne(col1 string, col2 int, col3 long);" + "create window MyWindowOne#keepall as select * from MyTypeOne;" + "insert into MyWindowOne select * from MyTypeOne;"; DeploymentResult resultThree = _deploySvc.ParseDeploy(text, "uri1", "arch1", null); _deploySvc.UndeployRemove(resultThree.DeploymentId); FilterService filterService = ((EPServiceProviderSPI)_epService).FilterService; FilterServiceSPI filterSPI = (FilterServiceSPI)filterService; Assert.AreEqual(0, filterSPI.CountTypes); // test on-merge _epService.EPAdministrator.Configuration.AddEventType <SupportBean>(); String moduleString = "@Name('S0') create window MyWindow#unique(IntPrimitive) as SupportBean;\n" + "@Name('S1') on MyWindow insert into SecondStream select *;\n" + "@Name('S2') on SecondStream merge MyWindow when matched then insert into ThirdStream select * then delete\n"; Module module = _epService.EPAdministrator.DeploymentAdmin.Parse(moduleString); _epService.EPAdministrator.DeploymentAdmin.Deploy(module, null, "myid_101"); _epService.EPAdministrator.DeploymentAdmin.UndeployRemove("myid_101"); _epService.EPAdministrator.DeploymentAdmin.Deploy(module, null, "myid_101"); // test table String moduleTableOne = "create table MyTable(c0 string, c1 string)"; DeploymentResult d = _epService.EPAdministrator.DeploymentAdmin.ParseDeploy(moduleTableOne); _epService.EPAdministrator.DeploymentAdmin.UndeployRemove(d.DeploymentId); String moduleTableTwo = "create table MyTable(c0 string, c1 string, c2 string)"; _epService.EPAdministrator.DeploymentAdmin.ParseDeploy(moduleTableTwo); }