Skip to content

Commit

Permalink
Change project creation URL (#2221)
Browse files Browse the repository at this point in the history
* Change project creation URL
* Update URL to set previous page
  • Loading branch information
chanseokoh authored Aug 3, 2017
1 parent 2630351 commit 08c2ac4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package com.google.cloud.tools.eclipse.appengine.deploy.ui;

import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
Expand Down Expand Up @@ -97,6 +98,12 @@ public void setUp() {
twoAccountSet = new HashSet<>(Arrays.asList(account1, account2));
}

@Test
public void testCreateGcpProjectUrl() {
assertEquals("https://console.cloud.google.com/projectcreate?previousPage=%2Fprojectselector%2Fappengine%2Fcreate%3Flang%3Djava",
AppEngineDeployPreferencesPanel.CREATE_GCP_PROJECT_URL);
}

@Test
public void testAutoSelectSingleAccount() {
when(loginService.getAccounts()).thenReturn(oneAccountSet);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import com.google.common.base.Preconditions;
import com.google.common.base.Predicate;
import com.google.common.base.Strings;
import com.google.common.net.UrlEscapers;
import java.util.Collection;
import java.util.Collections;
import java.util.Map;
Expand Down Expand Up @@ -90,8 +91,12 @@ public abstract class AppEngineDeployPreferencesPanel extends DeployPreferencesP

private static final String APPENGINE_VERSIONS_URL =
"https://console.cloud.google.com/appengine/versions";
private static final String CREATE_GCP_PROJECT_WITH_GAE_URL =
"https://console.cloud.google.com/projectselector/appengine/create?lang=java";
private static final String APP_ENGINE_APPLICATION_CREATE_PATH =
"/projectselector/appengine/create?lang=java";
@VisibleForTesting
static final String CREATE_GCP_PROJECT_URL =
"https://console.cloud.google.com/projectcreate?previousPage="
+ UrlEscapers.urlFormParameterEscaper().escape(APP_ENGINE_APPLICATION_CREATE_PATH);

private static final Logger logger = Logger.getLogger(
AppEngineDeployPreferencesPanel.class.getName());
Expand Down Expand Up @@ -335,7 +340,7 @@ private void createProjectIdSection() {
Composite linkComposite = new Composite(this, SWT.NONE);
Link createNewProject = new Link(linkComposite, SWT.WRAP);
createNewProject.setText(Messages.getString("projectselector.createproject",
CREATE_GCP_PROJECT_WITH_GAE_URL));
CREATE_GCP_PROJECT_URL));
createNewProject.setToolTipText(Messages.getString("projectselector.createproject.tooltip"));
FontUtil.convertFontToItalic(createNewProject);
createNewProject.addSelectionListener(
Expand Down

0 comments on commit 08c2ac4

Please sign in to comment.