Examples of InVMContext


Examples of org.hornetq.tests.unit.util.InVMContext

      conf0.setSecurityEnabled(false);
      conf0.getAcceptorConfigurations()
           .add(new TransportConfiguration("org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory"));
      server0 = HornetQServers.newHornetQServer(conf0, false);

      context0 = new InVMContext();
      jmsServer0 = new JMSServerManagerImpl(server0);
      jmsServer0.setContext(context0);
      jmsServer0.start();

      Configuration conf1 = createBasicConfig();
      conf1.setSecurityEnabled(false);
      conf1.setJournalDirectory(getJournalDir(1, false));
      conf1.setBindingsDirectory(getBindingsDir(1, false));
      params1 = new HashMap<String, Object>();
      params1.put(TransportConstants.SERVER_ID_PROP_NAME, 1);
      conf1.getAcceptorConfigurations()
           .add(new TransportConfiguration("org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory", params1));

      server1 = HornetQServers.newHornetQServer(conf1, false);

      context1 = new InVMContext();

      jmsServer1 = new JMSServerManagerImpl(server1);
      jmsServer1.setContext(context1);
      jmsServer1.start();
View Full Code Here

Examples of org.hornetq.tests.unit.util.InVMContext

      Configuration config = createBasicConfig();
      config.setFileDeploymentEnabled(false);
      config.setSecurityEnabled(false);
      config.getAcceptorConfigurations().add(new TransportConfiguration(InVMAcceptorFactory.class.getName()));
      InVMContext context = new InVMContext();
      jmsServer = new JMSServerManagerImpl(HornetQServers.newHornetQServer(config, false));
      jmsServer.setContext(context);
      jmsServer.start();

      jmsServer.createQueue(false, JMSBridgeImplTest.SOURCE, null, true, "/queue/" + JMSBridgeImplTest.SOURCE);
View Full Code Here

Examples of org.hornetq.tests.unit.util.InVMContext

      conf.getAcceptorConfigurations().add(new TransportConfiguration(InVMAcceptorFactory.class.getName()));
      conf.setFileDeploymentEnabled(false);
      server = HornetQServers.newHornetQServer(conf, mbeanServer, true);

      serverManager = new JMSServerManagerImpl(server);
      context = new InVMContext();
      serverManager.setContext(context);
      serverManager.start();
      serverManager.activated();

      queueName = RandomUtil.randomString();
View Full Code Here

Examples of org.hornetq.tests.unit.util.InVMContext

      conf.setPersistenceEnabled(true);
      conf.setJournalType(JournalType.NIO);
      conf.getAcceptorConfigurations().add(new TransportConfiguration(InVMAcceptorFactory.class.getName()));
      HornetQServer server = HornetQServers.newHornetQServer(conf, mbeanServer);

      context = new InVMContext();
     
      serverManager = new JMSServerManagerImpl(server);
      serverManager.setContext(context);
      return serverManager;
   }
View Full Code Here

Examples of org.hornetq.tests.unit.util.InVMContext

      server.start();

      serverManager = new JMSServerManagerImpl(server);
      serverManager.start();

      ctx = new InVMContext();

      serverManager.setContext(ctx);
      serverManager.activated();
   }
View Full Code Here

Examples of org.hornetq.tests.unit.util.InVMContext

      server = HornetQServers.newHornetQServer(conf, mbeanServer, false);
      server.start();

      serverManager = new JMSServerManagerImpl(server);
      serverManager.start();
      serverManager.setContext(new InVMContext());
      serverManager.activated();

      clientID = RandomUtil.randomString();
      subscriptionName = RandomUtil.randomString();
View Full Code Here

Examples of org.hornetq.tests.unit.util.InVMContext

      conf.getConnectorConfigurations().put("invm", new TransportConfiguration(INVM_CONNECTOR_FACTORY));

      server = HornetQServers.newHornetQServer(conf, mbeanServer, true);

      serverManager = new JMSServerManagerImpl(server);
      context = new InVMContext();
      serverManager.setContext(context);
      serverManager.start();
      serverManager.activated();
     
      this.fakeJMSStorageManager = new FakeJMSStorageManager(serverManager.getJMSStorageManager());
View Full Code Here

Examples of org.hornetq.tests.unit.util.InVMContext

      conf.setJMXManagementEnabled(true);
      conf.getAcceptorConfigurations().add(new TransportConfiguration(acceptorFactory));
      server = HornetQServers.newHornetQServer(conf, mbeanServer, true);
      server.start();

      context = new InVMContext();
      serverManager = new JMSServerManagerImpl(server);
      serverManager.setContext(context);
      serverManager.start();
      serverManager.activated();
   }
View Full Code Here

