Search in sources :

Example 1 with SiddhiApiServiceImpl

use of org.wso2.siddhi.service.impl.SiddhiApiServiceImpl in project siddhi by wso2.

the class SiddhiApiTestCase method testDeployAndUndeploy.

@Test
public /**
 * Check deploy and undeploy functionality
 */
void testDeployAndUndeploy() throws NotFoundException {
    SiddhiApiServiceImpl apiService = new SiddhiApiServiceImpl();
    String siddhiApp = "@app:name('filterTest1') " + "" + "define stream cseEventStream (symbol string, price float, volume long);" + "" + "@info(name = 'query1') " + "from cseEventStream[70 > price] " + "select symbol, price " + "insert into outputStream;" + "" + "@info(name = 'query2') " + "from outputStream[70 > price] " + "select symbol, price " + "insert into outputStream2 ;";
    Response response = apiService.siddhiArtifactDeployPost(siddhiApp);
    Assert.assertEquals(response.getStatus(), 200, "HTTP 200 should be returned");
    Assert.assertTrue(response.getEntity().toString().contains("Siddhi app is deployed and runtime is created"), "Siddhi App creation message should be returned");
    Response undeployResponse = apiService.siddhiArtifactUndeploySiddhiAppGet("filterTest1");
    Assert.assertEquals(undeployResponse.getStatus(), 200, "HTTP 200 should be returned");
    Assert.assertTrue(undeployResponse.getEntity().toString().contains("Siddhi app removed successfully"), "Siddhi App removed message should be returned");
}
Also used : Response(javax.ws.rs.core.Response) SiddhiApiServiceImpl(org.wso2.siddhi.service.impl.SiddhiApiServiceImpl) Test(org.testng.annotations.Test)

Aggregations

Response (javax.ws.rs.core.Response)1 Test (org.testng.annotations.Test)1 SiddhiApiServiceImpl (org.wso2.siddhi.service.impl.SiddhiApiServiceImpl)1