Java Code Examples for org.apache.activemq.artemis.core.config.Configuration#getHAPolicyConfiguration()
The following examples show how to use
org.apache.activemq.artemis.core.config.Configuration#getHAPolicyConfiguration() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ExtraBackupReplicatedFailoverTest.java From activemq-artemis with Apache License 2.0 | 6 votes |
@Test public void testExtraBackupGroupNameReplicates() throws Exception { ReplicaPolicyConfiguration backupReplicaPolicyConfiguration = (ReplicaPolicyConfiguration) backupServer.getServer().getConfiguration().getHAPolicyConfiguration(); backupReplicaPolicyConfiguration.setGroupName("foo"); ReplicatedPolicyConfiguration replicatedPolicyConfiguration = (ReplicatedPolicyConfiguration) liveServer.getServer().getConfiguration().getHAPolicyConfiguration(); replicatedPolicyConfiguration.setGroupName("foo"); Configuration secondBackupConfig = backupConfig.copy(); TransportConfiguration tc = secondBackupConfig.getAcceptorConfigurations().iterator().next(); TestableServer secondBackupServer = createTestableServer(secondBackupConfig); tc.getParams().put("serverId", "2"); secondBackupConfig.setBindingsDirectory(getBindingsDir(1, true)).setJournalDirectory(getJournalDir(1, true)).setPagingDirectory(getPageDir(1, true)).setLargeMessagesDirectory(getLargeMessagesDir(1, true)).setSecurityEnabled(false); ReplicaPolicyConfiguration replicaPolicyConfiguration = (ReplicaPolicyConfiguration) secondBackupConfig.getHAPolicyConfiguration(); replicaPolicyConfiguration.setGroupName("foo"); waitForRemoteBackupSynchronization(backupServer.getServer()); secondBackupServer.start(); Thread.sleep(5000); backupServer.stop(); waitForSync(secondBackupServer.getServer()); waitForRemoteBackupSynchronization(secondBackupServer.getServer()); }
Example 2
Source File: FileLockNodeManagerTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
@Override protected TestableServer createTestableServer(Configuration config) throws Exception { final boolean isBackup = config.getHAPolicyConfiguration() instanceof ReplicaPolicyConfiguration || config.getHAPolicyConfiguration() instanceof SharedStoreSlavePolicyConfiguration; NodeManager nodeManager = this.nodeManager; //create a separate NodeManager for the backup if (isBackup && (nodeManagerType == NodeManagerType.Jdbc || nodeManagerType == NodeManagerType.File)) { nodeManager = createNodeManager(); } return new SameProcessActiveMQServer(createInVMFailoverServer(true, config, nodeManager, isBackup ? 2 : 1)); }
Example 3
Source File: NettyFailoverTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
@Override protected TestableServer createTestableServer(Configuration config) throws Exception { final boolean isBackup = config.getHAPolicyConfiguration() instanceof ReplicaPolicyConfiguration || config.getHAPolicyConfiguration() instanceof SharedStoreSlavePolicyConfiguration; NodeManager nodeManager = this.nodeManager; //create a separate NodeManager for the backup if (isBackup && (nodeManagerType == NodeManagerType.Jdbc)) { nodeManager = createNodeManager(); } return new SameProcessActiveMQServer(createInVMFailoverServer(true, config, nodeManager, isBackup ? 2 : 1)); }
Example 4
Source File: FileConfigurationParserTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
@Test public void testParsingScaleDownConfig() throws Exception { FileConfigurationParser parser = new FileConfigurationParser(); String configStr = firstPart + "<ha-policy>\n" + " <live-only>\n" + " <scale-down>\n" + " <connectors>\n" + " <connector-ref>server0-connector</connector-ref>\n" + " </connectors>\n" + " </scale-down>\n" + " </live-only>\n" + "</ha-policy>\n" + lastPart; ByteArrayInputStream input = new ByteArrayInputStream(configStr.getBytes(StandardCharsets.UTF_8)); Configuration config = parser.parseMainConfig(input); HAPolicyConfiguration haConfig = config.getHAPolicyConfiguration(); assertTrue(haConfig instanceof LiveOnlyPolicyConfiguration); LiveOnlyPolicyConfiguration liveOnlyCfg = (LiveOnlyPolicyConfiguration) haConfig; ScaleDownConfiguration scaledownCfg = liveOnlyCfg.getScaleDownConfiguration(); List<String> connectors = scaledownCfg.getConnectors(); assertEquals(1, connectors.size()); String connector = connectors.get(0); assertEquals("server0-connector", connector); }
Example 5
Source File: FailoverTestBase.java From activemq-artemis with Apache License 2.0 | 4 votes |
protected TestableServer createTestableServer(Configuration config, NodeManager nodeManager) throws Exception { boolean isBackup = config.getHAPolicyConfiguration() instanceof ReplicaPolicyConfiguration || config.getHAPolicyConfiguration() instanceof SharedStoreSlavePolicyConfiguration; return new SameProcessActiveMQServer(createInVMFailoverServer(true, config, nodeManager, isBackup ? 2 : 1)); }
Example 6
Source File: ReplicaTimeoutTest.java From activemq-artemis with Apache License 2.0 | 4 votes |
protected TestableServer createTestableServer(Configuration config, NodeManager nodeManager) throws Exception { boolean isBackup = config.getHAPolicyConfiguration() instanceof ReplicaPolicyConfiguration || config.getHAPolicyConfiguration() instanceof SharedStoreSlavePolicyConfiguration; return new SameProcessActiveMQServer(createInVMFailoverServer(true, config, nodeManager, isBackup ? 2 : 1)); }
Example 7
Source File: AmqpReplicatedTestSupport.java From activemq-artemis with Apache License 2.0 | 4 votes |
protected TestableServer createTestableServer(Configuration config, NodeManager nodeManager) throws Exception { boolean isBackup = config.getHAPolicyConfiguration() instanceof ReplicaPolicyConfiguration || config.getHAPolicyConfiguration() instanceof SharedStoreSlavePolicyConfiguration; return new SameProcessActiveMQServer(createInVMFailoverServer(true, config, nodeManager, isBackup ? 2 : 1)); }
Example 8
Source File: FileConfigurationParserTest.java From activemq-artemis with Apache License 2.0 | 4 votes |
@Test public void testParsingHaSharedStoreWaitForActivation() throws Exception { FileConfigurationParser parser = new FileConfigurationParser(); String configStr = firstPart + "<ha-policy><shared-store><master><wait-for-activation>false</wait-for-activation></master></shared-store></ha-policy>" + lastPart; ByteArrayInputStream input = new ByteArrayInputStream(configStr.getBytes(StandardCharsets.UTF_8)); Configuration config = parser.parseMainConfig(input); HAPolicyConfiguration haConfig = config.getHAPolicyConfiguration(); assertTrue(haConfig instanceof SharedStoreMasterPolicyConfiguration); SharedStoreMasterPolicyConfiguration masterConfig = (SharedStoreMasterPolicyConfiguration) haConfig; assertFalse(masterConfig.isWaitForActivation()); }