com.google.protobuf.AbstractMessage Java Examples
The following examples show how to use
com.google.protobuf.AbstractMessage.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LanguageConstantServiceClientTest.java From google-ads-java with Apache License 2.0 | 6 votes |
@Test @SuppressWarnings("all") public void getLanguageConstantTest() { String resourceName2 = "resourceName2625949903"; LanguageConstant expectedResponse = LanguageConstant.newBuilder().setResourceName(resourceName2).build(); mockLanguageConstantService.addResponse(expectedResponse); String formattedResourceName = LanguageConstantServiceClient.formatLanguageConstantName("[LANGUAGE_CONSTANT]"); LanguageConstant actualResponse = client.getLanguageConstant(formattedResourceName); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockLanguageConstantService.getRequests(); Assert.assertEquals(1, actualRequests.size()); GetLanguageConstantRequest actualRequest = (GetLanguageConstantRequest) actualRequests.get(0); Assert.assertEquals(formattedResourceName, actualRequest.getResourceName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
Example #2
Source File: AdGroupCriterionServiceClientTest.java From google-ads-java with Apache License 2.0 | 6 votes |
@Test @SuppressWarnings("all") public void getAdGroupCriterionTest() { String resourceName2 = "resourceName2625949903"; AdGroupCriterion expectedResponse = AdGroupCriterion.newBuilder().setResourceName(resourceName2).build(); mockAdGroupCriterionService.addResponse(expectedResponse); String formattedResourceName = AdGroupCriterionServiceClient.formatAdGroupCriteriaName( "[CUSTOMER]", "[AD_GROUP_CRITERIA]"); AdGroupCriterion actualResponse = client.getAdGroupCriterion(formattedResourceName); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockAdGroupCriterionService.getRequests(); Assert.assertEquals(1, actualRequests.size()); GetAdGroupCriterionRequest actualRequest = (GetAdGroupCriterionRequest) actualRequests.get(0); Assert.assertEquals(formattedResourceName, actualRequest.getResourceName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
Example #3
Source File: AdGroupExtensionSettingServiceClientTest.java From google-ads-java with Apache License 2.0 | 6 votes |
@Test @SuppressWarnings("all") public void mutateAdGroupExtensionSettingsTest2() { MutateAdGroupExtensionSettingsResponse expectedResponse = MutateAdGroupExtensionSettingsResponse.newBuilder().build(); mockAdGroupExtensionSettingService.addResponse(expectedResponse); String customerId = "customerId-1772061412"; List<AdGroupExtensionSettingOperation> operations = new ArrayList<>(); MutateAdGroupExtensionSettingsResponse actualResponse = client.mutateAdGroupExtensionSettings(customerId, operations); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockAdGroupExtensionSettingService.getRequests(); Assert.assertEquals(1, actualRequests.size()); MutateAdGroupExtensionSettingsRequest actualRequest = (MutateAdGroupExtensionSettingsRequest) actualRequests.get(0); Assert.assertEquals(customerId, actualRequest.getCustomerId()); Assert.assertEquals(operations, actualRequest.getOperationsList()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
Example #4
Source File: CampaignExperimentServiceClientTest.java From google-ads-java with Apache License 2.0 | 6 votes |
@Test @SuppressWarnings("all") public void endCampaignExperimentTest() { Empty expectedResponse = Empty.newBuilder().build(); mockCampaignExperimentService.addResponse(expectedResponse); String formattedCampaignExperiment = CampaignExperimentServiceClient.formatCampaignExperimentName( "[CUSTOMER]", "[CAMPAIGN_EXPERIMENT]"); client.endCampaignExperiment(formattedCampaignExperiment); List<AbstractMessage> actualRequests = mockCampaignExperimentService.getRequests(); Assert.assertEquals(1, actualRequests.size()); EndCampaignExperimentRequest actualRequest = (EndCampaignExperimentRequest) actualRequests.get(0); Assert.assertEquals(formattedCampaignExperiment, actualRequest.getCampaignExperiment()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
Example #5
Source File: CampaignDraftServiceClientTest.java From google-ads-java with Apache License 2.0 | 6 votes |
@Test @SuppressWarnings("all") public void getCampaignDraftTest() { String resourceName2 = "resourceName2625949903"; CampaignDraft expectedResponse = CampaignDraft.newBuilder().setResourceName(resourceName2).build(); mockCampaignDraftService.addResponse(expectedResponse); String formattedResourceName = CampaignDraftServiceClient.formatCampaignDraftName("[CUSTOMER]", "[CAMPAIGN_DRAFT]"); CampaignDraft actualResponse = client.getCampaignDraft(formattedResourceName); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockCampaignDraftService.getRequests(); Assert.assertEquals(1, actualRequests.size()); GetCampaignDraftRequest actualRequest = (GetCampaignDraftRequest) actualRequests.get(0); Assert.assertEquals(formattedResourceName, actualRequest.getResourceName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
Example #6
Source File: AdGroupFeedServiceClientTest.java From google-ads-java with Apache License 2.0 | 6 votes |
@Test @SuppressWarnings("all") public void getAdGroupFeedTest() { String resourceName2 = "resourceName2625949903"; AdGroupFeed expectedResponse = AdGroupFeed.newBuilder().setResourceName(resourceName2).build(); mockAdGroupFeedService.addResponse(expectedResponse); String formattedResourceName = AdGroupFeedServiceClient.formatAdGroupFeedName("[CUSTOMER]", "[AD_GROUP_FEED]"); AdGroupFeed actualResponse = client.getAdGroupFeed(formattedResourceName); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockAdGroupFeedService.getRequests(); Assert.assertEquals(1, actualRequests.size()); GetAdGroupFeedRequest actualRequest = (GetAdGroupFeedRequest) actualRequests.get(0); Assert.assertEquals(formattedResourceName, actualRequest.getResourceName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
Example #7
Source File: UserLocationViewServiceClientTest.java From google-ads-java with Apache License 2.0 | 6 votes |
@Test @SuppressWarnings("all") public void getUserLocationViewTest() { String resourceName2 = "resourceName2625949903"; UserLocationView expectedResponse = UserLocationView.newBuilder().setResourceName(resourceName2).build(); mockUserLocationViewService.addResponse(expectedResponse); String formattedResourceName = UserLocationViewServiceClient.formatUserLocationViewName( "[CUSTOMER]", "[USER_LOCATION_VIEW]"); UserLocationView actualResponse = client.getUserLocationView(formattedResourceName); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockUserLocationViewService.getRequests(); Assert.assertEquals(1, actualRequests.size()); GetUserLocationViewRequest actualRequest = (GetUserLocationViewRequest) actualRequests.get(0); Assert.assertEquals(formattedResourceName, actualRequest.getResourceName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
Example #8
Source File: AssetServiceClientTest.java From google-ads-java with Apache License 2.0 | 6 votes |
@Test @SuppressWarnings("all") public void getAssetTest() { String resourceName2 = "resourceName2625949903"; Asset expectedResponse = Asset.newBuilder().setResourceName(resourceName2).build(); mockAssetService.addResponse(expectedResponse); String formattedResourceName = AssetServiceClient.formatAssetName("[CUSTOMER]", "[ASSET]"); Asset actualResponse = client.getAsset(formattedResourceName); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockAssetService.getRequests(); Assert.assertEquals(1, actualRequests.size()); GetAssetRequest actualRequest = (GetAssetRequest) actualRequests.get(0); Assert.assertEquals(formattedResourceName, actualRequest.getResourceName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
Example #9
Source File: CustomerClientLinkServiceClientTest.java From google-ads-java with Apache License 2.0 | 6 votes |
@Test @SuppressWarnings("all") public void mutateCustomerClientLinkTest() { MutateCustomerClientLinkResponse expectedResponse = MutateCustomerClientLinkResponse.newBuilder().build(); mockCustomerClientLinkService.addResponse(expectedResponse); String customerId = "customerId-1772061412"; CustomerClientLinkOperation operation = CustomerClientLinkOperation.newBuilder().build(); MutateCustomerClientLinkResponse actualResponse = client.mutateCustomerClientLink(customerId, operation); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockCustomerClientLinkService.getRequests(); Assert.assertEquals(1, actualRequests.size()); MutateCustomerClientLinkRequest actualRequest = (MutateCustomerClientLinkRequest) actualRequests.get(0); Assert.assertEquals(customerId, actualRequest.getCustomerId()); Assert.assertEquals(operation, actualRequest.getOperation()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
Example #10
Source File: KeywordPlanServiceClientTest.java From google-ads-java with Apache License 2.0 | 6 votes |
@Test @SuppressWarnings("all") public void generateHistoricalMetricsTest() { GenerateHistoricalMetricsResponse expectedResponse = GenerateHistoricalMetricsResponse.newBuilder().build(); mockKeywordPlanService.addResponse(expectedResponse); String formattedKeywordPlan = KeywordPlanServiceClient.formatKeywordPlanName("[CUSTOMER]", "[KEYWORD_PLAN]"); GenerateHistoricalMetricsResponse actualResponse = client.generateHistoricalMetrics(formattedKeywordPlan); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockKeywordPlanService.getRequests(); Assert.assertEquals(1, actualRequests.size()); GenerateHistoricalMetricsRequest actualRequest = (GenerateHistoricalMetricsRequest) actualRequests.get(0); Assert.assertEquals(formattedKeywordPlan, actualRequest.getKeywordPlan()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
Example #11
Source File: ProductGroupViewServiceClientTest.java From google-ads-java with Apache License 2.0 | 6 votes |
@Test @SuppressWarnings("all") public void getProductGroupViewTest() { String resourceName2 = "resourceName2625949903"; ProductGroupView expectedResponse = ProductGroupView.newBuilder().setResourceName(resourceName2).build(); mockProductGroupViewService.addResponse(expectedResponse); String formattedResourceName = ProductGroupViewServiceClient.formatProductGroupViewName( "[CUSTOMER]", "[PRODUCT_GROUP_VIEW]"); ProductGroupView actualResponse = client.getProductGroupView(formattedResourceName); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockProductGroupViewService.getRequests(); Assert.assertEquals(1, actualRequests.size()); GetProductGroupViewRequest actualRequest = (GetProductGroupViewRequest) actualRequests.get(0); Assert.assertEquals(formattedResourceName, actualRequest.getResourceName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
Example #12
Source File: GenderViewServiceClientTest.java From google-ads-java with Apache License 2.0 | 6 votes |
@Test @SuppressWarnings("all") public void getGenderViewTest() { String resourceName2 = "resourceName2625949903"; GenderView expectedResponse = GenderView.newBuilder().setResourceName(resourceName2).build(); mockGenderViewService.addResponse(expectedResponse); String formattedResourceName = GenderViewServiceClient.formatGenderViewName("[CUSTOMER]", "[GENDER_VIEW]"); GenderView actualResponse = client.getGenderView(formattedResourceName); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockGenderViewService.getRequests(); Assert.assertEquals(1, actualRequests.size()); GetGenderViewRequest actualRequest = (GetGenderViewRequest) actualRequests.get(0); Assert.assertEquals(formattedResourceName, actualRequest.getResourceName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
Example #13
Source File: CampaignExperimentServiceClientTest.java From google-ads-java with Apache License 2.0 | 6 votes |
@Test @SuppressWarnings("all") public void getCampaignExperimentTest() { String resourceName2 = "resourceName2625949903"; CampaignExperiment expectedResponse = CampaignExperiment.newBuilder().setResourceName(resourceName2).build(); mockCampaignExperimentService.addResponse(expectedResponse); String formattedResourceName = CampaignExperimentServiceClient.formatCampaignExperimentName( "[CUSTOMER]", "[CAMPAIGN_EXPERIMENT]"); CampaignExperiment actualResponse = client.getCampaignExperiment(formattedResourceName); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockCampaignExperimentService.getRequests(); Assert.assertEquals(1, actualRequests.size()); GetCampaignExperimentRequest actualRequest = (GetCampaignExperimentRequest) actualRequests.get(0); Assert.assertEquals(formattedResourceName, actualRequest.getResourceName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
Example #14
Source File: CampaignAudienceViewServiceClientTest.java From google-ads-java with Apache License 2.0 | 6 votes |
@Test @SuppressWarnings("all") public void getCampaignAudienceViewTest() { String resourceName2 = "resourceName2625949903"; CampaignAudienceView expectedResponse = CampaignAudienceView.newBuilder().setResourceName(resourceName2).build(); mockCampaignAudienceViewService.addResponse(expectedResponse); String formattedResourceName = CampaignAudienceViewServiceClient.formatCampaignAudienceViewName( "[CUSTOMER]", "[CAMPAIGN_AUDIENCE_VIEW]"); CampaignAudienceView actualResponse = client.getCampaignAudienceView(formattedResourceName); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockCampaignAudienceViewService.getRequests(); Assert.assertEquals(1, actualRequests.size()); GetCampaignAudienceViewRequest actualRequest = (GetCampaignAudienceViewRequest) actualRequests.get(0); Assert.assertEquals(formattedResourceName, actualRequest.getResourceName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
Example #15
Source File: FeedItemTargetServiceClientTest.java From google-ads-java with Apache License 2.0 | 6 votes |
@Test @SuppressWarnings("all") public void getFeedItemTargetTest() { String resourceName2 = "resourceName2625949903"; FeedItemTarget expectedResponse = FeedItemTarget.newBuilder().setResourceName(resourceName2).build(); mockFeedItemTargetService.addResponse(expectedResponse); String formattedResourceName = FeedItemTargetServiceClient.formatFeedItemTargetName("[CUSTOMER]", "[FEED_ITEM_TARGET]"); FeedItemTarget actualResponse = client.getFeedItemTarget(formattedResourceName); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockFeedItemTargetService.getRequests(); Assert.assertEquals(1, actualRequests.size()); GetFeedItemTargetRequest actualRequest = (GetFeedItemTargetRequest) actualRequests.get(0); Assert.assertEquals(formattedResourceName, actualRequest.getResourceName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
Example #16
Source File: DisplayKeywordViewServiceClientTest.java From google-ads-java with Apache License 2.0 | 6 votes |
@Test @SuppressWarnings("all") public void getDisplayKeywordViewTest() { String resourceName2 = "resourceName2625949903"; DisplayKeywordView expectedResponse = DisplayKeywordView.newBuilder().setResourceName(resourceName2).build(); mockDisplayKeywordViewService.addResponse(expectedResponse); String formattedResourceName = DisplayKeywordViewServiceClient.formatDisplayKeywordViewName( "[CUSTOMER]", "[DISPLAY_KEYWORD_VIEW]"); DisplayKeywordView actualResponse = client.getDisplayKeywordView(formattedResourceName); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockDisplayKeywordViewService.getRequests(); Assert.assertEquals(1, actualRequests.size()); GetDisplayKeywordViewRequest actualRequest = (GetDisplayKeywordViewRequest) actualRequests.get(0); Assert.assertEquals(formattedResourceName, actualRequest.getResourceName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
Example #17
Source File: CustomerFeedServiceClientTest.java From google-ads-java with Apache License 2.0 | 6 votes |
@Test @SuppressWarnings("all") public void getCustomerFeedTest() { String resourceName2 = "resourceName2625949903"; CustomerFeed expectedResponse = CustomerFeed.newBuilder().setResourceName(resourceName2).build(); mockCustomerFeedService.addResponse(expectedResponse); String formattedResourceName = CustomerFeedServiceClient.formatCustomerFeedName("[CUSTOMER]", "[CUSTOMER_FEED]"); CustomerFeed actualResponse = client.getCustomerFeed(formattedResourceName); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockCustomerFeedService.getRequests(); Assert.assertEquals(1, actualRequests.size()); GetCustomerFeedRequest actualRequest = (GetCustomerFeedRequest) actualRequests.get(0); Assert.assertEquals(formattedResourceName, actualRequest.getResourceName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
Example #18
Source File: FeedServiceClientTest.java From google-ads-java with Apache License 2.0 | 6 votes |
@Test @SuppressWarnings("all") public void mutateFeedsTest2() { MutateFeedsResponse expectedResponse = MutateFeedsResponse.newBuilder().build(); mockFeedService.addResponse(expectedResponse); String customerId = "customerId-1772061412"; List<FeedOperation> operations = new ArrayList<>(); MutateFeedsResponse actualResponse = client.mutateFeeds(customerId, operations); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockFeedService.getRequests(); Assert.assertEquals(1, actualRequests.size()); MutateFeedsRequest actualRequest = (MutateFeedsRequest) actualRequests.get(0); Assert.assertEquals(customerId, actualRequest.getCustomerId()); Assert.assertEquals(operations, actualRequest.getOperationsList()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
Example #19
Source File: AdParameterServiceClientTest.java From google-ads-java with Apache License 2.0 | 6 votes |
@Test @SuppressWarnings("all") public void getAdParameterTest() { String resourceName2 = "resourceName2625949903"; AdParameter expectedResponse = AdParameter.newBuilder().setResourceName(resourceName2).build(); mockAdParameterService.addResponse(expectedResponse); String formattedResourceName = AdParameterServiceClient.formatAdParameterName("[CUSTOMER]", "[AD_PARAMETER]"); AdParameter actualResponse = client.getAdParameter(formattedResourceName); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockAdParameterService.getRequests(); Assert.assertEquals(1, actualRequests.size()); GetAdParameterRequest actualRequest = (GetAdParameterRequest) actualRequests.get(0); Assert.assertEquals(formattedResourceName, actualRequest.getResourceName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
Example #20
Source File: FeedItemServiceClientTest.java From google-ads-java with Apache License 2.0 | 6 votes |
@Test @SuppressWarnings("all") public void getFeedItemTest() { String resourceName2 = "resourceName2625949903"; FeedItem expectedResponse = FeedItem.newBuilder().setResourceName(resourceName2).build(); mockFeedItemService.addResponse(expectedResponse); String formattedResourceName = FeedItemServiceClient.formatFeedItemName("[CUSTOMER]", "[FEED_ITEM]"); FeedItem actualResponse = client.getFeedItem(formattedResourceName); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockFeedItemService.getRequests(); Assert.assertEquals(1, actualRequests.size()); GetFeedItemRequest actualRequest = (GetFeedItemRequest) actualRequests.get(0); Assert.assertEquals(formattedResourceName, actualRequest.getResourceName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
Example #21
Source File: MutateJobServiceClientTest.java From google-ads-java with Apache License 2.0 | 5 votes |
@Test @SuppressWarnings("all") public void runMutateJobTest() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); Operation resultOperation = Operation.newBuilder() .setName("runMutateJobTest") .setDone(true) .setResponse(Any.pack(expectedResponse)) .build(); mockMutateJobService.addResponse(resultOperation); String formattedResourceName = MutateJobServiceClient.formatMutateJobName("[CUSTOMER]", "[MUTATE_JOB]"); Empty actualResponse = client.runMutateJobAsync(formattedResourceName).get(); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockMutateJobService.getRequests(); Assert.assertEquals(1, actualRequests.size()); RunMutateJobRequest actualRequest = (RunMutateJobRequest) actualRequests.get(0); Assert.assertEquals(formattedResourceName, actualRequest.getResourceName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
Example #22
Source File: ConversionUploadServiceClientTest.java From google-ads-java with Apache License 2.0 | 5 votes |
@Test @SuppressWarnings("all") public void uploadClickConversionsTest() { UploadClickConversionsResponse expectedResponse = UploadClickConversionsResponse.newBuilder().build(); mockConversionUploadService.addResponse(expectedResponse); String customerId = "customerId-1772061412"; List<ClickConversion> conversions = new ArrayList<>(); boolean partialFailure = true; boolean validateOnly = false; UploadClickConversionsResponse actualResponse = client.uploadClickConversions(customerId, conversions, partialFailure, validateOnly); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockConversionUploadService.getRequests(); Assert.assertEquals(1, actualRequests.size()); UploadClickConversionsRequest actualRequest = (UploadClickConversionsRequest) actualRequests.get(0); Assert.assertEquals(customerId, actualRequest.getCustomerId()); Assert.assertEquals(conversions, actualRequest.getConversionsList()); Assert.assertEquals(partialFailure, actualRequest.getPartialFailure()); Assert.assertEquals(validateOnly, actualRequest.getValidateOnly()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
Example #23
Source File: CampaignDraftServiceClientTest.java From google-ads-java with Apache License 2.0 | 5 votes |
@Test @SuppressWarnings("all") public void mutateCampaignDraftsTest() { MutateCampaignDraftsResponse expectedResponse = MutateCampaignDraftsResponse.newBuilder().build(); mockCampaignDraftService.addResponse(expectedResponse); String customerId = "customerId-1772061412"; List<CampaignDraftOperation> operations = new ArrayList<>(); boolean partialFailure = true; boolean validateOnly = false; MutateCampaignDraftsResponse actualResponse = client.mutateCampaignDrafts(customerId, operations, partialFailure, validateOnly); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockCampaignDraftService.getRequests(); Assert.assertEquals(1, actualRequests.size()); MutateCampaignDraftsRequest actualRequest = (MutateCampaignDraftsRequest) actualRequests.get(0); Assert.assertEquals(customerId, actualRequest.getCustomerId()); Assert.assertEquals(operations, actualRequest.getOperationsList()); Assert.assertEquals(partialFailure, actualRequest.getPartialFailure()); Assert.assertEquals(validateOnly, actualRequest.getValidateOnly()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
Example #24
Source File: SharedCriterionServiceClientTest.java From google-ads-java with Apache License 2.0 | 5 votes |
@Test @SuppressWarnings("all") public void mutateSharedCriteriaTest() { MutateSharedCriteriaResponse expectedResponse = MutateSharedCriteriaResponse.newBuilder().build(); mockSharedCriterionService.addResponse(expectedResponse); String customerId = "customerId-1772061412"; List<SharedCriterionOperation> operations = new ArrayList<>(); boolean partialFailure = true; boolean validateOnly = false; MutateSharedCriteriaResponse actualResponse = client.mutateSharedCriteria(customerId, operations, partialFailure, validateOnly); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockSharedCriterionService.getRequests(); Assert.assertEquals(1, actualRequests.size()); MutateSharedCriteriaRequest actualRequest = (MutateSharedCriteriaRequest) actualRequests.get(0); Assert.assertEquals(customerId, actualRequest.getCustomerId()); Assert.assertEquals(operations, actualRequest.getOperationsList()); Assert.assertEquals(partialFailure, actualRequest.getPartialFailure()); Assert.assertEquals(validateOnly, actualRequest.getValidateOnly()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
Example #25
Source File: CampaignExperimentServiceClientTest.java From google-ads-java with Apache License 2.0 | 5 votes |
@Test @SuppressWarnings("all") public void createCampaignExperimentTest2() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); Operation resultOperation = Operation.newBuilder() .setName("createCampaignExperimentTest2") .setDone(true) .setResponse(Any.pack(expectedResponse)) .build(); mockCampaignExperimentService.addResponse(resultOperation); String customerId = "customerId-1772061412"; CampaignExperiment campaignExperiment = CampaignExperiment.newBuilder().build(); Empty actualResponse = client.createCampaignExperimentAsync(customerId, campaignExperiment).get(); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockCampaignExperimentService.getRequests(); Assert.assertEquals(1, actualRequests.size()); CreateCampaignExperimentRequest actualRequest = (CreateCampaignExperimentRequest) actualRequests.get(0); Assert.assertEquals(customerId, actualRequest.getCustomerId()); Assert.assertEquals(campaignExperiment, actualRequest.getCampaignExperiment()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
Example #26
Source File: KeywordPlanNegativeKeywordServiceClientTest.java From google-ads-java with Apache License 2.0 | 5 votes |
@Test @SuppressWarnings("all") public void getKeywordPlanNegativeKeywordTest() { String resourceName2 = "resourceName2625949903"; KeywordPlanNegativeKeyword expectedResponse = KeywordPlanNegativeKeyword.newBuilder().setResourceName(resourceName2).build(); mockKeywordPlanNegativeKeywordService.addResponse(expectedResponse); String formattedResourceName = KeywordPlanNegativeKeywordServiceClient.formatKeywordPlanNegativeKeywordName( "[CUSTOMER]", "[KEYWORD_PLAN_NEGATIVE_KEYWORD]"); KeywordPlanNegativeKeyword actualResponse = client.getKeywordPlanNegativeKeyword(formattedResourceName); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockKeywordPlanNegativeKeywordService.getRequests(); Assert.assertEquals(1, actualRequests.size()); GetKeywordPlanNegativeKeywordRequest actualRequest = (GetKeywordPlanNegativeKeywordRequest) actualRequests.get(0); Assert.assertEquals(formattedResourceName, actualRequest.getResourceName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
Example #27
Source File: AdParameterServiceClientTest.java From google-ads-java with Apache License 2.0 | 5 votes |
@Test @SuppressWarnings("all") public void mutateAdParametersTest() { MutateAdParametersResponse expectedResponse = MutateAdParametersResponse.newBuilder().build(); mockAdParameterService.addResponse(expectedResponse); String customerId = "customerId-1772061412"; List<AdParameterOperation> operations = new ArrayList<>(); boolean partialFailure = true; boolean validateOnly = false; MutateAdParametersResponse actualResponse = client.mutateAdParameters(customerId, operations, partialFailure, validateOnly); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockAdParameterService.getRequests(); Assert.assertEquals(1, actualRequests.size()); MutateAdParametersRequest actualRequest = (MutateAdParametersRequest) actualRequests.get(0); Assert.assertEquals(customerId, actualRequest.getCustomerId()); Assert.assertEquals(operations, actualRequest.getOperationsList()); Assert.assertEquals(partialFailure, actualRequest.getPartialFailure()); Assert.assertEquals(validateOnly, actualRequest.getValidateOnly()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
Example #28
Source File: AdGroupCriterionLabelServiceClientTest.java From google-ads-java with Apache License 2.0 | 5 votes |
@Test @SuppressWarnings("all") public void mutateAdGroupCriterionLabelsTest() { MutateAdGroupCriterionLabelsResponse expectedResponse = MutateAdGroupCriterionLabelsResponse.newBuilder().build(); mockAdGroupCriterionLabelService.addResponse(expectedResponse); String customerId = "customerId-1772061412"; List<AdGroupCriterionLabelOperation> operations = new ArrayList<>(); boolean partialFailure = true; boolean validateOnly = false; MutateAdGroupCriterionLabelsResponse actualResponse = client.mutateAdGroupCriterionLabels(customerId, operations, partialFailure, validateOnly); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockAdGroupCriterionLabelService.getRequests(); Assert.assertEquals(1, actualRequests.size()); MutateAdGroupCriterionLabelsRequest actualRequest = (MutateAdGroupCriterionLabelsRequest) actualRequests.get(0); Assert.assertEquals(customerId, actualRequest.getCustomerId()); Assert.assertEquals(operations, actualRequest.getOperationsList()); Assert.assertEquals(partialFailure, actualRequest.getPartialFailure()); Assert.assertEquals(validateOnly, actualRequest.getValidateOnly()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
Example #29
Source File: CampaignCriterionServiceClientTest.java From google-ads-java with Apache License 2.0 | 5 votes |
@Test @SuppressWarnings("all") public void mutateCampaignCriteriaTest() { MutateCampaignCriteriaResponse expectedResponse = MutateCampaignCriteriaResponse.newBuilder().build(); mockCampaignCriterionService.addResponse(expectedResponse); String customerId = "customerId-1772061412"; List<CampaignCriterionOperation> operations = new ArrayList<>(); boolean partialFailure = true; boolean validateOnly = false; MutateCampaignCriteriaResponse actualResponse = client.mutateCampaignCriteria(customerId, operations, partialFailure, validateOnly); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockCampaignCriterionService.getRequests(); Assert.assertEquals(1, actualRequests.size()); MutateCampaignCriteriaRequest actualRequest = (MutateCampaignCriteriaRequest) actualRequests.get(0); Assert.assertEquals(customerId, actualRequest.getCustomerId()); Assert.assertEquals(operations, actualRequest.getOperationsList()); Assert.assertEquals(partialFailure, actualRequest.getPartialFailure()); Assert.assertEquals(validateOnly, actualRequest.getValidateOnly()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
Example #30
Source File: MockLanguageConstantService.java From google-ads-java with Apache License 2.0 | 4 votes |
@Override public List<AbstractMessage> getRequests() { return serviceImpl.getRequests(); }