Skip to content

Commit

Permalink
Merge branch 'develop' into feature/limit_tests
Browse files Browse the repository at this point in the history
  • Loading branch information
denis-yuen committed Apr 24, 2019
2 parents c7d813d + 96c8af3 commit cdf88a9
Show file tree
Hide file tree
Showing 14 changed files with 523 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
import io.swagger.client.api.UsersApi;
import io.swagger.client.api.WorkflowsApi;
import io.swagger.client.model.DescriptorLanguageBean;
import io.swagger.client.model.Config;
import io.swagger.client.model.DockstoreTool;
import io.swagger.client.model.Entry;
import io.swagger.client.model.MetadataV1;
Expand Down Expand Up @@ -822,6 +823,17 @@ public void testUploadZip() {
Assert.assertEquals(1, updatedWorkflow.getWorkflowVersions().size());
}

/**
* Test that the config endpoint doesn't fail and validates one random property
*/
@Test
public void testConfig() {
final ApiClient webClient = getWebClient();
final MetadataApi metadataApi = new MetadataApi(webClient);
final Config config = metadataApi.getConfig();
Assert.assertEquals("read:org,user:email", config.getGitHubScope());
}

/**
* Tests workflow sharing/permissions.
*
Expand Down
29 changes: 29 additions & 0 deletions dockstore-integration-testing/src/test/resources/dockstore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,32 @@ logging:
timeZone: UTC
target: stdout
logFormat: # TODO

uiConfig:
# Must end with a slash
discourseUrl: https://discuss.dockstore.org/
dnaStackImportUrl: https://app.dnastack.com/#/app/workflow/import/dockstore
fireCloudImportUrl: https://portal.firecloud.org/#import/dockstore
dnaNexusImportUrl: https://platform.dnanexus.com/panx/tools/import-workflow
terraImportUrl: https://app.terra.bio/#import-tool/dockstore

gitHubAuthUrl: https://github.com/login/oauth/authorize
gitHubRedirectPath: /auth/github.com
gitHubScope: read:org,user:email

quayIoAuthUrl: https://quay.io/oauth/authorize
quayIoRedirectPath: /auth/quay.io
quayIoScope: repo:read,user:read

bitBucketAuthUrl: https://bitbucket.org/site/oauth2/authorize

gitlabAuthUrl: https://gitlab.com/oauth/authorize
gitlabRedirectPath: /auth/gitlab.com
gitlabScope: api

googleScope: profile email

cwlVisualizerUri: https://view.commonwl.org

enableLaunchWithFireCloud: true

Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public class DockstoreWebserviceConfiguration extends Configuration {
private String quayClientID;

@NotEmpty
private List<String> githubClientID;
private String githubClientID;

@NotEmpty
private String googleClientID;
Expand All @@ -82,7 +82,7 @@ public class DockstoreWebserviceConfiguration extends Configuration {
private String githubRedirectURI;

@NotEmpty
private List<String> githubClientSecret;
private String githubClientSecret;

@NotEmpty
private String googleRedirectURI;
Expand All @@ -105,6 +105,10 @@ public class DockstoreWebserviceConfiguration extends Configuration {

private List<String> externalGoogleClientIdPrefixes = new ArrayList<>();

@Valid
@NotNull
private UIConfig uiConfig;

@JsonProperty("database")
public DataSourceFactory getDataSourceFactory() {
return database;
Expand Down Expand Up @@ -183,15 +187,15 @@ public void setHttpClientConfiguration(HttpClientConfiguration newHttpClient) {
*/
@JsonProperty
@JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
public List<String> getGithubClientID() {
public String getGithubClientID() {
return githubClientID;
}

/**
* @param githubClientID the githubClientID to set
*/
@JsonProperty
public void setGithubClientID(List<String> githubClientID) {
public void setGithubClientID(String githubClientID) {
this.githubClientID = githubClientID;
}

Expand All @@ -216,15 +220,15 @@ public void setGithubRedirectURI(String githubRedirectURI) {
*/
@JsonProperty
@JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
public List<String> getGithubClientSecret() {
public String getGithubClientSecret() {
return githubClientSecret;
}

/**
* @param githubClientSecret the githubClientSecret to set
*/
@JsonProperty
public void setGithubClientSecret(List<String> githubClientSecret) {
public void setGithubClientSecret(String githubClientSecret) {
this.githubClientSecret = githubClientSecret;
}

Expand Down Expand Up @@ -378,6 +382,11 @@ public void setLimitConfig(LimitConfig limitConfig) {
this.limitConfig = limitConfig;
}

@JsonProperty
public UIConfig getUiConfig() {
return uiConfig;
}

/**
* This config defines values that define the webservice from the outside world.
* Most notably, for swagger. But also to configure generated RSS paths and TRS paths
Expand Down Expand Up @@ -489,4 +498,186 @@ public void setWorkflowVersionLimit(int workflowVersionLimit) {
this.workflowVersionLimit = workflowVersionLimit;
}
}

/**
* A subset of properties returned to the UI. Only a subset because some properties that will
* be used by the UI are also used by the web service and predate the existences of this class.
*/
public static class UIConfig {

/**
* Must end with a slash
*/
private String discourseUrl;

private String dnaStackImportUrl;
private String fireCloudImportUrl;
private String dnaNexusImportUrl;
private String terraImportUrl;

private String gitHubAuthUrl;
private String gitHubRedirectPath;
private String gitHubScope;

private String quayIoAuthUrl;
private String quayIoRedirectPath;
private String quayIoScope;

private String bitBucketAuthUrl;

private String gitlabAuthUrl;
private String gitlabRedirectPath;
private String gitlabScope;

private String googleScope;

private String cwlVisualizerUri;

private boolean enableLaunchWithFireCloud;


public String getDiscourseUrl() {
return discourseUrl;
}

public void setDiscourseUrl(String discourseUrl) {
this.discourseUrl = discourseUrl;
}

public String getDnaStackImportUrl() {
return dnaStackImportUrl;
}

public void setDnaStackImportUrl(String dnaStackImportUrl) {
this.dnaStackImportUrl = dnaStackImportUrl;
}

public String getFireCloudImportUrl() {
return fireCloudImportUrl;
}

public void setFireCloudImportUrl(String fireCloudImportUrl) {
this.fireCloudImportUrl = fireCloudImportUrl;
}

public String getDnaNexusImportUrl() {
return dnaNexusImportUrl;
}

public void setDnaNexusImportUrl(String dnaNexusImportUrl) {
this.dnaNexusImportUrl = dnaNexusImportUrl;
}

public String getTerraImportUrl() {
return terraImportUrl;
}

public void setTerraImportUrl(String terraImportUrl) {
this.terraImportUrl = terraImportUrl;
}

public String getGitHubAuthUrl() {
return gitHubAuthUrl;
}

public void setGitHubAuthUrl(String gitHubAuthUrl) {
this.gitHubAuthUrl = gitHubAuthUrl;
}

public String getGitHubRedirectPath() {
return gitHubRedirectPath;
}

public void setGitHubRedirectPath(String gitHubRedirectPath) {
this.gitHubRedirectPath = gitHubRedirectPath;
}

public String getGitHubScope() {
return gitHubScope;
}

public void setGitHubScope(String gitHubScope) {
this.gitHubScope = gitHubScope;
}

public String getQuayIoAuthUrl() {
return quayIoAuthUrl;
}

public void setQuayIoAuthUrl(String quayIoAuthUrl) {
this.quayIoAuthUrl = quayIoAuthUrl;
}

public String getQuayIoRedirectPath() {
return quayIoRedirectPath;
}

public void setQuayIoRedirectPath(String quayIoRedirectPath) {
this.quayIoRedirectPath = quayIoRedirectPath;
}

public String getQuayIoScope() {
return quayIoScope;
}

public void setQuayIoScope(String quayIoScope) {
this.quayIoScope = quayIoScope;
}

public String getBitBucketAuthUrl() {
return bitBucketAuthUrl;
}

public void setBitBucketAuthUrl(String bitBucketAuthUrl) {
this.bitBucketAuthUrl = bitBucketAuthUrl;
}

public String getGitlabAuthUrl() {
return gitlabAuthUrl;
}

public void setGitlabAuthUrl(String gitlabAuthUrl) {
this.gitlabAuthUrl = gitlabAuthUrl;
}

public String getGitlabRedirectPath() {
return gitlabRedirectPath;
}

public void setGitlabRedirectPath(String gitlabRedirectPath) {
this.gitlabRedirectPath = gitlabRedirectPath;
}

public String getGitlabScope() {
return gitlabScope;
}

public void setGitlabScope(String gitlabScope) {
this.gitlabScope = gitlabScope;
}

public String getGoogleScope() {
return googleScope;
}

public void setGoogleScope(String googleScope) {
this.googleScope = googleScope;
}

public String getCwlVisualizerUri() {
return cwlVisualizerUri;
}

public void setCwlVisualizerUri(String cwlVisualizerUri) {
this.cwlVisualizerUri = cwlVisualizerUri;
}

public boolean isEnableLaunchWithFireCloud() {
return enableLaunchWithFireCloud;
}

public void setEnableLaunchWithFireCloud(boolean enableLaunchWithFireCloud) {
this.enableLaunchWithFireCloud = enableLaunchWithFireCloud;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
package io.dockstore.webservice.api;

import java.lang.reflect.InvocationTargetException;

import io.dockstore.webservice.DockstoreWebserviceConfiguration;
import io.swagger.annotations.ApiModel;
import org.apache.commons.beanutils.BeanUtils;

@ApiModel(description = "Configuration information for UI clients of the Dockstore webservice.")
public final class Config extends DockstoreWebserviceConfiguration.UIConfig {

/**
* Properties that aren't in UIConfig
*/

private String githubClientId;
private String quayIoClientId;
private String bitBucketClientId;
private String gitlabClientId;
private String googleClientId;


private Config() {
}

public static Config fromWebConfig(DockstoreWebserviceConfiguration webConfig)
throws InvocationTargetException, IllegalAccessException {
final Config config = new Config();
config.githubClientId = webConfig.getGithubClientID();
config.quayIoClientId = webConfig.getQuayClientID();
config.bitBucketClientId = webConfig.getBitbucketClientID();
config.gitlabClientId = webConfig.getGitlabClientID();
config.googleClientId = webConfig.getGoogleClientID();
BeanUtils.copyProperties(config, webConfig.getUiConfig());
return config;
}

public String getGithubClientId() {
return githubClientId;
}

public String getQuayIoClientId() {
return quayIoClientId;
}

public String getBitBucketClientId() {
return bitBucketClientId;
}

public String getGitlabClientId() {
return gitlabClientId;
}

public String getGoogleClientId() {
return googleClientId;
}

}

0 comments on commit cdf88a9

Please sign in to comment.