Skip to content

Commit 5832d17

Browse files
committed
Merge with HEAD
2 parents d5827f2 + 2f79c8c commit 5832d17

68 files changed

Lines changed: 973 additions & 502 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ The tests need to find the Google Cloud SDK. You can either:
5252

5353
By default, the build is targeted against Eclipse Mars / 4.5.
5454
You can explicitly set the `eclipse.target` property to
55-
`neon` (4.6).
55+
`neon` (4.6) or `oxygen` (4.7).
5656
```
5757
$ mvn -Declipse.target=neon package
5858
```
@@ -98,6 +98,17 @@ indicate a misconfigured _jdkHome_.
9898
You can disable the use of toolchains by setting the `tycho.toolchains`
9999
property to `SYSTEM`.
100100

101+
### Adding a new bundle/fragment
102+
103+
We normally put production code into a bundle and tests as a fragment hosted
104+
by that bundle, put under the `plugins/` directory.
105+
For now we have been committing both the `pom.xml` and Eclipse's
106+
`.project`, `.classpath`, and `.settings/` files.
107+
108+
Our CI process is configured to run our tests with JaCoCo, which requires
109+
some additional configuration to add new bundles and fragments
110+
in `build/jacoco/`.
111+
101112

102113
## Import into Eclipse
103114

@@ -259,6 +270,7 @@ This is currently:
259270

260271
- Eclipse Mars (4.5 SR2): [`eclipse/mars/gcp-eclipse-mars.target`](eclipse/mars/gcp-eclipse-mars.target)
261272
- Eclipse Neon (4.6): [`eclipse/neon/gcp-eclipse-neon.target`](eclipse/neon/gcp-eclipse-neon.target)
273+
- Eclipse Oxygen (4.7): [`eclipse/oxygen/gcp-eclipse-oxygen.target`](eclipse/oxygen/gcp-eclipse-oxygen.target)
262274

263275
These `.target` files are generated and *should not be manually updated*.
264276
Updating `.target` files directly becomes a chore once it has more than a

build/jacoco/pom.xml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,18 @@
9898
<version>0.1.0-SNAPSHOT</version>
9999
<scope>compile</scope>
100100
</dependency>
101+
<dependency>
102+
<groupId>com.google.cloud.tools.eclipse</groupId>
103+
<artifactId>com.google.cloud.tools.eclipse.appengine.flex.test</artifactId>
104+
<version>0.1.0-SNAPSHOT</version>
105+
<scope>test</scope>
106+
</dependency>
107+
<dependency>
108+
<groupId>com.google.cloud.tools.eclipse</groupId>
109+
<artifactId>com.google.cloud.tools.eclipse.appengine.flex</artifactId>
110+
<version>0.1.0-SNAPSHOT</version>
111+
<scope>compile</scope>
112+
</dependency>
101113
<dependency>
102114
<groupId>com.google.cloud.tools.eclipse</groupId>
103115
<artifactId>com.google.cloud.tools.eclipse.appengine.libraries.test</artifactId>
@@ -182,6 +194,18 @@
182194
<version>0.1.0-SNAPSHOT</version>
183195
<scope>compile</scope>
184196
</dependency>
197+
<dependency>
198+
<groupId>com.google.cloud.tools.eclipse</groupId>
199+
<artifactId>com.google.cloud.tools.eclipse.googleapis.test</artifactId>
200+
<version>0.1.0-SNAPSHOT</version>
201+
<scope>test</scope>
202+
</dependency>
203+
<dependency>
204+
<groupId>com.google.cloud.tools.eclipse</groupId>
205+
<artifactId>com.google.cloud.tools.eclipse.googleapis</artifactId>
206+
<version>0.1.0-SNAPSHOT</version>
207+
<scope>compile</scope>
208+
</dependency>
185209
<dependency>
186210
<groupId>com.google.cloud.tools.eclipse</groupId>
187211
<artifactId>com.google.cloud.tools.eclipse.integration.appengine</artifactId>

features/com.google.cloud.tools.eclipse.suite.e45.feature/feature.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<feature
33
id="com.google.cloud.tools.eclipse.suite.e45.feature"
44
label="Google Cloud Platform for Eclipse 4.5 and later"
5-
version="1.0.0.qualifier"
5+
version="1.0.1.qualifier"
66
provider-name="Google, Inc."
77
plugin="com.google.cloud.tools.eclipse.appengine.ui"
88
license-feature="com.google.licenses.apache_v2">

