Search in sources :

Example 21 with Dependency

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

the class DependenciesPresenter method setup.

@Override
public Promise<Void> setup(final ProjectScreenModel model) {
    this.model = model;
    view.init(this);
    dependencySelectorPopup.addSelectionHandler(gav -> {
        final Dependency dependency = new Dependency(gav);
        dependency.setScope("compile");
        add(dependency);
    });
    return promises.create((resolve, reject) -> {
        enhancedDependenciesManager.init(model.getPOM(), dependencies -> {
            updateHashCode(dependencies);
            view.setItems(buildDependencyViews(model, dependencies));
            resolve.onInvoke(promises.resolve());
            fireChangeEvent();
        });
        enhancedDependenciesManager.update();
    });
}
Also used : Dependency(org.guvnor.common.services.project.model.Dependency) EnhancedDependency(org.kie.workbench.common.services.shared.dependencies.EnhancedDependency)

Example 22 with Dependency

use of org.guvnor.common.services.project.model.Dependency 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 23 with Dependency

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

the class NewDependencyPopup method show.

public void show(final Callback<Dependency> callback) {
    this.callback = callback;
    dependency = new Dependency();
    validator = new DependencyValidator(dependency);
    view.clean();
    view.show();
}
Also used : DependencyValidator(org.kie.workbench.common.screens.projecteditor.client.forms.dependencies.validation.DependencyValidator) Dependency(org.guvnor.common.services.project.model.Dependency)

Example 24 with Dependency

use of org.guvnor.common.services.project.model.Dependency 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 25 with Dependency

use of org.guvnor.common.services.project.model.Dependency 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)

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