Skip to content

Commit

Permalink
Commit changes
Browse files Browse the repository at this point in the history
  • Loading branch information
dexamundsen committed Jul 19, 2023
1 parent d3c5f87 commit b36ced3
Show file tree
Hide file tree
Showing 13 changed files with 161 additions and 103 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import static bio.terra.workspace.common.GcsBucketUtils.waitForProjectAccess;
import static bio.terra.workspace.common.fixtures.ControlledResourceFixtures.RESOURCE_DESCRIPTION;
import static bio.terra.workspace.common.utils.MockMvcUtils.CONTROLLED_GCP_BIG_QUERY_DATASET_V1_PATH_FORMAT;
import static bio.terra.workspace.common.utils.MockGcpApi.CONTROLLED_GCP_BIG_QUERY_DATASET_V1_PATH_FORMAT;
import static bio.terra.workspace.common.utils.MockMvcUtils.assertApiBqDatasetEquals;
import static bio.terra.workspace.common.utils.MockMvcUtils.assertControlledResourceMetadata;
import static bio.terra.workspace.common.utils.MockMvcUtils.assertResourceMetadata;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
import static bio.terra.workspace.common.GcsBucketUtils.buildSignedUrlListObject;
import static bio.terra.workspace.common.GcsBucketUtils.waitForProjectAccess;
import static bio.terra.workspace.common.fixtures.ControlledResourceFixtures.RESOURCE_DESCRIPTION;
import static bio.terra.workspace.common.utils.MockMvcUtils.CONTROLLED_GCP_GCS_BUCKET_V1_PATH_FORMAT;
import static bio.terra.workspace.common.utils.MockMvcUtils.LOAD_SIGNED_URL_LIST_PATH_FORMAT;
import static bio.terra.workspace.common.utils.MockMvcUtils.LOAD_SIGNED_URL_LIST_RESULT_PATH_FORMAT;
import static bio.terra.workspace.common.utils.MockGcpApi.CONTROLLED_GCP_GCS_BUCKET_V1_PATH_FORMAT;
import static bio.terra.workspace.common.utils.MockGcpApi.LOAD_SIGNED_URL_LIST_PATH_FORMAT;
import static bio.terra.workspace.common.utils.MockGcpApi.LOAD_SIGNED_URL_LIST_RESULT_PATH_FORMAT;
import static bio.terra.workspace.common.utils.MockMvcUtils.assertApiGcsBucketEquals;
import static bio.terra.workspace.common.utils.MockMvcUtils.assertControlledResourceMetadata;
import static bio.terra.workspace.common.utils.MockMvcUtils.assertResourceMetadata;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package bio.terra.workspace.app.controller;

import static bio.terra.workspace.common.utils.MockMvcUtils.CONTROLLED_GCP_BIG_QUERY_DATASETS_V1_PATH_FORMAT;
import static bio.terra.workspace.common.utils.MockMvcUtils.GENERATE_GCP_AI_NOTEBOOK_NAME_PATH_FORMAT;
import static bio.terra.workspace.common.utils.MockMvcUtils.GENERATE_GCP_BQ_DATASET_NAME_PATH_FORMAT;
import static bio.terra.workspace.common.utils.MockMvcUtils.GENERATE_GCP_GCS_BUCKET_NAME_PATH_FORMAT;
import static bio.terra.workspace.common.utils.MockGcpApi.CONTROLLED_GCP_BIG_QUERY_DATASETS_V1_PATH_FORMAT;
import static bio.terra.workspace.common.utils.MockGcpApi.GENERATE_GCP_AI_NOTEBOOK_NAME_PATH_FORMAT;
import static bio.terra.workspace.common.utils.MockGcpApi.GENERATE_GCP_BQ_DATASET_NAME_PATH_FORMAT;
import static bio.terra.workspace.common.utils.MockGcpApi.GENERATE_GCP_GCS_BUCKET_NAME_PATH_FORMAT;
import static bio.terra.workspace.common.utils.MockMvcUtils.USER_REQUEST;
import static bio.terra.workspace.common.utils.MockMvcUtils.addAuth;
import static bio.terra.workspace.service.workspace.model.WorkspaceConstants.ResourceProperties.FOLDER_ID_KEY;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package bio.terra.workspace.app.controller;

