public ClusterManager(final ExecutorFactory executorFactory, final ActiveMQServer server, final PostOffice postOffice, final ScheduledExecutorService scheduledExecutor, final ManagementService managementService, final Configuration configuration, final NodeManager nodeManager, final boolean backup) { this.executorFactory = executorFactory; executor = executorFactory.getExecutor(); this.server = server; this.postOffice = postOffice; this.scheduledExecutor = scheduledExecutor; this.managementService = managementService; this.configuration = configuration; this.nodeManager = nodeManager; clusterController = new ClusterController(server, scheduledExecutor); haManager = server.getActivation().getHAManager(); }
@Test public void controlWithDifferentConnector() throws Exception { try (ServerLocatorImpl locator = (ServerLocatorImpl) createInVMNonHALocator()) { locator.setProtocolManagerFactory(ActiveMQServerSideProtocolManagerFactory.getInstance(locator)); ClusterController controller = new ClusterController(getServer(0), getServer(0).getScheduledPool()); ClusterControl clusterControl = controller.connectToNodeInCluster((ClientSessionFactoryInternal) locator.createSessionFactory()); clusterControl.authorize(); } }
@Test public void controlWithDifferentPassword() throws Exception { try (ServerLocatorImpl locator = (ServerLocatorImpl) createInVMNonHALocator()) { locator.setProtocolManagerFactory(ActiveMQServerSideProtocolManagerFactory.getInstance(locator)); ClusterController controller = new ClusterController(getServer(1), getServer(1).getScheduledPool()); ClusterControl clusterControl = controller.connectToNodeInCluster((ClientSessionFactoryInternal) locator.createSessionFactory()); try { clusterControl.authorize(); fail("should throw ActiveMQClusterSecurityException"); } catch (Exception e) { assertTrue("should throw ActiveMQClusterSecurityException", e instanceof ActiveMQClusterSecurityException); } } }