Search in sources :

Example 1 with TaskVariantManager

use of org.fakekoji.jobmanager.manager.TaskVariantManager in project jenkins-scm-koji-plugin by judovana.

the class GetterAPI method getProjectHandler.

private QueryHandler getProjectHandler() {
    final JDKProjectManager jdkProjectManager = settings.getConfigManager().jdkProjectManager;
    final JDKVersionManager jdkVersionManager = settings.getConfigManager().jdkVersionManager;
    final TaskVariantManager taskVariantManager = settings.getConfigManager().taskVariantManager;
    return new QueryHandler() {

        @Override
        public Result<String, String> handle(Map<String, List<String>> queryParams) throws StorageException {
            final Optional<String> archiveOpt = extractParamValue(queryParams, ARCHIVE);
            final Optional<String> buildOpt = extractParamValue(queryParams, BUILD);
            final OToolParser parser = new OToolParser(jdkProjectManager.readAll(), jdkVersionManager.readAll(), taskVariantManager.getBuildVariants());
            if (archiveOpt.isPresent()) {
                final String archive = archiveOpt.get();
                return parser.parseArchive(archive).map(OToolArchive::getProjectName);
            }
            if (buildOpt.isPresent()) {
                final String build = buildOpt.get();
                return parser.parseBuild(build).map(OToolBuild::getProjectName);
            }
            return Result.err(ERROR_PARAMETERS_EXPECTED);
        }

        @Override
        public String about() {
            return "/project?[" + String.join("|", ARCHIVE + "=<NVRA>", BUILD + "=<NVR>") + "]";
        }
    };
}
Also used : TaskVariantManager(org.fakekoji.jobmanager.manager.TaskVariantManager) JDKProjectManager(org.fakekoji.jobmanager.project.JDKProjectManager) OToolParser(org.fakekoji.core.utils.OToolParser) OToolArchive(org.fakekoji.model.OToolArchive) JDKVersionManager(org.fakekoji.jobmanager.manager.JDKVersionManager) HashMap(java.util.HashMap) Map(java.util.Map) OToolBuild(org.fakekoji.model.OToolBuild)

Example 2 with TaskVariantManager

use of org.fakekoji.jobmanager.manager.TaskVariantManager in project jenkins-scm-koji-plugin by judovana.

the class GetterAPI method getFileNameParserHandler.

private QueryHandler getFileNameParserHandler() {
    final JDKProjectManager jdkProjectManager = settings.getConfigManager().jdkProjectManager;
    final JDKVersionManager jdkVersionManager = settings.getConfigManager().jdkVersionManager;
    final TaskVariantManager taskVariantManager = settings.getConfigManager().taskVariantManager;
    return new QueryHandler() {

        @Override
        public Result<String, String> handle(Map<String, List<String>> queryParams) throws StorageException {
            final Optional<String> archiveOpt = extractParamValue(queryParams, ARCHIVE);
            final Optional<String> buildOpt = extractParamValue(queryParams, BUILD);
            final OToolParser parser = new OToolParser(jdkProjectManager.readAll(), jdkVersionManager.readAll(), taskVariantManager.getBuildVariants());
            if (archiveOpt.isPresent()) {
                final String archive = archiveOpt.get();
                Result<String, String> r = parser.parseArchive(archive).map(oToolArchive -> oToolArchive.toString("\n"));
                return r;
            }
            if (buildOpt.isPresent()) {
                final String build = buildOpt.get();
                Result<String, String> r = parser.parseBuild(build).map(oToolBuild -> oToolBuild.toString("\n"));
                return r;
            }
            return Result.err(ERROR_PARAMETERS_EXPECTED);
        }

        @Override
        public String about() {
            return "/filenameParser?[" + String.join("|", ARCHIVE + "=<NVRA>", BUILD + "=<NVR>") + "]";
        }
    };
}
Also used : TaskVariantManager(org.fakekoji.jobmanager.manager.TaskVariantManager) JDKProjectManager(org.fakekoji.jobmanager.project.JDKProjectManager) OToolParser(org.fakekoji.core.utils.OToolParser) JDKVersionManager(org.fakekoji.jobmanager.manager.JDKVersionManager) HashMap(java.util.HashMap) Map(java.util.Map)

