@Test public void testIsStreamAllowedOperation() throws Exception { String streamName= "myStream"; assertTrue("True value expected", SiddhiUtils.isStreamAllowedForThisOperation( streamName, STREAM_OPERATIONS.ACTION.LISTEN)); assertFalse("False value expected", SiddhiUtils.isStreamAllowedForThisOperation( streamName, "DASDSADASDSADAS")); assertTrue("True value expected", SiddhiUtils.isStreamAllowedForThisOperation( streamName, STREAM_OPERATIONS.MANIPULATION.INSERT)); assertFalse("False value expected", SiddhiUtils.isStreamAllowedForThisOperation( STREAMING.STATS_NAMES.STATS_STREAMS[0], STREAM_OPERATIONS.MANIPULATION.INSERT)); }
public static Boolean isStreamAllowedForThisOperation(String streamName, String operation) { switch (operation.toUpperCase()) { case STREAM_OPERATIONS.DEFINITION.ADD_QUERY: case STREAM_OPERATIONS.DEFINITION.ALTER: case STREAM_OPERATIONS.DEFINITION.CREATE: case STREAM_OPERATIONS.DEFINITION.DROP: case STREAM_OPERATIONS.DEFINITION.REMOVE_QUERY: case STREAM_OPERATIONS.MANIPULATION.INSERT: if (Arrays.asList(STREAMING.STATS_NAMES.STATS_STREAMS).contains(streamName)) { return Boolean.FALSE; } return Boolean.TRUE; case STREAM_OPERATIONS.ACTION.LISTEN: case STREAM_OPERATIONS.ACTION.SAVETO_CASSANDRA: case STREAM_OPERATIONS.ACTION.SAVETO_MONGO: case STREAM_OPERATIONS.ACTION.SAVETO_SOLR: case STREAM_OPERATIONS.ACTION.START_SENDTODROOLS: case STREAM_OPERATIONS.ACTION.STOP_SAVETO_MONGO: case STREAM_OPERATIONS.ACTION.STOP_SAVETO_CASSANDRA: case STREAM_OPERATIONS.ACTION.STOP_SAVETO_SOLR: case STREAM_OPERATIONS.ACTION.STOP_SENDTODROOLS: case STREAM_OPERATIONS.ACTION.INDEX: case STREAM_OPERATIONS.ACTION.STOP_LISTEN: case STREAM_OPERATIONS.ACTION.STOP_INDEX: case STREAM_OPERATIONS.MANIPULATION.LIST: return Boolean.TRUE; default: return Boolean.FALSE; } }
SiddhiUtils { public static Boolean isStreamAllowedForThisOperation(String streamName, String operation) { switch (operation.toUpperCase()) { case STREAM_OPERATIONS.DEFINITION.ADD_QUERY: case STREAM_OPERATIONS.DEFINITION.ALTER: case STREAM_OPERATIONS.DEFINITION.CREATE: case STREAM_OPERATIONS.DEFINITION.DROP: case STREAM_OPERATIONS.DEFINITION.REMOVE_QUERY: case STREAM_OPERATIONS.MANIPULATION.INSERT: if (Arrays.asList(STREAMING.STATS_NAMES.STATS_STREAMS).contains(streamName)) { return Boolean.FALSE; } return Boolean.TRUE; case STREAM_OPERATIONS.ACTION.LISTEN: case STREAM_OPERATIONS.ACTION.SAVETO_CASSANDRA: case STREAM_OPERATIONS.ACTION.SAVETO_MONGO: case STREAM_OPERATIONS.ACTION.SAVETO_SOLR: case STREAM_OPERATIONS.ACTION.START_SENDTODROOLS: case STREAM_OPERATIONS.ACTION.STOP_SAVETO_MONGO: case STREAM_OPERATIONS.ACTION.STOP_SAVETO_CASSANDRA: case STREAM_OPERATIONS.ACTION.STOP_SAVETO_SOLR: case STREAM_OPERATIONS.ACTION.STOP_SENDTODROOLS: case STREAM_OPERATIONS.ACTION.INDEX: case STREAM_OPERATIONS.ACTION.STOP_LISTEN: case STREAM_OPERATIONS.ACTION.STOP_INDEX: case STREAM_OPERATIONS.MANIPULATION.LIST: return Boolean.TRUE; default: return Boolean.FALSE; } } }
SiddhiUtils { public static Boolean isStreamAllowedForThisOperation(String streamName, String operation) { switch (operation.toUpperCase()) { case STREAM_OPERATIONS.DEFINITION.ADD_QUERY: case STREAM_OPERATIONS.DEFINITION.ALTER: case STREAM_OPERATIONS.DEFINITION.CREATE: case STREAM_OPERATIONS.DEFINITION.DROP: case STREAM_OPERATIONS.DEFINITION.REMOVE_QUERY: case STREAM_OPERATIONS.MANIPULATION.INSERT: if (Arrays.asList(STREAMING.STATS_NAMES.STATS_STREAMS).contains(streamName)) { return Boolean.FALSE; } return Boolean.TRUE; case STREAM_OPERATIONS.ACTION.LISTEN: case STREAM_OPERATIONS.ACTION.SAVETO_CASSANDRA: case STREAM_OPERATIONS.ACTION.SAVETO_MONGO: case STREAM_OPERATIONS.ACTION.SAVETO_SOLR: case STREAM_OPERATIONS.ACTION.START_SENDTODROOLS: case STREAM_OPERATIONS.ACTION.STOP_SAVETO_MONGO: case STREAM_OPERATIONS.ACTION.STOP_SAVETO_CASSANDRA: case STREAM_OPERATIONS.ACTION.STOP_SAVETO_SOLR: case STREAM_OPERATIONS.ACTION.STOP_SENDTODROOLS: case STREAM_OPERATIONS.ACTION.INDEX: case STREAM_OPERATIONS.ACTION.STOP_LISTEN: case STREAM_OPERATIONS.ACTION.STOP_INDEX: case STREAM_OPERATIONS.MANIPULATION.LIST: return Boolean.TRUE; default: return Boolean.FALSE; } } private  SiddhiUtils(); }
SiddhiUtils { public static Boolean isStreamAllowedForThisOperation(String streamName, String operation) { switch (operation.toUpperCase()) { case STREAM_OPERATIONS.DEFINITION.ADD_QUERY: case STREAM_OPERATIONS.DEFINITION.ALTER: case STREAM_OPERATIONS.DEFINITION.CREATE: case STREAM_OPERATIONS.DEFINITION.DROP: case STREAM_OPERATIONS.DEFINITION.REMOVE_QUERY: case STREAM_OPERATIONS.MANIPULATION.INSERT: if (Arrays.asList(STREAMING.STATS_NAMES.STATS_STREAMS).contains(streamName)) { return Boolean.FALSE; } return Boolean.TRUE; case STREAM_OPERATIONS.ACTION.LISTEN: case STREAM_OPERATIONS.ACTION.SAVETO_CASSANDRA: case STREAM_OPERATIONS.ACTION.SAVETO_MONGO: case STREAM_OPERATIONS.ACTION.SAVETO_SOLR: case STREAM_OPERATIONS.ACTION.START_SENDTODROOLS: case STREAM_OPERATIONS.ACTION.STOP_SAVETO_MONGO: case STREAM_OPERATIONS.ACTION.STOP_SAVETO_CASSANDRA: case STREAM_OPERATIONS.ACTION.STOP_SAVETO_SOLR: case STREAM_OPERATIONS.ACTION.STOP_SENDTODROOLS: case STREAM_OPERATIONS.ACTION.INDEX: case STREAM_OPERATIONS.ACTION.STOP_LISTEN: case STREAM_OPERATIONS.ACTION.STOP_INDEX: case STREAM_OPERATIONS.MANIPULATION.LIST: return Boolean.TRUE; default: return Boolean.FALSE; } } private  SiddhiUtils(); static boolean columnAlreadyExistsInStream(String columnName, StreamDefinition streamMetaData); static Object[] getOrderedValues(StreamDefinition streamMetaData, List<ColumnNameTypeValue> columns); static Boolean isStreamAllowedForThisOperation(String streamName, String operation); }
SiddhiUtils { public static Boolean isStreamAllowedForThisOperation(String streamName, String operation) { switch (operation.toUpperCase()) { case STREAM_OPERATIONS.DEFINITION.ADD_QUERY: case STREAM_OPERATIONS.DEFINITION.ALTER: case STREAM_OPERATIONS.DEFINITION.CREATE: case STREAM_OPERATIONS.DEFINITION.DROP: case STREAM_OPERATIONS.DEFINITION.REMOVE_QUERY: case STREAM_OPERATIONS.MANIPULATION.INSERT: if (Arrays.asList(STREAMING.STATS_NAMES.STATS_STREAMS).contains(streamName)) { return Boolean.FALSE; } return Boolean.TRUE; case STREAM_OPERATIONS.ACTION.LISTEN: case STREAM_OPERATIONS.ACTION.SAVETO_CASSANDRA: case STREAM_OPERATIONS.ACTION.SAVETO_MONGO: case STREAM_OPERATIONS.ACTION.SAVETO_SOLR: case STREAM_OPERATIONS.ACTION.START_SENDTODROOLS: case STREAM_OPERATIONS.ACTION.STOP_SAVETO_MONGO: case STREAM_OPERATIONS.ACTION.STOP_SAVETO_CASSANDRA: case STREAM_OPERATIONS.ACTION.STOP_SAVETO_SOLR: case STREAM_OPERATIONS.ACTION.STOP_SENDTODROOLS: case STREAM_OPERATIONS.ACTION.INDEX: case STREAM_OPERATIONS.ACTION.STOP_LISTEN: case STREAM_OPERATIONS.ACTION.STOP_INDEX: case STREAM_OPERATIONS.MANIPULATION.LIST: return Boolean.TRUE; default: return Boolean.FALSE; } } private  SiddhiUtils(); static boolean columnAlreadyExistsInStream(String columnName, StreamDefinition streamMetaData); static Object[] getOrderedValues(StreamDefinition streamMetaData, List<ColumnNameTypeValue> columns); static Boolean isStreamAllowedForThisOperation(String streamName, String operation); static final String QUERY_PLAN_IDENTIFIER; }