use of org.wso2.siddhi.query.api.execution.query.input.store.Store in project siddhi by wso2.
the class DefineTableTestCase method testQuery18.
@Test
public void testQuery18() {
log.info("testTableDefinition18 - Table w/ ref and additional properties");
Map<String, String> systemConfigs = new HashMap<>();
systemConfigs.put("test1.type", "test");
systemConfigs.put("test1.uri", "http://localhost");
InMemoryConfigManager inMemoryConfigManager = new InMemoryConfigManager(null, systemConfigs);
inMemoryConfigManager.extractSystemConfigs("test1");
SiddhiManager siddhiManager = new SiddhiManager();
siddhiManager.setConfigManager(inMemoryConfigManager);
siddhiManager.setExtension("store:test", TestStore.class);
String siddhiApp = "" + "@store(ref='test1', uri='http://localhost:8080', table.name ='Foo')" + "define table testTable (symbol string, price int, volume float); ";
SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(siddhiApp);
siddhiAppRuntime.shutdown();
Map<String, String> expectedSystemConfigs = new HashMap<>();
expectedSystemConfigs.put("type", "test");
expectedSystemConfigs.put("uri", "http://localhost:8080");
expectedSystemConfigs.put("table.name", "Foo");
AssertJUnit.assertEquals("Test store initialization failure", expectedSystemConfigs, TestStore.systemConfigs);
}
use of org.wso2.siddhi.query.api.execution.query.input.store.Store in project siddhi by wso2.
the class DefineTableTestCase method testQuery21.
@Test(expectedExceptions = SiddhiAppCreationException.class)
public void testQuery21() {
log.info("testTableDefinition21 - Table w/ ref to an undefined store type");
Map<String, String> systemConfigs = new HashMap<>();
systemConfigs.put("test1.type", "testdb");
systemConfigs.put("test1.uri", "http://localhost");
InMemoryConfigManager inMemoryConfigManager = new InMemoryConfigManager(null, systemConfigs);
inMemoryConfigManager.extractSystemConfigs("test2");
SiddhiManager siddhiManager = new SiddhiManager();
siddhiManager.setConfigManager(inMemoryConfigManager);
siddhiManager.setExtension("store:test", TestStore.class);
String siddhiApp = "" + "@store(ref='test2', uri='http://localhost:8080', table.name ='Foo')" + "define table testTable (symbol string, price int, volume float); ";
SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(siddhiApp);
siddhiAppRuntime.shutdown();
}
use of org.wso2.siddhi.query.api.execution.query.input.store.Store in project siddhi by wso2.
the class DefineTableTestCase method testQuery16.
@Test
public void testQuery16() {
log.info("testTableDefinition16 - Table w/ ref");
Map<String, String> systemConfigs = new HashMap<>();
systemConfigs.put("test1.type", "test");
systemConfigs.put("test1.uri", "http://localhost");
InMemoryConfigManager inMemoryConfigManager = new InMemoryConfigManager(null, systemConfigs);
inMemoryConfigManager.extractSystemConfigs("test1");
SiddhiManager siddhiManager = new SiddhiManager();
siddhiManager.setConfigManager(inMemoryConfigManager);
siddhiManager.setExtension("store:test", TestStore.class);
String siddhiApp = "" + "@store(ref='test1')" + "define table testTable (symbol string, price int, volume float); ";
SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(siddhiApp);
siddhiAppRuntime.shutdown();
Map<String, String> expectedSystemConfigs = new HashMap<>();
expectedSystemConfigs.put("type", "test");
expectedSystemConfigs.put("uri", "http://localhost");
AssertJUnit.assertEquals("Test store initialization failure", expectedSystemConfigs, TestStore.systemConfigs);
}
use of org.wso2.siddhi.query.api.execution.query.input.store.Store in project siddhi by wso2.
the class SiddhiQLBaseVisitorImpl method visitStore_input.
@Override
public Object visitStore_input(SiddhiQLParser.Store_inputContext ctx) {
String sourceId = (String) visit(ctx.source_id());
String alias = null;
if (ctx.alias() != null) {
alias = (String) visit(ctx.source_id());
}
Store store = InputStore.store(alias, sourceId);
Expression expression = null;
if (ctx.expression() != null) {
expression = (Expression) visit(ctx.expression());
}
populateQueryContext(store, ctx);
if (ctx.per() != null) {
return store.on(expression, (Within) visit(ctx.within_time_range()), (Expression) visit(ctx.per()));
} else if (expression != null) {
return store.on(expression);
} else {
return store;
}
}
use of org.wso2.siddhi.query.api.execution.query.input.store.Store in project product-apim by wso2.
the class APIMgtBaseIntegrationIT method init.
@BeforeClass
public void init() throws AMIntegrationTestException {
TokenInfo tokenInfo = TestUtil.getToken("admin", "admin");
apiPublisherClient = new ApiClient(TestUtil.OAUTH2_SECURITY).setBasePath("https://" + TestUtil.getIpAddressOfContainer() + ":9443/api/am/publisher/v1.0");
apiPublisherClient.setAccessToken(tokenInfo.getToken(), tokenInfo.getExpiryTime());
apiStoreClient = new org.wso2.carbon.apimgt.rest.integration.tests.store.ApiClient(TestUtil.OAUTH2_SECURITY).setBasePath("https://" + TestUtil.getIpAddressOfContainer() + ":9443/api/am/store/v1.0");
apiStoreClient.setAccessToken(tokenInfo.getToken(), tokenInfo.getExpiryTime());
apiAdminClient = new org.wso2.carbon.apimgt.rest.integration.tests.admin.ApiClient(TestUtil.OAUTH2_SECURITY).setBasePath("https://" + TestUtil.getIpAddressOfContainer() + ":9443/api/am/admin/v1.0");
apiAdminClient.setAccessToken(tokenInfo.getToken(), tokenInfo.getExpiryTime());
}
Aggregations