Search in sources :

Example 1 with ComputeThreatListDiffResponse

use of com.google.webrisk.v1.ComputeThreatListDiffResponse in project java-webrisk by googleapis.

the class WebRiskServiceV1Beta1ClientTest method computeThreatListDiffTest.

@Test
public void computeThreatListDiffTest() throws Exception {
    ComputeThreatListDiffResponse expectedResponse = ComputeThreatListDiffResponse.newBuilder().setAdditions(ThreatEntryAdditions.newBuilder().build()).setRemovals(ThreatEntryRemovals.newBuilder().build()).setNewVersionToken(ByteString.EMPTY).setChecksum(ComputeThreatListDiffResponse.Checksum.newBuilder().build()).setRecommendedNextDiff(Timestamp.newBuilder().build()).build();
    mockWebRiskServiceV1Beta1.addResponse(expectedResponse);
    ThreatType threatType = ThreatType.forNumber(0);
    ByteString versionToken = ByteString.EMPTY;
    ComputeThreatListDiffRequest.Constraints constraints = ComputeThreatListDiffRequest.Constraints.newBuilder().build();
    ComputeThreatListDiffResponse actualResponse = client.computeThreatListDiff(threatType, versionToken, constraints);
    Assert.assertEquals(expectedResponse, actualResponse);
    List<AbstractMessage> actualRequests = mockWebRiskServiceV1Beta1.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ComputeThreatListDiffRequest actualRequest = ((ComputeThreatListDiffRequest) actualRequests.get(0));
    Assert.assertEquals(threatType, actualRequest.getThreatType());
    Assert.assertEquals(versionToken, actualRequest.getVersionToken());
    Assert.assertEquals(constraints, actualRequest.getConstraints());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ThreatType(com.google.webrisk.v1beta1.ThreatType) ByteString(com.google.protobuf.ByteString) ComputeThreatListDiffRequest(com.google.webrisk.v1beta1.ComputeThreatListDiffRequest) ComputeThreatListDiffResponse(com.google.webrisk.v1beta1.ComputeThreatListDiffResponse) Test(org.junit.Test)

Example 2 with ComputeThreatListDiffResponse

use of com.google.webrisk.v1.ComputeThreatListDiffResponse in project java-webrisk by googleapis.

the class WebRiskServiceClientTest method computeThreatListDiffTest.

@Test
public void computeThreatListDiffTest() throws Exception {
    ComputeThreatListDiffResponse expectedResponse = ComputeThreatListDiffResponse.newBuilder().setAdditions(ThreatEntryAdditions.newBuilder().build()).setRemovals(ThreatEntryRemovals.newBuilder().build()).setNewVersionToken(ByteString.EMPTY).setChecksum(ComputeThreatListDiffResponse.Checksum.newBuilder().build()).setRecommendedNextDiff(Timestamp.newBuilder().build()).build();
    mockWebRiskService.addResponse(expectedResponse);
    ThreatType threatType = ThreatType.forNumber(0);
    ByteString versionToken = ByteString.EMPTY;
    ComputeThreatListDiffRequest.Constraints constraints = ComputeThreatListDiffRequest.Constraints.newBuilder().build();
    ComputeThreatListDiffResponse actualResponse = client.computeThreatListDiff(threatType, versionToken, constraints);
    Assert.assertEquals(expectedResponse, actualResponse);
    List<AbstractMessage> actualRequests = mockWebRiskService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ComputeThreatListDiffRequest actualRequest = ((ComputeThreatListDiffRequest) actualRequests.get(0));
    Assert.assertEquals(threatType, actualRequest.getThreatType());
    Assert.assertEquals(versionToken, actualRequest.getVersionToken());
    Assert.assertEquals(constraints, actualRequest.getConstraints());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ThreatType(com.google.webrisk.v1.ThreatType) ByteString(com.google.protobuf.ByteString) ComputeThreatListDiffRequest(com.google.webrisk.v1.ComputeThreatListDiffRequest) ComputeThreatListDiffResponse(com.google.webrisk.v1.ComputeThreatListDiffResponse) Test(org.junit.Test)

Aggregations

AbstractMessage (com.google.protobuf.AbstractMessage)2 ByteString (com.google.protobuf.ByteString)2 Test (org.junit.Test)2 ComputeThreatListDiffRequest (com.google.webrisk.v1.ComputeThreatListDiffRequest)1 ComputeThreatListDiffResponse (com.google.webrisk.v1.ComputeThreatListDiffResponse)1 ThreatType (com.google.webrisk.v1.ThreatType)1 ComputeThreatListDiffRequest (com.google.webrisk.v1beta1.ComputeThreatListDiffRequest)1 ComputeThreatListDiffResponse (com.google.webrisk.v1beta1.ComputeThreatListDiffResponse)1 ThreatType (com.google.webrisk.v1beta1.ThreatType)1