package org.jerkar.integrationtest;

import org.jerkar.api.depmanagement.*;
import org.jerkar.api.system.JkLog;
import org.jerkar.api.utils.JkUtilsSystem;
import org.junit.Assert;
import org.junit.Test;

import java.util.List;
import java.util.stream.Collectors;

import static org.jerkar.api.depmanagement.JkJavaDepScopes.COMPILE;
import static org.jerkar.api.depmanagement.JkJavaDepScopes.COMPILE_AND_RUNTIME;
import static org.jerkar.api.depmanagement.JkJavaDepScopes.TEST;

public class ResolveSpringBootStarterIT {

    private static final String SPRINGBOOT_STARTER = "org.springframework.boot:spring-boot-starter:1.5.13.RELEASE";

    private static final JkModuleId SLF4J_API = JkModuleId.of("org.slf4j:slf4j-api");

    @Test
    public void resolveCompile() {
        JkLog.registerBasicConsoleHandler();
        JkResolveResult result = resolver().resolve(
                JkDependencySet.of().and(SPRINGBOOT_STARTER, COMPILE_AND_RUNTIME)
             //   .and(SLF4J_API.getGroupAndName() + ":1.7.25")
        );
        System.out.println(resolver().getParams().getScopeMapping());
        System.out.println(result.getDependencyTree().toStringTree());
        result.getFiles().forEach(System.out::println);
        List<JkDependencyNode> slf4japiNodes = result.getDependencyTree().toFlattenList().stream()
                .filter(node -> node.getModuleInfo().getModuleId().equals(SLF4J_API)).collect(Collectors.toList());
        for (JkDependencyNode slf4japiNode : slf4japiNodes) {
            System.out.println("---------------------");
            System.out.println(slf4japiNode);
            slf4japiNode.getResolvedFiles().forEach(System.out::println);
        }

    }

    private JkDependencyResolver resolver() {
        return JkDependencyResolver.of(JkRepo.ofMavenCentral());
    }
}

@@ -193,24 +193,51 @@
 unit.Test;%0A%0A
+import java.nio.file.Path;%0A
 import java.
@@ -247,16 +247,16 @@
 l.List;%0A
-
 import j
@@ -974,72 +974,8 @@
 ME)%0A
-             //   .and(SLF4J_API.getGroupAndName() + %22:1.7.25%22)%0A
     
@@ -1624,32 +1624,32 @@
 .out::println);%0A
-
         %7D%0A%0A    %7D
@@ -1639,24 +1639,205 @@
 %0A        %7D%0A%0A
+        // Does not contains test-jars%0A        Assert.assertFalse(result.getFiles().getEntries().stream().anyMatch(path -%3E path.getFileName().toString().endsWith(%22-tests.jar%22)));%0A%0A%0A
     %7D%0A%0A    p

test dependency management