/*******************************************************************************
* Copyright (c) 2014, 2014 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Bruno Medeiros - initial API and implementation
*******************************************************************************/
package mmrnmhrm.core.dub_model;
import static melnorme.utilbox.core.Assert.AssertNamespace.assertTrue;
import mmrnmhrm.core.workspace.viewmodel.DubDependencyElement;
import org.eclipse.core.resources.IProject;
import org.junit.Test;
import dtool.dub.CommonDubTest;
import dtool.dub.DubBundle;
import dtool.dub.DubBundleDescription;
import melnorme.lang.ide.core.project_model.view.DependenciesContainer;
import melnorme.lang.tooling.bundle.DependencyRef;
public class DeeBundleModelTest extends AbstractDeeModelManagerTest {
public static final String DUB_TEST = "DubTest";
public static final String DUB_LIB = "DubLib";
@Test
public void testBasic() throws Exception { testBasic$(); }
public void testBasic$() throws Exception {
IProject libProject = createAndOpenDeeProject(DUB_LIB, true);
libProject.getFolder("src").create(true, true, null);
IProject project = createAndOpenDeeProject(DUB_TEST, true);
project.getFolder("source").create(true, true, null);
DubBundle mainBundle = new DubBundle(bpath(project), "dub_test", null,
"~master", array("source"), CommonDubTest.paths("source"),
null,
array(new DependencyRef("dub_lib", null)),
null, null, null);
DubBundle[] bundleDeps = array(new DubBundle(bpath(libProject), "dub_lib", null,
"~master", array("src"), CommonDubTest.paths("src"),
null,
null,
null, null, null));
DubBundleDescription bundleDesc = new DubBundleDescription(mainBundle, bundleDeps);
getBundleModelManager().updateProjectInfo(project, getBundleModelManager().getProjectInfo(project), bundleDesc);
DependenciesContainer dubContainer = getDubContainer(project);
assertTrue(dubContainer.getChildren().length == 1);
DubDependencyElement libDepElement =
assertCast(dubContainer.getChildren()[0], DubDependencyElement.class);
assertTrue(libDepElement.getChildren().length == 1);
}
}