Search in sources :

Example 1 with NormalEnhancedDependency

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

the class DependenciesItemPresenterTest method testSetupNormal.

@Test
public void testSetupNormal() {
    dependenciesItemPresenter.setup(new NormalEnhancedDependency(mock(Dependency.class), emptySet()), new WhiteList(), mock(DependenciesPresenter.class));
    verify(view).init(any());
    verify(view).setGroupId(any());
    verify(view).setArtifactId(any());
    verify(view).setVersion(any());
    verify(view).setPackagesWhiteListedState(any());
    verify(view).setTransitiveDependency(eq(false));
}
Also used : WhiteList(org.kie.workbench.common.services.shared.whitelist.WhiteList) NormalEnhancedDependency(org.kie.workbench.common.services.shared.dependencies.NormalEnhancedDependency) Test(org.junit.Test)

Example 2 with NormalEnhancedDependency

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

the class DependenciesItemPresenterTest method testRemove.

@Test
public void testRemove() {
    final DependenciesPresenter parentPresenter = mock(DependenciesPresenter.class);
    final EnhancedDependency enhancedDependency = new NormalEnhancedDependency(mock(Dependency.class), emptySet());
    dependenciesItemPresenter.parentPresenter = parentPresenter;
    dependenciesItemPresenter.enhancedDependency = enhancedDependency;
    dependenciesItemPresenter.remove();
    verify(parentPresenter).remove(eq(enhancedDependency));
}
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) Test(org.junit.Test)

Example 3 with NormalEnhancedDependency

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

the class DependenciesItemPresenterTest method testRemoveAllPackagesToWhiteList.

@Test
public void testRemoveAllPackagesToWhiteList() {
    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.removeAllPackagesFromWhiteList();
    verify(parentPresenter).removeAllFromWhiteList(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 4 with NormalEnhancedDependency

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

the class DependencyLoader method returnDefault.

private void returnDefault() {
    final EnhancedDependencies enhancedDependencies = new EnhancedDependencies();
    for (final Dependency dependency : updateQueue) {
        enhancedDependencies.add(new NormalEnhancedDependency(dependency, new HashSet<>()));
    }
    updateQueue.clear();
    manager.onEnhancedDependenciesUpdated(enhancedDependencies);
}
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) NormalEnhancedDependency(org.kie.workbench.common.services.shared.dependencies.NormalEnhancedDependency) HashSet(java.util.HashSet)

Example 5 with NormalEnhancedDependency

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

the class EnhancedDependenciesManagerTest method testDelete.

@Test
public void testDelete() throws Exception {
    enhancedDependenciesManager.addNew(makeDependency("artifactId", "groupId", "1.0"));
    enhancedDependenciesManager.delete(new NormalEnhancedDependency(makeDependency("artifactId", "groupId", "1.0"), new HashSet<String>()));
    assertTrue(originalSetOfDependencies.isEmpty());
}
Also used : 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