• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java VerificationTimes类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.mockserver.verify.VerificationTimes的典型用法代码示例。如果您正苦于以下问题:Java VerificationTimes类的具体用法?Java VerificationTimes怎么用?Java VerificationTimes使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



VerificationTimes类属于org.mockserver.verify包,在下文中一共展示了VerificationTimes类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: verifications

import org.mockserver.verify.VerificationTimes; //导入依赖的package包/类
private void verifications() throws AssertionError {
  new MockServerClient("localhost", 7755)
  .verify(HttpRequest.request()
        .withMethod("PUT")
        .withPath("/v0.3/traces")
        .withHeaders(new Header("Content-Type", "application/msgpack")),
        VerificationTimes.exactly(1))
  .verify(HttpRequest.request()
        .withMethod("PUT")
        .withPath("/v0.2/traces")
        .withHeaders(new Header("Content-Type", "application/json")),
        VerificationTimes.exactly(1));
}
 
开发者ID:chonton,项目名称:apm-client,代码行数:14,代码来源:WriterTest.java


示例2: verifications

import org.mockserver.verify.VerificationTimes; //导入依赖的package包/类
private void verifications() throws AssertionError {
  new MockServerClient("localhost", 7755)
  .verify(HttpRequest.request()
        .withMethod("PUT")
        .withPath("/v0.3/traces")
        .withHeaders(new Header("Content-Type", "application/msgpack")),
        VerificationTimes.exactly(1));
}
 
开发者ID:chonton,项目名称:apm-client,代码行数:9,代码来源:WriterBackoffTest.java


示例3: shouldSuccessfulSendDatapoint

import org.mockserver.verify.VerificationTimes; //导入依赖的package包/类
@Test
public void shouldSuccessfulSendDatapoint() throws Exception {
    Datapoint datapoint = new Datapoint("metric", timestamp, Collections.emptyMap(), 123);

    MockedSources sources = new MockedSources();
    // TODO: rather than use Topic.OTSDB, grab it from the TopologyConfig object (which does
    // not exist at this point in the code.
    sources.addMockData(Topic.OTSDB+"-spout",
            new Values(MAPPER.writeValueAsString(datapoint)));
    completeTopologyParam.setMockedSources(sources);

    Testing.withTrackedCluster(clusterParam, (cluster) ->  {
        OpenTSDBTopology topology = new TestingTargetTopology(new TestingKafkaBolt());
        StormTopology stormTopology = topology.createTopology();

        Map result = Testing.completeTopology(cluster, stormTopology, completeTopologyParam);
    });

    //verify that request is sent to OpenTSDB server
    mockServer.verify(HttpRequest.request(), VerificationTimes.exactly(1));
}
 
开发者ID:telstra,项目名称:open-kilda,代码行数:22,代码来源:OpenTSDBTopologyTest.java


示例4: shouldSendDatapointRequestsOnlyOnce

import org.mockserver.verify.VerificationTimes; //导入依赖的package包/类
@Test
public void shouldSendDatapointRequestsOnlyOnce() throws Exception {
    Datapoint datapoint = new Datapoint("metric", timestamp, Collections.emptyMap(), 123);
    String jsonDatapoint = MAPPER.writeValueAsString(datapoint);

    MockedSources sources = new MockedSources();
    sources.addMockData(Topic.OTSDB+"-spout",
            new Values(jsonDatapoint), new Values(jsonDatapoint));
    completeTopologyParam.setMockedSources(sources);

    Testing.withTrackedCluster(clusterParam, (cluster) ->  {
        OpenTSDBTopology topology = new TestingTargetTopology(new TestingKafkaBolt());
        StormTopology stormTopology = topology.createTopology();

        Testing.completeTopology(cluster, stormTopology, completeTopologyParam);
    });
    //verify that request is sent to OpenTSDB server once
    mockServer.verify(HttpRequest.request(), VerificationTimes.exactly(1));
}
 
开发者ID:telstra,项目名称:open-kilda,代码行数:20,代码来源:OpenTSDBTopologyTest.java


示例5: hostShouldNotBeAbleToRescheduleNonExistingGame

