当前位置: 首页>>代码示例>>Java>>正文


Java ClientResponse.releaseConnection方法代码示例

本文整理汇总了Java中org.jboss.resteasy.client.ClientResponse.releaseConnection方法的典型用法代码示例。如果您正苦于以下问题:Java ClientResponse.releaseConnection方法的具体用法?Java ClientResponse.releaseConnection怎么用?Java ClientResponse.releaseConnection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jboss.resteasy.client.ClientResponse的用法示例。


在下文中一共展示了ClientResponse.releaseConnection方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: shouldReturnPublishedEntity

import org.jboss.resteasy.client.ClientResponse; //导入方法依赖的package包/类
@Test
public void shouldReturnPublishedEntity() throws Exception {
   TransformTest.Order order = createTestOrder("1", "$5.00");

   publish("exampleQueue", order, null);
   ClientResponse<?> res = consumeNext.request().header("Accept-Wait", "2").accept("application/xml").post(String.class);

   TransformTest.Order order2 = res.getEntity(TransformTest.Order.class);
   assertEquals(order, order2);
   res.releaseConnection();
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:12,代码来源:EmbeddedRestActiveMQJMSTest.java

示例2: consumeOrder

import org.jboss.resteasy.client.ClientResponse; //导入方法依赖的package包/类
private Link consumeOrder(Order order, Link consumeNext) throws Exception {
   ClientResponse<?> response = consumeNext.request().header("Accept-Wait", "4").accept("application/xml").post(String.class);
   Assert.assertEquals(200, response.getStatus());
   Assert.assertEquals("application/xml", response.getHeaders().getFirst("Content-Type").toString().toLowerCase());
   Order order2 = response.getEntity(Order.class);
   Assert.assertEquals(order, order2);
   consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consume-next");
   Assert.assertNotNull(consumeNext);
   response.releaseConnection();
   return consumeNext;
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:12,代码来源:SelectorTest.java

示例3: handleResponse

import org.jboss.resteasy.client.ClientResponse; //导入方法依赖的package包/类
protected void handleResponse(ClientResponse response) {
    if (response != null) {
        int status = response.getStatus();
        response.releaseConnection();

        if (status >= 400) {
            throw new OperationFailedException(status,
                                               "Operation failed. See server log messages.");
        }
    }
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:12,代码来源:BaseKeyCloakManager.java

示例4: shouldUseJsonAcceptHeaderToSetContentType

import org.jboss.resteasy.client.ClientResponse; //导入方法依赖的package包/类
@Test
public void shouldUseJsonAcceptHeaderToSetContentType() throws Exception {
   TransformTest.Order order = createTestOrder("1", "$5.00");
   publish("exampleQueue", order, null);

   ClientResponse<?> res = consumeNext.request().header("Accept-Wait", "2").accept("application/json").post(String.class);
   assertEquals("application/json", res.getHeaders().getFirst("Content-Type").toString().toLowerCase());

   consumeNext = res.getLinkHeader().getLinkByTitle("consume-next");
   res.releaseConnection();
   assertNotNull(consumeNext);
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:13,代码来源:EmbeddedRestActiveMQJMSTest.java

示例5: createPushRegistration

import org.jboss.resteasy.client.ClientResponse; //导入方法依赖的package包/类
private Link createPushRegistration(String queueToPushTo,
                                    Link pushSubscriptions,
                                    PushRegistrationType pushRegistrationType,
                                    int sessionCount) throws Exception {
   PushRegistration reg = new PushRegistration();
   reg.setDurable(false);
   XmlLink target = new XmlLink();
   if (pushRegistrationType == PushRegistrationType.CLASS) {
      target.setHref(generateURL(Util.getUrlPath(queueToPushTo)));
      target.setClassName(ActiveMQPushStrategy.class.getName());
   } else if (pushRegistrationType == PushRegistrationType.BRIDGE) {
      target.setHref(generateURL(Util.getUrlPath(queueToPushTo)));
      target.setRelationship("destination");
   } else if (pushRegistrationType == PushRegistrationType.TEMPLATE) {
      target.setHref(queueToPushTo);
      target.setRelationship("template");
   } else if (pushRegistrationType == PushRegistrationType.URI) {
      target.setMethod("put");
      target.setHref(queueToPushTo);
   }
   reg.setTarget(target);
   reg.setSessionCount(sessionCount);
   ClientResponse pushRegistrationResponse = pushSubscriptions.request().body("application/xml", reg).post();
   pushRegistrationResponse.releaseConnection();
   Assert.assertEquals(201, pushRegistrationResponse.getStatus());
   Link pushSubscription = pushRegistrationResponse.getLocationLink();
   return pushSubscription;
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:29,代码来源:PushQueueConsumerTest.java

示例6: testCreateQueueWithBadContentType

import org.jboss.resteasy.client.ClientResponse; //导入方法依赖的package包/类
@Test
public void testCreateQueueWithBadContentType() throws Exception {
   String queueConfig = "<queue name=\"testQueue\"><durable>true</durable></queue>";
   ClientRequest create = new ClientRequest(TestPortProvider.generateURL("/queues"));
   ClientResponse cRes = create.body("application/x-www-form-urlencoded", queueConfig).post();
   cRes.releaseConnection();

   Assert.assertEquals(415, cRes.getStatus());
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:10,代码来源:CreateDestinationTest.java

示例7: testPostOnOldConsumeNext

import org.jboss.resteasy.client.ClientResponse; //导入方法依赖的package包/类
@Test
public void testPostOnOldConsumeNext() throws Exception {
   ClientRequest request = new ClientRequest(generateURL("/topics/testTopic"));

   ClientResponse<?> response = request.head();
   response.releaseConnection();
   Assert.assertEquals(200, response.getStatus());
   Link sender = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "create");
   System.out.println("create: " + sender);
   Link consumers = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "pull-subscriptions");
   System.out.println("pull: " + consumers);
   response = Util.setAutoAck(consumers, true);
   Link consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consume-next");
   System.out.println("resource consume-next: " + consumeNext);

   response = sender.request().body("text/plain", Integer.toString(1)).post();
   response.releaseConnection();
   Assert.assertEquals(201, response.getStatus());

   response = consumeNext.request().post(String.class);
   Assert.assertEquals(200, response.getStatus());
   Assert.assertEquals("1", response.getEntity(String.class));
   response.releaseConnection();
   Link session = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consumer");
   System.out.println("session: " + session);
   consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consume-next");
   Link firstConsumeNext = consumeNext;
   System.out.println("session 1st consumeNext: " + consumeNext);

   response = sender.request().body("text/plain", Integer.toString(2)).post();
   response.releaseConnection();
   Assert.assertEquals(201, response.getStatus());

   response = consumeNext.request().header(Constants.WAIT_HEADER, "10").post(String.class);
   Assert.assertEquals(200, response.getStatus());
   Assert.assertEquals("2", response.getEntity(String.class));
   response.releaseConnection();
   session = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consumer");
   System.out.println("session: " + session);
   consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consume-next");
   System.out.println("session 2nd consumeNext: " + consumeNext);

   response = sender.request().body("text/plain", Integer.toString(3)).post();
   response.releaseConnection();
   Assert.assertEquals(201, response.getStatus());
   response = consumeNext.request().header(Constants.WAIT_HEADER, "10").post(String.class);
   Assert.assertEquals(200, response.getStatus());
   Assert.assertEquals("3", response.getEntity(String.class));
   response.releaseConnection();

   response = firstConsumeNext.request().header(Constants.WAIT_HEADER, "10").post(String.class);
   Assert.assertEquals(412, response.getStatus());
   System.out.println(response.getEntity(String.class));
   response.releaseConnection();

   response = session.request().delete();
   response.releaseConnection();
   Assert.assertEquals(204, response.getStatus());
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:60,代码来源:RepostingTopicTest.java

示例8: testRepostSuccessfulUnacknowledge

import org.jboss.resteasy.client.ClientResponse; //导入方法依赖的package包/类
@Test
public void testRepostSuccessfulUnacknowledge() throws Exception {
   ClientRequest request = new ClientRequest(generateURL("/queues/testQueue"));

   ClientResponse<?> response = request.head();
   response.releaseConnection();
   Assert.assertEquals(200, response.getStatus());
   Link sender = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "create");
   System.out.println("create: " + sender);
   Link consumers = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "pull-consumers");
   System.out.println("pull: " + consumers);
   response = Util.setAutoAck(consumers, false);
   Link consumeNext = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledge-next");
   System.out.println("resource acknowledge-next: " + consumeNext);

   response = sender.request().body("text/plain", Integer.toString(1)).post();
   response.releaseConnection();
   Assert.assertEquals(201, response.getStatus());

   response = consumeNext.request().header(Constants.WAIT_HEADER, "1").post(String.class);
   Assert.assertEquals(200, response.getStatus());
   Assert.assertEquals("1", response.getEntity(String.class));
   response.releaseConnection();
   Link session = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consumer");
   System.out.println("session: " + session);
   Link ack = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledgement");
   System.out.println("ack: " + ack);
   response = ack.request().formParameter("acknowledge", "false").post();
   response.releaseConnection();
   Assert.assertEquals(204, response.getStatus());
   response = ack.request().formParameter("acknowledge", "false").post();
   response.releaseConnection();
   Assert.assertEquals(204, response.getStatus());
   response = ack.request().formParameter("acknowledge", "false").post();
   response.releaseConnection();
   Assert.assertEquals(204, response.getStatus());
   consumeNext = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledge-next");
   System.out.println("session 1st acknowledge-next: " + consumeNext);

   response = consumeNext.request().header(Constants.WAIT_HEADER, "10").post(String.class);
   Assert.assertEquals(200, response.getStatus());
   Assert.assertEquals("1", response.getEntity(String.class));
   response.releaseConnection();
   response = consumeNext.request().header(Constants.WAIT_HEADER, "10").post(String.class);
   Assert.assertEquals(200, response.getStatus());
   Assert.assertEquals("1", response.getEntity(String.class));
   response.releaseConnection();
   response = consumeNext.request().header(Constants.WAIT_HEADER, "10").post(String.class);
   Assert.assertEquals(200, response.getStatus());
   Assert.assertEquals("1", response.getEntity(String.class));
   response.releaseConnection();
   response = consumeNext.request().header(Constants.WAIT_HEADER, "10").post(String.class);
   Assert.assertEquals(200, response.getStatus());
   Assert.assertEquals("1", response.getEntity(String.class));
   response.releaseConnection();
   ack = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledgement");
   System.out.println("ack: " + ack);
   response = ack.request().formParameter("acknowledge", "true").post();
   response.releaseConnection();
   Assert.assertEquals(204, response.getStatus());

   response = session.request().delete();
   response.releaseConnection();
   Assert.assertEquals(204, response.getStatus());
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:66,代码来源:RepostingQueueTest.java

示例9: testPostOnSameConsumeNextWithTimeout

import org.jboss.resteasy.client.ClientResponse; //导入方法依赖的package包/类
@Test
public void testPostOnSameConsumeNextWithTimeout() throws Exception {
   ClientRequest request = new ClientRequest(generateURL("/queues/testQueue"));

   ClientResponse<?> response = request.head();
   response.releaseConnection();
   Assert.assertEquals(200, response.getStatus());
   Link sender = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "create");
   System.out.println("create: " + sender);
   Link consumers = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "pull-consumers");
   System.out.println("pull: " + consumers);
   response = Util.setAutoAck(consumers, true);
   Link consumeNext = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consume-next");
   System.out.println("resource consume-next: " + consumeNext);

   response = sender.request().body("text/plain", Integer.toString(1)).post();
   response.releaseConnection();
   Assert.assertEquals(201, response.getStatus());

   response = consumeNext.request().header(Constants.WAIT_HEADER, "1").post(String.class);
   Assert.assertEquals(200, response.getStatus());
   Assert.assertEquals("1", response.getEntity(String.class));
   response.releaseConnection();
   Link session = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consumer");
   System.out.println("session: " + session);
   consumeNext = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consume-next");
   System.out.println("session 1st consumeNext: " + consumeNext);

   // test timeout here
   response = consumeNext.request().post(String.class);
   response.releaseConnection();
   Assert.assertEquals(503, response.getStatus());
   session = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consumer");
   System.out.println("session: " + session);
   consumeNext = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consume-next");
   System.out.println("session 2nd consumeNext: " + consumeNext);

   response = sender.request().body("text/plain", Integer.toString(3)).post();
   response.releaseConnection();
   Assert.assertEquals(201, response.getStatus());
   response = consumeNext.request().header(Constants.WAIT_HEADER, "10").post(String.class);
   Assert.assertEquals(200, response.getStatus());
   Assert.assertEquals("3", response.getEntity(String.class));
   response.releaseConnection();

   response = session.request().delete();
   response.releaseConnection();
   Assert.assertEquals(204, response.getStatus());
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:50,代码来源:RepostingQueueTest.java

示例10: testRepostAckAfterUnacknowledge

import org.jboss.resteasy.client.ClientResponse; //导入方法依赖的package包/类
@Test
public void testRepostAckAfterUnacknowledge() throws Exception {
   ClientRequest request = new ClientRequest(generateURL("/topics/testTopic"));

   ClientResponse<?> response = request.head();
   response.releaseConnection();
   Assert.assertEquals(200, response.getStatus());
   Link sender = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "create");
   System.out.println("create: " + sender);
   Link consumers = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "pull-subscriptions");
   System.out.println("pull: " + consumers);
   response = Util.setAutoAck(consumers, false);
   Link consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledge-next");
   System.out.println("resource acknowledge-next: " + consumeNext);

   response = sender.request().body("text/plain", Integer.toString(1)).post();
   response.releaseConnection();
   Assert.assertEquals(201, response.getStatus());

   response = consumeNext.request().post(String.class);
   Assert.assertEquals(200, response.getStatus());
   Assert.assertEquals("1", response.getEntity(String.class));
   response.releaseConnection();
   Link session = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consumer");
   System.out.println("session: " + session);
   Link ack = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledgement");
   System.out.println("ack: " + ack);
   response = ack.request().formParameter("acknowledge", "false").post();
   response.releaseConnection();
   Assert.assertEquals(204, response.getStatus());
   response = ack.request().formParameter("acknowledge", "true").post();
   Assert.assertEquals(412, response.getStatus());
   System.out.println(response.getEntity(String.class));
   response.releaseConnection();
   consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledge-next");
   System.out.println("session 1st acknowledge-next: " + consumeNext);

   response = consumeNext.request().header(Constants.WAIT_HEADER, "10").post(String.class);
   Assert.assertEquals(200, response.getStatus());
   Assert.assertEquals("1", response.getEntity(String.class));
   response.releaseConnection();
   response = consumeNext.request().header(Constants.WAIT_HEADER, "10").post(String.class);
   Assert.assertEquals(200, response.getStatus());
   Assert.assertEquals("1", response.getEntity(String.class));
   response.releaseConnection();
   response = consumeNext.request().header(Constants.WAIT_HEADER, "10").post(String.class);
   Assert.assertEquals(200, response.getStatus());
   Assert.assertEquals("1", response.getEntity(String.class));
   response.releaseConnection();
   response = consumeNext.request().header(Constants.WAIT_HEADER, "10").post(String.class);
   Assert.assertEquals(200, response.getStatus());
   Assert.assertEquals("1", response.getEntity(String.class));
   response.releaseConnection();
   ack = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledgement");
   System.out.println("ack: " + ack);
   response = ack.request().formParameter("acknowledge", "true").post();
   response.releaseConnection();
   Assert.assertEquals(204, response.getStatus());

   response = session.request().delete();
   response.releaseConnection();
   Assert.assertEquals(204, response.getStatus());
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:64,代码来源:RepostingTopicTest.java

示例11: testPostOnOldAcknowledgeNextAndAck

import org.jboss.resteasy.client.ClientResponse; //导入方法依赖的package包/类
@Test
public void testPostOnOldAcknowledgeNextAndAck() throws Exception {
   ClientRequest request = new ClientRequest(generateURL("/topics/testTopic"));

   ClientResponse<?> response = request.head();
   response.releaseConnection();
   Assert.assertEquals(200, response.getStatus());
   Link sender = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "create");
   System.out.println("create: " + sender);
   Link consumers = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "pull-subscriptions");
   System.out.println("pull: " + consumers);
   response = Util.setAutoAck(consumers, false);
   Link consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledge-next");
   System.out.println("resource acknowledge-next: " + consumeNext);

   response = sender.request().body("text/plain", Integer.toString(1)).post();
   response.releaseConnection();
   Assert.assertEquals(201, response.getStatus());

   response = consumeNext.request().header(Constants.WAIT_HEADER, "1").post(String.class);
   Assert.assertEquals(200, response.getStatus());
   Assert.assertEquals("1", response.getEntity(String.class));
   response.releaseConnection();
   Link session = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consumer");
   System.out.println("session: " + session);
   Link ack = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledgement");
   Link oldAck = ack;
   System.out.println("ack: " + ack);
   response = ack.request().formParameter("acknowledge", "true").post();
   response.releaseConnection();
   Assert.assertEquals(204, response.getStatus());
   consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledge-next");
   System.out.println("session 1st acknowledge-next: " + consumeNext);
   Link firstConsumeNext = consumeNext;

   response = sender.request().body("text/plain", Integer.toString(2)).post();
   response.releaseConnection();
   Assert.assertEquals(201, response.getStatus());

   response = consumeNext.request().header(Constants.WAIT_HEADER, "10").post(String.class);
   response.releaseConnection();
   Assert.assertEquals(200, response.getStatus());
   ack = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledgement");
   System.out.println("ack: " + ack);

   response = oldAck.request().formParameter("acknowledge", "true").post();
   Assert.assertEquals(412, response.getStatus());
   System.out.println(response.getEntity(String.class));
   response.releaseConnection();
   consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledge-next");

   response = ack.request().formParameter("acknowledge", "true").post();
   response.releaseConnection();
   Assert.assertEquals(204, response.getStatus());
   consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledge-next");

   response = consumeNext.request().post(String.class);
   response.releaseConnection();
   Assert.assertEquals(503, response.getStatus());

   response = session.request().delete();
   response.releaseConnection();
   Assert.assertEquals(204, response.getStatus());
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:65,代码来源:RepostingTopicTest.java

示例12: testPull

import org.jboss.resteasy.client.ClientResponse; //导入方法依赖的package包/类
public void testPull(int start, String queueName) throws Exception {
   ClientRequest request = new ClientRequest(generateURL(Util.getUrlPath(queueName)));

   ClientResponse<?> response = Util.head(request);
   Link sender = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "create");
   System.out.println("create: " + sender);
   Link consumers = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "pull-consumers");
   System.out.println("pull: " + consumers);
   response = Util.setAutoAck(consumers, false);
   Link consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledge-next");
   System.out.println("poller: " + consumeNext);

   ClientResponse<String> res = consumeNext.request().post(String.class);
   res.releaseConnection();
   Assert.assertEquals(503, res.getStatus());
   consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "acknowledge-next");
   System.out.println(consumeNext);
   res = sender.request().body("text/plain", Integer.toString(start)).post();
   res.releaseConnection();
   Assert.assertEquals(201, res.getStatus());
   res = consumeNext.request().post(String.class);
   Assert.assertEquals(200, res.getStatus());
   Assert.assertEquals(Integer.toString(start++), res.getEntity());
   res.releaseConnection();
   Link ack = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "acknowledgement");
   System.out.println("ack: " + ack);
   ClientResponse ackRes = ack.request().formParameter("acknowledge", "true").post();
   ackRes.releaseConnection();
   Assert.assertEquals(204, ackRes.getStatus());
   res = consumeNext.request().post();
   res.releaseConnection();
   Assert.assertEquals(503, res.getStatus());
   res = sender.request().body("text/plain", Integer.toString(start)).post();
   res.releaseConnection();
   Assert.assertEquals(201, res.getStatus());
   res = sender.request().body("text/plain", Integer.toString(start + 1)).post();
   res.releaseConnection();
   Assert.assertEquals(201, res.getStatus());

   res = consumeNext.request().post(String.class);
   Assert.assertEquals(200, res.getStatus());
   Assert.assertEquals(Integer.toString(start++), res.getEntity());
   res.releaseConnection();
   ack = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "acknowledgement");
   System.out.println("ack: " + ack);
   ackRes = ack.request().formParameter("acknowledge", "true").post();
   ackRes.releaseConnection();
   Assert.assertEquals(204, ackRes.getStatus());

   res = consumeNext.request().post(String.class);
   Assert.assertEquals(200, res.getStatus());
   Assert.assertEquals(Integer.toString(start++), res.getEntity());
   res.releaseConnection();
   ack = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "acknowledgement");
   System.out.println("ack: " + ack);
   ackRes = ack.request().formParameter("acknowledge", "true").post();
   ackRes.releaseConnection();
   Assert.assertEquals(204, ackRes.getStatus());
   Link session = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), ackRes, "consumer");

   res = consumeNext.request().post();
   res.releaseConnection();
   Assert.assertEquals(503, res.getStatus());
   System.out.println(session);
   res = session.request().delete();
   res.releaseConnection();
   Assert.assertEquals(204, res.getStatus());
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:69,代码来源:ClientAckQueueTest.java

示例13: testSuccessFirst

import org.jboss.resteasy.client.ClientResponse; //导入方法依赖的package包/类
public void testSuccessFirst(int start, String queueName) throws Exception {
   ClientRequest request = new ClientRequest(generateURL(Util.getUrlPath(queueName)));

   ClientResponse<?> response = Util.head(request);
   Link sender = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "create");
   System.out.println("create: " + sender);
   Link consumers = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "pull-consumers");
   System.out.println("pull-consumers: " + consumers);
   response = Util.setAutoAck(consumers, false);
   Link consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledge-next");
   System.out.println("acknowledge-next: " + consumeNext);

   String data = Integer.toString(start);
   System.out.println("Sending: " + data);
   ClientResponse<?> res = sender.request().body("text/plain", data).post();
   res.releaseConnection();
   Assert.assertEquals(201, res.getStatus());

   System.out.println("call acknowledge-next");
   res = consumeNext.request().post(String.class);
   Assert.assertEquals(200, res.getStatus());
   Assert.assertEquals(Integer.toString(start++), res.getEntity());
   res.releaseConnection();
   Link ack = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "acknowledgement");
   System.out.println("ack: " + ack);
   Assert.assertNotNull(ack);
   Link session = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "consumer");
   System.out.println("session: " + session);
   consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "acknowledge-next");
   System.out.println("consumeNext: " + consumeNext);
   ClientResponse ackRes = ack.request().formParameter("acknowledge", "true").post();
   ackRes.releaseConnection();
   Assert.assertEquals(204, ackRes.getStatus());
   consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), ackRes, "acknowledge-next");

   System.out.println("sending next...");
   String data2 = Integer.toString(start);
   System.out.println("Sending: " + data2);
   res = sender.request().body("text/plain", data2).post();
   res.releaseConnection();
   Assert.assertEquals(201, res.getStatus());

   System.out.println(consumeNext);
   res = consumeNext.request().header(Constants.WAIT_HEADER, "10").post(String.class);
   Assert.assertEquals(200, res.getStatus());
   Assert.assertEquals(Integer.toString(start++), res.getEntity());
   res.releaseConnection();
   ack = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "acknowledgement");
   System.out.println("ack: " + ack);
   Assert.assertNotNull(ack);
   session = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "consumer");
   System.out.println("session: " + session);
   ackRes = ack.request().formParameter("acknowledge", "true").post();
   ackRes.releaseConnection();
   Assert.assertEquals(204, ackRes.getStatus());
   consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), ackRes, "acknowledge-next");
   System.out.println("consumeNext: " + consumeNext);
   res = consumeNext.request().post(String.class);
   res.releaseConnection();

   System.out.println(res.getStatus());

   Assert.assertEquals(204, session.request().delete().getStatus());
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:65,代码来源:ClientAckQueueTest.java

示例14: testRepostSuccessfulUnacknowledge

import org.jboss.resteasy.client.ClientResponse; //导入方法依赖的package包/类
@Test
public void testRepostSuccessfulUnacknowledge() throws Exception {
   ClientRequest request = new ClientRequest(generateURL("/topics/testTopic"));

   ClientResponse<?> response = request.head();
   response.releaseConnection();
   Assert.assertEquals(200, response.getStatus());
   Link sender = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "create");
   System.out.println("create: " + sender);
   Link consumers = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "pull-subscriptions");
   System.out.println("pull: " + consumers);
   response = Util.setAutoAck(consumers, false);
   Link consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledge-next");
   System.out.println("resource acknowledge-next: " + consumeNext);

   response = sender.request().body("text/plain", Integer.toString(1)).post();
   response.releaseConnection();
   Assert.assertEquals(201, response.getStatus());

   response = consumeNext.request().post(String.class);
   Assert.assertEquals(200, response.getStatus());
   Assert.assertEquals("1", response.getEntity(String.class));
   response.releaseConnection();
   Link session = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consumer");
   System.out.println("session: " + session);
   Link ack = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledgement");
   System.out.println("ack: " + ack);
   response = ack.request().formParameter("acknowledge", "false").post();
   response.releaseConnection();
   Assert.assertEquals(204, response.getStatus());
   response = ack.request().formParameter("acknowledge", "false").post();
   response.releaseConnection();
   Assert.assertEquals(204, response.getStatus());
   response = ack.request().formParameter("acknowledge", "false").post();
   response.releaseConnection();
   Assert.assertEquals(204, response.getStatus());
   consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledge-next");
   System.out.println("session 1st acknowledge-next: " + consumeNext);

   response = consumeNext.request().header(Constants.WAIT_HEADER, "10").post(String.class);
   Assert.assertEquals(200, response.getStatus());
   Assert.assertEquals("1", response.getEntity(String.class));
   response.releaseConnection();
   response = consumeNext.request().header(Constants.WAIT_HEADER, "10").post(String.class);
   Assert.assertEquals(200, response.getStatus());
   Assert.assertEquals("1", response.getEntity(String.class));
   response.releaseConnection();
   response = consumeNext.request().header(Constants.WAIT_HEADER, "10").post(String.class);
   Assert.assertEquals(200, response.getStatus());
   Assert.assertEquals("1", response.getEntity(String.class));
   response.releaseConnection();
   response = consumeNext.request().header(Constants.WAIT_HEADER, "10").post(String.class);
   Assert.assertEquals(200, response.getStatus());
   Assert.assertEquals("1", response.getEntity(String.class));
   response.releaseConnection();
   ack = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledgement");
   System.out.println("ack: " + ack);
   response = ack.request().formParameter("acknowledge", "true").post();
   response.releaseConnection();
   Assert.assertEquals(204, response.getStatus());

   response = session.request().delete();
   response.releaseConnection();
   Assert.assertEquals(204, response.getStatus());
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:66,代码来源:RepostingTopicTest.java

示例15: testSuccessFirst

import org.jboss.resteasy.client.ClientResponse; //导入方法依赖的package包/类
@Test
public void testSuccessFirst() throws Exception {
   String testName = "AutoAckTopicTest.testSuccessFirst";
   TopicDeployment deployment = new TopicDeployment();
   deployment.setDuplicatesAllowed(true);
   deployment.setDurableSend(false);
   deployment.setName(testName);
   manager.getTopicManager().deploy(deployment);

   ClientRequest request = new ClientRequest(TestPortProvider.generateURL("/topics/" + testName));

   ClientResponse<?> response = request.head();
   response.releaseConnection();
   Assert.assertEquals(200, response.getStatus());
   Link sender = getLinkByTitle(manager.getTopicManager().getLinkStrategy(), response, "create");
   Link subscriptions = getLinkByTitle(manager.getTopicManager().getLinkStrategy(), response, "pull-subscriptions");

   ClientResponse<?> res = subscriptions.request().post();
   res.releaseConnection();
   Assert.assertEquals(201, res.getStatus());
   Link sub1 = res.getLocationLink();
   Assert.assertNotNull(sub1);
   Link consumeNext1 = getLinkByTitle(manager.getTopicManager().getLinkStrategy(), res, "consume-next");
   Assert.assertNotNull(consumeNext1);
   System.out.println("consumeNext1: " + consumeNext1);

   res = subscriptions.request().post();
   res.releaseConnection();
   Assert.assertEquals(201, res.getStatus());
   Link sub2 = res.getLocationLink();
   Assert.assertNotNull(sub2);
   Link consumeNext2 = getLinkByTitle(manager.getTopicManager().getLinkStrategy(), res, "consume-next");
   Assert.assertNotNull(consumeNext2);
   System.out.println("consumeNext2: " + consumeNext2);

   res = sender.request().body("text/plain", "1").post();
   res.releaseConnection();
   Assert.assertEquals(201, res.getStatus());
   res = sender.request().body("text/plain", "2").post();
   res.releaseConnection();
   Assert.assertEquals(201, res.getStatus());

   res = consumeNext1.request().post(String.class);
   Assert.assertEquals(200, res.getStatus());
   Assert.assertEquals("1", res.getEntity(String.class));
   res.releaseConnection();
   consumeNext1 = getLinkByTitle(manager.getTopicManager().getLinkStrategy(), res, "consume-next");

   res = consumeNext1.request().post(String.class);
   Assert.assertEquals(200, res.getStatus());
   Assert.assertEquals("2", res.getEntity(String.class));
   res.releaseConnection();
   consumeNext1 = getLinkByTitle(manager.getTopicManager().getLinkStrategy(), res, "consume-next");

   res = consumeNext2.request().post(String.class);
   Assert.assertEquals(200, res.getStatus());
   Assert.assertEquals("1", res.getEntity(String.class));
   res.releaseConnection();
   consumeNext2 = getLinkByTitle(manager.getTopicManager().getLinkStrategy(), res, "consume-next");

   res = consumeNext2.request().post(String.class);
   Assert.assertEquals(200, res.getStatus());
   Assert.assertEquals("2", res.getEntity(String.class));
   res.releaseConnection();
   consumeNext2 = getLinkByTitle(manager.getTopicManager().getLinkStrategy(), res, "consume-next");
   Assert.assertEquals(204, sub1.request().delete().getStatus());
   Assert.assertEquals(204, sub2.request().delete().getStatus());
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:69,代码来源:AutoAckTopicTest.java


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