Examples of org.hornetq.tests.unit.util.InVMContext

   // Constructors --------------------------------------------------

   public void testSetupJMSConfiguration() throws Exception
   {
      Context context = new InVMContext();

      Configuration coreConfiguration = createDefaultConfig(false);
      HornetQServer coreServer = new HornetQServerImpl(coreConfiguration);

      JMSConfiguration jmsConfiguration = new JMSConfigurationImpl();
      jmsConfiguration.setContext(context);
      TransportConfiguration connectorConfig = new TransportConfiguration(InVMConnectorFactory.class.getName());
      List<TransportConfiguration> transportConfigs = new ArrayList<TransportConfiguration>();
      transportConfigs.add(connectorConfig);
      ConnectionFactoryConfiguration cfConfig = new ConnectionFactoryConfigurationImpl(RandomUtil.randomString(),
                                                                                       false,
                                                                                       registerConnectors(coreServer, transportConfigs),
                                                                                       "/cf/binding1",
                                                                                       "/cf/binding2");
      jmsConfiguration.getConnectionFactoryConfigurations().add(cfConfig);
      JMSQueueConfigurationImpl queueConfig = new JMSQueueConfigurationImpl(RandomUtil.randomString(),
                                                                      null,
                                                                      false,
                                                                      "/queue/binding1",
                                                                      "/queue/binding2");
      jmsConfiguration.getQueueConfigurations().add(queueConfig);
      TopicConfiguration topicConfig = new TopicConfigurationImpl(RandomUtil.randomString(),
                                                                  "/topic/binding1",
                                                                  "/topic/binding2");
      jmsConfiguration.getTopicConfigurations().add(topicConfig);

      JMSServerManager server = new JMSServerManagerImpl(coreServer, jmsConfiguration);
      server.start();

      for (String binding : cfConfig.getBindings())
      {
         Object o = context.lookup(binding);
         Assert.assertNotNull(o);
         Assert.assertTrue(o instanceof ConnectionFactory);
         ConnectionFactory cf = (ConnectionFactory)o;
         Connection connection = cf.createConnection();
         connection.close();
      }

      for (String binding : queueConfig.getBindings())
      {
         Object o = context.lookup(binding);
         Assert.assertNotNull(o);
         Assert.assertTrue(o instanceof Queue);
         Queue queue = (Queue)o;
         Assert.assertEquals(queueConfig.getName(), queue.getQueueName());
      }

      for (String binding : topicConfig.getBindings())
      {
         Object o = context.lookup(binding);
         Assert.assertNotNull(o);
         Assert.assertTrue(o instanceof Topic);
         Topic topic = (Topic)o;
         Assert.assertEquals(topicConfig.getName(), topic.getTopicName());
      }
View Full Code Here

Examples of org.hornetq.tests.unit.util.InVMContext

      config.setJournalSyncNonTransactional(false);

      HornetQServer server = createServer(true, config, PAGE_SIZE, -1, new HashMap<String, AddressSettings>());

      JMSServerManagerImpl jmsServer = new JMSServerManagerImpl(server);
      InVMContext context = new InVMContext();
      jmsServer.setContext(context);
      jmsServer.start();

      jmsServer.createTopic(true, "tt", "/topic/TT");

      server.getHornetQServerControl().addAddressSettings("jms.topic.TT",
                                                          "DLQ",
                                                          "DLQ",
                                                          false,
                                                          5,
                                                          1024 * 1024,
                                                          1024 * 10,
                                                          5,
                                                          5,
                                                          0,
                                                          false,
                                                          "PAGE");

      HornetQJMSConnectionFactory cf = (HornetQJMSConnectionFactory)HornetQJMSClient.createConnectionFactoryWithoutHA(JMSFactoryType.CF,
                                                                                                                      new TransportConfiguration(INVM_CONNECTOR_FACTORY));

      Connection conn = cf.createConnection();
      conn.setClientID("tst");
      Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
      Topic topic = (Topic)context.lookup("/topic/TT");
      sess.createDurableSubscriber(topic, "t1");
     
      MessageProducer prod = sess.createProducer(topic);
      prod.setDeliveryMode(DeliveryMode.PERSISTENT);
      TextMessage txt = sess.createTextMessage("TST");
      prod.send(txt);
     
      PagingStore store = server.getPagingManager().getPageStore(new SimpleString("jms.topic.TT"));

      assertEquals(1024 * 1024, store.getMaxSize());
      assertEquals(10 * 1024, store.getPageSizeBytes());

      jmsServer.stop();

      server = createServer(true, config, PAGE_SIZE, -1, new HashMap<String, AddressSettings>());

      jmsServer = new JMSServerManagerImpl(server);
      context = new InVMContext();
      jmsServer.setContext(context);
      jmsServer.start();

      AddressSettings settings = server.getAddressSettingsRepository().getMatch("jms.topic.TT");

View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.