components/global/core/io.cellery.observability.k8s.client/src/test/java/io/cellery/observability/k8s/client/ComponentPodsEventSourceTestCase.java
private void initializeSiddhiAppRuntime() {
        String inStreamDefinition = "@App:name(\"test-siddhi-app\")\n" +
                "@source(type=\"k8s-component-pods\", @map(type=\"keyvalue\", " +
                "fail.on.missing.attribute=\"true\"))\n" +
                "define stream K8sComponentPodsStream (instance string, instanceKind string, component string, " +
                "podName string, creationTimestamp long, deletionTimestamp long, nodeName string, status string, " +
                "action string);";
        String query = "@info(name = \"query\")\n" +
                "from K8sComponentPodsStream\n" +
                "select *\n" +
                "insert into OutputStream;";
        SiddhiManager siddhiManager = new SiddhiManager();
        siddhiManager.setExtension("keyvalue", KeyValueSourceMapper.class);
        siddhiManager.setPersistenceStore(new InMemoryPersistenceStore());
        siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(inStreamDefinition + "\n" + query);
        siddhiAppRuntime.addCallback("query", new QueryCallback() {
            @Override
            public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
                EventPrinter.print(timeStamp, inEvents, removeEvents);
                for (Event event : inEvents) {
                    synchronized (this) {
                        receivedEvents.add(event);
                    }
                    eventCount.incrementAndGet();
                }
            }
        });
        siddhiAppRuntime.start();
        if (logger.isDebugEnabled()) {
            logger.debug("EventPrinter Initialized Siddhi App Runtime");
        }
    }
/**
     * Initialize the Siddhi App Runtime with the k8s
     */
Initialize the Siddhi App Runtime with the k8s
Initialize the Siddhi App Runtime with the k8s
private void initializeSiddhiAppRuntime() {
        String inStreamDefinition = "@App:name(\"test-siddhi-app\")\n" +
                "@source(type=\"k8s-component-pods\", @map(type=\"keyvalue\", " +
                "fail.on.missing.attribute=\"true\"))\n" +
                "define stream K8sComponentPodsStream (instance string, instanceKind string, component string, " +
                "podName string, creationTimestamp long, deletionTimestamp long, nodeName string, status string, " +
                "action string);";
        String query = "@info(name = \"query\")\n" +
                "from K8sComponentPodsStream\n" +
                "select *\n" +
                "insert into OutputStream;";
        SiddhiManager siddhiManager = new SiddhiManager();
        siddhiManager.setExtension("keyvalue", KeyValueSourceMapper.class);
        siddhiManager.setPersistenceStore(new InMemoryPersistenceStore());
        siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(inStreamDefinition + "\n" + query);
        siddhiAppRuntime.addCallback("query", new QueryCallback() {
            @Override
            public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
                EventPrinter.print(timeStamp, inEvents, removeEvents);
                for (Event event : inEvents) {
                    synchronized (this) {
                        receivedEvents.add(event);
                    }
                    eventCount.incrementAndGet();
                }
            }
        });
        siddhiAppRuntime.start();
        if (logger.isDebugEnabled()) {
            logger.debug("EventPrinter Initialized Siddhi App Runtime");
        }
    }
private void initializeSiddhiAppRuntime ( ) { String inStreamDefinition = "@App:name(\"test-siddhi-app\")\n" + "@source(type=\"k8s-component-pods\", @map(type=\"keyvalue\", " + "fail.on.missing.attribute=\"true\"))\n" + "define stream K8sComponentPodsStream (instance string, instanceKind string, component string, " + "podName string, creationTimestamp long, deletionTimestamp long, nodeName string, status string, " + "action string);" ; String query = "@info(name = \"query\")\n" + "from K8sComponentPodsStream\n" + "select *\n" + "insert into OutputStream;" ; SiddhiManager siddhiManager = new SiddhiManager ( ) ; siddhiManager . setExtension ( "keyvalue" , KeyValueSourceMapper . class ) ; siddhiManager . setPersistenceStore ( new InMemoryPersistenceStore ( ) ) ; siddhiAppRuntime = siddhiManager . createSiddhiAppRuntime ( inStreamDefinition + "\n" + query ) ; siddhiAppRuntime . addCallback ( "query" , new QueryCallback ( ) { @ Override public void receive ( long timeStamp , Event [ ] inEvents , Event [ ] removeEvents ) { EventPrinter . print ( timeStamp , inEvents , removeEvents ) ; for ( Event event : inEvents ) { synchronized ( this ) { receivedEvents . add ( event ) ; } eventCount . incrementAndGet ( ) ; } } } ) ; siddhiAppRuntime . start ( ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "EventPrinter Initialized Siddhi App Runtime" ) ; } }
Initialize the Siddhi App Runtime with the k8s
Initialize the Siddhi App Runtime with the k8s