import org.mockserver.verify.VerificationTimes; //导入依赖的package包/类
@Test
@DirtiesContext
public void hostShouldNotBeAbleToRescheduleNonExistingGame() {
    // given
    final String hostName = testDataUtils.generateHostName();
    final String proposedTime = testDataUtils.getProposedTimeInTenMinutes();

    // expect private Slack message about unability of rescheduling the game
    mockServerClient.when(requestUtils.getUnableToRescheduleGamePrivateMessageRequest()).respond(response().withStatusCode(200));

    // when
    slashCommandUtils.slashRescheduleCommand(hostName, proposedTime);

    // then
    mockServerClient.verify(requestUtils.getUnableToRescheduleGamePrivateMessageRequest(), VerificationTimes.exactly(1));

    mockServerClient.verify(requestUtils.getInternalErrorPrivateMessageBodyRequest(), VerificationTimes.exactly(0));
}
 
开发者ID:JakubStas,项目名称:foosie,代码行数:19,代码来源:RescheduleGameIntegrationTest.java


示例6: hostShouldBeAbleToCancelTheirOwnGame

import org.mockserver.verify.VerificationTimes; //导入依赖的package包/类
@Test
@DirtiesContext
public void hostShouldBeAbleToCancelTheirOwnGame() {
    // given
    final String hostName = testDataUtils.generateHostName();
    final String hostId = testDataUtils.generateUserId();
    final String proposedTime = testDataUtils.getProposedTimeInTenMinutes();

    createSingleGameExpectations(hostName, proposedTime);

    // expect private Slack message about canceling newly created game
    mockServerClient.when(requestUtils.getSuccessfullyCanceledGamePrivateMessageRequest()).respond(response().withStatusCode(200));
    // expect channel Slack message about canceling newly created game
    mockServerClient.when(requestUtils.getCreateGameCanceledChannelMessageRequest(hostName)).respond(response().withStatusCode(200));

    slashCommandUtils.slashNewCommand(hostName, hostId, proposedTime);

    // when
    slashCommandUtils.slashCancelCommand(hostName);

    // then
    mockServerClient.verify(requestUtils.getCreateGameCanceledChannelMessageRequest(hostName), VerificationTimes.exactly(1));
    mockServerClient.verify(requestUtils.getSuccessfullyCanceledGamePrivateMessageRequest(), VerificationTimes.exactly(1));

    mockServerClient.verify(requestUtils.getInternalErrorPrivateMessageBodyRequest(), VerificationTimes.exactly(0));
}
 
开发者ID:JakubStas,项目名称:foosie,代码行数:27,代码来源:CancelGameIntegrationTest.java


示例7: hostShouldNotBeAbleToCancelOtherGame

import org.mockserver.verify.VerificationTimes; //导入依赖的package包/类
@Test
@DirtiesContext
public void hostShouldNotBeAbleToCancelOtherGame() {
    // given
    final String otherHostName = testDataUtils.generateHostName();
    final String originalHostName = testDataUtils.generateHostName();
    final String originalHostId = testDataUtils.generateUserId();
    final String proposedTime = testDataUtils.getProposedTimeInTenMinutes();

    createSingleGameExpectations(originalHostName, proposedTime);

    // expect private Slack message about canceling newly created game
    mockServerClient.when(requestUtils.getUnableToCancelGamePrivateMessageRequest()).respond(response().withStatusCode(200));

    slashCommandUtils.slashNewCommand(originalHostName, originalHostId, proposedTime);

    // when
    slashCommandUtils.slashCancelCommand(otherHostName);

    // then
    mockServerClient.verify(requestUtils.getUnableToCancelGamePrivateMessageRequest(), VerificationTimes.exactly(1));

    mockServerClient.verify(requestUtils.getInternalErrorPrivateMessageBodyRequest(), VerificationTimes.exactly(0));
}
 
开发者ID:JakubStas,项目名称:foosie,代码行数:25,代码来源:CancelGameIntegrationTest.java


示例8: hostShouldNotBeAbleToCancelNonExistingGame

import org.mockserver.verify.VerificationTimes; //导入依赖的package包/类
@Test
@DirtiesContext
public void hostShouldNotBeAbleToCancelNonExistingGame() {
    // given
    final String hostName = testDataUtils.generateHostName();

    // expect private Slack message about unability newly created game
    mockServerClient.when(requestUtils.getUnableToCancelGamePrivateMessageRequest()).respond(response().withStatusCode(200));

    // when
    slashCommandUtils.slashCancelCommand(hostName);

    // then
    mockServerClient.verify(requestUtils.getUnableToCancelGamePrivateMessageRequest(), VerificationTimes.exactly(1));

    mockServerClient.verify(requestUtils.getInternalErrorPrivateMessageBodyRequest(), VerificationTimes.exactly(0));
}
 
