/**
 * Copyright 2016 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.glowroot.testing;

public class Netty {

    private static final String MODULE_PATH = "agent-parent/plugins/netty-plugin";

    public static void main(String[] args) throws Exception {
        runNetty();
        runVertx();
    }

    private static void runNetty() throws Exception {
        runNetty("3.3.0.Final");
        runNetty("3.3.1.Final");
        for (int i = 0; i <= 6; i++) {
            runNetty("3.4." + i + ".Final");
        }
        for (int i = 0; i <= 13; i++) {
            runNetty("3.5." + i + ".Final");
        }
        for (int i = 0; i <= 10; i++) {
            runNetty("3.6." + i + ".Final");
        }
        runNetty("3.7.0.Final");
        runNetty("3.7.1.Final");
        for (int i = 0; i <= 3; i++) {
            runNetty("3.8." + i + ".Final");
        }
        for (int i = 0; i <= 9; i++) {
            runNetty("3.9." + i + ".Final");
        }
        for (int i = 0; i <= 5; i++) {
            runNetty("3.10." + i + ".Final");
        }
        for (int i = 0; i <= 36; i++) {
            runNetty("4.0." + i + ".Final");
        }
    }

    private static void runVertx() throws Exception {
        runVertx("1.2.1.final", "3.5.0.Final", "vertx-1.x");
        runVertx("1.2.3.final", "3.5.0.Final", "vertx-1.x");
        runVertx("1.3.0.final", "3.5.8.Final", "vertx-1.x");
        runVertx("1.3.1.final", "3.5.9.Final", "vertx-1.x");

        runVertx("2.0.0-final", "4.0.2.Final", "vertx-2.x");
        runVertx("2.0.1-final", "4.0.7.Final", "vertx-2.x");
        runVertx("2.0.2-final", "4.0.10.Final", "vertx-2.x");

        runVertx("2.1", "4.0.19.Final", "vertx-2.x");
        runVertx("2.1.1", "4.0.20.Final", "vertx-2.x");
        runVertx("2.1.2", "4.0.20.Final", "vertx-2.x");
        runVertx("2.1.3", "4.0.21.Final", "vertx-2.x");
        runVertx("2.1.4", "4.0.21.Final", "vertx-2.x");
        runVertx("2.1.5", "4.0.21.Final", "vertx-2.x");
        runVertx("2.1.6", "4.0.21.Final", "vertx-2.x");

        runVertx("3.0.0", "4.0.28.Final", "vertx-3.x");
        runVertx("3.1.0", "4.0.31.Final", "vertx-3.x");
        runVertx("3.2.0", "4.0.33.Final", "vertx-3.x");
        runVertx("3.2.1", "4.0.33.Final", "vertx-3.x");
    }

    private static void runNetty(String version, String... profile) throws Exception {
        Util.updateLibVersion(MODULE_PATH, "netty.version", version);
        Util.runTests(MODULE_PATH, profile);
    }

    private static void runVertx(String vertxVersion, String nettyVersion, String profile)
            throws Exception {
        Util.updateLibVersion(MODULE_PATH, "vertx.version", vertxVersion);
        Util.updateLibVersion(MODULE_PATH, "netty.version", nettyVersion);
        Util.runTests(MODULE_PATH, profile);
    }
}

@@ -927,32 +927,45 @@
 ty(%223.3.0.Final%22
+, %22netty-3.x%22
 );%0A        runNe
@@ -973,32 +973,45 @@
 ty(%223.3.1.Final%22
+, %22netty-3.x%22
 );%0A        for (
@@ -1070,32 +1070,45 @@
 %22 + i + %22.Final%22
+, %22netty-3.x%22
 );%0A        %7D%0A   
@@ -1178,32 +1178,45 @@
 %22 + i + %22.Final%22
+, %22netty-3.x%22
 );%0A        %7D%0A   
@@ -1286,32 +1286,45 @@
 %22 + i + %22.Final%22
+, %22netty-3.x%22
 );%0A        %7D%0A   
@@ -1346,24 +1346,37 @@
 3.7.0.Final%22
+, %22netty-3.x%22
 );%0A        r
@@ -1392,24 +1392,37 @@
 3.7.1.Final%22
+, %22netty-3.x%22
 );%0A        f
@@ -1485,32 +1485,45 @@
 %22 + i + %22.Final%22
+, %22netty-3.x%22
 );%0A        %7D%0A   
@@ -1592,32 +1592,45 @@
 %22 + i + %22.Final%22
+, %22netty-3.x%22
 );%0A        %7D%0A   
@@ -1700,32 +1700,45 @@
 %22 + i + %22.Final%22
+, %22netty-3.x%22
 );%0A        %7D%0A   
@@ -1816,16 +1816,129 @@
 %22.Final%22
+, %22netty-4.x%22);%0A        %7D%0A        for (int i = 1; i %3C= 7; i++) %7B%0A            runNetty(%224.1.0.CR%22 + i, %22netty-4.x%22
 );%0A     

Fix netty tests