test_class.declarator: targetRepo = Paths.get("build").toAbsolutePath().toString() + File.separator + "platform-libs"
test_class.original_string: String targetRepo = Paths.get("build").toAbsolutePath().toString() + File.separator + "platform-libs";
test_class.type: String
test_class.var_name: targetRepo
test_class.declarator: mavenArtifactVersion = "3.6.3"
test_class.original_string: String mavenArtifactVersion = "3.6.3";
test_class.type: String
test_class.var_name: mavenArtifactVersion
test_class.declarator: cassandraVersion = "0.8.3"
test_class.original_string: String cassandraVersion = "0.8.3";
test_class.type: String
test_class.var_name: cassandraVersion
test_class.declarator: commandDistVersion = "0.8.5"
test_class.original_string: String commandDistVersion = "0.8.5";
test_class.type: String
test_class.var_name: commandDistVersion
test_class.declarator: resolver = new MavenResolver(targetRepo)
test_class.original_string: MavenResolver resolver = new MavenResolver(targetRepo);
test_class.type: MavenResolver
test_class.var_name: resolver
test_class.file: misc/maven-resolver/src/test/java/org/ballerinalang/maven/MavenResolverTest.java
test_class.identifier: MavenResolverTest
test_case.body: @Test
      public void testTransitiveDependency() {
          try {
              Dependency dependency = resolver.resolve("org.apache.maven", "maven-artifact", mavenArtifactVersion,
                      true);
              String jarPath = Utils.getJarPath(targetRepo, dependency.getDepedencies().get(0));
              Assert.assertTrue(new File(jarPath).exists());
          } catch (MavenResolverException e) {
              Assert.fail(e.getMessage());
          }
      }
test_case.class_method_signature: MavenResolverTest.testTransitiveDependency()
test_case.full_signature: @Test public void testTransitiveDependency()
test_case.identifier: testTransitiveDependency
test_case.invocations: resolve getJarPath get getDepedencies assertTrue exists fail getMessage
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testTransitiveDependency()
focal_class.declarator: rootNode = null
focal_class.original_string: org.ballerinalang.maven.Dependency rootNode = null;
focal_class.type: org.ballerinalang.maven.Dependency
focal_class.var_name: rootNode
focal_class.declarator: repositories
focal_class.modifier: private
focal_class.original_string: private List<RemoteRepository> repositories;
focal_class.type: List<RemoteRepository>
focal_class.var_name: repositories
focal_class.declarator: system
focal_class.original_string: RepositorySystem system;
focal_class.type: RepositorySystem
focal_class.var_name: system
focal_class.declarator: session
focal_class.original_string: DefaultRepositorySystemSession session;
focal_class.type: DefaultRepositorySystemSession
focal_class.var_name: session
focal_class.file: misc/maven-resolver/src/main/java/org/ballerinalang/maven/MavenResolver.java
focal_class.identifier: MavenResolver
focal_class.class_method_signature: MavenResolver.MavenResolver(String targetLocation)
focal_class.full_signature: public  MavenResolver(String targetLocation)
focal_class.identifier: MavenResolver
focal_class.modifiers: public
focal_class.parameters: (String targetLocation)
focal_class.signature:  MavenResolver(String targetLocation)
focal_class.class_method_signature: MavenResolver.addRepository(String id, String url)
focal_class.full_signature: public void addRepository(String id, String url)
focal_class.identifier: addRepository
focal_class.modifiers: public
focal_class.parameters: (String id, String url)
focal_class.return: void
focal_class.signature: void addRepository(String id, String url)
focal_class.class_method_signature: MavenResolver.addRepository(String id, String url, String username, String password)
focal_class.full_signature: public void addRepository(String id, String url, String username, String password)
focal_class.identifier: addRepository
focal_class.modifiers: public
focal_class.parameters: (String id, String url, String username, String password)
focal_class.return: void
focal_class.signature: void addRepository(String id, String url, String username, String password)
focal_class.class_method_signature: MavenResolver.convertDependency(DependencyNode dependencyNode)
focal_class.full_signature: private org.ballerinalang.maven.Dependency convertDependency(DependencyNode dependencyNode)
focal_class.identifier: convertDependency
focal_class.modifiers: private
focal_class.parameters: (DependencyNode dependencyNode)
focal_class.return: org.ballerinalang.maven.Dependency
focal_class.signature: org.ballerinalang.maven.Dependency convertDependency(DependencyNode dependencyNode)
focal_class.class_method_signature: MavenResolver.resolve(String groupId, String artifactId, String version,
                                                        boolean resolveTransitiveDependencies)
