Search in sources :

Example 1 with ISourcePathComputer

use of org.eclipse.debug.core.sourcelookup.ISourcePathComputer 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")));
}
Also used : DebugPlugin(org.eclipse.debug.core.DebugPlugin) IServerType(org.eclipse.wst.server.core.IServerType) CoreUtil(com.liferay.ide.core.util.CoreUtil) CoreException(org.eclipse.core.runtime.CoreException) ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) TestUtil(com.liferay.ide.core.tests.TestUtil) JavaProjectSourceContainer(org.eclipse.jdt.launching.sourcelookup.containers.JavaProjectSourceContainer) PortalServer(com.liferay.ide.server.core.portal.PortalServer) IProject(org.eclipse.core.resources.IProject) IModule(org.eclipse.wst.server.core.IModule) Before(org.junit.Before) ProgressMonitorBridge(org.eclipse.sapphire.platform.ProgressMonitorBridge) IServer(org.eclipse.wst.server.core.IServer) BundleFactoryDelegate(com.liferay.ide.project.core.BundleFactoryDelegate) ImportLiferayModuleProjectOp(com.liferay.ide.project.core.modules.ImportLiferayModuleProjectOp) Test(org.junit.Test) File(java.io.File) ILaunchManager(org.eclipse.debug.core.ILaunchManager) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) ISourcePathComputer(org.eclipse.debug.core.sourcelookup.ISourcePathComputer) Stream(java.util.stream.Stream) Rule(org.junit.Rule) ServerCore(org.eclipse.wst.server.core.ServerCore) NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) ISourceContainer(org.eclipse.debug.core.sourcelookup.ISourceContainer) Assert(org.junit.Assert) PackageFragmentRootSourceContainer(org.eclipse.jdt.launching.sourcelookup.containers.PackageFragmentRootSourceContainer) TemporaryFolder(org.junit.rules.TemporaryFolder) IServerWorkingCopy(org.eclipse.wst.server.core.IServerWorkingCopy) NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) IServer(org.eclipse.wst.server.core.IServer) ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) ISourcePathComputer(org.eclipse.debug.core.sourcelookup.ISourcePathComputer) PackageFragmentRootSourceContainer(org.eclipse.jdt.launching.sourcelookup.containers.PackageFragmentRootSourceContainer) ISourceContainer(org.eclipse.debug.core.sourcelookup.ISourceContainer) JavaProjectSourceContainer(org.eclipse.jdt.launching.sourcelookup.containers.JavaProjectSourceContainer) Test(org.junit.Test)

Example 2 with ISourcePathComputer

use of org.eclipse.debug.core.sourcelookup.ISourcePathComputer 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")));
}
Also used : DebugPlugin(org.eclipse.debug.core.DebugPlugin) IServerType(org.eclipse.wst.server.core.IServerType) CoreUtil(com.liferay.ide.core.util.CoreUtil) CoreException(org.eclipse.core.runtime.CoreException) ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) TestUtil(com.liferay.ide.core.tests.TestUtil) JavaProjectSourceContainer(org.eclipse.jdt.launching.sourcelookup.containers.JavaProjectSourceContainer) PortalServer(com.liferay.ide.server.core.portal.PortalServer) IProject(org.eclipse.core.resources.IProject) IModule(org.eclipse.wst.server.core.IModule) Before(org.junit.Before) ProgressMonitorBridge(org.eclipse.sapphire.platform.ProgressMonitorBridge) IServer(org.eclipse.wst.server.core.IServer) BundleFactoryDelegate(com.liferay.ide.project.core.BundleFactoryDelegate) ImportLiferayModuleProjectOp(com.liferay.ide.project.core.modules.ImportLiferayModuleProjectOp) Test(org.junit.Test) File(java.io.File) ILaunchManager(org.eclipse.debug.core.ILaunchManager) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) ISourcePathComputer(org.eclipse.debug.core.sourcelookup.ISourcePathComputer) Stream(java.util.stream.Stream) Rule(org.junit.Rule) ServerCore(org.eclipse.wst.server.core.ServerCore) NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) ISourceContainer(org.eclipse.debug.core.sourcelookup.ISourceContainer) Assert(org.junit.Assert) PackageFragmentRootSourceContainer(org.eclipse.jdt.launching.sourcelookup.containers.PackageFragmentRootSourceContainer) TemporaryFolder(org.junit.rules.TemporaryFolder) IServerWorkingCopy(org.eclipse.wst.server.core.IServerWorkingCopy) IServer(org.eclipse.wst.server.core.IServer) ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) ISourcePathComputer(org.eclipse.debug.core.sourcelookup.ISourcePathComputer) PackageFragmentRootSourceContainer(org.eclipse.jdt.launching.sourcelookup.containers.PackageFragmentRootSourceContainer) ISourceContainer(org.eclipse.debug.core.sourcelookup.ISourceContainer) JavaProjectSourceContainer(org.eclipse.jdt.launching.sourcelookup.containers.JavaProjectSourceContainer) IProject(org.eclipse.core.resources.IProject) Test(org.junit.Test)

Aggregations

TestUtil (com.liferay.ide.core.tests.TestUtil)2 CoreUtil (com.liferay.ide.core.util.CoreUtil)2 BundleFactoryDelegate (com.liferay.ide.project.core.BundleFactoryDelegate)2 ImportLiferayModuleProjectOp (com.liferay.ide.project.core.modules.ImportLiferayModuleProjectOp)2 PortalServer (com.liferay.ide.server.core.portal.PortalServer)2 File (java.io.File)2 Stream (java.util.stream.Stream)2 IProject (org.eclipse.core.resources.IProject)2 CoreException (org.eclipse.core.runtime.CoreException)2 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)2 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)2 DebugPlugin (org.eclipse.debug.core.DebugPlugin)2 ILaunchConfiguration (org.eclipse.debug.core.ILaunchConfiguration)2 ILaunchManager (org.eclipse.debug.core.ILaunchManager)2 ISourceContainer (org.eclipse.debug.core.sourcelookup.ISourceContainer)2 ISourcePathComputer (org.eclipse.debug.core.sourcelookup.ISourcePathComputer)2 JavaProjectSourceContainer (org.eclipse.jdt.launching.sourcelookup.containers.JavaProjectSourceContainer)2 PackageFragmentRootSourceContainer (org.eclipse.jdt.launching.sourcelookup.containers.PackageFragmentRootSourceContainer)2 ProgressMonitorBridge (org.eclipse.sapphire.platform.ProgressMonitorBridge)2 IModule (org.eclipse.wst.server.core.IModule)2