Example 3 with TaskVariantManager

use of org.fakekoji.jobmanager.manager.TaskVariantManager in project jenkins-scm-koji-plugin by judovana.

the class GetterAPI method getProjectsHandler.

private QueryHandler getProjectsHandler() {
    final JDKProjectManager jdkProjectManager = settings.getConfigManager().jdkProjectManager;
    final JDKTestProjectManager jdkTestProjectManager = settings.getConfigManager().jdkTestProjectManager;
    final JDKVersionManager jdkVersionManager = settings.getConfigManager().jdkVersionManager;
    final TaskVariantManager taskVariantManager = settings.getConfigManager().taskVariantManager;
    return new QueryHandler() {

        @Override
        public Result<String, String> handle(Map<String, List<String>> queryParams) throws StorageException {
            final Optional<String> typeOpt = extractParamValue(queryParams, TYPE);
            final Optional<String> nvrOpt = extractParamValue(queryParams, NVR);
            final Optional<String> rulesOpt = extractParamValue(queryParams, ADDITIONAL_RULES);
            final List<String[]> rulesPairList;
            if (rulesOpt.isPresent()) {
                String[] rules = rulesOpt.get().split("[\\s,]+");
                if (rules.length == 0 || rules.length % 2 == 1) {
                    return Result.err("if " + ADDITIONAL_RULES + " is used, then it must be >0 and mus be even number of them. You have " + rules.length);
                }
                rulesPairList = new ArrayList<>(rules.length / 2);
                for (int i = 0; i < rules.length; i += 2) {
                    rulesPairList.add(new String[] { rules[i], rules[i + 1] });
                }
            } else {
                rulesPairList = Collections.emptyList();
            }
            final String asRegex = extractParamValue(queryParams, AS_REGEX_LIST).orElse(null);
            final boolean unsafe = Boolean.valueOf(extractParamValue(queryParams, UNSAFE).orElse("false"));
            final String prep;
            final String join;
            final String post;
            if ("regex".equals(asRegex)) {
                prep = ".*-";
                join = "-.*|.*-";
                post = "-.*";
            } else if ("list".equals(asRegex)) {
                prep = "";
                join = ",";
                post = "";
            } else {
                prep = "";
                join = "\n";
                post = "\n";
            }
            if (typeOpt.isPresent()) {
                final String type = typeOpt.get();
                final Stream<Project> projects;
                switch(Project.ProjectType.valueOf(type)) {
                    case JDK_PROJECT:
                        projects = jdkProjectManager.readAll().stream().map(project -> project);
                        break;
                    case JDK_TEST_PROJECT:
                        projects = jdkTestProjectManager.readAll().stream().map(project -> project);
                        break;
                    default:
                        return Result.err("Unknown project type");
                }
                return Result.ok(prep + projects.map(Project::getId).sorted(String::compareTo).collect(Collectors.joining(join)) + post);
            } else if (nvrOpt.isPresent()) {
                final OToolParser parser = new OToolParser(jdkProjectManager.readAll(), jdkVersionManager.readAll(), taskVariantManager.getBuildVariants());
                final String archive = nvrOpt.get();
                Result r;
                try {
                    r = parser.parseArchive(archive).map(oToolArchive -> prep + oToolArchive.getProjectName() + post);
                } catch (Exception ex) {
                    // ex.printStackTrace(); we do not care, falling back to
                    r = Result.err("Not and parse-able project");
                }
                if (r.isOk()) {
                    return r;
                } else {
                    if (unsafe) {
                        // by longest project, try stupid substring
                        List<JDKProject> projects = jdkProjectManager.readAll();
                        Collections.sort(projects, new Comparator<JDKProject>() {

                            @Override
                            public int compare(JDKProject o1, JDKProject o2) {
                                return o2.getId().length() - o1.getId().length();
                            }
                        });
                        for (JDKProject project : projects) {
                            if (nvrOpt.get().contains("-" + project.getId() + "-") || nvrOpt.get().contains("." + project.getId() + ".") || nvrOpt.get().contains("." + project.getId() + "-") || nvrOpt.get().contains("-" + project.getId() + ".") || nvrOpt.get().endsWith("-" + project.getId()) || nvrOpt.get().endsWith("." + project.getId())) {
                                // add also cehck against pkg? Likely not, the src snapshots may not be parseable
                                return Result.ok(prep + project.getId() + post);
                            }
                        }
                    }
                    // ok, it is not jdkProject, so it must be jdkTestProject
                    String nv = archive.substring(0, archive.lastIndexOf("-"));
                    String n = nv.substring(0, nv.lastIndexOf("-"));
                    String vr = archive.replaceFirst(n + "-", "");
                    Pattern tmpRuleMatcher = Pattern.compile(".*");
                    List<JDKTestProject> testProjects = jdkTestProjectManager.readAll();
                    for (String[] rule : rulesPairList) {
                        if (vr.matches(rule[0])) {
                            tmpRuleMatcher = Pattern.compile(rule[1]);
                            break;
                        }
                    }
                    final Pattern ruleMatcher = tmpRuleMatcher;
                    List<String> results = testProjects.stream().filter(testproject -> testproject.getProduct().getPackageName().equals(n)).filter(testproject -> ruleMatcher.matcher(testproject.getId()).matches()).map(testproject -> testproject.getId()).sorted().collect(Collectors.toList());
                    if (results.isEmpty()) {
                        if (unsafe) {
                            results = jdkTestProjectManager.readAll().stream().filter(testproject -> ruleMatcher.matcher(testproject.getId()).matches()).map(Project::getId).sorted(String::compareTo).collect(Collectors.toList());
                            if (results.isEmpty()) {
                                // without rules
                                results = jdkTestProjectManager.readAll().stream().map(Project::getId).sorted(String::compareTo).collect(Collectors.toList());
                            }
                            return Result.ok(prep + String.join(join, results) + post);
                        } else {
                            return Result.err("");
                        }
                    } else {
                        return Result.ok(prep + String.join(join, results) + post);
                    }
                }
            } else {
                final Stream<Project> projects = Stream.of(jdkProjectManager.readAll(), jdkTestProjectManager.readAll()).flatMap(List::stream);
                Optional<String> productOpt = extractParamValue(queryParams, PRODUCT);
                if (productOpt.isPresent()) {
                    final String product = productOpt.get();
                    return Result.ok(prep + projects.filter(project -> project.getProduct().getPackageName().equals(product)).map(Project::getId).collect(Collectors.joining(join)) + post);
                }
                return Result.ok(prep + projects.map(Project::getId).sorted(String::compareTo).collect(Collectors.joining(join)) + post);
            }
        }

        @Override
        public String about() {
            return "/projects?[ one of \n" + "\t" + TYPE + "=[" + Project.ProjectType.JDK_PROJECT + "|" + Project.ProjectType.JDK_TEST_PROJECT + "]\n" + "\t" + NVR + "=nvr with optional as=<regex|list> and usnafe=true (will try also longest substring for jdkProjects or return all testOnly on failure)\n" + "\t" + ADDITIONAL_RULES + "=space or comma sepparated list of pairs eg Pa1 Pb1,Pa2 Pb2,...PaN PBn \n" + "\t" + "each pair is if VR matches Pa then use Pb matching projects. Firs matched, first served \n" + "]";
        }
    };
}
Also used : JenkinsCliWrapper(org.fakekoji.jobmanager.JenkinsCliWrapper) Platform(org.fakekoji.model.Platform) JDKTestProjectManager(org.fakekoji.jobmanager.project.JDKTestProjectManager) Task(org.fakekoji.model.Task) TaskVariantManager(org.fakekoji.jobmanager.manager.TaskVariantManager) Job(org.fakekoji.jobmanager.model.Job) HashMap(java.util.HashMap) JDKTestProject(org.fakekoji.jobmanager.model.JDKTestProject) PlatformManager(org.fakekoji.jobmanager.manager.PlatformManager) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) Map(java.util.Map) RestUtils.extractParamValue(org.fakekoji.api.http.rest.RestUtils.extractParamValue) StorageException(org.fakekoji.storage.StorageException) Path(java.nio.file.Path) JDKVersionManager(org.fakekoji.jobmanager.manager.JDKVersionManager) Project(org.fakekoji.jobmanager.model.Project) ManagementException(org.fakekoji.jobmanager.ManagementException) FileVisitor(java.nio.file.FileVisitor) Files(java.nio.file.Files) Predicate(java.util.function.Predicate) Collection(java.util.Collection) TaskManager(org.fakekoji.jobmanager.manager.TaskManager) Set(java.util.Set) IOException(java.io.IOException) BasicFileAttributes(java.nio.file.attribute.BasicFileAttributes) EndpointGroup(io.javalin.apibuilder.EndpointGroup) JDKProject(org.fakekoji.jobmanager.model.JDKProject) Collectors(java.util.stream.Collectors) TaskVariantValue(org.fakekoji.model.TaskVariantValue) Objects(java.util.Objects) FileVisitResult(java.nio.file.FileVisitResult) OToolParser(org.fakekoji.core.utils.OToolParser) List(java.util.List) Stream(java.util.stream.Stream) OToolBuild(org.fakekoji.model.OToolBuild) Result(org.fakekoji.functional.Result) TaskVariant(org.fakekoji.model.TaskVariant) Optional(java.util.Optional) ApiBuilder.get(io.javalin.apibuilder.ApiBuilder.get) Pattern(java.util.regex.Pattern) ApiBuilder.path(io.javalin.apibuilder.ApiBuilder.path) JDKProjectManager(org.fakekoji.jobmanager.project.JDKProjectManager) JDKVersion(org.fakekoji.model.JDKVersion) Comparator(java.util.Comparator) Collections(java.util.Collections) OToolArchive(org.fakekoji.model.OToolArchive) AccessibleSettings(org.fakekoji.core.AccessibleSettings) FileVisitResult(java.nio.file.FileVisitResult) Result(org.fakekoji.functional.Result) Comparator(java.util.Comparator) ArrayList(java.util.ArrayList) List(java.util.List) Stream(java.util.stream.Stream) JDKVersionManager(org.fakekoji.jobmanager.manager.JDKVersionManager) TaskVariantManager(org.fakekoji.jobmanager.manager.TaskVariantManager) JDKProject(org.fakekoji.jobmanager.model.JDKProject) Pattern(java.util.regex.Pattern) Optional(java.util.Optional) OToolParser(org.fakekoji.core.utils.OToolParser) StorageException(org.fakekoji.storage.StorageException) ManagementException(org.fakekoji.jobmanager.ManagementException) IOException(java.io.IOException) JDKTestProject(org.fakekoji.jobmanager.model.JDKTestProject) Project(org.fakekoji.jobmanager.model.Project) JDKProject(org.fakekoji.jobmanager.model.JDKProject) JDKTestProjectManager(org.fakekoji.jobmanager.project.JDKTestProjectManager) JDKProjectManager(org.fakekoji.jobmanager.project.JDKProjectManager) HashMap(java.util.HashMap) Map(java.util.Map)

