Search in sources :

Example 6 with EnhancedDependencies

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

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

the class EnhancedDependenciesManagerResetTest method testReset.

@Test
public void testReset() throws Exception {
    final Callback callback = init(makePOM(makeDependency()));
    final EnhancedDependencies shownEnhancedDependencies = getEnhancedDependencies(callback);
    assertEquals(1, shownEnhancedDependencies.size());
    final Callback callback2 = init(makePOM());
    final EnhancedDependencies shownEnhancedDependencies2 = getEnhancedDependencies(callback2);
    assertEquals(0, shownEnhancedDependencies2.size());
}
Also used : EnhancedDependencies(org.kie.workbench.common.services.shared.dependencies.EnhancedDependencies) Callback(org.uberfire.client.callbacks.Callback) Test(org.junit.Test)

Example 8 with EnhancedDependencies

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

the class EnhancedDependenciesManager_onEchancedDependenciesLoadedTest method setUp.

@Before
public void setUp() throws Exception {
    shownDependencies = null;
    originalSetOfDependencies = new Dependencies();
    junit = makeDependency("org.junit", "junit", "1.0");
    originalSetOfDependencies.add(junit);
    originalSetOfDependencies.add(makeDependency("org.drools", "drools-core", "4.0"));
    final POM pom = new POM();
    pom.setDependencies(originalSetOfDependencies);
    enhancedDependenciesManager.init(pom, new Callback<EnhancedDependencies>() {

        @Override
        public void callback(final EnhancedDependencies result) {
            shownDependencies = result;
        }
    });
}
Also used : EnhancedDependencies(org.kie.workbench.common.services.shared.dependencies.EnhancedDependencies) Dependencies(org.guvnor.common.services.project.model.Dependencies) EnhancedDependencies(org.kie.workbench.common.services.shared.dependencies.EnhancedDependencies) POM(org.guvnor.common.services.project.model.POM) Before(org.junit.Before)

Example 9 with EnhancedDependencies

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

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

EnhancedDependencies (org.kie.workbench.common.services.shared.dependencies.EnhancedDependencies)11 Test (org.junit.Test)8 HashSet (java.util.HashSet)5 NormalEnhancedDependency (org.kie.workbench.common.services.shared.dependencies.NormalEnhancedDependency)5 Dependency (org.guvnor.common.services.project.model.Dependency)3 EnhancedDependency (org.kie.workbench.common.services.shared.dependencies.EnhancedDependency)2 Callback (org.uberfire.client.callbacks.Callback)2 Dependencies (org.guvnor.common.services.project.model.Dependencies)1 GAV (org.guvnor.common.services.project.model.GAV)1 POM (org.guvnor.common.services.project.model.POM)1 Before (org.junit.Before)1 Util.makeDependency (org.kie.workbench.common.screens.projecteditor.client.forms.dependencies.Util.makeDependency)1