Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use account properties to get TFS URL #155

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Localization.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ We’re using an open localization platform to regularly integrate community fee
* Go to https://www.transifex.com/microsoft-oss/teamexplorereverywhere/
* Select your requested language.
* Click ![](./img/trans.png)
* Select a partucilar resource or choose "All resources" to see all strings in the product.
* Select a particular resource or choose "All resources" to see all strings in the product.

###Reviewing and voting on translations
* Review the suggestions and vote ![](./img/1.png) , ![](./img/2.png)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import java.util.Set;
import java.util.concurrent.atomic.AtomicReference;

import com.microsoft.alm.client.utils.StringUtil;
import com.microsoft.tfs.client.clc.AcceptedOptionSet;
import com.microsoft.tfs.client.clc.EnvironmentVariables;
import com.microsoft.tfs.client.clc.ExitCode;
Expand Down Expand Up @@ -56,6 +55,7 @@
import com.microsoft.tfs.core.util.FileEncoding;
import com.microsoft.tfs.jni.FileSystemUtils;
import com.microsoft.tfs.util.Check;
import com.microsoft.tfs.util.StringUtil;
import com.microsoft.tfs.util.process.ProcessFinishedHandler;
import com.microsoft.tfs.util.process.ProcessRunner;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,10 @@
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.widgets.Composite;

import com.microsoft.alm.client.TeeClientHandler;
import com.microsoft.alm.teamfoundation.build.webapi.BuildDefinitionTemplate;
import com.microsoft.alm.teamfoundation.distributedtask.webapi.TaskAgentHttpClient;
import com.microsoft.tfs.client.common.ui.TFSCommonUIClientPlugin;
import com.microsoft.tfs.client.common.ui.framework.table.TableColumnData;
import com.microsoft.tfs.client.common.ui.framework.table.TableControl;
import com.microsoft.tfs.client.common.ui.teambuild.Messages;
import com.microsoft.tfs.core.TFSTeamProjectCollection;
import com.microsoft.tfs.util.StringUtil;