开发者ID:JakubStas,项目名称:foosie,代码行数:18,代码来源:CancelGameIntegrationTest.java


示例9: userShouldNotJoinAnyGameImplicitlyWhenNoneExists

import org.mockserver.verify.VerificationTimes; //导入依赖的package包/类
@Test
@DirtiesContext
public void userShouldNotJoinAnyGameImplicitlyWhenNoneExists() {
    // given
    final String playerName = testDataUtils.generatePlayerName();
    final String playerId = testDataUtils.generateUserId();

    // expect private Slack message about no active games available
    mockServerClient.when(requestUtils.getNoActiveGamesToJoinPrivateMessageRequest()).respond(response().withStatusCode(200));

    // when
    slashCommandUtils.slashIaminCommand(playerName, playerId, Optional.empty());

    // then
    mockServerClient.verify(requestUtils.getNoActiveGamesToJoinPrivateMessageRequest(), VerificationTimes.exactly(1));

    mockServerClient.verify(requestUtils.getInternalErrorPrivateMessageBodyRequest(), VerificationTimes.exactly(0));
}
 
开发者ID:JakubStas,项目名称:foosie,代码行数:19,代码来源:JoinGameIntegrationTest.java


示例10: userShouldNotJoinAnyGameBySpecifyingHostnameWhenNoneExists

import org.mockserver.verify.VerificationTimes; //导入依赖的package包/类
@Test
@DirtiesContext
public void userShouldNotJoinAnyGameBySpecifyingHostnameWhenNoneExists() {
    // given
    final String playerName = testDataUtils.generatePlayerName();
    final String playerId = testDataUtils.generateUserId();
    final String hostName = testDataUtils.generateHostName();

    // expect private Slack message about no active games available
    mockServerClient.when(requestUtils.getNoActiveGamesToJoinByHostPrivateMessageRequest(hostName)).respond(response().withStatusCode(200));

    // when
    slashCommandUtils.slashIaminCommand(playerName, playerId, Optional.of(hostName));

    // then
    mockServerClient.verify(requestUtils.getNoActiveGamesToJoinByHostPrivateMessageRequest(hostName), VerificationTimes.exactly(1));

    mockServerClient.verify(requestUtils.getInternalErrorPrivateMessageBodyRequest(), VerificationTimes.exactly(0));
}
 
开发者ID:JakubStas,项目名称:foosie,代码行数:20,代码来源:JoinGameIntegrationTest.java


示例11: serverCalledOnceInCacheTime

import org.mockserver.verify.VerificationTimes; //导入依赖的package包/类
@Test
public void serverCalledOnceInCacheTime() throws Exception {
	mockServer.when(request().withPath(ElasticsearchClient.CLUSTER_STATS_ENDPOINT))
			.respond(response()
					.withBody(new JsonBody(clusterStatsJson))
					.withHeaders(new Header("Content-Type", "application/json"))
					.withStatusCode(HttpServletResponse.SC_OK));

	ElasticsearchClusterStats clusterStats = esClient.getClusterStats();
	assertThat(clusterStats).isNotNull();
	assertThat(clusterStats.getStatus()).isEqualTo("red");
	assertThat(clusterStats.getNodes().getFileSystem().getTotalBytes()).isEqualTo(206289465344L);
	assertThat(clusterStats.getNodes().getFileSystem().getFreeBytes()).isEqualTo(132861665280L);
	assertThat(clusterStats.getNodes().getFileSystem().getAvailableBytes()).isEqualTo(122359132160L);

	// Call again, should hit cache
	clusterStats = esClient.getClusterStats();
	assertThat(clusterStats).isNotNull();
	assertThat(clusterStats.getStatus()).isEqualTo("red");
	assertThat(clusterStats.getNodes().getFileSystem().getTotalBytes()).isEqualTo(206289465344L);
	assertThat(clusterStats.getNodes().getFileSystem().getFreeBytes()).isEqualTo(132861665280L);
	assertThat(clusterStats.getNodes().getFileSystem().getAvailableBytes()).isEqualTo(122359132160L);

	// Verify mockServer calls
	mockServer.verify(request().withPath(ElasticsearchClient.CLUSTER_STATS_ENDPOINT), VerificationTimes.once());
}
 
开发者ID:flaxsearch,项目名称:harahachibu,代码行数:27,代码来源:ElasticsearchClientTest.java


示例12: testSendBatchSuccess

