Skip to content

Commit 7a3f332

Browse files
authored
healthcare API: update Pub/Sub URI and fix FhirResourceDeletePurge formatting/test (GoogleCloudPlatform#5729)
* healthcare API: update Pub/Sub topic example to use fully qualified URI * fix FhirResourceDeletePurge resource path * fix lint
1 parent a0cdbca commit 7a3f332

5 files changed

Lines changed: 17 additions & 17 deletions

File tree

healthcare/v1/src/main/java/snippets/healthcare/dicom/DicomStorePatch.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public static void patchDicomStore(String dicomStoreName, String pubsubTopic) th
4040
// String dicomStoreName =
4141
// String.format(
4242
// DICOM_NAME, "your-project-id", "your-region-id", "your-dataset-id", "your-dicom-id");
43-
// String pubsubTopic = "your-pubsub-topic";
43+
// String pubsubTopic = "projects/your-project-id/topics/your-pubsub-topic";
4444

4545
// Initialize the client, which will be used to interact with the service.
4646
CloudHealthcare client = createClient();

healthcare/v1/src/main/java/snippets/healthcare/fhir/FhirStorePatch.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public static void fhirStorePatch(String fhirStoreName, String pubsubTopic) thro
4040
// String fhirStoreName =
4141
// String.format(
4242
// FHIR_NAME, "your-project-id", "your-region-id", "your-dataset-id", "your-fhir-id");
43-
// String pubsubTopic = "your-pubsub-topic";
43+
// String pubsubTopic = "projects/your-project-id/topics/your-pubsub-topic";
4444

4545
// Initialize the client, which will be used to interact with the service.
4646
CloudHealthcare client = createClient();

healthcare/v1/src/main/java/snippets/healthcare/fhir/resources/FhirResourceDeletePurge.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,16 @@
3939

4040
public class FhirResourceDeletePurge {
4141
private static final String FHIR_NAME =
42-
"projects/%s/locations/%s/datasets/%s/fhirStores/%s/fhir/%s";
42+
"projects/%s/locations/%s/datasets/%s/fhirStores/%s/fhir/%s/%s";
4343
private static final JsonFactory JSON_FACTORY = new JacksonFactory();
4444
private static final NetHttpTransport HTTP_TRANSPORT = new NetHttpTransport();
4545

4646
public static void fhirResourceDeletePurge(String resourceName)
4747
throws IOException, URISyntaxException {
4848
// String resourceName =
4949
// String.format(
50-
// FHIR_NAME, "project-id", "region-id", "dataset-id", "store-id", "fhir-id");
50+
// FHIR_NAME, "project-id", "region-id", "dataset-id", "store-id", "resource-type",
51+
// "resource-id");
5152

5253
// Initialize the client, which will be used to interact with the service.
5354
CloudHealthcare client = createClient();
@@ -75,7 +76,7 @@ public static void fhirResourceDeletePurge(String resourceName)
7576
responseEntity.writeTo(System.err);
7677
throw new RuntimeException(errorMessage);
7778
}
78-
System.out.println("FHIR resource history purged.");
79+
System.out.println("FHIR resource history purged (excluding current version).");
7980
responseEntity.writeTo(System.out);
8081
}
8182

@@ -104,7 +105,7 @@ private static String getAccessToken() throws IOException {
104105
GoogleCredentials credential =
105106
GoogleCredentials.getApplicationDefault()
106107
.createScoped(Collections.singleton(CloudHealthcareScopes.CLOUD_PLATFORM));
107-
108+
108109
return credential.refreshAccessToken().getTokenValue();
109110
}
110111
}

healthcare/v1/src/main/java/snippets/healthcare/hl7v2/Hl7v2StorePatch.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public static void patchHl7v2Store(String hl7v2StoreName, String pubsubTopic) th
4242
// String hl7v2StoreName =
4343
// String.format(
4444
// HL7v2_NAME, "your-project-id", "your-region-id", "your-dataset-id", "your-hl7v2-id");
45-
// String pubsubTopic = "your-pubsub-topic";
45+
// String pubsubTopic = "projects/your-project-id/topics/your-pubsub-topic";
4646

4747
// Initialize the client, which will be used to interact with the service.
4848
CloudHealthcare client = createClient();

healthcare/v1/src/test/java/snippets/healthcare/FhirResourceTests.java

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -199,14 +199,6 @@ public void test_FhirResourceGetPatientEverything() throws Exception {
199199
assertThat(output, containsString("Patient compartment results:"));
200200
}
201201

202-
@Test
203-
public void test_FhirResourceDelete() throws Exception {
204-
FhirResourceDelete.fhirResourceDelete(fhirResourceName);
205-
206-
String output = bout.toString();
207-
assertThat(output, containsString("FHIR resource deleted."));
208-
}
209-
210202
@Test
211203
public void test_FhirResourceGetHistory() throws Exception {
212204
JsonObject json = new JsonObject();
@@ -251,10 +243,17 @@ public void test_DeletePurgeFhirResource() throws Exception {
251243
JsonArray jarray = new JsonArray();
252244
jarray.add(json);
253245
FhirResourcePatch.fhirResourcePatch(fhirResourceName, jarray.toString());
254-
FhirResourceDelete.fhirResourceDelete(fhirResourceName);
255246
FhirResourceDeletePurge.fhirResourceDeletePurge(fhirResourceName);
256247

257248
String output = bout.toString();
258-
assertThat(output, containsString("FHIR resource history purged."));
249+
assertThat(output, containsString("FHIR resource history purged (excluding current version)."));
250+
}
251+
252+
@Test
253+
public void test_FhirResourceDelete() throws Exception {
254+
FhirResourceDelete.fhirResourceDelete(fhirResourceName);
255+
256+
String output = bout.toString();
257+
assertThat(output, containsString("FHIR resource deleted."));
259258
}
260259
}

0 commit comments

Comments
 (0)