Example 4 with TaskVariantManager

use of org.fakekoji.jobmanager.manager.TaskVariantManager in project jenkins-scm-koji-plugin by judovana.

the class GetterAPI method getProductHandler.

private QueryHandler getProductHandler() {
    final JDKProjectManager jdkProjectManager = settings.getConfigManager().jdkProjectManager;
    final JDKTestProjectManager jdkTestProjectManager = settings.getConfigManager().jdkTestProjectManager;
    final JDKVersionManager jdkVersionManager = settings.getConfigManager().jdkVersionManager;
    final TaskVariantManager taskVariantManager = settings.getConfigManager().taskVariantManager;
    return new QueryHandler() {

        @Override
        public Result<String, String> handle(Map<String, List<String>> queryParams) throws StorageException {
            final Optional<String> archiveOpt = extractParamValue(queryParams, ARCHIVE);
            if (archiveOpt.isPresent()) {
                final String archive = archiveOpt.get();
                return new OToolParser(jdkProjectManager.readAll(), jdkVersionManager.readAll(), taskVariantManager.getBuildVariants()).parseArchive(archive).map(OToolBuild::getPackageName);
            }
            final Optional<String> projectOpt = extractParamValue(queryParams, PROJECT);
            if (projectOpt.isPresent()) {
                final String project = projectOpt.get();
                final List<JDKProject> jdkProjects = jdkProjectManager.readAll();
                final Optional<JDKProject> optionalJDKProject = jdkProjects.stream().filter(proj -> proj.getId().equals(project)).findFirst();
                if (optionalJDKProject.isPresent()) {
                    final JDKProject jdkProject = optionalJDKProject.get();
                    return Result.ok(jdkProject.getProduct().getPackageName());
                }
                final List<JDKTestProject> jdkTestProjects = jdkTestProjectManager.readAll();
                final Optional<JDKTestProject> optionalJDKTestProject = jdkTestProjects.stream().filter(proj -> proj.getId().equals(project)).findFirst();
                if (optionalJDKTestProject.isPresent()) {
                    final JDKTestProject jdkTestProject = optionalJDKTestProject.get();
                    return Result.ok(jdkTestProject.getProduct().getPackageName());
                }
                return Result.err(ERROR_PROJECT_NOT_FOUND);
            }
            final Optional<String> buildOpt = extractParamValue(queryParams, BUILD);
            if (buildOpt.isPresent()) {
                final String build = buildOpt.get();
                return new OToolParser(jdkProjectManager.readAll(), jdkVersionManager.readAll(), taskVariantManager.getBuildVariants()).parseBuild(build).map(OToolBuild::getPackageName);
            }
            return Result.err(ERROR_PARAMETERS_EXPECTED);
        }

        @Override
        public String about() {
            return "/product?[" + String.join("|", ARCHIVE + "=<NVRA>", BUILD + "=<NVR>", PROJECT + "=projectName") + "]";
        }
    };
}
Also used : TaskVariantManager(org.fakekoji.jobmanager.manager.TaskVariantManager) JenkinsCliWrapper(org.fakekoji.jobmanager.JenkinsCliWrapper) Platform(org.fakekoji.model.Platform) JDKTestProjectManager(org.fakekoji.jobmanager.project.JDKTestProjectManager) Task(org.fakekoji.model.Task) TaskVariantManager(org.fakekoji.jobmanager.manager.TaskVariantManager) Job(org.fakekoji.jobmanager.model.Job) HashMap(java.util.HashMap) JDKTestProject(org.fakekoji.jobmanager.model.JDKTestProject) PlatformManager(org.fakekoji.jobmanager.manager.PlatformManager) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) Map(java.util.Map) RestUtils.extractParamValue(org.fakekoji.api.http.rest.RestUtils.extractParamValue) StorageException(org.fakekoji.storage.StorageException) Path(java.nio.file.Path) JDKVersionManager(org.fakekoji.jobmanager.manager.JDKVersionManager) Project(org.fakekoji.jobmanager.model.Project) ManagementException(org.fakekoji.jobmanager.ManagementException) FileVisitor(java.nio.file.FileVisitor) Files(java.nio.file.Files) Predicate(java.util.function.Predicate) Collection(java.util.Collection) TaskManager(org.fakekoji.jobmanager.manager.TaskManager) Set(java.util.Set) IOException(java.io.IOException) BasicFileAttributes(java.nio.file.attribute.BasicFileAttributes) EndpointGroup(io.javalin.apibuilder.EndpointGroup) JDKProject(org.fakekoji.jobmanager.model.JDKProject) Collectors(java.util.stream.Collectors) TaskVariantValue(org.fakekoji.model.TaskVariantValue) Objects(java.util.Objects) FileVisitResult(java.nio.file.FileVisitResult) OToolParser(org.fakekoji.core.utils.OToolParser) List(java.util.List) Stream(java.util.stream.Stream) OToolBuild(org.fakekoji.model.OToolBuild) Result(org.fakekoji.functional.Result) TaskVariant(org.fakekoji.model.TaskVariant) Optional(java.util.Optional) ApiBuilder.get(io.javalin.apibuilder.ApiBuilder.get) Pattern(java.util.regex.Pattern) ApiBuilder.path(io.javalin.apibuilder.ApiBuilder.path) JDKProjectManager(org.fakekoji.jobmanager.project.JDKProjectManager) JDKVersion(org.fakekoji.model.JDKVersion) Comparator(java.util.Comparator) Collections(java.util.Collections) OToolArchive(org.fakekoji.model.OToolArchive) AccessibleSettings(org.fakekoji.core.AccessibleSettings) JDKProject(org.fakekoji.jobmanager.model.JDKProject) OToolParser(org.fakekoji.core.utils.OToolParser) JDKTestProjectManager(org.fakekoji.jobmanager.project.JDKTestProjectManager) JDKProjectManager(org.fakekoji.jobmanager.project.JDKProjectManager) JDKVersionManager(org.fakekoji.jobmanager.manager.JDKVersionManager) HashMap(java.util.HashMap) Map(java.util.Map) JDKTestProject(org.fakekoji.jobmanager.model.JDKTestProject) OToolBuild(org.fakekoji.model.OToolBuild)

