Examples of CaldecottTunnelDescriptor


Examples of org.cloudfoundry.ide.eclipse.server.core.internal.tunnel.CaldecottTunnelDescriptor

    assertStopModule(appModule);

    bindServiceToApp(nonCaldecottApp, service);

    CaldecottTunnelDescriptor descriptor = createCaldecottTunnel(MYSQL_SERVICE_NAME);
    assertNotNull(descriptor);
    assertTunnel(MYSQL_SERVICE_NAME);

    assertStartModule(appModule);
    assertServiceBound(service.getName(), nonCaldecottApp);
View Full Code Here

Examples of org.cloudfoundry.ide.eclipse.server.core.internal.tunnel.CaldecottTunnelDescriptor

  public void testTunnelCloseOnCaldecottDeletion() throws Exception {

    CloudService service = getMysqlService();
    assertServiceExists(MYSQL_SERVICE_NAME);

    CaldecottTunnelDescriptor descriptor = createCaldecottTunnel(MYSQL_SERVICE_NAME);
    assertNotNull(descriptor);
    assertTunnel(MYSQL_SERVICE_NAME);

    CloudApplication caldecottApp = getCaldecottApplication();
    assertNotNull(caldecottApp);
View Full Code Here

Examples of org.cloudfoundry.ide.eclipse.server.core.internal.tunnel.CaldecottTunnelDescriptor

  public void testTunnelCloseOnCaldecottServiceUnbinding() throws Exception {
    CloudService service = getMysqlService();
    assertServiceExists(MYSQL_SERVICE_NAME);

    CaldecottTunnelDescriptor descriptor = createCaldecottTunnel(MYSQL_SERVICE_NAME);
    assertNotNull(descriptor);
    assertTunnel(MYSQL_SERVICE_NAME);

    CloudApplication caldecottApp = getCaldecottApplication();
    assertNotNull(caldecottApp);
View Full Code Here

Examples of org.cloudfoundry.ide.eclipse.server.core.internal.tunnel.CaldecottTunnelDescriptor

   */
  public void testCaldecottApplicationIsRemoved() throws Exception {
    CloudService service = getMysqlService();
    assertServiceExists(MYSQL_SERVICE_NAME);

    CaldecottTunnelDescriptor descriptor = createCaldecottTunnel(MYSQL_SERVICE_NAME);
    assertNotNull(descriptor);
    assertTunnel(MYSQL_SERVICE_NAME);

    CloudApplication caldecottApp = getCaldecottApplication();
    assertNotNull(caldecottApp);
View Full Code Here

Examples of org.cloudfoundry.ide.eclipse.server.core.internal.tunnel.CaldecottTunnelDescriptor

      selectedService = services.get(0);
    }

    if (selectedService != null) {
      // See if there is an existing tunnel that is open
      CaldecottTunnelDescriptor descriptor = CloudFoundryPlugin.getCaldecottTunnelCache().getDescriptor(
          cloudServer, selectedService.getName());

      IAction dataToolsAction = DataToolsTunnelAction.getAction(editorPage, selectedService, descriptor,
          cloudServer);
View Full Code Here

Examples of org.cloudfoundry.ide.eclipse.server.core.internal.tunnel.CaldecottTunnelDescriptor

        // The application must be started before creating a tunnel

        startCaldecottApp(getSubMonitor(worked, progress), client);

        CaldecottTunnelDescriptor oldDescriptor = CloudFoundryPlugin.getCaldecottTunnelCache().getDescriptor(
            cloudServer, serviceName);

        if (oldDescriptor != null) {
          try {
            progress.setTaskName("Stopping existing tunnel"); //$NON-NLS-1$
            stopAndDeleteCaldecottTunnel(serviceName, getSubMonitor(worked, progress));

          }
          catch (CoreException e) {
            CloudFoundryPlugin
                .logError("Failed to stop existing tunnel for service " + serviceName + ". Unable to create new tunnel."); //$NON-NLS-1$ //$NON-NLS-2$
            return null;
          }
        }

        String url = getTunnelUri(client, getSubMonitor(worked, progress));

        Map<String, String> info = getTunnelInfo(client, serviceName, getSubMonitor(worked, progress));
        if (info == null) {
          CloudFoundryPlugin.logError("Failed to obtain tunnel information for " + serviceName); //$NON-NLS-1$
          return null;
        }

        String host = info.get("hostname"); //$NON-NLS-1$
        int port = Integer.valueOf(info.get("port")); //$NON-NLS-1$
        String auth = getTunnelAuthorisation(client);
        String serviceUserName = info.get("username"); //$NON-NLS-1$
        String servicePassword = info.get("password"); //$NON-NLS-1$
        String dataBase = getServiceVendor(serviceName, getSubMonitor(worked, progress));

        String name = info.get("vhost"); //$NON-NLS-1$
        if (name == null) {
          name = info.get("db") != null ? info.get("db") : info.get("name"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        }

        // Use proxy settings if they exist

        HttpProxyConfiguration proxyConfiguration = null;

        try {
          URL urlOb = new URL(url);
          proxyConfiguration = CloudFoundryClientFactory.getProxy(urlOb);
        }
        catch (MalformedURLException e) {
          // Unable to handle proxy URL. Attempt to connect anyway.
        }

        TunnelFactory tunnelFactory = new HttpTunnelFactory(url, host, port, auth, proxyConfiguration);

        List<TunnelServer> tunnelServers = new ArrayList<TunnelServer>(1);
        int localPort = getTunnelServer(tunnelFactory, tunnelServers);

        if (tunnelServers.isEmpty() || localPort == -1) {
          CloudFoundryPlugin.logError("Tunnel information obtained for " + serviceName + //$NON-NLS-1$
              ", but failed to create tunnel server for ports between: " + new Integer(BASE_PORT)
              + " and " + new Integer(MAX_PORT)); //$NON-NLS-1$ //$NON-NLS-2$
          return null;
        }

        TunnelServer tunnelServer = tunnelServers.get(0);

        progress.setTaskName("Starting tunnel server"); //$NON-NLS-1$
        tunnelServer.start();

        CaldecottTunnelDescriptor descriptor = new CaldecottTunnelDescriptor(serviceUserName, servicePassword,
            name, serviceName, dataBase, tunnelServer, localPort);

        CloudFoundryPlugin.getCaldecottTunnelCache().addDescriptor(cloudServer, descriptor);
        tunnel.add(descriptor);
View Full Code Here

Examples of org.cloudfoundry.ide.eclipse.server.core.internal.tunnel.CaldecottTunnelDescriptor

  }

  public synchronized CaldecottTunnelDescriptor stopAndDeleteCaldecottTunnel(String serviceName,
      IProgressMonitor monitor) throws CoreException {

    CaldecottTunnelDescriptor tunnelDescriptor = stopCaldecottTunnel(serviceName);
    if (tunnelDescriptor != null) {
      CloudFoundryPlugin.getCaldecottTunnelCache().removeDescriptor(cloudServer,
          tunnelDescriptor.getServiceName());
    }
    return tunnelDescriptor;

  }
View Full Code Here

Examples of org.cloudfoundry.ide.eclipse.server.core.internal.tunnel.CaldecottTunnelDescriptor

    }
  }

  public synchronized CaldecottTunnelDescriptor stopCaldecottTunnel(String serviceName) throws CoreException {

    CaldecottTunnelDescriptor tunnelDescriptor = CloudFoundryPlugin.getCaldecottTunnelCache().getDescriptor(
        cloudServer, serviceName);
    if (tunnelDescriptor != null) {
      tunnelDescriptor.getTunnelServer().stop();
    }
    return tunnelDescriptor;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.