features/com.google.cloud.tools.eclipse.suite.e45.feature/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<relativePath>../../</relativePath>
1010
</parent>
1111
<artifactId>com.google.cloud.tools.eclipse.suite.e45.feature</artifactId>
12-
<version>1.0.0-SNAPSHOT</version>
12+
<version>1.0.1-SNAPSHOT</version>
1313
<packaging>eclipse-feature</packaging>
1414

1515
</project>

gcp-repo/metadata.p2.inf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010

1111
requires.1.namespace=org.eclipse.equinox.p2.iu
1212
requires.1.name=com.google.cloud.tools.eclipse.category
13-
requires.1.range=[1.0.0,1.0.0]
13+
requires.1.range=[1.0.0,1.0.1]
1414
requires.1.greedy=true
1515

1616
units.1.id=com.google.cloud.tools.eclipse.category
17-
units.1.version=1.0.0
17+
units.1.version=1.0.1
1818
units.1.properties.1.name=org.eclipse.equinox.p2.type.category
1919
units.1.properties.1.value=true
2020
units.1.properties.2.name=org.eclipse.equinox.p2.name
@@ -27,7 +27,7 @@ units.1.properties.5.name=org.eclipse.equinox.p2.doc.url
2727
units.1.properties.5.value=https://cloud.google.com/eclipse/docs/
2828
units.1.provides.1.namespace=org.eclipse.equinox.p2.iu
2929
units.1.provides.1.name=com.google.cloud.tools.eclipse.category
30-
units.1.provides.1.version=1.0.0
30+
units.1.provides.1.version=1.0.1
3131
units.1.copyright =Copyright 2016, 2017 Google Inc.
3232
units.1.licenses.0 =\
3333
Cloud Tools for Eclipse is made available under the Apache License, Version 2.0. \

gcp-repo/metadata.product

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
This product exists to (1) bring in any required features, and
55
(2) add any additional metadata for the CT4E repository.
66
-->
7-
<product uid="com.google.cloud.tools.eclipse.dist" version="1.0.0.qualifier" useFeatures="true" includeLaunchers="false">
7+
<product uid="com.google.cloud.tools.eclipse.dist" version="1.0.1.qualifier" useFeatures="true" includeLaunchers="false">
88

99
<configIni use="default">
1010
</configIni>

plugins/com.google.cloud.tools.eclipse.appengine.deploy.ui.test/src/com/google/cloud/tools/eclipse/appengine/deploy/ui/StandardDeployPreferencesPanelTest.java

Lines changed: 74 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@
2828

