Search in sources :

Example 21 with IServer

use of org.eclipse.wst.server.core.IServer in project liferay-ide by liferay.

the class PropertiesContentProvider method getPipelinedChildren.

@Override
@SuppressWarnings({ "rawtypes", "unchecked" })
public void getPipelinedChildren(Object parent, Set currentChildren) {
    if (shouldAddChildren(parent)) {
        final IServer server = (IServer) parent;
        PropertiesFile[] propertiesFiles = this.propertiesFilesMap.get(server.getId());
        if (ListUtil.isEmpty(propertiesFiles)) {
            final ILiferayRuntime runtime = ServerUtil.getLiferayRuntime(server);
            if (runtime != null) {
                File[] files = getExtPropertiesFiles(runtime);
                final List<PropertiesFile> newFiles = new ArrayList<PropertiesFile>();
                for (File file : files) {
                    newFiles.add(new PropertiesFile(file));
                }
                propertiesFiles = newFiles.toArray(new PropertiesFile[0]);
                this.propertiesFilesMap.put(server.getId(), propertiesFiles);
            }
        }
        if (ListUtil.isNotEmpty(propertiesFiles)) {
            for (PropertiesFile propertiesFile : propertiesFiles) {
                currentChildren.add(propertiesFile);
            }
        }
    }
}
Also used : IServer(org.eclipse.wst.server.core.IServer) ILiferayRuntime(com.liferay.ide.server.core.ILiferayRuntime) ArrayList(java.util.ArrayList) File(java.io.File)

Example 22 with IServer

use of org.eclipse.wst.server.core.IServer in project liferay-ide by liferay.

the class PropertiesContentProvider method hasChildren.

@Override
public boolean hasChildren(Object element) {
    boolean retVal = false;
    if (element instanceof IServer) {
        final IServer server = (IServer) element;
        ILiferayRuntime liferayRuntime = ServerUtil.getLiferayRuntime(server);
        if (liferayRuntime != null) {
            File[] files = getExtPropertiesFiles(liferayRuntime);
            return ListUtil.isNotEmpty(files);
        }
    }
    return retVal;
}
Also used : IServer(org.eclipse.wst.server.core.IServer) ILiferayRuntime(com.liferay.ide.server.core.ILiferayRuntime) File(java.io.File)

Example 23 with IServer

use of org.eclipse.wst.server.core.IServer 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 24 with IServer

use of org.eclipse.wst.server.core.IServer in project liferay-ide by liferay.

the class ServerCustomSettingTests method testDefaultValueOfUseDefaultPortalSetting.

@Test
public void testDefaultValueOfUseDefaultPortalSetting() throws Exception {
    if (shouldSkipBundleTests())
        return;
    final NullProgressMonitor npm = new NullProgressMonitor();
    if (runtime == null) {
        setupRuntime();
    }
    assertNotNull(runtime);
    final IServerWorkingCopy serverWC = createServerForRuntime("testdefault", runtime);
    IServer newServer = serverWC.save(true, npm);
    IServer findServer = ServerCore.findServer(newServer.getId());
    assertNotNull(findServer);
    ILiferayTomcatServer portalServer = (ILiferayTomcatServer) findServer.loadAdapter(ILiferayTomcatServer.class, null);
    final boolean useDefaultPortalServerSettings = ((LiferayTomcatServer) portalServer).getUseDefaultPortalServerSettings();
    assertEquals(false, useDefaultPortalServerSettings);
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) IServer(org.eclipse.wst.server.core.IServer) IServerWorkingCopy(org.eclipse.wst.server.core.IServerWorkingCopy) ILiferayTomcatServer(com.liferay.ide.server.tomcat.core.ILiferayTomcatServer) LiferayTomcatServer(com.liferay.ide.server.tomcat.core.LiferayTomcatServer) ILiferayTomcatServer(com.liferay.ide.server.tomcat.core.ILiferayTomcatServer) Test(org.junit.Test)

Example 25 with IServer

use of org.eclipse.wst.server.core.IServer in project liferay-ide by liferay.

the class ServerCustomSettingTests method testVMArgsWithCustomMemoryArgsAndUseDefaultSetting.

@Test
public void testVMArgsWithCustomMemoryArgsAndUseDefaultSetting() throws Exception {
    if (shouldSkipBundleTests())
        return;
    final NullProgressMonitor npm = new NullProgressMonitor();
    if (runtime == null) {
        setupRuntime();
    }
    assertNotNull(runtime);
    final IServerWorkingCopy serverWC = createServerForRuntime("testvmargs", runtime);
    LiferayTomcatServer wc = (LiferayTomcatServer) serverWC.loadAdapter(LiferayTomcatServer.class, npm);
    wc.setMemoryArgs("-Xmx2048m");
    wc.setUseDefaultPortalServerSettings(true);
    final IServer newServer = serverWC.save(true, npm);
    final LiferayTomcatServerBehavior behavior = (LiferayTomcatServerBehavior) newServer.loadAdapter(LiferayTomcatServerBehavior.class, npm);
    assertEquals("-Xmx1024m", behavior.getRuntimeVMArguments()[6]);
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) IServer(org.eclipse.wst.server.core.IServer) LiferayTomcatServerBehavior(com.liferay.ide.server.tomcat.core.LiferayTomcatServerBehavior) IServerWorkingCopy(org.eclipse.wst.server.core.IServerWorkingCopy) LiferayTomcatServer(com.liferay.ide.server.tomcat.core.LiferayTomcatServer) ILiferayTomcatServer(com.liferay.ide.server.tomcat.core.ILiferayTomcatServer) Test(org.junit.Test)

Aggregations

IServer (org.eclipse.wst.server.core.IServer)183 CoreException (org.eclipse.core.runtime.CoreException)39 IModule (org.eclipse.wst.server.core.IModule)32 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)30 Test (org.junit.Test)30 IProject (org.eclipse.core.resources.IProject)25 IStatus (org.eclipse.core.runtime.IStatus)25 IServerWorkingCopy (org.eclipse.wst.server.core.IServerWorkingCopy)23 ArrayList (java.util.ArrayList)20 File (java.io.File)17 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)13 Status (org.eclipse.core.runtime.Status)12 Iterator (java.util.Iterator)11 IPath (org.eclipse.core.runtime.IPath)11 IServerType (org.eclipse.wst.server.core.IServerType)11 CDKServer (org.jboss.tools.openshift.cdk.server.core.internal.adapter.CDKServer)11 IOException (java.io.IOException)10 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)10 Server (org.eclipse.wst.server.core.internal.Server)10 IFolder (org.eclipse.core.resources.IFolder)8