/*******************************************************************************
 * This file is part of OpenNMS(R).
 *
 * Copyright (C) 2018-2018 The OpenNMS Group, Inc.
 * OpenNMS(R) is Copyright (C) 1999-2018 The OpenNMS Group, Inc.
 *
 * OpenNMS(R) is a registered trademark of The OpenNMS Group, Inc.
 *
 * OpenNMS(R) is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published
 * by the Free Software Foundation, either version 3 of the License,
 * or (at your option) any later version.
 *
 * OpenNMS(R) is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with OpenNMS(R).  If not, see:
 *      http://www.gnu.org/licenses/
 *
 * For more information contact:
 *     OpenNMS(R) Licensing <license@opennms.org>
 *     http://www.opennms.org/
 *     http://www.opennms.com/
 *******************************************************************************/

package org.opennms.smoketest.sentinel;

import org.opennms.test.system.api.TestEnvironmentBuilder;

// Verifies that flows can be processed by a sentinel and are persisted to Elastic communicating via activemq (jms)
public class FlowStackJmsIT extends AbstractFlowIT {

    @Override
    protected void customizeTestEnvironment(TestEnvironmentBuilder builder) {
            builder
                    .opennms()
                    .minion()
                    .es6()
                    .sentinel();

            // Enable Netflow 5 Adapter
            builder.withSentinelEnvironment()
                    .addFile(getClass().getResource("/sentinel/features-jms.xml"), "deploy/features.xml");

            // Enable Netflow 5 Listener
            builder.withMinionEnvironment()
                    .addFile(getClass().getResource("/sentinel/org.opennms.features.telemetry.listeners-udp-50000.cfg"), "etc/org.opennms.features.telemetry.listeners-udp-50000.cfg");
    }

    @Override
    protected String getSentinelReadyString() {
        return "Route: Sink.Server.Telemetry-Netflow-5 started and consuming from: queuingservice://OpenNMS.Sink.Telemetry-Netflow-5";
    }
}

@@ -1252,58 +1252,458 @@
 ort 
-org.opennms.test.system.api.TestEnvironmentBuilder
+static com.jayway.awaitility.Awaitility.await;%0Aimport static java.util.concurrent.TimeUnit.MINUTES;%0Aimport static java.util.concurrent.TimeUnit.SECONDS;%0A%0Aimport java.io.PrintStream;%0Aimport java.net.InetSocketAddress;%0A%0Aimport org.junit.Test;%0Aimport org.opennms.test.system.api.NewTestEnvironment;%0Aimport org.opennms.test.system.api.TestEnvironmentBuilder;%0Aimport org.opennms.test.system.api.utils.SshClient;%0Aimport org.springframework.util.StringUtils
 ;%0A%0A/
@@ -2376,32 +2376,32 @@
 onEnvironment()%0A
-
                 
@@ -2575,16 +2575,1453 @@
 %0A    %7D%0A%0A
+    @Test%0A    public void verifyHealthCheck() %7B%0A        final InetSocketAddress sentinelSshAddress = testEnvironment.getServiceAddress(NewTestEnvironment.ContainerAlias.SENTINEL, 8301);%0A%0A        // Ensure we are actually started the sink and are ready to listen for messages%0A        await().atMost(5, MINUTES)%0A                .pollInterval(5, SECONDS)%0A                .until(() -%3E %7B%0A                    try (final SshClient sshClient = new SshClient(sentinelSshAddress, %22admin%22, %22admin%22)) %7B%0A                        final PrintStream pipe = sshClient.openShell();%0A                        pipe.println(%22health:check%22);%0A                        pipe.println(%22logout%22);%0A%0A                        // Wait for karaf to process the commands%0A                        await().atMost(10, SECONDS).until(sshClient.isShellClosedCallable());%0A%0A                        // Read stdout and verify%0A                        final String shellOutput = sshClient.getStdout();%0A                        final int count = StringUtils.countOccurrencesOf(shellOutput, %22Success%22);%0A%0A                        logger.info(%22log:display%22);%0A                        logger.info(%22%7B%7D%22, shellOutput);%0A                        return count == 6;%0A                    %7D catch (Exception ex) %7B%0A                        logger.error(%22Error while trying to verify health:check: %7B%7D%22, ex.getMessage());%0A                        return false;%0A                    %7D%0A                %7D);%0A    %7D%0A%0A
     @Ove

Add test for healh:check in case of sentinel jms setup