Search in sources :

Example 1 with IServerAttributes

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

the class ServerPropertyTester method test.

public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
    if (receiver instanceof IServerAttributes) {
        IServerAttributes server = (IServerAttributes) receiver;
        IServerType serverType = server.getServerType();
        if (serverType != null) {
            String id = serverType.getId();
            if (// $NON-NLS-1$
            "com.liferay.ide.eclipse.server.remote".equals(id)) {
                return true;
            }
        }
    }
    return false;
}
Also used : IServerAttributes(org.eclipse.wst.server.core.IServerAttributes) IServerType(org.eclipse.wst.server.core.IServerType)

Example 2 with IServerAttributes

use of org.eclipse.wst.server.core.IServerAttributes in project jbosstools-openshift by jbosstools.

the class OpenShiftServerUtilsTest method testGetSourceFromServer.

@Test
public void testGetSourceFromServer() {
    // Only tests resolution from server
    IServerAttributes server = mock(IServerAttributes.class);
    when(server.getAttribute(OpenShiftServerUtils.ATTR_SOURCE_PATH, (String) null)).thenReturn("test1");
    assertEquals("test1", OpenShiftServerUtils.getSourcePath(server));
}
Also used : IServerAttributes(org.eclipse.wst.server.core.IServerAttributes) Test(org.junit.Test)

Example 3 with IServerAttributes

use of org.eclipse.wst.server.core.IServerAttributes in project jbosstools-openshift by jbosstools.

the class OpenShiftServerUtilsTest method testGetPodPathFromServer.

@Test
public void testGetPodPathFromServer() {
    // Only tests resolution from server
    IServerAttributes server = mock(IServerAttributes.class);
    when(server.getAttribute(OpenShiftServerUtils.ATTR_POD_PATH, (String) null)).thenReturn("test1");
    assertEquals("test1", OpenShiftServerUtils.getPodPath(server));
}
Also used : IServerAttributes(org.eclipse.wst.server.core.IServerAttributes) Test(org.junit.Test)

Example 4 with IServerAttributes

use of org.eclipse.wst.server.core.IServerAttributes in project jbosstools-openshift by jbosstools.

the class OpenShiftServerUtilsTest method testGetRouteURLFromServer.

@Test
public void testGetRouteURLFromServer() {
    // Only tests resolution from server
    IServerAttributes server = mock(IServerAttributes.class);
    when(server.getAttribute(OpenShiftServerUtils.ATTR_ROUTE, (String) null)).thenReturn("test1");
    assertEquals("test1", OpenShiftServerUtils.getRouteURL(server));
}
Also used : IServerAttributes(org.eclipse.wst.server.core.IServerAttributes) Test(org.junit.Test)

Example 5 with IServerAttributes

use of org.eclipse.wst.server.core.IServerAttributes in project webtools.servertools by eclipse.

the class ConfigurationPropertyTester method test.

/* (non-Javadoc)
	 * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object)
	 */
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
    try {
        IServerAttributes server = (IServerAttributes) receiver;
        TomcatServer tomcatServer = (TomcatServer) server.loadAdapter(ITomcatServer.class, null);
        if (tomcatServer != null)
            return tomcatServer.getServerConfiguration() != null;
    } catch (Exception e) {
    // ignore
    }
    return false;
}
Also used : IServerAttributes(org.eclipse.wst.server.core.IServerAttributes) ITomcatServer(org.eclipse.jst.server.tomcat.core.internal.ITomcatServer) TomcatServer(org.eclipse.jst.server.tomcat.core.internal.TomcatServer) ITomcatServer(org.eclipse.jst.server.tomcat.core.internal.ITomcatServer)

Aggregations

IServerAttributes (org.eclipse.wst.server.core.IServerAttributes)7 Test (org.junit.Test)3 GridData (org.eclipse.swt.layout.GridData)2 GridLayout (org.eclipse.swt.layout.GridLayout)2 Composite (org.eclipse.swt.widgets.Composite)2 ServerComposite (org.eclipse.wst.server.ui.internal.viewers.ServerComposite)2 IRunnableWithProgress (org.eclipse.jface.operation.IRunnableWithProgress)1 ITomcatServer (org.eclipse.jst.server.tomcat.core.internal.ITomcatServer)1 TomcatServer (org.eclipse.jst.server.tomcat.core.internal.TomcatServer)1 IModuleType (org.eclipse.wst.server.core.IModuleType)1 IRuntime (org.eclipse.wst.server.core.IRuntime)1 IServerType (org.eclipse.wst.server.core.IServerType)1