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