Example 5 with TaskVariantManager

use of org.fakekoji.jobmanager.manager.TaskVariantManager in project jenkins-scm-koji-plugin by judovana.

the class GetterAPI method getVariantsHandler.

private QueryHandler getVariantsHandler() {
    final TaskVariantManager taskVariantManager = settings.getConfigManager().taskVariantManager;
    return new QueryHandler() {

        @Override
        public Result<String, String> handle(Map<String, List<String>> queryParams) throws StorageException {
            List<TaskVariant> allVariants = taskVariantManager.readAll();
            Collections.sort(allVariants);
            List<TaskVariant> testVariants = new ArrayList<>(allVariants.size());
            List<TaskVariant> buildVariants = new ArrayList<>(allVariants.size());
            final Optional<String> type = extractParamValue(queryParams, VARIANTS_TYPE);
            final Optional<String> defaults = extractParamValue(queryParams, VARIANTS_DEFAULTS);
            if (type.isPresent() && type.get().equals("TYPES")) {
                return Result.ok(Task.Type.BUILD + " " + Task.Type.TEST + "\n");
            }
            for (TaskVariant variant : allVariants) {
                if (type.isPresent() && type.get().equals(Task.Type.BUILD.getValue())) {
                    if (variant.getType().equals(Task.Type.BUILD)) {
                        buildVariants.add(variant);
                    }
                }
                if (type.isPresent() && type.get().equals(Task.Type.TEST.getValue())) {
                    if (variant.getType().equals(Task.Type.TEST)) {
                        testVariants.add(variant);
                    }
                }
                if (!type.isPresent() || variant.getId().equals(type.get())) {
                    if (variant.getType().equals(Task.Type.TEST)) {
                        testVariants.add(variant);
                    }
                    if (variant.getType().equals(Task.Type.BUILD)) {
                        buildVariants.add(variant);
                    }
                }
            }
            StringBuilder sb = new StringBuilder();
            if (buildVariants.size() > 0 && testVariants.size() > 0) {
                if (defaults.isPresent() && defaults.get().equals("string")) {
                // skipping
                } else {
                    printTitle(sb, "Build variants", defaults);
                }
            }
            for (TaskVariant t : buildVariants) {
                print(t, sb, defaults, buildVariants.size() + testVariants.size());
            }
            if (sb.length() > 0 && sb.charAt(sb.length() - 1) == '.') {
                sb = new StringBuilder(sb.reverse().toString().replaceFirst("\\.", ""));
                sb.reverse();
            }
            if (buildVariants.size() > 0 && testVariants.size() > 0) {
                printTitle(sb, "Test  variants", defaults);
            }
            for (TaskVariant t : testVariants) {
                print(t, sb, defaults, buildVariants.size() + testVariants.size());
            }
            if (sb.length() > 0 && sb.charAt(sb.length() - 1) == '.') {
                sb = new StringBuilder(sb.reverse().toString().replaceFirst("\\.", ""));
                sb.reverse();
            }
            String s = sb.toString();
            if (s.endsWith("\n")) {
                return Result.ok(s);
            } else {
                sb.append("\n");
                return Result.ok(sb.toString());
            }
        }

        private void printTitle(StringBuilder sb, String title, Optional<String> defaults) {
            if (defaults.isPresent() && defaults.get().equals("string")) {
                sb.append("-");
            } else {
                sb.append(" * ").append(title).append(" *\n");
            }
        }

        private void print(TaskVariant t, StringBuilder sb, Optional<String> defaults, int items) {
            if (defaults.isPresent()) {
                if ("list".equals(defaults.get())) {
                    sb.append(t.getId()).append(":" + t.getOrder() + ":").append(t.getDefaultValue()).append("\n");
                } else if ("string".equals(defaults.get())) {
                    sb.append(t.getDefaultValue()).append(".");
                }
            } else {
                if (items == 1) {
                    sb.append(t.getVariants().values().stream().map(TaskVariantValue::getId).collect(Collectors.joining(","))).append("\n");
                } else {
                    sb.append(t.getId()).append(":" + t.getOrder() + ":").append(t.getVariants().values().stream().map(TaskVariantValue::getId).collect(Collectors.joining(","))).append("\n");
                }
            }
        }

        @Override
        public String about() {
            return "/" + VARIANTS + "[" + VARIANTS_TYPE + "=" + Task.Type.BUILD + "/" + Task.Type.TEST + "/TYPES/nameOfSelectedVariant;" + VARIANTS_DEFAULTS + "=list/string]";
        }
    };
}
Also used : TaskVariantManager(org.fakekoji.jobmanager.manager.TaskVariantManager) Optional(java.util.Optional) ArrayList(java.util.ArrayList) HashMap(java.util.HashMap) Map(java.util.Map) TaskVariant(org.fakekoji.model.TaskVariant)