import static bio.terra.workspace.common.utils.MockMvcUtils.REFERENCED_GCP_BIG_QUERY_DATASET_V1_PATH_FORMAT;
import static bio.terra.workspace.common.utils.MockGcpApi.REFERENCED_GCP_BIG_QUERY_DATASET_V1_PATH_FORMAT;
import static bio.terra.workspace.common.utils.MockMvcUtils.assertApiBqDatasetEquals;
import static bio.terra.workspace.common.utils.MockMvcUtils.assertResourceMetadata;
import static org.hamcrest.MatcherAssert.assertThat;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package bio.terra.workspace.app.controller;

import static bio.terra.workspace.common.fixtures.ControlledResourceFixtures.RESOURCE_DESCRIPTION;
import static bio.terra.workspace.common.utils.MockMvcUtils.REFERENCED_GCP_BIG_QUERY_DATA_TABLE_V1_PATH_FORMAT;
import static bio.terra.workspace.common.utils.MockGcpApi.REFERENCED_GCP_BIG_QUERY_DATA_TABLE_V1_PATH_FORMAT;
import static bio.terra.workspace.common.utils.MockMvcUtils.assertApiBqDataTableEquals;
import static bio.terra.workspace.common.utils.MockMvcUtils.assertResourceMetadata;
import static org.hamcrest.MatcherAssert.assertThat;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package bio.terra.workspace.app.controller;

import static bio.terra.workspace.common.fixtures.ControlledResourceFixtures.RESOURCE_DESCRIPTION;
import static bio.terra.workspace.common.utils.MockMvcUtils.REFERENCED_GCP_GCS_BUCKET_V1_PATH_FORMAT;
import static bio.terra.workspace.common.utils.MockGcpApi.REFERENCED_GCP_GCS_BUCKET_V1_PATH_FORMAT;
import static bio.terra.workspace.common.utils.MockMvcUtils.assertApiGcsBucketEquals;
import static bio.terra.workspace.common.utils.MockMvcUtils.assertResourceMetadata;
import static org.hamcrest.MatcherAssert.assertThat;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package bio.terra.workspace.app.controller;

import static bio.terra.workspace.common.fixtures.ControlledResourceFixtures.RESOURCE_DESCRIPTION;
import static bio.terra.workspace.common.utils.MockMvcUtils.REFERENCED_GCP_GCS_OBJECT_V1_PATH_FORMAT;
import static bio.terra.workspace.common.utils.MockGcpApi.REFERENCED_GCP_GCS_OBJECT_V1_PATH_FORMAT;
import static bio.terra.workspace.common.utils.MockMvcUtils.assertResourceMetadata;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsInAnyOrder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import static bio.terra.workspace.common.fixtures.PolicyFixtures.IOWA_REGION;
import static bio.terra.workspace.common.fixtures.WorkspaceFixtures.DEFAULT_SPEND_PROFILE_NAME;
import static bio.terra.workspace.common.utils.MockMvcUtils.CLONE_WORKSPACE_PATH_FORMAT;
import static bio.terra.workspace.common.utils.MockMvcUtils.REFERENCED_GCP_GCS_BUCKETS_V1_PATH_FORMAT;
import static bio.terra.workspace.common.utils.MockGcpApi.REFERENCED_GCP_GCS_BUCKETS_V1_PATH_FORMAT;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
Expand Down
105 changes: 105 additions & 0 deletions service/src/test/java/bio/terra/workspace/common/utils/MockGcpApi.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
package bio.terra.workspace.common.utils;

import org.springframework.stereotype.Component;