2929
import com.google.api.client.auth.oauth2.Credential;
3030
import com.google.cloud.tools.eclipse.appengine.deploy.standard.StandardDeployPreferences;
31+
import com.google.cloud.tools.eclipse.appengine.deploy.ui.StandardDeployPreferencesPanel.ProjectSelectionValidator;
3132
import com.google.cloud.tools.eclipse.login.IGoogleLoginService;
33+
import com.google.cloud.tools.eclipse.login.ui.AccountSelector;
3234
import com.google.cloud.tools.eclipse.login.ui.AccountSelectorObservableValue;
3335
import com.google.cloud.tools.eclipse.projectselector.ProjectRepository;
3436
import com.google.cloud.tools.eclipse.projectselector.ProjectRepositoryException;
@@ -65,6 +67,7 @@ public class StandardDeployPreferencesPanelTest {
6567
private static final String EMAIL_1 = "some-email-1@example.com";
6668

6769
private Composite parent;
70+
private StandardDeployPreferencesPanel deployPanel;
6871
@Mock private IProject project;
6972
@Mock private IGoogleLoginService loginService;
7073
@Mock private Runnable layoutChangedHandler;
@@ -87,14 +90,13 @@ public void setUp() throws Exception {
8790
@Test
8891
public void testSelectSingleAccount() {
8992
when(loginService.getAccounts()).thenReturn(new HashSet<>(Arrays.asList(account1)));
90-
StandardDeployPreferencesPanel deployPanel = new StandardDeployPreferencesPanel(
91-
parent, project, loginService, layoutChangedHandler, true, projectRepository);
93+
deployPanel = createPanel(true /* requireValues */);
9294
assertThat(deployPanel.getSelectedCredential(), is(credential));
9395

9496
// todo? assertTrue(deployPanel.getAccountSelector().isAutoSelectAccountIfNone()
9597

9698
// verify not in error
97-
IStatus status = getAccountSelectorValidationStatus(deployPanel);
99+
IStatus status = getAccountSelectorValidationStatus();
98100
assertTrue("account selector is in error: " + status.getMessage(), status.isOK());
99101

100102
assertThat("auto-selected value should be propagated back to model",
@@ -103,10 +105,8 @@ public void testSelectSingleAccount() {
103105

104106
@Test
105107
public void testValidationMessageWhenNotSignedIn() {
106-
StandardDeployPreferencesPanel deployPanel =
107-
new StandardDeployPreferencesPanel(parent, project, loginService, layoutChangedHandler,
108-
true, projectRepository);
109-
IStatus status = getAccountSelectorValidationStatus(deployPanel);
108+
deployPanel = createPanel(true /* requireValues */);
109+
IStatus status = getAccountSelectorValidationStatus();
110110
assertThat(status.getMessage(), is("Sign in to Google."));
111111
}
112112

@@ -115,34 +115,19 @@ public void testValidationMessageWhenSignedIn() {
115115
// Return two accounts because the account selector will auto-select if there exists only one.
116116
when(loginService.getAccounts()).thenReturn(new HashSet<>(Arrays.asList(account1, account2)));
117117

118-
StandardDeployPreferencesPanel deployPanel =
119-
new StandardDeployPreferencesPanel(parent, project, loginService, layoutChangedHandler,
120-
true, projectRepository);
121-
IStatus status = getAccountSelectorValidationStatus(deployPanel);
118+
deployPanel = createPanel(true /* requireValues */);
119+
IStatus status = getAccountSelectorValidationStatus();
122120
assertThat(status.getMessage(), is("Select an account."));
123121
}
124122

125-
private static Button getButtonWithText(Composite parent, String text) {
126-
for (Control control : parent.getChildren()) {
127-
if (control instanceof Button) {
128-
Button button = (Button) control;
129-
if (button.getText().equals(text)) {
130-
return button;
131-
}
132-
}
133-
}
134-
return null;
135-
}
136-
137123
// https://github.com/GoogleCloudPlatform/google-cloud-eclipse/issues/1229
138124
@Test
139125
public void testUncheckStopPreviousVersionButtonWhenDisabled() {
140-
StandardDeployPreferencesPanel panel = new StandardDeployPreferencesPanel(
141-
parent, project, loginService, layoutChangedHandler, true, projectRepository);
126+
deployPanel = createPanel(true /* requireValues */);
142127

143128
Button promoteButton =
144-
getButtonWithText(panel, "Promote the deployed version to receive all traffic");
145-
Button stopButton = getButtonWithText(panel, "Stop previous version");
129+
getButtonWithText("Promote the deployed version to receive all traffic");
130+
Button stopButton = getButtonWithText("Stop previous version");
146131
SWTBotCheckBox promote = new SWTBotCheckBox(promoteButton);
147132
SWTBotCheckBox stop = new SWTBotCheckBox(stopButton);
148133

@@ -183,11 +168,9 @@ public void testProjectSavedInPreferencesSelected() throws ProjectRepositoryExce
183168
new ProjectScope(project).getNode(StandardDeployPreferences.PREFERENCE_STORE_QUALIFIER);
184169
node.put("project.id", "projectId1");
185170
node.put("account.email", EMAIL_1);
186-
initializeProjectRepository(projectRepository);
171+
initializeProjectRepository();
187172
when(loginService.getAccounts()).thenReturn(new HashSet<>(Arrays.asList(account1, account2)));
188-
StandardDeployPreferencesPanel deployPanel =
189-
new StandardDeployPreferencesPanel(parent, project, loginService, layoutChangedHandler,
190-
true, projectRepository);
173+
deployPanel = createPanel(true /* requireValues */);
191174
Queue<Control> children = new ArrayDeque<>(Arrays.asList(deployPanel.getChildren()));
192175
while (!children.isEmpty()) {
193176
Control control = children.poll();
@@ -204,7 +187,65 @@ public void testProjectSavedInPreferencesSelected() throws ProjectRepositoryExce
204187
fail("Did not find ProjectSelector widget");
205188
}
206189

207-
private void initializeProjectRepository(ProjectRepository projectRepository)
190+
@Test
191+
public void testProjectNotSelectedIsAnErrorWhenRequireValuesIsTrue() {
192+
deployPanel = createPanel(true /* requireValues */);
193+
assertThat(getProjectSelectionValidator().getSeverity(), is(IStatus.ERROR));
194+
}
195+
196+
@Test
197+
public void testProjectNotSelectedIsNotAnErrorWhenRequireValuesIsFalse() {
198+
deployPanel = createPanel(false /* requireValues */);
199+
assertThat(getProjectSelectionValidator().getSeverity(), is(IStatus.INFO));
200+
}
201+
202+
@Test
203+
public void testProjectsExistThenNoProjectNotFoundError() throws ProjectRepositoryException {
204+
when(loginService.getAccounts()).thenReturn(new HashSet<>(Arrays.asList(account1)));
205+
initializeProjectRepository();
206+
deployPanel = createPanel(false /* requireValues */);
207+
selectAccount(account1);
208+
assertThat(getProjectSelectionValidator().getSeverity(), is(IStatus.OK));
209+
}
210+
211+
private Button getButtonWithText(String text) {
212+
for (Control control : deployPanel.getChildren()) {
213+
if (control instanceof Button) {
214+
Button button = (Button) control;
215+
if (button.getText().equals(text)) {
216+
return button;
217+
}
218+
}
219+
}
220+
return null;
221+
}
222+
223+
private void selectAccount(Account account) {
224+
for (Control control : deployPanel.getChildren()) {
225+
if (control instanceof AccountSelector) {
226+
AccountSelector accountSelector = (AccountSelector) control;
227+
accountSelector.selectAccount(account.getEmail());
228+
}
229+
}
230+
}
231+
232+
private StandardDeployPreferencesPanel createPanel(boolean requireValues) {
233+
return new StandardDeployPreferencesPanel(parent, project, loginService, layoutChangedHandler,
234+
requireValues, projectRepository);
235+
}
236+
237+
private IStatus getProjectSelectionValidator() {
238+
for (Object object : deployPanel.getDataBindingContext().getValidationStatusProviders()) {
239+
if (object instanceof ProjectSelectionValidator) {
240+
ProjectSelectionValidator projectSelectionValidator = (ProjectSelectionValidator) object;
241+
return (IStatus) projectSelectionValidator.getValidationStatus().getValue();
242+
}
243+
}
244+
fail("Could not find ProjectSelectionValidator.");
245+
return null;
246+
}
247+
248+
private void initializeProjectRepository()
208249
throws ProjectRepositoryException {
209250
GcpProject project1 = new GcpProject("Project1", "projectId1");
210251
GcpProject project2 = new GcpProject("Project2", "projectId2");
@@ -216,7 +257,7 @@ private void initializeProjectRepository(ProjectRepository projectRepository)
216257
.thenReturn(project2);
217258
}
218259

219-
private IStatus getAccountSelectorValidationStatus(StandardDeployPreferencesPanel deployPanel) {
260+
private IStatus getAccountSelectorValidationStatus() {
220261
IStatus status = null;
221262
for (Object object : deployPanel.getDataBindingContext().getValidationStatusProviders()) {
222263
ValidationStatusProvider statusProvider = (ValidationStatusProvider) object;

plugins/com.google.cloud.tools.eclipse.appengine.deploy.ui/src/com/google/cloud/tools/eclipse/appengine/deploy/ui/DeployPropertyPage.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
public class DeployPropertyPage extends PropertyPage {
4848

4949
private DeployPreferencesPanel content;
50-
private boolean canSetMessage;
50+
private boolean canSetMessage = true;
5151
private boolean isStandardPanel;
5252
private IFacetedProject facetedProject = null;
5353
private String invalidFacetConfigErrorMessage = "";
@@ -202,7 +202,7 @@ private void evaluateFacetConfiguration() {
202202
private void updatePageBasedOnFacetConfig(boolean hasCorrectFacetConfiguration) {
203203
if (hasCorrectFacetConfiguration) {
204204
canSetMessage = true;
205-
setErrorMessage(null);
205+
content.getDataBindingContext().updateModels();
206206
} else {
207207
setErrorMessage(invalidFacetConfigErrorMessage);
208208
canSetMessage = false;

0 commit comments

Comments
 (0)