use of org.eclipse.jdt.launching.sourcelookup.containers.PackageFragmentRootSourceContainer in project liferay-ide by liferay.
the class PortalSourceLookupTests method testPortalSourcePathComputerDelegateDefaults.
@Test
public void testPortalSourcePathComputerDelegateDefaults() throws Exception {
IServer portalServer = createPortalServer();
addProjectToServer(CoreUtil.getLiferayProject("debug-lib"), portalServer);
addProjectToServer(CoreUtil.getLiferayProject("debug-test"), portalServer);
ILaunchConfiguration launchConfig = portalServer.getLaunchConfiguration(true, _NPM);
ISourcePathComputer sourcePathComputer = getPortalSourcePathComputer(launchConfig);
Assert.assertNotNull(sourcePathComputer);
ISourceContainer[] sourceContainers = sourcePathComputer.computeSourceContainers(launchConfig, new NullProgressMonitor());
Assert.assertNotNull(sourceContainers);
Assert.assertEquals(2, Stream.of(sourceContainers).filter(sourceContainer -> sourceContainer instanceof JavaProjectSourceContainer).count());
Assert.assertTrue(Stream.of(sourceContainers).filter(sourceContainer -> sourceContainer instanceof PackageFragmentRootSourceContainer).map(sourceContainer -> ((PackageFragmentRootSourceContainer) sourceContainer).getPath()).anyMatch(path -> path.lastSegment().endsWith("commons-io-2.5.jar")));
}
use of org.eclipse.jdt.launching.sourcelookup.containers.PackageFragmentRootSourceContainer in project liferay-ide by liferay.
the class PortalSourceLookupTests method testPortalSourceContainersChangeWhenModulesChange.
@Test
public void testPortalSourceContainersChangeWhenModulesChange() throws Exception {
IServer portalServer = createPortalServer();
IProject debugLibProject = CoreUtil.getProject("debug-lib");
addProjectToServer(debugLibProject, portalServer);
ILaunchConfiguration launchConfiguration = portalServer.getLaunchConfiguration(true, _NPM);
ISourcePathComputer portalSourcePathComputer = getPortalSourcePathComputer(launchConfiguration);
ISourceContainer[] sourceContainers = portalSourcePathComputer.computeSourceContainers(launchConfiguration, _NPM);
Assert.assertNotNull(sourceContainers);
Assert.assertEquals(1, Stream.of(sourceContainers).filter(sourceContainer -> sourceContainer instanceof JavaProjectSourceContainer).count());
Assert.assertFalse(Stream.of(sourceContainers).filter(sourceContainer -> sourceContainer instanceof PackageFragmentRootSourceContainer).map(sourceContainer -> ((PackageFragmentRootSourceContainer) sourceContainer).getPath()).anyMatch(path -> path.lastSegment().endsWith("commons-io-2.5.jar")));
IProject debugTestProject = CoreUtil.getProject("debug-test");
portalServer = addProjectToServer(debugTestProject, portalServer);
ISourceContainer[] updatedSourceContainers = portalSourcePathComputer.computeSourceContainers(launchConfiguration, _NPM);
Assert.assertNotNull(updatedSourceContainers);
Assert.assertEquals(2, Stream.of(updatedSourceContainers).filter(sourceContainer -> sourceContainer instanceof JavaProjectSourceContainer).count());
Assert.assertTrue(Stream.of(updatedSourceContainers).filter(sourceContainer -> sourceContainer instanceof PackageFragmentRootSourceContainer).map(sourceContainer -> ((PackageFragmentRootSourceContainer) sourceContainer).getPath()).anyMatch(path -> path.lastSegment().endsWith("commons-io-2.5.jar")));
}
Aggregations