Aggregations

TaskVariantManager (org.fakekoji.jobmanager.manager.TaskVariantManager)6 HashMap (java.util.HashMap)5 Map (java.util.Map)5 JDKVersionManager (org.fakekoji.jobmanager.manager.JDKVersionManager)5 JDKProjectManager (org.fakekoji.jobmanager.project.JDKProjectManager)5 TaskVariant (org.fakekoji.model.TaskVariant)4 IOException (java.io.IOException)3 ArrayList (java.util.ArrayList)3 Optional (java.util.Optional)3 Pattern (java.util.regex.Pattern)3 Collectors (java.util.stream.Collectors)3 JenkinsCliWrapper (org.fakekoji.jobmanager.JenkinsCliWrapper)3 PlatformManager (org.fakekoji.jobmanager.manager.PlatformManager)3 TaskManager (org.fakekoji.jobmanager.manager.TaskManager)3 JDKProject (org.fakekoji.jobmanager.model.JDKProject)3 JDKTestProject (org.fakekoji.jobmanager.model.JDKTestProject)3 Job (org.fakekoji.jobmanager.model.Job)3 JDKTestProjectManager (org.fakekoji.jobmanager.project.JDKTestProjectManager)3 JDKVersion (org.fakekoji.model.JDKVersion)3 Platform (org.fakekoji.model.Platform)3