@Component
public class MockGcpApi extends MockMvcUtils {

// GCS Bucket

public static final String GET_REFERENCED_GCP_GCS_BUCKET_FORMAT =
"/api/workspaces/v1/%s/resources/referenced/gcp/buckets/%s";
public static final String CLONE_CONTROLLED_GCP_GCS_BUCKET_FORMAT =
"/api/workspaces/v1/%s/resources/controlled/gcp/buckets/%s/clone";
public static final String CLONE_RESULT_CONTROLLED_GCP_GCS_BUCKET_FORMAT =
"/api/workspaces/v1/%s/resources/controlled/gcp/buckets/clone-result/%s";
public static final String GENERATE_GCP_GCS_BUCKET_NAME_PATH_FORMAT =
"/api/workspaces/v1/%s/resources/controlled/gcp/buckets/generateName";
public static final String CONTROLLED_GCP_GCS_BUCKETS_V1_PATH_FORMAT =
"/api/workspaces/v1/%s/resources/controlled/gcp/buckets";
public static final String CONTROLLED_GCP_GCS_BUCKET_V1_PATH_FORMAT = // todo-dex
"/api/workspaces/v1/%s/resources/controlled/gcp/buckets/%s";
public static final String REFERENCED_GCP_GCS_BUCKETS_V1_PATH_FORMAT =
"/api/workspaces/v1/%s/resources/referenced/gcp/buckets";
public static final String LOAD_SIGNED_URL_LIST_PATH_FORMAT =
"/api/workspaces/alpha1/%s/resources/controlled/gcp/buckets/%s/load";
public static final String LOAD_SIGNED_URL_LIST_RESULT_PATH_FORMAT =
"/api/workspaces/alpha1/%s/resources/controlled/gcp/buckets/%s/load/result/%s";
public static final String REFERENCED_GCP_GCS_BUCKET_V1_PATH_FORMAT =
"/api/workspaces/v1/%s/resources/referenced/gcp/buckets/%s";
public static final String CLONE_REFERENCED_GCP_GCS_BUCKET_V1_PATH_FORMAT =
"/api/workspaces/v1/%s/resources/referenced/gcp/buckets/%s/clone";

// GCS Object

public static final String REFERENCED_GCP_GCS_OBJECTS_V1_PATH_FORMAT =
"/api/workspaces/v1/%s/resources/referenced/gcp/bucket/objects";
public static final String REFERENCED_GCP_GCS_OBJECT_V1_PATH_FORMAT =
"/api/workspaces/v1/%s/resources/referenced/gcp/bucket/objects/%s";
public static final String CLONE_REFERENCED_GCP_GCS_OBJECT_V1_PATH_FORMAT =
"/api/workspaces/v1/%s/resources/referenced/gcp/bucket/objects/%s/clone";

// Big Query

public static final String CONTROLLED_GCP_BIG_QUERY_DATASETS_V1_PATH_FORMAT =
"/api/workspaces/v1/%s/resources/controlled/gcp/bqdatasets";
public static final String CONTROLLED_GCP_BIG_QUERY_DATASET_V1_PATH_FORMAT =
"/api/workspaces/v1/%s/resources/controlled/gcp/bqdatasets/%s";
public static final String CLONE_CONTROLLED_GCP_BIG_QUERY_DATASET_FORMAT =
"/api/workspaces/v1/%s/resources/controlled/gcp/bqdatasets/%s/clone";
public static final String CLONE_RESULT_CONTROLLED_GCP_BIG_QUERY_DATASET_FORMAT =
"/api/workspaces/v1/%s/resources/controlled/gcp/bqdatasets/clone-result/%s";

// BQ Dataset

public static final String GENERATE_GCP_BQ_DATASET_NAME_PATH_FORMAT =
"/api/workspaces/v1/%s/resources/controlled/gcp/bqdatasets/generateName";
public static final String REFERENCED_GCP_BIG_QUERY_DATASETS_V1_PATH_FORMAT =
"/api/workspaces/v1/%s/resources/referenced/gcp/bigquerydatasets";
public static final String REFERENCED_GCP_BIG_QUERY_DATASET_V1_PATH_FORMAT =
"/api/workspaces/v1/%s/resources/referenced/gcp/bigquerydatasets/%s";
public static final String CLONE_REFERENCED_GCP_BIG_QUERY_DATASET_V1_PATH_FORMAT =
"/api/workspaces/v1/%s/resources/referenced/gcp/bigquerydatasets/%s/clone";

// BQ Datatable

public static final String REFERENCED_GCP_BIG_QUERY_DATA_TABLES_V1_PATH_FORMAT =
"/api/workspaces/v1/%s/resources/referenced/gcp/bigquerydatatables";
public static final String REFERENCED_GCP_BIG_QUERY_DATA_TABLE_V1_PATH_FORMAT =
"/api/workspaces/v1/%s/resources/referenced/gcp/bigquerydatatables/%s";
public static final String CLONE_REFERENCED_GCP_BIG_QUERY_DATA_TABLE_V1_PATH_FORMAT =
"/api/workspaces/v1/%s/resources/referenced/gcp/bigquerydatatables/%s/clone";

// AI Notebook

public static final String GENERATE_GCP_AI_NOTEBOOK_NAME_PATH_FORMAT =
"/api/workspaces/v1/%s/resources/controlled/gcp/ai-notebook-instances/generateName";
public static final String CONTROLLED_GCP_AI_NOTEBOOKS_V1_PATH_FORMAT = // TODO-dex
"/api/workspaces/v1/%s/resources/controlled/gcp/ai-notebook-instances";
public static final String CONTROLLED_GCP_AI_NOTEBOOK_V1_PATH_FORMAT =
"/api/workspaces/v1/%s/resources/controlled/gcp/ai-notebook-instances/%s";
public static final String CONTROLLED_GCP_AI_NOTEBOOKS_V1_RESULT_PATH_FORMAT =
"/api/workspaces/v1/%s/resources/controlled/gcp/ai-notebook-instances/create-result/%s";

// GCE Instance

public static final String GENERATE_GCP_GCE_INSTANCE_NAME_PATH_FORMAT =
"/api/workspaces/v1/%s/resources/controlled/gcp/gce-instances/generateName";
public static final String CONTROLLED_GCP_GCE_INSTANCES_V1_PATH_FORMAT =
"/api/workspaces/v1/%s/resources/controlled/gcp/gce-instances";
public static final String CONTROLLED_GCP_GCE_INSTANCE_V1_PATH_FORMAT = // TODO-dex
"/api/workspaces/v1/%s/resources/controlled/gcp/gce-instances/%s";
public static final String CONTROLLED_GCP_GCE_INSTANCES_V1_RESULT_PATH_FORMAT =
"/api/workspaces/v1/%s/resources/controlled/gcp/gce-instances/create-result/%s";

// DataProc Cluster

public static final String GENERATE_GCP_DATAPROC_CLUSTER_NAME_PATH_FORMAT =
"/api/workspaces/v1/%s/resources/controlled/gcp/dataproc-clusters/generateName";
public static final String CONTROLLED_GCP_DATAPROC_CLUSTERS_PATH_FORMAT =
"/api/workspaces/v1/%s/resources/controlled/gcp/dataproc-clusters";
public static final String CONTROLLED_GCP_DATAPROC_CLUSTER_PATH_FORMAT =
"/api/workspaces/v1/%s/resources/controlled/gcp/dataproc-clusters/%s";
public static final String CONTROLLED_GCP_DATAPROC_CLUSTERS_RESULT_PATH_FORMAT =
"/api/workspaces/v1/%s/resources/controlled/gcp/dataproc-clusters/create-result/%s";
}
Loading

0 comments on commit b36ced3

Please sign in to comment.