public void testRepositoryConfigWithSystemVariables() throws Exception { final String id = "testvalue"; final long syncDelay = 11; System.setProperty(ClusterNode.SYSTEM_PROPERTY_NODE_ID, id); System.setProperty("cluster.syncDelay", Long.toString(syncDelay)); try { InputStream in = getClass().getResourceAsStream( "/org/apache/jackrabbit/core/cluster/repository.xml"); RepositoryConfig config = RepositoryConfig.create(in, DIR.getPath()); ClusterConfig clusterConfig = config.getClusterConfig(); assertEquals(id, clusterConfig.getId()); assertEquals(syncDelay, clusterConfig.getSyncDelay()); } finally { System.clearProperty(ClusterNode.SYSTEM_PROPERTY_NODE_ID); System.clearProperty("cluster.syncDelay"); } }
assertEquals(syncDelay, clusterConfig.getSyncDelay()); assertEquals(syncDelay, clusterConfig.getSyncDelay()); } finally { System.clearProperty("cluster.syncDelay");
/** * Initialize this cluster node (overridable). * * @throws ClusterException if an error occurs */ protected void init() throws ClusterException { ClusterConfig cc = clusterContext.getClusterConfig(); clusterNodeId = cc.getId(); syncDelay = cc.getSyncDelay(); stopDelay = cc.getStopDelay(); try { journal = cc.getJournal(clusterContext.getNamespaceResolver()); instanceRevision = journal.getInstanceRevision(); journal.register(this); producer = journal.getProducer(PRODUCER_ID); } catch (RepositoryException e) { throw new ClusterException( "Cluster initialization failed: " + this, e); } catch (JournalException e) { throw new ClusterException( "Journal initialization failed: " + this, e); } }
/** * Initialize this cluster node (overridable). * * @throws ClusterException if an error occurs */ protected void init() throws ClusterException { ClusterConfig cc = clusterContext.getClusterConfig(); clusterNodeId = cc.getId(); syncDelay = cc.getSyncDelay(); stopDelay = cc.getStopDelay(); try { journal = cc.getJournal(clusterContext.getNamespaceResolver()); instanceRevision = journal.getInstanceRevision(); journal.register(this); producer = journal.getProducer(PRODUCER_ID); } catch (RepositoryException e) { throw new ClusterException( "Cluster initialization failed: " + this, e); } catch (JournalException e) { throw new ClusterException( "Journal initialization failed: " + this, e); } }