Search in sources :

Example 1 with Dependency

use of org.guvnor.common.services.project.model.Dependency in project kie-wb-common by kiegroup.

the class EnhancedDependenciesAsListTest method addDroolsCore.

private void addDroolsCore() {
    droolsCoreNormalDependency = new NormalEnhancedDependency(new Dependency(new GAV("org.drools:drools-core:1.3")), new HashSet<>());
    xstreamTransitiveDependency = new TransitiveEnhancedDependency(new Dependency(new GAV("org.xstream:xstream:1.0")), new HashSet<>());
    droolsApiTransitiveDependency1 = new TransitiveEnhancedDependency(new Dependency(new GAV("org.drools:drools-api:1.0")), new HashSet<>());
    droolsCoreNormalDependency.addTransitiveDependency(xstreamTransitiveDependency);
    enhancedDependencies.add(droolsCoreNormalDependency);
}
Also used : Dependency(org.guvnor.common.services.project.model.Dependency) GAV(org.guvnor.common.services.project.model.GAV) HashSet(java.util.HashSet)

Example 2 with Dependency

use of org.guvnor.common.services.project.model.Dependency in project kie-wb-common by kiegroup.

the class EnhancedDependenciesTest method setUp.

@Before
public void setUp() throws Exception {
    enhancedDependencies = new EnhancedDependencies();
    final NormalEnhancedDependency enhancedDependency = new NormalEnhancedDependency(new Dependency(new GAV("org.hamcrest", "hamcrest-core", "1.3")), new HashSet<>());
    enhancedDependency.addTransitiveDependency(new TransitiveEnhancedDependency(new Dependency(new GAV("hi:something:1.0")), new HashSet<String>()));
    enhancedDependencies.add(enhancedDependency);
}
Also used : Dependency(org.guvnor.common.services.project.model.Dependency) GAV(org.guvnor.common.services.project.model.GAV) HashSet(java.util.HashSet) Before(org.junit.Before)

Example 3 with Dependency

use of org.guvnor.common.services.project.model.Dependency in project kie-wb-common by kiegroup.

the class DependencyServiceImplTest method testDependenciesForGAVs.

@Test
public void testDependenciesForGAVs() throws Exception {
    final Collection<GAV> gavs = new ArrayList<GAV>();
    gavs.add(new GAV("junit", "junit", "4.11"));
    gavs.add(new GAV("org.guvnor", "guvnor-web-app", "5.0"));
    Collection<Dependency> dependencies = service.loadDependencies(gavs);
    assertEquals(2, dependencies.size());
    final Iterator<Dependency> iterator = dependencies.iterator();
    Dependency dependency = iterator.next();
    assertEquals("org.hamcrest", dependency.getGroupId());
    assertEquals("hamcrest-core", dependency.getArtifactId());
    assertEquals("1.3", dependency.getVersion());
    dependency = iterator.next();
    assertEquals("org.drools", dependency.getGroupId());
    assertEquals("drools-core", dependency.getArtifactId());
    assertEquals("5.0", dependency.getVersion());
}
Also used : ArrayList(java.util.ArrayList) Dependency(org.guvnor.common.services.project.model.Dependency) GAV(org.guvnor.common.services.project.model.GAV) Test(org.junit.Test)

Example 4 with Dependency

use of org.guvnor.common.services.project.model.Dependency in project kie-wb-common by kiegroup.

the class DependencyServiceImplTest method testDependencies.

@Test
public void testDependencies() throws Exception {
    Collection<Dependency> dependencies = service.loadDependencies(new GAV("junit", "junit", "4.11"));
    assertEquals(1, dependencies.size());
    Dependency dependency = dependencies.iterator().next();
    assertEquals("org.hamcrest", dependency.getGroupId());
    assertEquals("hamcrest-core", dependency.getArtifactId());
    assertEquals("1.3", dependency.getVersion());
}
Also used : Dependency(org.guvnor.common.services.project.model.Dependency) GAV(org.guvnor.common.services.project.model.GAV) Test(org.junit.Test)

Example 5 with Dependency

use of org.guvnor.common.services.project.model.Dependency in project kie-wb-common by kiegroup.

the class PackageNameSearchProviderTest method testLoadTopLevelDependenciesWhenIncompleteDependenciesInPOM.

@Test
public void testLoadTopLevelDependenciesWhenIncompleteDependenciesInPOM() throws Exception {
    POM pom = new POM(new GAV("artifactID", "groupID", "version"));
    pom.getDependencies().add(getDependency("drools-core", "org.drools", null));
    pom.getDependencies().add(getDependency(null, null, null));
    HashMap<Dependency, Set<String>> map = setUpDependencyService(pom);
    map.put(getGAV("drools-core", "org.drools", "6.3.0"), toSet("org.drools.a", "org.drools.b", "org.drools.c"));
    Set<String> packageNames = packageNameSearchProvider.newTopLevelPackageNamesSearch(pom).search();
    assertEquals(3, packageNames.size());
    assertTrue(packageNames.contains("org.drools.a"));
    assertTrue(packageNames.contains("org.drools.b"));
    assertTrue(packageNames.contains("org.drools.c"));
}
Also used : Set(java.util.Set) HashSet(java.util.HashSet) Dependency(org.guvnor.common.services.project.model.Dependency) GAV(org.guvnor.common.services.project.model.GAV) POM(org.guvnor.common.services.project.model.POM) Test(org.junit.Test)

Aggregations

Dependency (org.guvnor.common.services.project.model.Dependency)32 GAV (org.guvnor.common.services.project.model.GAV)17 Test (org.junit.Test)16 HashSet (java.util.HashSet)10 NormalEnhancedDependency (org.kie.workbench.common.services.shared.dependencies.NormalEnhancedDependency)8 EnhancedDependency (org.kie.workbench.common.services.shared.dependencies.EnhancedDependency)6 EnhancedDependencies (org.kie.workbench.common.services.shared.dependencies.EnhancedDependencies)4 POM (org.guvnor.common.services.project.model.POM)3 Set (java.util.Set)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 ArrayList (java.util.ArrayList)1 Artifact (org.apache.maven.artifact.Artifact)1 MavenProject (org.apache.maven.project.MavenProject)1 Dependencies (org.guvnor.common.services.project.model.Dependencies)1 Before (org.junit.Before)1 Util.makeDependency (org.kie.workbench.common.screens.projecteditor.client.forms.dependencies.Util.makeDependency)1 DependencyValidator (org.kie.workbench.common.screens.projecteditor.client.forms.dependencies.validation.DependencyValidator)1 TransitiveEnhancedDependency (org.kie.workbench.common.services.shared.dependencies.TransitiveEnhancedDependency)1