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;
}
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());
}
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;
}
});
}
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));
}
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));
}
Aggregations