import org.mockserver.verify.VerificationTimes; //导入依赖的package包/类
@Test
public void testSendBatchSuccess() {
    final String batchRequest =
        "{\"commonTags\":{\"what\":\"error-rate\"},\"points\":[{\"key\":\"test_key\"," +
            "\"tags\":{\"what\":\"error-rate\"},\"value\":1234.0,\"timestamp\":11111}]}";

    final HttpRequest request = request()
        .withMethod("POST")
        .withPath("/v1/batch")
        .withHeader("content-type", "application/json")
        .withBody(batchRequest);

    mockServerClient.when(request).respond(response().withStatusCode(200));

    final Batch.Point point =
        new Batch.Point("test_key", ImmutableMap.of("what", "error-rate"), 1234L, 11111L);
    final Batch batch =
        new Batch(ImmutableMap.of("what", "error-rate"), ImmutableList.of(point));

    httpClient.sendBatch(batch).toCompletable().await();

    mockServerClient.verify(request, VerificationTimes.atLeast(1));
}
 
开发者ID:spotify,项目名称:ffwd,代码行数:24,代码来源:HttpClientTest.java


示例13: noDiscoveryFoundTest

import org.mockserver.verify.VerificationTimes; //导入依赖的package包/类
/**
 * A test for the situation where no discovery is 
 * found.
 */
@Test
public void noDiscoveryFoundTest() throws Exception{		
	
	//no need to arm a mock server; just send a request to IoT Broker
	String response = sendReqToServer(null, B_PORT, "GET",
			"/ngsi10/contextEntities/ConferenceRoom/attributes/temperature");		
	
	/*
	 * verify that there was a POST on discovery
	 * with the right path, right method, right body parameters
	 */
	d_client.verify(request()
			.withPath("/ngsi9/discoverContextAvailability")
			.withMethod("POST")
			.withBody(xpath(
					"(/discoverContextAvailabilityRequest/entityIdList/entityId//id=\"ConferenceRoom\")"
					+ "and"
					+ "(/discoverContextAvailabilityRequest/attributeList/attribute=\"temperature\")"
					))						
			,
			VerificationTimes.exactly(1)
			);
	
}
 
开发者ID:Aeronbroker,项目名称:Aeron,代码行数:29,代码来源:BBTest.java


示例14: should_call_method_execute_on_executeCommand

import org.mockserver.verify.VerificationTimes; //导入依赖的package包/类
@Test
public void should_call_method_execute_on_executeCommand() throws Exception {
	if (isUsingMockServer()) {
		mockServer
				.when(request().withPath("/xmlrpc/2/object")
						.withBody(RegexBody.regex(".*<methodName>execute</methodName>.*")))
				.respond(response().withStatusCode(200).withBody(
						"<?xml version='1.0'?>\n<methodResponse>\n<params>\n<param>\n<value><int>1</int></value>\n</param>\n</params>\n</methodResponse>\n"));
	} else {
		session.startSession();
	}
	session.executeCommand("res.users", "context_get", null);
	if (isUsingMockServer()) {
		mockServer.verify(request().withBody(new RegexBody(".*<methodName>execute</methodName>.*")),
				VerificationTimes.once());
	}
}
 
开发者ID:DeBortoliWines,项目名称:openerp-java-api,代码行数:18,代码来源:SessionTest.java


示例15: should_call_method_exec_workflow_on_executeCommand

import org.mockserver.verify.VerificationTimes; //导入依赖的package包/类
@Test
public void should_call_method_exec_workflow_on_executeCommand() throws Exception {
	if (isUsingMockServer()) {
		mockServer
				.when(request().withPath("/xmlrpc/2/object")
						.withBody(RegexBody.regex(".*<methodName>exec_workflow</methodName>.*")))
				.respond(response().withStatusCode(200).withBody(
						"<?xml version='1.0'?>\n<methodResponse>\n<params>\n<param>\n<value><int>1</int></value>\n</param>\n</params>\n</methodResponse>\n"));
	} else {
		session.startSession();
	}
	session.executeWorkflow("account.invoice", "invoice_open", 42424242);
	if (isUsingMockServer()) {
		mockServer.verify(request().withBody(new RegexBody(".*<methodName>exec_workflow</methodName>.*")),
				VerificationTimes.once());
	}
}
 
开发者ID:DeBortoliWines,项目名称:openerp-java-api,代码行数:18,代码来源:SessionTest.java


示例16: shouldVerifyReceivedRequestsWithNoBody