focal_class.full_signature: public org.ballerinalang.maven.Dependency resolve(String groupId, String artifactId, String version,
                                                        boolean resolveTransitiveDependencies)
focal_class.identifier: resolve
focal_class.modifiers: public
focal_class.parameters: (String groupId, String artifactId, String version,
                                                        boolean resolveTransitiveDependencies)
focal_class.return: org.ballerinalang.maven.Dependency
focal_class.signature: org.ballerinalang.maven.Dependency resolve(String groupId, String artifactId, String version,
                                                        boolean resolveTransitiveDependencies)
focal_method.body: public org.ballerinalang.maven.Dependency resolve(String groupId, String artifactId, String version,
                                                        boolean resolveTransitiveDependencies)
              throws MavenResolverException {
          Artifact artifact = new DefaultArtifact(groupId + ":" + artifactId + ":" + version);
          if (resolveTransitiveDependencies) {
              try {
                  DependencyFilter classpathFilter = DependencyFilterUtils.classpathFilter(JavaScopes.COMPILE);
                  CollectRequest collectRequest = new CollectRequest();
                  collectRequest.setRoot(new Dependency(artifact, JavaScopes.COMPILE));
                  collectRequest.setRepositories(repositories);
  
                  DependencyRequest dependencyRequest = new DependencyRequest(collectRequest, classpathFilter);
                  system.resolveDependencies(session, dependencyRequest);
  
                  CollectResult collectResult = system.collectDependencies(session, collectRequest);
                  DependencyNode node = collectResult.getRoot();
  
                  node.accept(new TreeDependencyVisitor(new DependencyVisitor() {
                      int level = 0;
  
                      @Override
                      public boolean visitEnter(DependencyNode dependencyNode) {
                          org.ballerinalang.maven.Dependency currentNode = convertDependency(dependencyNode);
                          if (level == 0) {
                              rootNode = currentNode;
                          } else {
                              org.ballerinalang.maven.Dependency parent = rootNode;
                              for (int i = 0; i < level; i++) {
                                  if (level > 1) {
                                      parent = rootNode.getDepedencies().get(rootNode.getDepedencies().size() - 1);
                                  }
                              }
                              parent.addDependency(currentNode);
                          }
                          level += 1;
                          return true;
                      }
  
                      @Override
                      public boolean visitLeave(DependencyNode dependencyNode) {
                          level -= 1;
                          return true;
                      }
                  }));
              } catch (DependencyResolutionException | DependencyCollectionException e) {
                  throw new MavenResolverException(e.getMessage());
              }
          } else {
              try {
                  ArtifactRequest artifactRequest = new ArtifactRequest();
                  artifactRequest.setArtifact(artifact);
                  artifactRequest.setRepositories(repositories);
                  system.resolveArtifact(session, artifactRequest);
                  rootNode = new org.ballerinalang.maven.Dependency(artifact.getGroupId(), artifact.getArtifactId(),
                          artifact.getVersion());
              } catch (ArtifactResolutionException e) {
                  throw new MavenResolverException(e.getMessage());
              }
          }
          return rootNode;
      }
focal_method.class_method_signature: MavenResolver.resolve(String groupId, String artifactId, String version,
                                                        boolean resolveTransitiveDependencies)
focal_method.full_signature: public org.ballerinalang.maven.Dependency resolve(String groupId, String artifactId, String version,
                                                        boolean resolveTransitiveDependencies)
focal_method.identifier: resolve
focal_method.invocations: classpathFilter setRoot setRepositories resolveDependencies collectDependencies getRoot accept convertDependency get getDepedencies size getDepedencies addDependency getMessage setArtifact setRepositories resolveArtifact getGroupId getArtifactId getVersion getMessage
focal_method.modifiers: public
focal_method.parameters: (String groupId, String artifactId, String version,
                                                        boolean resolveTransitiveDependencies)
focal_method.return: org.ballerinalang.maven.Dependency
focal_method.signature: org.ballerinalang.maven.Dependency resolve(String groupId, String artifactId, String version,
                                                        boolean resolveTransitiveDependencies)