Search in sources :

Example 6 with NormalEnhancedDependency

use of org.kie.workbench.common.services.shared.dependencies.NormalEnhancedDependency in project kie-wb-common by kiegroup.

the class DependenciesItemPresenterTest method testAddAllPackagesToWhiteList.

@Test
public void testAddAllPackagesToWhiteList() {
    final DependenciesPresenter parentPresenter = mock(DependenciesPresenter.class);
    final Set<String> packages = new HashSet<>(Arrays.asList("foo", "bar"));
    final EnhancedDependency enhancedDependency = new NormalEnhancedDependency(mock(Dependency.class), packages);
    dependenciesItemPresenter.parentPresenter = parentPresenter;
    dependenciesItemPresenter.enhancedDependency = enhancedDependency;
    dependenciesItemPresenter.addAllPackagesToWhiteList();
    verify(parentPresenter).addAllToWhiteList(eq(packages));
}
Also used : NormalEnhancedDependency(org.kie.workbench.common.services.shared.dependencies.NormalEnhancedDependency) EnhancedDependency(org.kie.workbench.common.services.shared.dependencies.EnhancedDependency) TransitiveEnhancedDependency(org.kie.workbench.common.services.shared.dependencies.TransitiveEnhancedDependency) NormalEnhancedDependency(org.kie.workbench.common.services.shared.dependencies.NormalEnhancedDependency) Dependency(org.guvnor.common.services.project.model.Dependency) EnhancedDependency(org.kie.workbench.common.services.shared.dependencies.EnhancedDependency) TransitiveEnhancedDependency(org.kie.workbench.common.services.shared.dependencies.TransitiveEnhancedDependency) NormalEnhancedDependency(org.kie.workbench.common.services.shared.dependencies.NormalEnhancedDependency) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 7 with NormalEnhancedDependency

use of org.kie.workbench.common.services.shared.dependencies.NormalEnhancedDependency in project kie-wb-common by kiegroup.

the class EnhancedDependenciesManager method updateWithOriginalDependency.

private void updateWithOriginalDependency(final NormalEnhancedDependency enhancedDependency) {
    final Dependency originalDependency = originalSetOfDependencies.get(enhancedDependency.getDependency());
    enhancedDependency.setDependency(originalDependency);
}
Also used : NormalEnhancedDependency(org.kie.workbench.common.services.shared.dependencies.NormalEnhancedDependency) Dependency(org.guvnor.common.services.project.model.Dependency) EnhancedDependency(org.kie.workbench.common.services.shared.dependencies.EnhancedDependency)

Example 8 with NormalEnhancedDependency

use of org.kie.workbench.common.services.shared.dependencies.NormalEnhancedDependency in project kie-wb-common by kiegroup.

the class EnhancedDependenciesManagerResetTest method init.

private Callback init(final POM pom) {
    final Callback callback = mock(Callback.class);
    manager.init(pom, callback);
    final EnhancedDependencies enhancedDependencies = new EnhancedDependencies();
    for (Dependency dependency : pom.getDependencies()) {
        enhancedDependencies.add(new NormalEnhancedDependency(dependency, new HashSet<String>()));
    }
    manager.onEnhancedDependenciesUpdated(enhancedDependencies);
    return callback;
}
Also used : EnhancedDependencies(org.kie.workbench.common.services.shared.dependencies.EnhancedDependencies) Callback(org.uberfire.client.callbacks.Callback) NormalEnhancedDependency(org.kie.workbench.common.services.shared.dependencies.NormalEnhancedDependency) Dependency(org.guvnor.common.services.project.model.Dependency) NormalEnhancedDependency(org.kie.workbench.common.services.shared.dependencies.NormalEnhancedDependency) HashSet(java.util.HashSet)

Example 9 with NormalEnhancedDependency

use of org.kie.workbench.common.services.shared.dependencies.NormalEnhancedDependency in project kie-wb-common by kiegroup.

the class EnhancedDependenciesManager_onEchancedDependenciesLoadedTest method testAdd.

@Test
public void testAdd() throws Exception {
    final Dependency dependency = makeDependency("artifactId", "groupId", "1.0");
    enhancedDependenciesManager.addNew(dependency);
    final EnhancedDependencies loadedEnhancedDependencies = new EnhancedDependencies();
    loadedEnhancedDependencies.add(new NormalEnhancedDependency(dependency, new HashSet<String>()));
    enhancedDependenciesManager.onEnhancedDependenciesUpdated(loadedEnhancedDependencies);
    assertEquals(3, originalSetOfDependencies.size());
    assertTrue(originalSetOfDependencies.contains(dependency));
    assertEquals(1, shownDependencies.size());
    assertTrue(shownDependencies.asList().get(0).getDependency().isGAVEqual(dependency));
}
Also used : EnhancedDependencies(org.kie.workbench.common.services.shared.dependencies.EnhancedDependencies) NormalEnhancedDependency(org.kie.workbench.common.services.shared.dependencies.NormalEnhancedDependency) Dependency(org.guvnor.common.services.project.model.Dependency) EnhancedDependency(org.kie.workbench.common.services.shared.dependencies.EnhancedDependency) Util.makeDependency(org.kie.workbench.common.screens.projecteditor.client.forms.dependencies.Util.makeDependency) NormalEnhancedDependency(org.kie.workbench.common.services.shared.dependencies.NormalEnhancedDependency) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 10 with NormalEnhancedDependency

use of org.kie.workbench.common.services.shared.dependencies.NormalEnhancedDependency in project kie-wb-common by kiegroup.

the class EnhancedDependenciesManager_onEchancedDependenciesLoadedTest method testDelete.

@Test
public void testDelete() throws Exception {
    enhancedDependenciesManager.delete(new NormalEnhancedDependency(makeDependency("org.junit", "junit", "1.0"), new HashSet<String>()));
    verify(dependencyLoader).load();
    // Queue is empty so loader returns with nothing.
    enhancedDependenciesManager.onEnhancedDependenciesUpdated(new EnhancedDependencies());
    assertTrue(shownDependencies.isEmpty());
    assertFalse(originalSetOfDependencies.contains(junit));
}
Also used : EnhancedDependencies(org.kie.workbench.common.services.shared.dependencies.EnhancedDependencies) NormalEnhancedDependency(org.kie.workbench.common.services.shared.dependencies.NormalEnhancedDependency) HashSet(java.util.HashSet) Test(org.junit.Test)

Aggregations

NormalEnhancedDependency (org.kie.workbench.common.services.shared.dependencies.NormalEnhancedDependency)11 HashSet (java.util.HashSet)8 Test (org.junit.Test)8 Dependency (org.guvnor.common.services.project.model.Dependency)7 EnhancedDependency (org.kie.workbench.common.services.shared.dependencies.EnhancedDependency)6 EnhancedDependencies (org.kie.workbench.common.services.shared.dependencies.EnhancedDependencies)5 TransitiveEnhancedDependency (org.kie.workbench.common.services.shared.dependencies.TransitiveEnhancedDependency)3 Util.makeDependency (org.kie.workbench.common.screens.projecteditor.client.forms.dependencies.Util.makeDependency)1 WhiteList (org.kie.workbench.common.services.shared.whitelist.WhiteList)1 Callback (org.uberfire.client.callbacks.Callback)1