blob: ca58369073566569e23aa444e277644f383a168a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
/*******************************************************************************
* Copyright (c) 2017 Red Hat, Inc.
* Distributed under license by Red Hat, Inc. All rights reserved.
* This program is made available under the terms of the
* Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributor:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.eclipse.linuxtools.docker.reddeer.core.ui.wizards;
import org.eclipse.linuxtools.docker.reddeer.ui.DockerExplorerView;
import org.eclipse.reddeer.common.wait.TimePeriod;
import org.eclipse.reddeer.common.wait.WaitUntil;
import org.eclipse.reddeer.common.wait.WaitWhile;
import org.eclipse.reddeer.core.reference.ReferencedComposite;
import org.eclipse.reddeer.jface.wizard.WizardPage;
import org.eclipse.reddeer.swt.api.Button;
import org.eclipse.reddeer.swt.api.Table;
import org.eclipse.reddeer.swt.condition.ControlIsEnabled;
import org.eclipse.reddeer.swt.condition.ShellIsAvailable;
import org.eclipse.reddeer.swt.impl.button.CheckBox;
import org.eclipse.reddeer.swt.impl.button.FinishButton;
import org.eclipse.reddeer.swt.impl.button.OkButton;
import org.eclipse.reddeer.swt.impl.button.PushButton;
import org.eclipse.reddeer.swt.impl.button.RadioButton;
import org.eclipse.reddeer.swt.impl.table.DefaultTable;
import org.eclipse.reddeer.swt.impl.text.LabeledText;
import org.eclipse.reddeer.swt.impl.toolbar.DefaultToolItem;
import org.eclipse.reddeer.workbench.core.condition.JobIsRunning;
/**
*
* @author jkopriva@redhat.com
*
*/
public class NewDockerConnectionPage extends WizardPage {
private static final String NEW_DOCKER_CONNECTION_SHELL = "New Docker Connection";
public NewDockerConnectionPage(ReferencedComposite referencedComposite) {
super(referencedComposite);
}
public void open() {
new DockerExplorerView().open();
new DefaultToolItem("Add Connection").click();
new WaitUntil(new ShellIsAvailable(NEW_DOCKER_CONNECTION_SHELL), TimePeriod.LONG);
}
public void finish() {
new WaitUntil(new ShellIsAvailable(NEW_DOCKER_CONNECTION_SHELL));
new WaitUntil(new ControlIsEnabled(new FinishButton()));
new FinishButton().click();
new WaitWhile(new ShellIsAvailable(NEW_DOCKER_CONNECTION_SHELL), TimePeriod.LONG);
new WaitWhile(new JobIsRunning(), TimePeriod.VERY_LONG);
}
public void setConnectionName(String name) {
new LabeledText("Connection name:").setText(name);
}
public void setUnixSocket(String unixSocket) {
new CheckBox("Use custom connection settings:").toggle(true);
new LabeledText("Location:").setText(unixSocket);
}
public void setTcpConnection(String uri) {
setTcpConnection(uri, null, false);
}
public void setTcpConnection(String uri, String authentificationCertificatePath, boolean pingConnection) {
setTcpUri(uri);
if (authentificationCertificatePath != null) {
new CheckBox("Enable authentication").toggle(true);
new LabeledText("Path:").setText(authentificationCertificatePath);
}
if (pingConnection) {
pingConnection();
}
}
public void setTcpUri(String uri) {
setConnectionName(uri);
new CheckBox("Use custom connection settings:").toggle(true);
new LabeledText("Location:").setText("");
new RadioButton("TCP Connection").toggle(true);
new LabeledText("URI:").setText(uri);
}
public void pingConnection() {
Button testConnectionButton = new PushButton("Test Connection");
testConnectionButton.click();
new WaitUntil(new ShellIsAvailable("Success"));
new OkButton().click();
}
public void search(String connectionName) {
new PushButton("Search...").click();
new WaitUntil(new ShellIsAvailable("Docker Connection Selection"));
Table table = new DefaultTable();
table.getItem(connectionName).select();
new OkButton().click();
}
}
|