diff --git a/service/src/test/java/bio/terra/pipelines/dependencies/gcs/GcsServiceTest.java b/service/src/test/java/bio/terra/pipelines/dependencies/gcs/GcsServiceTest.java index 48e62b13..f3f4019f 100644 --- a/service/src/test/java/bio/terra/pipelines/dependencies/gcs/GcsServiceTest.java +++ b/service/src/test/java/bio/terra/pipelines/dependencies/gcs/GcsServiceTest.java @@ -66,6 +66,22 @@ void generatePutObjectSignedUrl() throws MalformedURLException { assertEquals(fakeURL, generatedURL); } + @Test + void generateGetObjectSignedUrl() throws MalformedURLException { + URL fakeURL = new URL("https://storage.googleapis.com/signed-url-stuff"); + when(mockStorageService.signUrl( + any(BlobInfo.class), + anyLong(), + any(TimeUnit.class), + any(Storage.SignUrlOption.class), + any(Storage.SignUrlOption.class))) + .thenReturn(fakeURL); + + URL generatedURL = + gcsService.generateGetObjectSignedUrl("projectId", "bucketName", "objectName"); + assertEquals(fakeURL, generatedURL); + } + @Test void socketExceptionRetriesEventuallySucceed() throws Exception { URL fakeURL = new URL("https://storage.googleapis.com/signed-url-stuff"); diff --git a/service/src/test/java/bio/terra/pipelines/dependencies/rawls/RawlsServiceTest.java b/service/src/test/java/bio/terra/pipelines/dependencies/rawls/RawlsServiceTest.java index 504758ff..80a512f9 100644 --- a/service/src/test/java/bio/terra/pipelines/dependencies/rawls/RawlsServiceTest.java +++ b/service/src/test/java/bio/terra/pipelines/dependencies/rawls/RawlsServiceTest.java @@ -216,6 +216,25 @@ void upsertDataTableEntity() throws Exception { assertEquals(expectedResponse, rawlsService.upsertDataTableEntity(any(), any(), any(), any())); } + @Test + void getDataTableEntity() throws Exception { + Entity expectedResponse = new Entity().name("entityName").entityType("entityType"); + + rawlsClient = mock(RawlsClient.class); + EntitiesApi entitiesApi = mock(EntitiesApi.class); + when(entitiesApi.getEntity(any(), any(), any(), any(), any(), any())) + .thenReturn(expectedResponse); + + rawlsService = spy(new RawlsService(rawlsClient, template)); + + doReturn(entitiesApi).when(rawlsClient).getEntitiesApi(any()); + + assertEquals( + expectedResponse, + rawlsService.getDataTableEntity( + "token", "billingProject", "workspace", "entityType", "entityName")); + } + @Test void submissionIsNotRunning() { assertFalse(RawlsService.submissionIsRunning(new Submission().status(SubmissionStatus.DONE)));