1616
1717package com .google .cloud .asset .v1 ;
1818
19+ import static com .google .cloud .asset .v1 .AssetServiceClient .SearchAllIamPoliciesPagedResponse ;
20+ import static com .google .cloud .asset .v1 .AssetServiceClient .SearchAllResourcesPagedResponse ;
21+
1922import com .google .api .gax .core .NoCredentialsProvider ;
2023import com .google .api .gax .grpc .GaxGrpcProperties ;
2124import com .google .api .gax .grpc .testing .LocalChannelProvider ;
@@ -83,7 +86,7 @@ public void tearDown() throws Exception {
8386 }
8487
8588 @ Test
86- public void exportAssetsTest () {
89+ public void exportAssetsTest () throws Exception {
8790 ExportAssetsResponse expectedResponse =
8891 ExportAssetsResponse .newBuilder ()
8992 .setOutputConfig (OutputConfig .newBuilder ().build ())
@@ -99,7 +102,7 @@ public void exportAssetsTest() {
99102
100103 ExportAssetsRequest request =
101104 ExportAssetsRequest .newBuilder ()
102- .setParent (ProjectName . of ("[PROJECT]" ).toString ())
105+ .setParent (FeedName . ofProjectFeedName ("[PROJECT]" , "[FEED ]" ).toString ())
103106 .addAllAssetTypes (new ArrayList <>())
104107 .setOutputConfig (OutputConfig .newBuilder ().build ())
105108 .build ();
@@ -130,7 +133,7 @@ public void exportAssetsExceptionTest() throws Exception {
130133 try {
131134 ExportAssetsRequest request =
132135 ExportAssetsRequest .newBuilder ()
133- .setParent (ProjectName . of ("[PROJECT]" ).toString ())
136+ .setParent (FeedName . ofProjectFeedName ("[PROJECT]" , "[FEED ]" ).toString ())
134137 .addAllAssetTypes (new ArrayList <>())
135138 .setOutputConfig (OutputConfig .newBuilder ().build ())
136139 .build ();
@@ -144,14 +147,14 @@ public void exportAssetsExceptionTest() throws Exception {
144147 }
145148
146149 @ Test
147- public void batchGetAssetsHistoryTest () {
150+ public void batchGetAssetsHistoryTest () throws Exception {
148151 BatchGetAssetsHistoryResponse expectedResponse =
149152 BatchGetAssetsHistoryResponse .newBuilder ().addAllAssets (new ArrayList <>()).build ();
150153 mockAssetService .addResponse (expectedResponse );
151154
152155 BatchGetAssetsHistoryRequest request =
153156 BatchGetAssetsHistoryRequest .newBuilder ()
154- .setParent (ProjectName . of ("[PROJECT]" ).toString ())
157+ .setParent (FeedName . ofProjectFeedName ("[PROJECT]" , "[FEED ]" ).toString ())
155158 .addAllAssetNames (new ArrayList <>())
156159 .setReadTimeWindow (TimeWindow .newBuilder ().build ())
157160 .build ();
@@ -182,7 +185,7 @@ public void batchGetAssetsHistoryExceptionTest() throws Exception {
182185 try {
183186 BatchGetAssetsHistoryRequest request =
184187 BatchGetAssetsHistoryRequest .newBuilder ()
185- .setParent (ProjectName . of ("[PROJECT]" ).toString ())
188+ .setParent (FeedName . ofProjectFeedName ("[PROJECT]" , "[FEED ]" ).toString ())
186189 .addAllAssetNames (new ArrayList <>())
187190 .setReadTimeWindow (TimeWindow .newBuilder ().build ())
188191 .build ();
@@ -194,7 +197,7 @@ public void batchGetAssetsHistoryExceptionTest() throws Exception {
194197 }
195198
196199 @ Test
197- public void createFeedTest () {
200+ public void createFeedTest () throws Exception {
198201 Feed expectedResponse =
199202 Feed .newBuilder ()
200203 .setName (FeedName .ofProjectFeedName ("[PROJECT]" , "[FEED]" ).toString ())
@@ -235,7 +238,7 @@ public void createFeedExceptionTest() throws Exception {
235238 }
236239
237240 @ Test
238- public void getFeedTest () {
241+ public void getFeedTest () throws Exception {
239242 Feed expectedResponse =
240243 Feed .newBuilder ()
241244 .setName (FeedName .ofProjectFeedName ("[PROJECT]" , "[FEED]" ).toString ())
@@ -276,7 +279,7 @@ public void getFeedExceptionTest() throws Exception {
276279 }
277280
278281 @ Test
279- public void getFeedTest2 () {
282+ public void getFeedTest2 () throws Exception {
280283 Feed expectedResponse =
281284 Feed .newBuilder ()
282285 .setName (FeedName .ofProjectFeedName ("[PROJECT]" , "[FEED]" ).toString ())
@@ -317,7 +320,7 @@ public void getFeedExceptionTest2() throws Exception {
317320 }
318321
319322 @ Test
320- public void listFeedsTest () {
323+ public void listFeedsTest () throws Exception {
321324 ListFeedsResponse expectedResponse =
322325 ListFeedsResponse .newBuilder ().addAllFeeds (new ArrayList <>()).build ();
323326 mockAssetService .addResponse (expectedResponse );
@@ -353,7 +356,7 @@ public void listFeedsExceptionTest() throws Exception {
353356 }
354357
355358 @ Test
356- public void updateFeedTest () {
359+ public void updateFeedTest () throws Exception {
357360 Feed expectedResponse =
358361 Feed .newBuilder ()
359362 .setName (FeedName .ofProjectFeedName ("[PROJECT]" , "[FEED]" ).toString ())
@@ -394,7 +397,7 @@ public void updateFeedExceptionTest() throws Exception {
394397 }
395398
396399 @ Test
397- public void deleteFeedTest () {
400+ public void deleteFeedTest () throws Exception {
398401 Empty expectedResponse = Empty .newBuilder ().build ();
399402 mockAssetService .addResponse (expectedResponse );
400403
@@ -429,7 +432,7 @@ public void deleteFeedExceptionTest() throws Exception {
429432 }
430433
431434 @ Test
432- public void deleteFeedTest2 () {
435+ public void deleteFeedTest2 () throws Exception {
433436 Empty expectedResponse = Empty .newBuilder ().build ();
434437 mockAssetService .addResponse (expectedResponse );
435438
@@ -464,26 +467,26 @@ public void deleteFeedExceptionTest2() throws Exception {
464467 }
465468
466469 @ Test
467- public void searchAllResourcesTest () {
470+ public void searchAllResourcesTest () throws Exception {
468471 ResourceSearchResult responsesElement = ResourceSearchResult .newBuilder ().build ();
469472 SearchAllResourcesResponse expectedResponse =
470473 SearchAllResourcesResponse .newBuilder ()
471474 .setNextPageToken ("" )
472- .addAllResponses (Arrays .asList (responsesElement ))
475+ .addAllResults (Arrays .asList (responsesElement ))
473476 .build ();
474477 mockAssetService .addResponse (expectedResponse );
475478
476479 String scope = "scope109264468" ;
477480 String query = "query107944136" ;
478481 List <String > assetTypes = new ArrayList <>();
479482
480- SearchAllResourcesResponse pagedListResponse =
483+ SearchAllResourcesPagedResponse pagedListResponse =
481484 client .searchAllResources (scope , query , assetTypes );
482485
483486 List <ResourceSearchResult > resources = Lists .newArrayList (pagedListResponse .iterateAll ());
484487
485488 Assert .assertEquals (1 , resources .size ());
486- Assert .assertEquals (expectedResponse .getResponsesList ().get (0 ), resources .get (0 ));
489+ Assert .assertEquals (expectedResponse .getResultsList ().get (0 ), resources .get (0 ));
487490
488491 List <AbstractMessage > actualRequests = mockAssetService .getRequests ();
489492 Assert .assertEquals (1 , actualRequests .size ());
@@ -515,24 +518,24 @@ public void searchAllResourcesExceptionTest() throws Exception {
515518 }
516519
517520 @ Test
518- public void searchAllIamPoliciesTest () {
521+ public void searchAllIamPoliciesTest () throws Exception {
519522 IamPolicySearchResult responsesElement = IamPolicySearchResult .newBuilder ().build ();
520523 SearchAllIamPoliciesResponse expectedResponse =
521524 SearchAllIamPoliciesResponse .newBuilder ()
522525 .setNextPageToken ("" )
523- .addAllResponses (Arrays .asList (responsesElement ))
526+ .addAllResults (Arrays .asList (responsesElement ))
524527 .build ();
525528 mockAssetService .addResponse (expectedResponse );
526529
527530 String scope = "scope109264468" ;
528531 String query = "query107944136" ;
529532
530- SearchAllIamPoliciesResponse pagedListResponse = client .searchAllIamPolicies (scope , query );
533+ SearchAllIamPoliciesPagedResponse pagedListResponse = client .searchAllIamPolicies (scope , query );
531534
532535 List <IamPolicySearchResult > resources = Lists .newArrayList (pagedListResponse .iterateAll ());
533536
534537 Assert .assertEquals (1 , resources .size ());
535- Assert .assertEquals (expectedResponse .getResponsesList ().get (0 ), resources .get (0 ));
538+ Assert .assertEquals (expectedResponse .getResultsList ().get (0 ), resources .get (0 ));
536539
537540 List <AbstractMessage > actualRequests = mockAssetService .getRequests ();
538541 Assert .assertEquals (1 , actualRequests .size ());
0 commit comments