Search in sources :

Example 6 with OpenShiftToolsException

use of org.jboss.tools.openshift.reddeer.exception.OpenShiftToolsException in project jbosstools-openshift by jbosstools.

the class CreateServerAdapterTest method removeAdapterIfExists.

@After
public void removeAdapterIfExists() {
    try {
        OpenShiftUtils.killJobs();
        new ServerAdapter(Version.OPENSHIFT3, "eap-app", "Service").delete();
    } catch (OpenShiftToolsException ex) {
    // do nothing, adapter does not exists
    }
}
Also used : ServerAdapter(org.jboss.tools.openshift.reddeer.view.resources.ServerAdapter) OpenShiftToolsException(org.jboss.tools.openshift.reddeer.exception.OpenShiftToolsException) After(org.junit.After)

Example 7 with OpenShiftToolsException

use of org.jboss.tools.openshift.reddeer.exception.OpenShiftToolsException in project jbosstools-openshift by jbosstools.

the class NodeJSAppDebugTest method clean.

@After
public void clean() {
    ProjectExplorer pe = new ProjectExplorer();
    pe.open();
    pe.deleteAllProjects();
    try {
        new WaitWhile(new JobIsRunning(), TimePeriod.LONG);
        new ServerAdapter(Version.OPENSHIFT3, OpenShiftResources.NODEJS_SERVICE).delete();
    } catch (OpenShiftToolsException ex) {
    // do nothing, adapter does not exists
    }
}
Also used : ProjectExplorer(org.eclipse.reddeer.eclipse.ui.navigator.resources.ProjectExplorer) ServerAdapter(org.jboss.tools.openshift.reddeer.view.resources.ServerAdapter) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) OpenShiftToolsException(org.jboss.tools.openshift.reddeer.exception.OpenShiftToolsException) After(org.junit.After)

Example 8 with OpenShiftToolsException

use of org.jboss.tools.openshift.reddeer.exception.OpenShiftToolsException in project jbosstools-openshift by jbosstools.

the class CDKServerAdapterAbstractTest method findOpenShiftConnection.

/**
 * Finds OpenShift 3 connection based on server username parameters
 *
 * @param server server name
 * @param username connection username
 * @return openshift 3 connection object if found
 */
public OpenShift3Connection findOpenShiftConnection(String server, String username) {
    OpenShiftExplorerView osExplorer = new OpenShiftExplorerView();
    osExplorer.open();
    if (osExplorer.connectionExists(server, username)) {
        return osExplorer.getOpenShift3Connection(server, username);
    } else {
        throw new OpenShiftToolsException("Could not find OpenShift connection for " + server + " and " + // $NON-NLS-1$;
        username);
    }
}
Also used : OpenShiftExplorerView(org.jboss.tools.openshift.reddeer.view.OpenShiftExplorerView) OpenShiftToolsException(org.jboss.tools.openshift.reddeer.exception.OpenShiftToolsException)

Example 9 with OpenShiftToolsException

use of org.jboss.tools.openshift.reddeer.exception.OpenShiftToolsException in project jbosstools-openshift by jbosstools.

the class OpenShiftExplorerView method getConnectionItem.

private TreeItem getConnectionItem(String server, String username) {
    open();
    if (username == null) {
        username = TreeViewerHandler.getInstance().getNonStyledText(new DefaultTree().getItems().get(0));
    }
    TreeItem connectionItem = treeViewerHandler.getTreeItem(new DefaultTree(), username);
    if (server != null && DatastoreOS3.AUTH_METHOD.equals(AuthenticationMethod.OAUTH)) {
        if (treeViewerHandler.getStyledTexts(connectionItem)[0].equals(server)) {
            return connectionItem;
        } else {
            throw new OpenShiftToolsException("There is no connection with specified server " + server + " and username " + username);
        }
    } else {
        return connectionItem;
    }
}
Also used : DefaultTree(org.eclipse.reddeer.swt.impl.tree.DefaultTree) TreeItem(org.eclipse.reddeer.swt.api.TreeItem) OpenShiftToolsException(org.jboss.tools.openshift.reddeer.exception.OpenShiftToolsException)

Example 10 with OpenShiftToolsException

use of org.jboss.tools.openshift.reddeer.exception.OpenShiftToolsException in project jbosstools-openshift by jbosstools.

the class OpenShiftCommandLineToolsRequirement method deleteOnPathIfExists.

private void deleteOnPathIfExists(String path) {
    try {
        URI uri = new File(path).toURI();
        LOGGER.info("Going to delete URI resources on path: " + uri.getPath());
        Files.deleteIfExists(Paths.get(uri));
    } catch (IOException e) {
        LOGGER.error(e.getMessage());
        throw new OpenShiftToolsException("Deleting files on path " + path + " was not successful, cause: " + e.getMessage());
    }
}
Also used : IOException(java.io.IOException) URI(java.net.URI) File(java.io.File) OpenShiftToolsException(org.jboss.tools.openshift.reddeer.exception.OpenShiftToolsException)

Aggregations

OpenShiftToolsException (org.jboss.tools.openshift.reddeer.exception.OpenShiftToolsException)16 File (java.io.File)7 IOException (java.io.IOException)4 MalformedURLException (java.net.MalformedURLException)3 WaitUntil (org.eclipse.reddeer.common.wait.WaitUntil)3 ShellIsAvailable (org.eclipse.reddeer.swt.condition.ShellIsAvailable)3 ServerAdapter (org.jboss.tools.openshift.reddeer.view.resources.ServerAdapter)3 FileOutputStream (java.io.FileOutputStream)2 UnsupportedEncodingException (java.io.UnsupportedEncodingException)2 ZipFile (java.util.zip.ZipFile)2 WaitTimeoutExpiredException (org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException)2 WaitWhile (org.eclipse.reddeer.common.wait.WaitWhile)2 ProjectExplorer (org.eclipse.reddeer.eclipse.ui.navigator.resources.ProjectExplorer)2 OkButton (org.eclipse.reddeer.swt.impl.button.OkButton)2 DefaultShell (org.eclipse.reddeer.swt.impl.shell.DefaultShell)2 JobIsRunning (org.eclipse.reddeer.workbench.core.condition.JobIsRunning)2 ConnectionURL (org.jboss.tools.openshift.common.core.connection.ConnectionURL)2 After (org.junit.After)2 BufferedInputStream (java.io.BufferedInputStream)1 BufferedOutputStream (java.io.BufferedOutputStream)1