Search in sources :

Example 1 with EnhancedDependency

use of org.kie.workbench.common.services.shared.dependencies.EnhancedDependency 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 2 with EnhancedDependency

use of org.kie.workbench.common.services.shared.dependencies.EnhancedDependency 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 3 with EnhancedDependency

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

the class DependenciesItemPresenter method setup.

public DependenciesItemPresenter setup(final EnhancedDependency enhancedDependency, final WhiteList whiteList, final DependenciesPresenter dependenciesPresenter) {
    this.enhancedDependency = enhancedDependency;
    this.parentPresenter = dependenciesPresenter;
    final Dependency dependency = enhancedDependency.getDependency();
    view.init(this);
    view.setGroupId(dependency.getGroupId());
    view.setArtifactId(dependency.getArtifactId());
    view.setVersion(dependency.getVersion());
    view.setPackagesWhiteListedState(WhiteListedPackagesState.from(whiteList, enhancedDependency.getPackages()));
    view.setTransitiveDependency(enhancedDependency instanceof TransitiveEnhancedDependency);
    return this;
}
Also used : TransitiveEnhancedDependency(org.kie.workbench.common.services.shared.dependencies.TransitiveEnhancedDependency) 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)

Example 4 with EnhancedDependency

use of org.kie.workbench.common.services.shared.dependencies.EnhancedDependency 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 5 with EnhancedDependency

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

the class DependenciesPresenterTest method testRemove.

@Test
public void testRemove() {
    final EnhancedDependency enhancedDependency = mock(EnhancedDependency.class);
    dependenciesPresenter.remove(enhancedDependency);
    verify(enhancedDependenciesManager).delete(eq(enhancedDependency));
}
Also used : EnhancedDependency(org.kie.workbench.common.services.shared.dependencies.EnhancedDependency) Test(org.junit.Test)

Aggregations

EnhancedDependency (org.kie.workbench.common.services.shared.dependencies.EnhancedDependency)8 NormalEnhancedDependency (org.kie.workbench.common.services.shared.dependencies.NormalEnhancedDependency)6 Dependency (org.guvnor.common.services.project.model.Dependency)5 Test (org.junit.Test)5 TransitiveEnhancedDependency (org.kie.workbench.common.services.shared.dependencies.TransitiveEnhancedDependency)4 HashSet (java.util.HashSet)3 EnhancedDependencies (org.kie.workbench.common.services.shared.dependencies.EnhancedDependencies)1