import org.mockserver.verify.VerificationTimes; //导入依赖的package包/类
@Test
public void shouldVerifyReceivedRequestsWithNoBody() {
    // when
    mockServerClient.when(request().withPath(calculatePath("some_path")), exactly(2)).respond(response());

    // then
    // - in http
    assertEquals(
        response()
            .withStatusCode(OK_200.code())
            .withReasonPhrase(OK_200.reasonPhrase()),
        makeRequest(
            request()
                .withPath(calculatePath("some_path")),
            headersToIgnore)
    );
    mockServerClient.verify(request()
        .withPath(calculatePath("some_path")));
    mockServerClient.verify(request()
        .withPath(calculatePath("some_path")), VerificationTimes.exactly(1));
}
 
开发者ID:jamesdbloom,项目名称:mockserver,代码行数:22,代码来源:AbstractExtendedMockingIntegrationTest.java


示例17: shouldVerifyReceivedRequests

import org.mockserver.verify.VerificationTimes; //导入依赖的package包/类
@Test
public void shouldVerifyReceivedRequests() throws Exception {
    // given
    Future<HttpResponse> responseSettableFuture =
        httpClient.sendRequest(
            request()
                .withPath("/some_path")
                .withHeader(HOST.toString(), "localhost:" + PortFactory.findFreePort()),
            new InetSocketAddress(clientAndServer.getLocalPort())
        );

    // then
    assertThat(responseSettableFuture.get(10, TimeUnit.SECONDS).getStatusCode(), is(404));

    // then
    clientAndServer.verify(request()
        .withPath("/some_path"));
    clientAndServer.verify(request()
        .withPath("/some_path"), VerificationTimes.exactly(1));
}
 
开发者ID:jamesdbloom,项目名称:mockserver,代码行数:21,代码来源:ProxyToInvalidSocketIntegrationTest.java


示例18: shouldVerifyReceivedRequests

import org.mockserver.verify.VerificationTimes; //导入依赖的package包/类
@Test
public void shouldVerifyReceivedRequests() throws Exception {
    // given
    Future<HttpResponse> responseSettableFuture =
        httpClient.sendRequest(
            request()
                .withPath("/some_path")
                .withHeader(HOST.toString(), "localhost:" + loadBalancerClient.getLocalPort()),
            new InetSocketAddress(loadBalancerClient.getLocalPort())
        );

    // then
    assertThat(responseSettableFuture.get(10, TimeUnit.SECONDS).getStatusCode(), is(404));

    // then
    clientAndServer.verify(request()
        .withPath("/some_path"));
    clientAndServer.verify(request()
        .withPath("/some_path"), VerificationTimes.exactly(1));
}
 
开发者ID:jamesdbloom,项目名称:mockserver,代码行数:21,代码来源:ProxyViaLoadBalanceIntegrationTest.java


示例19: shouldReturnValuesSetInConstructor

import org.mockserver.verify.VerificationTimes; //导入依赖的package包/类
@Test
public void shouldReturnValuesSetInConstructor() {
    // given
    HttpRequest request = request();
    VerificationTimes times = VerificationTimes.atLeast(1);
    Verification verification = verification()
            .withRequest(request)
            .withTimes(times);

    // when
    VerificationDTO verificationDTO = new VerificationDTO(verification);

    // then
    assertThat(verificationDTO.getHttpRequest(), is(new HttpRequestDTO(request)));
    assertThat(verificationDTO.getTimes(), is(new VerificationTimesDTO(times)));
}
 
开发者ID:jamesdbloom,项目名称:mockserver,代码行数:17,代码来源:VerificationDTOTest.java


示例20: shouldBuildObject

import org.mockserver.verify.VerificationTimes; //导入依赖的package包/类
@Test
public void shouldBuildObject() {
    // given
    HttpRequest request = request();
    VerificationTimes times = VerificationTimes.atLeast(1);
    Verification verification = verification()
            .withRequest(request)
            .withTimes(times);

    // when
    Verification builtVerification = new VerificationDTO(verification).buildObject();

    // then
    assertThat(builtVerification.getHttpRequest(), is(request));
    assertThat(builtVerification.getTimes(), is(times));
}
 
开发者ID:jamesdbloom,项目名称:mockserver,代码行数:17,代码来源:VerificationDTOTest.java



注:本文中的org.mockserver.verify.VerificationTimes类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Binding类代码示例发布时间:2022-05-22
下一篇:
Java ASN1Dump类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap