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

Java SimpleString类代码示例

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

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



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

示例1: connectInternal

import org.apache.activemq.artemis.api.core.SimpleString; //导入依赖的package包/类
private void connectInternal(Runnable command) {
	final JMSContext jmsCtx = mock(JMSContext.class);
	when(this.jmsCtxProvider.get()).thenReturn(jmsCtx);

	when(this.artemisConfig.getManagementNotificationAddress()).thenReturn(new SimpleString("notif"));
	final JMSConsumer consumer = mock(JMSConsumer.class);
	when(jmsCtx.createConsumer(any())).thenReturn(consumer);

	command.run();

	verify(this.jmsCtxProvider).get();
	verify(this.artemisConfig).getManagementNotificationAddress();
	verify(this.log).info("Connecting to broker for sourcing destination events.");
	verify(jmsCtx).createConsumer(any());
	verify(consumer).setMessageListener(this.eventProducer);
	verifyNoMoreInteractions(consumer);
}
 
开发者ID:dansiviter,项目名称:cito,代码行数:18,代码来源:EventProducerTest.java


示例2: moveReference

import org.apache.activemq.artemis.api.core.SimpleString; //导入依赖的package包/类
@Override
public synchronized boolean moveReference(final long messageID,
                                          final SimpleString toAddress,
                                          final boolean rejectDuplicate) throws Exception {
   try (LinkedListIterator<MessageReference> iter = iterator()) {
      while (iter.hasNext()) {
         MessageReference ref = iter.next();
         if (ref.getMessage().getMessageID() == messageID) {
            iter.remove();
            refRemoved(ref);
            incDelivering();
            try {
               move(null, toAddress, ref, rejectDuplicate, AckReason.NORMAL);
            } catch (Exception e) {
               decDelivering();
               throw e;
            }
            return true;
         }
      }
      return false;
   }
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:24,代码来源:QueueImpl.java


示例3: sendQueueInfoToQueue

import org.apache.activemq.artemis.api.core.SimpleString; //导入依赖的package包/类
@Override
public void sendQueueInfoToQueue(final String queueName, final String address) throws Exception {
   checkStarted();

   clearIO();
   try {
      postOffice.sendQueueInfoToQueue(new SimpleString(queueName), new SimpleString(address == null ? "" : address));

      GroupingHandler handler = server.getGroupingHandler();
      if (handler != null) {
         // the group handler would miss responses if the group was requested before the reset was done
         // on that case we ask the groupinghandler to replay its send in case it's waiting for the information
         handler.resendPending();
      }
   } finally {
      blockOnIO();
   }
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:19,代码来源:ActiveMQServerControlImpl.java


示例4: locateSubscription

import org.apache.activemq.artemis.api.core.SimpleString; //导入依赖的package包/类
/**
 * @param queueID
 * @param pageSubscriptions
 * @param queueInfos
 * @return
 */
private static PageSubscription locateSubscription(final long queueID,
                                                   final Map<Long, PageSubscription> pageSubscriptions,
                                                   final Map<Long, QueueBindingInfo> queueInfos,
                                                   final PagingManager pagingManager) throws Exception {

   PageSubscription subs = pageSubscriptions.get(queueID);
   if (subs == null) {
      QueueBindingInfo queueInfo = queueInfos.get(queueID);

      if (queueInfo != null) {
         SimpleString address = queueInfo.getAddress();
         PagingStore store = pagingManager.getPageStore(address);
         subs = store.getCursorProvider().getSubscription(queueID);
         pageSubscriptions.put(queueID, subs);
      }
   }

   return subs;
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:26,代码来源:AbstractJournalStorageManager.java


示例5: removeBinding

import org.apache.activemq.artemis.api.core.SimpleString; //导入依赖的package包/类
@Override
public void removeBinding(final Binding binding) {
   if (binding.isExclusive()) {
      exclusiveBindings.remove(binding);
   } else {
      SimpleString routingName = binding.getRoutingName();

      List<Binding> bindings = routingNameBindingMap.get(routingName);

      if (bindings != null) {
         bindings.remove(binding);

         if (bindings.isEmpty()) {
            routingNameBindingMap.remove(routingName);
         }
      }
   }

   bindingsMap.remove(binding.getID());

   if (logger.isTraceEnabled()) {
      logger.trace("Removing binding " + binding + " from " + this + " bindingTable: " + debugBindings());
   }
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:25,代码来源:BindingsImpl.java


示例6: testTypedProperties

import org.apache.activemq.artemis.api.core.SimpleString; //导入依赖的package包/类
@Test
public void testTypedProperties() throws Exception {
   SimpleString longKey = RandomUtil.randomSimpleString();
   long longValue = RandomUtil.randomLong();
   SimpleString simpleStringKey = RandomUtil.randomSimpleString();
   SimpleString simpleStringValue = RandomUtil.randomSimpleString();
   TypedProperties otherProps = new TypedProperties();
   otherProps.putLongProperty(longKey, longValue);
   otherProps.putSimpleStringProperty(simpleStringKey, simpleStringValue);

   props.putTypedProperties(otherProps);

   long ll = props.getLongProperty(longKey);
   Assert.assertEquals(longValue, ll);
   SimpleString ss = props.getSimpleStringProperty(simpleStringKey);
   Assert.assertEquals(simpleStringValue, ss);
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:18,代码来源:TypedPropertiesTest.java


示例7: testByteBufSimpleStringPool

import org.apache.activemq.artemis.api.core.SimpleString; //导入依赖的package包/类
@Test
public void testByteBufSimpleStringPool() {
   final int capacity = 8;
   final int chars = Integer.toString(capacity).length();
   final SimpleString.ByteBufSimpleStringPool pool = new SimpleString.ByteBufSimpleStringPool(capacity, chars);
   final int bytes = new SimpleString(Integer.toString(capacity)).sizeof();
   final ByteBuf bb = Unpooled.buffer(bytes, bytes);
   for (int i = 0; i < capacity; i++) {
      final SimpleString s = new SimpleString(Integer.toString(i));
      bb.resetWriterIndex();
      SimpleString.writeSimpleString(bb, s);
      bb.resetReaderIndex();
      final SimpleString expectedPooled = pool.getOrCreate(bb);
      bb.resetReaderIndex();
      Assert.assertSame(expectedPooled, pool.getOrCreate(bb));
   }
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:18,代码来源:SimpleStringTest.java


示例8: testCreateQueueWithNullAddress

import org.apache.activemq.artemis.api.core.SimpleString; //导入依赖的package包/类
@Test
public void testCreateQueueWithNullAddress() throws Exception {
   SimpleString address = RandomUtil.randomSimpleString();
   SimpleString name = address;

   ActiveMQServerControl serverControl = createManagementControl();

   checkNoResource(ObjectNameBuilder.DEFAULT.getQueueObjectName(address, name, RoutingType.ANYCAST));
   serverControl.createQueue(null, name.toString(), "ANYCAST");

   checkResource(ObjectNameBuilder.DEFAULT.getQueueObjectName(name, name, RoutingType.ANYCAST));
   QueueControl queueControl = ManagementControlHelper.createQueueControl(address, name, RoutingType.ANYCAST, mbeanServer);
   Assert.assertEquals(address.toString(), queueControl.getAddress());
   Assert.assertEquals(name.toString(), queueControl.getName());
   Assert.assertNull(queueControl.getFilter());
   Assert.assertEquals(true, queueControl.isDurable());
   Assert.assertEquals(false, queueControl.isTemporary());

   serverControl.destroyQueue(name.toString());

   checkNoResource(ObjectNameBuilder.DEFAULT.getQueueObjectName(address, name, RoutingType.ANYCAST));
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:23,代码来源:ActiveMQServerControlTest.java


示例9: testMulticastMessageRoutingExclusivity

import org.apache.activemq.artemis.api.core.SimpleString; //导入依赖的package包/类
@Test
public void testMulticastMessageRoutingExclusivity() throws Exception {
   conn.connect(defUser, defPass);

   final String addressA = "addressA";
   final String queueA = "queueA";
   final String queueB = "queueB";
   final String queueC = "queueC";

   ActiveMQServer activeMQServer = server.getActiveMQServer();
   ActiveMQServerControl serverControl = server.getActiveMQServer().getActiveMQServerControl();
   serverControl.createAddress(addressA, RoutingType.ANYCAST.toString() + "," + RoutingType.MULTICAST.toString());
   serverControl.createQueue(addressA, queueA, RoutingType.ANYCAST.toString());
   serverControl.createQueue(addressA, queueB, RoutingType.MULTICAST.toString());
   serverControl.createQueue(addressA, queueC, RoutingType.MULTICAST.toString());

   send(conn, addressA, null, "Hello World!", true, RoutingType.MULTICAST);

   assertTrue(Wait.waitFor(() -> activeMQServer.locateQueue(SimpleString.toSimpleString(queueA)).getMessageCount() == 0, 2000, 100));
   assertTrue(Wait.waitFor(() -> activeMQServer.locateQueue(SimpleString.toSimpleString(queueC)).getMessageCount() + activeMQServer.locateQueue(SimpleString.toSimpleString(queueB)).getMessageCount() == 2, 2000, 100));
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:22,代码来源:StompTest.java


示例10: testLargeMessage

import org.apache.activemq.artemis.api.core.SimpleString; //导入依赖的package包/类
@Test
public void testLargeMessage() throws Exception {
   ClientProducer producer = clientSessionTxReceives.createProducer(address);
   ClientConsumer consumer = clientSessionTxReceives.createConsumer(qName1);
   SimpleString rh = new SimpleString("SMID1");

   for (int i = 0; i < 50; i++) {
      ClientMessage message = clientSession.createMessage(true);
      message.setBodyInputStream(createFakeLargeStream(300 * 1024));
      message.putStringProperty(Message.HDR_LAST_VALUE_NAME, rh);
      producer.send(message);
      clientSession.commit();
   }
   clientSessionTxReceives.start();
   ClientMessage m = consumer.receive(1000);
   Assert.assertNotNull(m);
   m.acknowledge();
   Assert.assertNull(consumer.receiveImmediate());
   clientSessionTxReceives.commit();
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:21,代码来源:LVQTest.java


示例11: testGetMessagesAdded

import org.apache.activemq.artemis.api.core.SimpleString; //导入依赖的package包/类
@Test
public void testGetMessagesAdded() throws Exception {
   SimpleString address = RandomUtil.randomSimpleString();
   SimpleString queue = RandomUtil.randomSimpleString();

   session.createQueue(address, queue, null, false);

   QueueControl queueControl = createManagementControl(address, queue);
   Assert.assertEquals(0, getMessagesAdded(queueControl));

   ClientProducer producer = session.createProducer(address);
   producer.send(session.createMessage(false));
   Assert.assertEquals(1, getMessagesAdded(queueControl));
   producer.send(session.createMessage(false));
   Assert.assertEquals(2, getMessagesAdded(queueControl));

   consumeMessages(2, session, queue);

   Assert.assertEquals(2, getMessagesAdded(queueControl));

   session.deleteQueue(queue);
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:23,代码来源:QueueControlTest.java


示例12: printMessageProperties

import org.apache.activemq.artemis.api.core.SimpleString; //导入依赖的package包/类
private void printMessageProperties(Message message) throws XMLStreamException {
   xmlWriter.writeStartElement(XmlDataConstants.PROPERTIES_PARENT);
   for (SimpleString key : message.getPropertyNames()) {
      Object value = message.getObjectProperty(key);
      xmlWriter.writeEmptyElement(XmlDataConstants.PROPERTIES_CHILD);
      xmlWriter.writeAttribute(XmlDataConstants.PROPERTY_NAME, key.toString());
      xmlWriter.writeAttribute(XmlDataConstants.PROPERTY_VALUE, XmlDataExporterUtil.convertProperty(value));

      // Write the property type as an attribute
      String propertyType = XmlDataExporterUtil.getPropertyType(value);
      if (propertyType != null) {
         xmlWriter.writeAttribute(XmlDataConstants.PROPERTY_TYPE, propertyType);
      }
   }
   xmlWriter.writeEndElement(); // end PROPERTIES_PARENT
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:17,代码来源:XmlDataExporter.java


示例13: testMulticastMessageRoutingExclusivityUsingProperty

import org.apache.activemq.artemis.api.core.SimpleString; //导入依赖的package包/类
@Test(timeout = 60000)
public void testMulticastMessageRoutingExclusivityUsingProperty() throws Exception {
   final String addressA = "addressA";
   final String queueA = "queueA";
   final String queueB = "queueB";
   final String queueC = "queueC";

   ActiveMQServerControl serverControl = server.getActiveMQServerControl();
   serverControl.createAddress(addressA, RoutingType.ANYCAST.toString() + "," + RoutingType.MULTICAST.toString());
   serverControl.createQueue(addressA, queueA, RoutingType.ANYCAST.toString());
   serverControl.createQueue(addressA, queueB, RoutingType.MULTICAST.toString());
   serverControl.createQueue(addressA, queueC, RoutingType.MULTICAST.toString());

   sendMessages(addressA, 1, RoutingType.MULTICAST);

   assertEquals(0, server.locateQueue(SimpleString.toSimpleString(queueA)).getMessageCount());
   assertEquals(2, server.locateQueue(SimpleString.toSimpleString(queueC)).getMessageCount() + server.locateQueue(SimpleString.toSimpleString(queueB)).getMessageCount());
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:19,代码来源:AmqpMessageRoutingTest.java


示例14: testSystemPropertyBlackWhiteListDefault

import org.apache.activemq.artemis.api.core.SimpleString; //导入依赖的package包/类
@Test
public void testSystemPropertyBlackWhiteListDefault() throws Exception {
   System.setProperty(ObjectInputStreamWithClassLoader.BLACKLIST_PROPERTY, "*");
   System.setProperty(ObjectInputStreamWithClassLoader.WHITELIST_PROPERTY, "some.other.package");

   String qname = "SerialTestQueue";
   SimpleString qaddr = new SimpleString(qname);
   liveService.createQueue(qaddr, RoutingType.ANYCAST, qaddr, null, true, false);

   try {
      String blackList = null;
      String whiteList = null;
      Object obj = receiveObjectMessage(blackList, whiteList, qname, new TestClass1(), false, false);
      assertTrue("Object is " + obj, obj instanceof JMSException);
      //but String always trusted
      obj = receiveObjectMessage(blackList, whiteList, qname, new String("hello"), false, false);
      assertTrue("java.lang.String always trusted " + obj, "hello".equals(obj));

      //override
      blackList = "some.other.package";
      whiteList = "org.apache.activemq.artemis.tests.integration";
      obj = receiveObjectMessage(blackList, whiteList, qname, new TestClass1(), false, false);
      assertTrue("Object is " + obj, obj instanceof TestClass1);
      //but String always trusted
      obj = receiveObjectMessage(blackList, whiteList, qname, new String("hello"), false, false);
      assertTrue("java.lang.String always trusted " + obj, "hello".equals(obj));
   } finally {
      System.clearProperty(ObjectInputStreamWithClassLoader.BLACKLIST_PROPERTY);
      System.clearProperty(ObjectInputStreamWithClassLoader.WHITELIST_PROPERTY);
   }
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:32,代码来源:ActiveMQConnectionFactoryTest.java


示例15: testM

import org.apache.activemq.artemis.api.core.SimpleString; //导入依赖的package包/类
@Test
public void testM() {
   SimpleString s1 = new SimpleString("a.b.c");
   SimpleString s2 = new SimpleString("a.b.x.e");
   SimpleString s3 = new SimpleString("a.b.c.#");
   Address a1 = new AddressImpl(s1);
   Address a2 = new AddressImpl(s2);
   Address w = new AddressImpl(s3);
   Assert.assertTrue(a1.matches(w));
   Assert.assertFalse(a2.matches(w));
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:12,代码来源:AddressImplTest.java


示例16: testSECURITY_PERMISSION_VIOLATION

import org.apache.activemq.artemis.api.core.SimpleString; //导入依赖的package包/类
@Test
public void testSECURITY_PERMISSION_VIOLATION() throws Exception {
   SimpleString queue = RandomUtil.randomSimpleString();
   SimpleString address = RandomUtil.randomSimpleString();

   // guest can not create queue
   Role role = new Role("roleCanNotCreateQueue", true, true, false, true, false, true, true, true, true, true);
   Set<Role> roles = new HashSet<>();
   roles.add(role);
   server.getSecurityRepository().addMatch(address.toString(), roles);
   ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager();
   securityManager.getConfiguration().addRole("guest", "roleCanNotCreateQueue");

   SecurityNotificationTest.flush(notifConsumer);

   ServerLocator locator = createInVMNonHALocator();
   ClientSessionFactory sf = createSessionFactory(locator);
   ClientSession guestSession = sf.createSession("guest", "guest", false, true, true, false, 1);

   try {
      guestSession.createQueue(address, queue, true);
      Assert.fail("session creation must fail and a notification of security violation must be sent");
   } catch (Exception e) {
   }

   ClientMessage[] notifications = SecurityNotificationTest.consumeMessages(1, notifConsumer);
   Assert.assertEquals(SECURITY_PERMISSION_VIOLATION.toString(), notifications[0].getObjectProperty(ManagementHelper.HDR_NOTIFICATION_TYPE).toString());
   Assert.assertEquals("guest", notifications[0].getObjectProperty(ManagementHelper.HDR_USER).toString());
   Assert.assertEquals(address.toString(), notifications[0].getObjectProperty(ManagementHelper.HDR_ADDRESS).toString());
   Assert.assertEquals(CheckType.CREATE_DURABLE_QUEUE.toString(), notifications[0].getObjectProperty(ManagementHelper.HDR_CHECK_TYPE).toString());

   guestSession.close();
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:34,代码来源:SecurityNotificationTest.java


示例17: createAddressInfo

import org.apache.activemq.artemis.api.core.SimpleString; //导入依赖的package包/类
protected void createAddressInfo(final int node,
                                 final String address,
                                 final RoutingType routingType,
                                 final int defaulMaxConsumers,
                                 boolean defaultPurgeOnNoConsumers) throws Exception {
   AddressInfo addressInfo = new AddressInfo(new SimpleString(address));
   addressInfo.addRoutingType(routingType);
   servers[node].addOrUpdateAddressInfo(addressInfo);
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:10,代码来源:ClusterTestBase.java


示例18: createQueue

import org.apache.activemq.artemis.api.core.SimpleString; //导入依赖的package包/类
@Override
public void createQueue(final String address,
                        final String queueName,
                        final String filterString,
                        final boolean durable,
                        final boolean autoCreated) throws ActiveMQException {
   createQueue(SimpleString.toSimpleString(address), SimpleString.toSimpleString(queueName), SimpleString.toSimpleString(filterString), durable, autoCreated);
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:9,代码来源:ClientSessionImpl.java


示例19: getObjectProperty

import org.apache.activemq.artemis.api.core.SimpleString; //导入依赖的package包/类
@Override
public Object getObjectProperty(String name) {
   try {
      SimpleString key = new SimpleString(name);
      Object property = properties.getProperty(key);
      if (stringPropertyNames.contains(key)) {
         property = property.toString();
      }
      return property;
   } catch (ActiveMQPropertyConversionException ce) {
      throw new MessageFormatRuntimeException(ce.getMessage());
   } catch (RuntimeException e) {
      throw new JMSRuntimeException(e.getMessage());
   }
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:16,代码来源:ActiveMQJMSProducer.java


示例20: removeBinding

import org.apache.activemq.artemis.api.core.SimpleString; //导入依赖的package包/类
private synchronized void removeBinding(final SimpleString clusterName) throws Exception {
   RemoteQueueBinding binding = bindings.remove(clusterName);

   if (binding == null) {
      throw new IllegalStateException("Cannot find binding for queue " + clusterName);
   }

   postOffice.removeBinding(binding.getUniqueName(), null, false);
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:10,代码来源:ClusterConnectionImpl.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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