SiddhiUtils { public static boolean columnAlreadyExistsInStream(String columnName, StreamDefinition streamMetaData) { for (Attribute column : streamMetaData.getAttributeList()) { if (column.getName().equalsIgnoreCase(columnName)) { return true; } } return 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; }
@Test public void testColumnAlreadyExistsInStream() throws Exception { String columnName= "myAttr"; StreamDefinition definition= Mockito.mock(StreamDefinition.class); when(definition.getAttributeList()).thenReturn(listAttributes); assertTrue("Expected attribute not found", SiddhiUtils.columnAlreadyExistsInStream(columnName, definition)); assertFalse("Unexpected attribute found", SiddhiUtils.columnAlreadyExistsInStream("NotExists", definition)); }