Skip to content

Commit c8ef8a5

Browse files
authored
Cleanup DLP Risk Analysis snippets (GoogleCloudPlatform#2069)
* refactored Risk analysis samples * updated inspect tests and readme * moved parameters to inline, cleaned up files, reformatted for consistency * replaced iterators with intstream in RiskAnalysisKMap * moved message receiver lambda to its own method * ran code formatter * refactored long messageReciever lambda * rewrote lambda for pubsub message receiver * replaced int stream with for loop
1 parent 08086de commit c8ef8a5

File tree

9 files changed

+995
-966
lines changed

9 files changed

+995
-966
lines changed

dlp/README.md

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,28 @@ Commands:
6868

6969
## Integration tests
7070
### Setup
71+
- Ensure that `GOOGLE_APPLICATION_CREDENTIALS` points to authorized service account credentials file.
7172
- [Create a Google Cloud Storage bucket](https://console.cloud.google.com/storage) and upload [test.txt](src/test/resources/test.txt).
72-
- Set the `GCS_PATH` environment variable to point to the path for the bucket.
73+
- Set the `GCS_PATH` environment variable to point to the path for the bucket.
74+
- Copy and paste the data below into a CSV file and [create a BigQuery table](https://cloud.google.com/bigquery/docs/loading-data-local) from the file:
75+
```$xslt
76+
Name,TelephoneNumber,Mystery,Age,Gender
77+
James,(567) 890-1234,8291 3627 8250 1234,19,Male
78+
Gandalf,(123) 456-7890,4231 5555 6781 9876,27,Male
79+
Dumbledore,(313) 337-1337,6291 8765 1095 7629,27,Male
80+
Joe,(452) 123-1234,3782 2288 1166 3030,35,Male
81+
Marie,(452) 123-1234,8291 3627 8250 1234,35,Female
82+
Carrie,(567) 890-1234,2253 5218 4251 4526,35,Female
83+
84+
```
85+
- Set the `BIGQUERY_DATASET` and `BIGQUERY_TABLE` environment values.
86+
- [Create a Google Cloud Pub/Sub](https://console.cloud.google.com/datastore) topic and and a subscription that is subscribed to the topic.
87+
- Set the `PUB_SUB_TOPIC` and `PUB_SUB_SUBSCRIPTION` environment variables to the corresponding values.
7388
- [Create a Google Cloud Datastore](https://console.cloud.google.com/datastore) kind and add an entity with properties:
7489
- `property1` : john@doe.com
7590
- `property2` : 343-343-3435
76-
- [Create a Google Cloud Pub/Sub](https://console.cloud.google.com/datastore) topic with the id `dlp-tests` and a subscription with the id `dlp-test`
77-
- Set the `PUB_SUB_TOPIC_ID` and `PUB_SUB_SUBSCRIPTION_ID` to the corresponding values.
78-
- Update the Google Cloud Storage path and Datastore kind in [InspectTests.java](src/test/java/dlp/snippets/InspectTests.java).
79-
- Ensure that `GOOGLE_APPLICATION_CREDENTIALS` points to authorized service account credentials file.
91+
- Update the Datastore kind in [InspectTests.java](src/test/java/dlp/snippets/InspectTests.java).
92+
8093
8194
## Run
8295
Run all tests:

0 commit comments

Comments
 (0)