Package org.hornetq.core.replication.impl

Examples of org.hornetq.core.replication.impl.ReplicationManagerImpl$NullEncoding


      server.start();

      try
      {
         ReplicationManagerImpl manager = new ReplicationManagerImpl(failoverManager, factory);
         manager.start();
         manager.stop();
      }
      finally
      {
         server.stop();
      }
View Full Code Here


      server.start();

      try
      {
         ReplicationManagerImpl manager = new ReplicationManagerImpl(failoverManager, factory);
         manager.start();
         try
         {
            manager.compareJournals(new JournalLoadInformation[] { new JournalLoadInformation(2, 2),
                                                                  new JournalLoadInformation(2, 2) });
            Assert.fail("Exception was expected");
         }
         catch (HornetQException e)
         {
            e.printStackTrace();
            Assert.assertEquals(HornetQException.ILLEGAL_STATE, e.getCode());
         }

         manager.compareJournals(new JournalLoadInformation[] { new JournalLoadInformation(),
                                                               new JournalLoadInformation() });

         manager.stop();
      }
      finally
      {
         server.stop();
      }
View Full Code Here

      server.start();

      try
      {
         ReplicationManagerImpl manager = new ReplicationManagerImpl(failoverManager, factory);

         manager.start();

         try
         {
            ReplicationManagerImpl manager2 = new ReplicationManagerImpl(failoverManager, factory);

            manager2.start();
            Assert.fail("Exception was expected");
         }
         catch (Exception e)
         {
         }
View Full Code Here

      FailoverManager failoverManager = createFailoverManager();

      try
      {
         ReplicationManagerImpl manager = new ReplicationManagerImpl(failoverManager, factory);

         try
         {
            manager.start();
            Assert.fail("Exception was expected");
         }
         catch (HornetQException expected)
         {
         }

         manager.stop();
      }
      finally
      {
         server.stop();
      }
View Full Code Here

      try
      {
         StorageManager storage = getStorage();

         ReplicationManagerImpl manager = new ReplicationManagerImpl(failoverManager, factory);
         manager.start();

         Journal replicatedJournal = new ReplicatedJournal((byte)1, new FakeJournal(), manager);

         replicatedJournal.appendPrepareRecord(1, new FakeData(), false);

         replicatedJournal.appendAddRecord(1, (byte)1, new FakeData(), false);
         replicatedJournal.appendUpdateRecord(1, (byte)2, new FakeData(), false);
         replicatedJournal.appendDeleteRecord(1, false);
         replicatedJournal.appendAddRecordTransactional(2, 2, (byte)1, new FakeData());
         replicatedJournal.appendUpdateRecordTransactional(2, 2, (byte)2, new FakeData());
         replicatedJournal.appendCommitRecord(2, false);

         replicatedJournal.appendDeleteRecordTransactional(3, 4, new FakeData());
         replicatedJournal.appendPrepareRecord(3, new FakeData(), false);
         replicatedJournal.appendRollbackRecord(3, false);

         blockOnReplication(storage, manager);

         Assert.assertEquals(0, manager.getActiveTokens().size());

         ServerMessage msg = new ServerMessageImpl(1, 1024);

         SimpleString dummy = new SimpleString("dummy");
         msg.setAddress(dummy);

         replicatedJournal.appendAddRecordTransactional(23, 24, (byte)1, new FakeData());

         PagedMessage pgmsg = new PagedMessageImpl(msg, -1);
         manager.pageWrite(pgmsg, 1);
         manager.pageWrite(pgmsg, 2);
         manager.pageWrite(pgmsg, 3);
         manager.pageWrite(pgmsg, 4);

         blockOnReplication(storage, manager);

         PagingManager pagingManager = createPageManager(server.getStorageManager(),
                                                         server.getConfiguration(),
                                                         server.getExecutorFactory(),
                                                         server.getAddressSettingsRepository());

         PagingStore store = pagingManager.getPageStore(dummy);
         store.start();
         Assert.assertEquals(5, store.getNumberOfPages());
         store.stop();

         manager.pageDeleted(dummy, 1);
         manager.pageDeleted(dummy, 2);
         manager.pageDeleted(dummy, 3);
         manager.pageDeleted(dummy, 4);
         manager.pageDeleted(dummy, 5);
         manager.pageDeleted(dummy, 6);

         blockOnReplication(storage, manager);

         ServerMessageImpl serverMsg = new ServerMessageImpl();
         serverMsg.setMessageID(500);
         serverMsg.setAddress(new SimpleString("tttt"));

         HornetQBuffer buffer = HornetQBuffers.dynamicBuffer(100);
         serverMsg.encodeHeadersAndProperties(buffer);

         manager.largeMessageBegin(500);

         manager.largeMessageWrite(500, new byte[1024]);

         manager.largeMessageDelete(500);

         blockOnReplication(storage, manager);

         store.start();

         Assert.assertEquals(0, store.getNumberOfPages());

         manager.stop();
      }
      finally
      {
         server.stop();
      }
View Full Code Here

      FailoverManager failoverManager = createFailoverManager();

      try
      {
         StorageManager storage = getStorage();
         ReplicationManagerImpl manager = new ReplicationManagerImpl(failoverManager, factory);
         manager.start();

         Journal replicatedJournal = new ReplicatedJournal((byte)1, new FakeJournal(), manager);

         TestInterceptor.value.set(false);
View Full Code Here

   {
      FailoverManager failoverManager = createFailoverManager();

      try
      {
         ReplicationManagerImpl manager = new ReplicationManagerImpl(failoverManager, factory);
         manager.start();
         Assert.fail("Exception expected");
      }
      catch (HornetQException expected)
      {
         Assert.assertEquals(HornetQException.ILLEGAL_STATE, expected.getCode());
View Full Code Here

      FailoverManager failoverManager = createFailoverManager();

      try
      {
         StorageManager storage = getStorage();
         ReplicationManagerImpl manager = new ReplicationManagerImpl(failoverManager, factory);
         manager.start();

         Journal replicatedJournal = new ReplicatedJournal((byte)1, new FakeJournal(), manager);

         replicatedJournal.appendPrepareRecord(1, new FakeData(), false);

         final CountDownLatch latch = new CountDownLatch(1);
         storage.afterCompleteOperations(new IOAsyncTask()
         {

            public void onError(final int errorCode, final String errorMessage)
            {
            }

            public void done()
            {
               latch.countDown();
            }
         });

         Assert.assertTrue(latch.await(1, TimeUnit.SECONDS));

         Assert.assertEquals(0, manager.getActiveTokens().size());
         manager.stop();
      }
      finally
      {
         server.stop();
      }
View Full Code Here

      final ArrayList<Integer> executions = new ArrayList<Integer>();

      try
      {
         StorageManager storage = getStorage();
         ReplicationManagerImpl manager = new ReplicationManagerImpl(failoverManager, factory);
         manager.start();

         Journal replicatedJournal = new ReplicatedJournal((byte)1, new FakeJournal(), manager);

         int numberOfAdds = 200;

         final CountDownLatch latch = new CountDownLatch(numberOfAdds);

         OperationContext ctx = storage.getContext();

         for (int i = 0; i < numberOfAdds; i++)
         {
            final int nAdd = i;

            if (i % 2 == 0)
            {
               replicatedJournal.appendPrepareRecord(i, new FakeData(), false);
            }

            ctx.executeOnCompletion(new IOAsyncTask()
            {

               public void onError(final int errorCode, final String errorMessage)
               {
               }

               public void done()
               {
                  System.out.println("Add " + nAdd);
                  executions.add(nAdd);
                  latch.countDown();
               }
            });
         }

         Assert.assertTrue(latch.await(10, TimeUnit.SECONDS));

         for (int i = 0; i < numberOfAdds; i++)
         {
            Assert.assertEquals(i, executions.get(i).intValue());
         }

         Assert.assertEquals(0, manager.getActiveTokens().size());
         manager.stop();
      }
      finally
      {
         server.stop();
      }
View Full Code Here

      server.start();

      try
      {
         ReplicationManagerImpl manager = new ReplicationManagerImpl((ClientSessionFactoryInternal) locator.createSessionFactory(), factory);
         manager.start();
         manager.stop();
      }
      finally
      {
         server.stop();
      }
View Full Code Here

TOP

Related Classes of org.hornetq.core.replication.impl.ReplicationManagerImpl$NullEncoding

Copyright © 2018 www.massapicom. 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.