Search in sources :

Example 66 with IServer

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

the class OpenShiftSubsystemTest method testSubsystemsNull.

@Test
public void testSubsystemsNull() throws Exception {
    IServer s1 = OpenShiftServerTestUtils.createOpenshift3Server("example", null);
    testOpenshift3Standard(s1);
}
Also used : IServer(org.eclipse.wst.server.core.IServer) Test(org.junit.Test)

Example 67 with IServer

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

the class OpenShiftServerTestUtils method mockServer.

public static IServer mockServer(IServerWorkingCopy workingCopy, IResource resource, Connection connection) throws UnsupportedEncodingException, MalformedURLException {
    IServer server = mock(IServer.class);
    if (connection != null) {
        String connectionUrl = ConnectionURL.forConnection(connection).toString();
        doReturn(connectionUrl).when(server).getAttribute(eq(OpenShiftServerUtils.ATTR_CONNECTIONURL), anyString());
    }
    String resourceUniqueId = OpenShiftResourceUniqueId.get(resource);
    doReturn(resourceUniqueId).when(server).getAttribute(eq(OpenShiftServerUtils.ATTR_SERVICE), anyString());
    doReturn(workingCopy).when(server).createWorkingCopy();
    return server;
}
Also used : IServer(org.eclipse.wst.server.core.IServer) Matchers.anyString(org.mockito.Matchers.anyString)

Example 68 with IServer

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

the class DebugLaunchConfigsTest method getRemoteDebuggerLaunchConfiguration.

@Test
public void getRemoteDebuggerLaunchConfiguration() throws CoreException {
    String name = "Remote debugger to foo";
    ILaunchConfiguration good = mock(ILaunchConfiguration.class);
    when(good.getName()).thenReturn(name);
    ILaunchConfiguration bad = mock(ILaunchConfiguration.class);
    when(launchManager.getLaunchConfigurations(any())).thenReturn(new ILaunchConfiguration[] { bad, good });
    IServer server = mockServer("foo");
    assertSame(good, debugLaunchConfigs.getRemoteDebuggerLaunchConfiguration(server));
    server = mockServer("bar");
    assertNull(debugLaunchConfigs.getRemoteDebuggerLaunchConfiguration(server));
}
Also used : ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) IServer(org.eclipse.wst.server.core.IServer) Test(org.junit.Test)

Example 69 with IServer

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

the class DebugLaunchConfigsTest method mockServer.

private IServer mockServer(String name) {
    IServer server = mock(IServer.class);
    when(server.getName()).thenReturn(name);
    return server;
}
Also used : IServer(org.eclipse.wst.server.core.IServer)

Example 70 with IServer

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

the class ResourceChangePublisher method getPublishRequiredServers.

private OpenShiftServer[] getPublishRequiredServers(IResourceDelta delta) {
    // The list of servers that will require publish
    final List<OpenShiftServer> servers2 = new ArrayList<>();
    // wrksServers = Workspaces Servers
    final IServer[] wrksServers = ServerCore.getServers();
    for (int i = 0; i < wrksServers.length; i++) {
        OpenShiftServer os = (OpenShiftServer) wrksServers[i].loadAdapter(OpenShiftServer.class, new NullProgressMonitor());
        if (os != null) {
            IProject magic = OpenShiftServerUtils.getDeployProject(wrksServers[i]);
            if (magic != null) {
                // Safe because we've already eliminated non-project deltas
                IProject p = (IProject) delta.getResource();
                if (magic.equals(p)) {
                    servers2.add(os);
                }
            }
        }
    }
    return servers2.toArray(new OpenShiftServer[servers2.size()]);
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) IServer(org.eclipse.wst.server.core.IServer) OpenShiftServer(org.jboss.tools.openshift.core.server.OpenShiftServer) ArrayList(java.util.ArrayList) IProject(org.eclipse.core.resources.IProject)

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