public class BuildDefinitionTemplatesTable extends TableControl {
Expand All @@ -30,8 +26,6 @@ public class BuildDefinitionTemplatesTable extends TableControl {
private static final int DESCRIPTION_COLUMN_NUM = 2;
private final TableColumnData[] columnData;

private final TaskAgentHttpClient taskAgentClient;

public BuildDefinitionTemplatesTable(final Composite parent, final int style) {
super(parent, (style | SWT.FULL_SELECTION) & ~SWT.MULTI & ~SWT.CHECK, BuildDefinitionTemplate.class, null);

Expand All @@ -55,11 +49,6 @@ public BuildDefinitionTemplatesTable(final Composite parent, final int style) {

setupTable(true, false, columnData);
setUseViewerDefaults();

final TFSTeamProjectCollection connection =
TFSCommonUIClientPlugin.getDefault().getProductPlugin().getServerManager().getDefaultServer().getConnection();
taskAgentClient =
new TaskAgentHttpClient(new TeeClientHandler(connection.getHTTPClient()), connection.getBaseURI());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ private static BuildDefinition getBuildDefinitionFromFavorite(
new BuildHttpClient(new TeeClientHandler(connection.getHTTPClient()), connection.getBaseURI());

final DefinitionReference definition =
buildClient.getDefinition(oldDefinition.getProject().getId(), oldDefinition.getId(), null, null);
buildClient.getDefinition(oldDefinition.getProject().getId(), oldDefinition.getId(), null, null, null);

if (definition == null || !(definition instanceof BuildDefinition) || definition.getUri() == null) {
throw new FavoritesException("Build favorite " + oldDefinition.getUri() + " does not exist."); //$NON-NLS-1$ //$NON-NLS-2$
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,16 @@
import com.microsoft.tfs.core.util.ServerURIUtils;
import com.microsoft.tfs.core.util.URIUtils;
import com.microsoft.tfs.util.Platform;
import com.microsoft.tfs.util.StringUtil;

public class WizardServerSelectionPage extends ExtendedWizardPage {
public static final String PAGE_NAME = "WizardServerSelectionPage"; //$NON-NLS-1$

private static final Log log = LogFactory.getLog(WizardServerSelectionPage.class);

private static final int MAX_CREDENTIALS_RETRIES = 3;
private static final String TFS_URL_PROPERTY_NAME =
"Microsoft.VisualStudio.Services.Account.ServiceUrl.00025394-6065-48CA-87D9-7F5672854EF7"; //$NON-NLS-1$

private ServerTypeSelectControl serverTypeSelectControl;

Expand Down Expand Up @@ -163,8 +166,8 @@ private List<Account> getUserAccounts(final Action<DeviceFlowResponse> deviceFlo
final AccountHttpClient accountClient =
new AccountHttpClient(clientHandler, URIUtils.VSTS_ROOT_URL);

final List<Account> accounts = accountClient.getAccounts(profile.getId());
log.info("Accounts number = " + accounts.size()); //$NON-NLS-1$
final List<Account> accounts =
accountClient.getAccounts(null, null, profile.getId(), null, TFS_URL_PROPERTY_NAME, null);

return accounts;
}
Expand Down Expand Up @@ -214,19 +217,25 @@ private List<TFSConnection> getConfigurationServers(

for (final Account account : accounts) {
log.debug("Account name = " + account.getAccountName()); //$NON-NLS-1$
log.debug("Account URI = " + account.getAccountUri()); //$NON-NLS-1$

final String accountURI = "https://" + account.getAccountName() + ".visualstudio.com"; //$NON-NLS-1$ //$NON-NLS-2$
if (account.getProperties() != null && account.getProperties().containsKey(TFS_URL_PROPERTY_NAME)) {

try {
final URI uri = URIUtils.newURI(accountURI);
final TFSConnection configurationServer =
openAccount(uri, CredentialsHelper.getOAuthCredentials(uri, deviceFlowCallback));
if (configurationServer != null) {
configurationServers.add(configurationServer);
final String accountURL = account.getProperties().get(TFS_URL_PROPERTY_NAME).getValue();

if (!StringUtil.isNullOrEmpty(accountURL)) {
log.debug("Account URI = " + accountURL); //$NON-NLS-1$

try {
final URI uri = URIUtils.newURI(accountURL);
final TFSConnection configurationServer =
openAccount(uri, CredentialsHelper.getOAuthCredentials(uri, deviceFlowCallback));
if (configurationServer != null) {
configurationServers.add(configurationServer);
}
} catch (final Exception e) {
log.error(e.getMessage(), e);
}
}
} catch (final Exception e) {
log.error(e.getMessage(), e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import com.microsoft.alm.storage.InsecureInMemoryStore;
import com.microsoft.alm.storage.SecretStore;
import com.microsoft.alm.visualstudio.services.account.client.AccountHttpClient;
import com.microsoft.alm.visualstudio.services.delegatedauthorization.SessionToken;
import com.microsoft.tfs.client.common.Messages;
import com.microsoft.tfs.client.common.config.CommonClientConnectionAdvisor;
import com.microsoft.tfs.core.TFSConnection;
Expand Down
38 changes: 18 additions & 20 deletions source/com.microsoft.tfs.core/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,18 @@
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="rest_core"/>
<classpathentry kind="src" path="tests"/>
<classpathentry exported="true" kind="lib" path="libs/AlmHttpClient-15.105.0.20161011/alm-distributedtask-client-15.105.0-SNAPSHOT.jar" sourcepath="libs/AlmHttpClient-15.105.0.20161011/alm-distributedtask-client-15.105.0-SNAPSHOT-sources.jar"/>
<classpathentry exported="true" kind="lib" path="libs/AlmHttpClient-15.105.0.20161011/alm-extensionmanagement-client-15.105.0-SNAPSHOT.jar" sourcepath="libs/AlmHttpClient-15.105.0.20161011/alm-extensionmanagement-client-15.105.0-SNAPSHOT-sources.jar"/>
<classpathentry exported="true" kind="lib" path="libs/AlmHttpClient-15.105.0.20161011/alm-gallery-client-15.105.0-SNAPSHOT.jar" sourcepath="libs/AlmHttpClient-15.105.0.20161011/alm-gallery-client-15.105.0-SNAPSHOT-sources.jar"/>
<classpathentry exported="true" kind="lib" path="libs/AlmHttpClient-15.105.0.20161011/alm-releasemanagement-client-15.105.0-SNAPSHOT.jar" sourcepath="libs/AlmHttpClient-15.105.0.20161011/alm-releasemanagement-client-15.105.0-SNAPSHOT-sources.jar"/>
<classpathentry exported="true" kind="lib" path="libs/AlmHttpClient-15.105.0.20161011/alm-tfs-client-15.105.0-SNAPSHOT.jar" sourcepath="libs/AlmHttpClient-15.105.0.20161011/alm-tfs-client-15.105.0-SNAPSHOT-sources.jar"/>
<classpathentry exported="true" kind="lib" path="libs/AlmHttpClient-15.105.0.20161011/alm-vss-client-15.105.0-SNAPSHOT.jar" sourcepath="libs/AlmHttpClient-15.105.0.20161011/alm-vss-client-15.105.0-SNAPSHOT-sources.jar"/>
<classpathentry kind="lib" path="libs/annotation-detector-3.0.4/annotation-detector-3.0.4.jar"/>
<classpathentry kind="lib" path="libs/applicationinsights-core/applicationinsights-core-1.0.4.jar"/>
<classpathentry exported="true" kind="lib" path="libs/java-auth-lib/auth-common-0.5.0.jar" sourcepath="libs/java-auth-lib/auth-common-0.5.0-sources.jar"/>
<classpathentry exported="true" kind="lib" path="libs/java-auth-lib/auth-core-0.5.0.jar" sourcepath="libs/java-auth-lib/auth-core-0.5.0-sources.jar"/>
<classpathentry exported="true" kind="lib" path="libs/java-auth-lib/auth-providers-0.5.0.jar" sourcepath="libs/java-auth-lib/auth-providers-0.5.0-sources.jar"/>
<classpathentry exported="true" kind="lib" path="libs/java-auth-lib/auth-secure-storage-0.5.0.jar" sourcepath="libs/java-auth-lib/auth-secure-storage-0.5.0-sources.jar"/>
<classpathentry kind="lib" path="libs/logging-1.1.3/commons-logging-1.1.3.jar"/>
<classpathentry exported="true" kind="lib" path="libs/AlmHttpClient-15.108.2/alm-vss-client-15.108.2-20161228.200110-6.jar"/>
<classpathentry exported="true" kind="lib" path="libs/AlmHttpClient-15.108.2/alm-tfs-client-15.108.2-20161228.200220-6.jar"/>
<classpathentry exported="true" kind="lib" path="libs/hsqldb-1.8.0.10-ebcdic/hsqldb.jar"/>
<classpathentry exported="true" kind="lib" path="libs/guava-12.0.1/guava-12.0.1.jar"/>
<classpathentry kind="lib" path="libs/commons-codec-1.6/commons-codec-1.6.jar" sourcepath="libs_src/commons-codec-1.6/commons-codec-1.6-sources.jar"/>
<classpathentry kind="lib" path="libs/commons-io-2.4/commons-io-2.4.jar"/>
<classpathentry kind="lib" path="libs/commons-lang3-3.1/commons-lang3-3.1.jar"/>
<classpathentry kind="lib" path="libs/httpcore-4.3/httpcore-4.3.jar"/>
<classpathentry kind="lib" path="libs/httpclient-4.3.1/httpclient-4.3.1.jar"/>
<classpathentry kind="lib" path="libs/hsqldb-1.8.0.10-ebcdic/hsqldb.jar"/>
<classpathentry kind="lib" path="libs/guava-12.0.1/guava-12.0.1.jar"/>
<classpathentry exported="true" kind="lib" path="libs/commons-io-2.4/commons-io-2.4.jar"/>
<classpathentry exported="true" kind="lib" path="libs/commons-lang3-3.1/commons-lang3-3.1.jar"/>
<classpathentry exported="true" kind="lib" path="libs/httpclient-4.3.1/httpclient-4.3.1.jar"/>
<classpathentry exported="true" kind="lib" path="libs/httpcore-4.3/httpcore-4.3.jar"/>
<classpathentry exported="true" kind="lib" path="libs/jsr305-1.3.9/jsr305-1.3.9.jar"/>
<classpathentry exported="true" kind="lib" path="libs/logging-1.1.3/commons-logging-1.1.3.jar"/>
<classpathentry exported="true" kind="lib" path="libs/applicationinsights-core/applicationinsights-core-1.0.4.jar"/>
<classpathentry exported="true" kind="lib" path="libs/jackson-core-2.4.1/jackson-annotations-2.4.1.jar" sourcepath="libs_src/jackson-core-2.4.1/jackson-annotations-2.4.1-sources.jar">
<attributes>
<attribute name="javadoc_location" value="jar:platform:/resource/com.microsoft.tfs.core/libs_src/jackson-core-2.4.1/jackson-annotations-2.4.1-javadoc.jar!/"/>
Expand All @@ -41,9 +33,15 @@
<attribute name="javadoc_location" value="jar:platform:/resource/com.microsoft.tfs.core/libs_src/jackson-core-2.4.1/jackson-databind-2.4.1-javadoc.jar!/"/>
</attributes>
</classpathentry>
<classpathentry exported="true" kind="lib" path="libs/annotation-detector-3.0.4/annotation-detector-3.0.4.jar"/>
<classpathentry exported="true" kind="lib" path="libs/jna/jna-4.2.1.jar"/>
<classpathentry exported="true" kind="lib" path="libs/jna/jna-platform-4.2.1.jar"/>
<classpathentry kind="lib" path="libs/jsr305-1.3.9/jsr305-1.3.9.jar"/>
<classpathentry exported="true" kind="lib" path="libs/slf4j/slf4j-api-1.7.19.jar"/>
<classpathentry exported="true" kind="lib" path="libs/slf4j/slf4j-log4j12-1.7.19.jar"/>
<classpathentry exported="true" kind="lib" path="libs/oauth2-useragent/oauth2-useragent-0.11.2.jar" sourcepath="libs/oauth2-useragent/oauth2-useragent-0.11.2-sources.jar"/>
<classpathentry exported="true" kind="lib" path="libs/java-auth-lib/auth-common-0.5.0.jar" sourcepath="libs/java-auth-lib/auth-common-0.5.0-sources.jar"/>
<classpathentry exported="true" kind="lib" path="libs/java-auth-lib/auth-core-0.5.0.jar" sourcepath="libs/java-auth-lib/auth-core-0.5.0-sources.jar"/>
<classpathentry exported="true" kind="lib" path="libs/java-auth-lib/auth-providers-0.5.0.jar" sourcepath="libs/java-auth-lib/auth-providers-0.5.0-sources.jar"/>
<classpathentry exported="true" kind="lib" path="libs/java-auth-lib/auth-secure-storage-0.5.0.jar" sourcepath="libs/java-auth-lib/auth-secure-storage-0.5.0-sources.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
21 changes: 2 additions & 19 deletions source/com.microsoft.tfs.core/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,9 @@ Bundle-Name: %Bundle-Name
Bundle-SymbolicName: com.microsoft.tfs.core;singleton:=true
Bundle-Version: 14.111.1.qualifier
Bundle-ClassPath: com.microsoft.tfs.core.jar,
libs/AlmHttpClient-15.105.0.20161011/alm-vss-client-15.105.0-SNAPSHOT.jar,
libs/AlmHttpClient-15.105.0.20161011/alm-gallery-client-15.105.0-SNAPSHOT.jar,
libs/AlmHttpClient-15.105.0.20161011/alm-extensionmanagement-client-15.105.0-SNAPSHOT.jar,
libs/AlmHttpClient-15.105.0.20161011/alm-distributedtask-client-15.105.0-SNAPSHOT.jar,
libs/AlmHttpClient-15.105.0.20161011/alm-tfs-client-15.105.0-SNAPSHOT.jar,
libs/AlmHttpClient-15.105.0.20161011/alm-releasemanagement-client-15.105.0-SNAPSHOT.jar,
libs/AlmHttpClient-15.108.2/alm-vss-client-15.108.2-20161228.200110-6.jar,
libs/AlmHttpClient-15.108.2/alm-tfs-client-15.108.2-20161228.200220-6.jar,
libs/hsqldb-1.8.0.10-ebcdic/hsqldb.jar,
libs/xerces-2.8.0/xercesImpl.jar,
libs/xerces-2.8.0/xml-apis.jar,
libs/guava-12.0.1/guava-12.0.1.jar,
libs/commons-codec-1.6/commons-codec-1.6.jar,
libs/commons-io-2.4/commons-io-2.4.jar,
Expand Down Expand Up @@ -81,7 +75,6 @@ Export-Package: .,
com.microsoft.alm.teamfoundation.chat.webapi,
com.microsoft.alm.teamfoundation.core.webapi,
com.microsoft.alm.teamfoundation.core.webapi.types,
com.microsoft.alm.teamfoundation.distributedtask.webapi,
com.microsoft.alm.teamfoundation.policy.webapi,
com.microsoft.alm.teamfoundation.sourcecontrol.webapi,
com.microsoft.alm.teamfoundation.sourcecontrol.webapi.internal,
Expand All @@ -96,17 +89,11 @@ Export-Package: .,
com.microsoft.alm.visualstudio.services.customerintelligence.webapi,
com.microsoft.alm.visualstudio.services.delegatedauthorization,
com.microsoft.alm.visualstudio.services.delegatedauthorization.client,
com.microsoft.alm.visualstudio.services.extensionmanagement.webapi,
com.microsoft.alm.visualstudio.services.extensionmanagement.webapi.acquisitionrequest,
com.microsoft.alm.visualstudio.services.featureavailability,
com.microsoft.alm.visualstudio.services.featureavailability.webapi,
com.microsoft.alm.visualstudio.services.filecontainer,
com.microsoft.alm.visualstudio.services.filecontainer.client,
com.microsoft.alm.visualstudio.services.forminput,
com.microsoft.alm.visualstudio.services.gallery.webapi,
com.microsoft.alm.visualstudio.services.gallery.webapi.acquisitionoption,
com.microsoft.alm.visualstudio.services.gallery.webapi.acquisitionrequest,
com.microsoft.alm.visualstudio.services.gallery.webapi.commerce,
com.microsoft.alm.visualstudio.services.identity,
com.microsoft.alm.visualstudio.services.identity.client,
com.microsoft.alm.visualstudio.services.identity.mru,
Expand All @@ -115,10 +102,6 @@ Export-Package: .,
com.microsoft.alm.visualstudio.services.operations,
com.microsoft.alm.visualstudio.services.profile,
com.microsoft.alm.visualstudio.services.profile.client,
com.microsoft.alm.visualstudio.services.releasemanagement.webapi,
com.microsoft.alm.visualstudio.services.releasemanagement.webapi.contracts,
com.microsoft.alm.visualstudio.services.releasemanagement.webapi.contracts.conditions,
com.microsoft.alm.visualstudio.services.releasemanagement.webapi.events,
com.microsoft.alm.visualstudio.services.security,
com.microsoft.alm.visualstudio.services.security.client,
com.microsoft.alm.visualstudio.services.webapi,
Expand Down
11 changes: 3 additions & 8 deletions source/com.microsoft.tfs.core/build.properties
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
bin.includes = META-INF/,\
about.html,\
libs/hsqldb-1.8.0.10-ebcdic/hsqldb.jar,\
libs/xerces-2.8.0/xercesImpl.jar,\
libs/xerces-2.8.0/xml-apis.jar,\
com.microsoft.tfs.core.jar,\
plugin.properties,\
libs/guava-12.0.1/guava-12.0.1.jar,\
Expand All @@ -27,11 +25,8 @@ bin.includes = META-INF/,\
libs/java-auth-lib/auth-core-0.5.0.jar,\
libs/java-auth-lib/auth-providers-0.5.0.jar,\
libs/java-auth-lib/auth-secure-storage-0.5.0.jar,\
libs/AlmHttpClient-15.105.0.20161011/alm-distributedtask-client-15.105.0-SNAPSHOT.jar,\
libs/AlmHttpClient-15.105.0.20161011/alm-extensionmanagement-client-15.105.0-SNAPSHOT.jar,\
libs/AlmHttpClient-15.105.0.20161011/alm-gallery-client-15.105.0-SNAPSHOT.jar,\
libs/AlmHttpClient-15.105.0.20161011/alm-releasemanagement-client-15.105.0-SNAPSHOT.jar,\
libs/AlmHttpClient-15.105.0.20161011/alm-tfs-client-15.105.0-SNAPSHOT.jar,\
libs/AlmHttpClient-15.105.0.20161011/alm-vss-client-15.105.0-SNAPSHOT.jar
libs/AlmHttpClient-15.108.2/alm-vss-client-15.108.2-20161228.200110-6.jar,\
libs/AlmHttpClient-15.108.2/alm-tfs-client-15.108.2-20161228.200220-6.jar
source.com.microsoft.tfs.core.jar = src/,\
rest_core/
src.excludes = tests/
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.microsoft.alm.client.model.VssResourceNotFoundException;
import com.microsoft.alm.client.model.VssServiceException;
import com.microsoft.alm.client.utils.JsonHelper;
import com.microsoft.alm.client.VssRestClientHandler;
import com.microsoft.alm.visualstudio.services.webapi.ApiResourceLocation;
import com.microsoft.alm.visualstudio.services.webapi.ApiResourceLocationCollection;
import com.microsoft.alm.visualstudio.services.webapi.ApiResourceVersion;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file gets replaced at build-time with the correct numbers.
# This version gets checked in so debugging/tfdev works.
number.version.major=14
number.version.minor=0
number.version.service=4
number.version.minor=111
number.version.service=1
number.version.build=SNAPSHOT