1   /**
2    *  Copyright 2003-2007 Greg Luck
3    *
4    *  Licensed under the Apache License, Version 2.0 (the "License");
5    *  you may not use this file except in compliance with the License.
6    *  You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   *  Unless required by applicable law or agreed to in writing, software
11   *  distributed under the License is distributed on an "AS IS" BASIS,
12   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   *  See the License for the specific language governing permissions and
14   *  limitations under the License.
15   */
16  
17  package net.sf.ehcache.distribution;
18  
19  import net.sf.ehcache.AbstractCacheTest;
20  import net.sf.ehcache.CacheManager;
21  
22  /**
23   * @author <a href="mailto:gluck@thoughtworks.com">Greg Luck</a>
24   * @version $Id: ManualRMIPeerProviderTest.java 512 2007-07-10 09:18:45Z gregluck $
25   */
26  public class ManualRMIPeerProviderTest extends MulticastRMIPeerProviderTest {
27  
28  
29      /**
30       * {@inheritDoc}
31       */
32      protected void setUp() throws Exception {
33          if (JVMUtil.isSingleRMIRegistryPerVM()) {
34              return;
35          }
36  
37          manager1 = new CacheManager(AbstractCacheTest.TEST_CONFIG_DIR + "distribution/ehcache-manual-distributed1.xml");
38          manager2 = new CacheManager(AbstractCacheTest.TEST_CONFIG_DIR + "distribution/ehcache-manual-distributed2.xml");
39          manager3 = new CacheManager(AbstractCacheTest.TEST_CONFIG_DIR + "distribution/ehcache-manual-distributed3.xml");
40  
41          /* manager3 has an empty manual configuration, which is topped up by adding manual entries.
42           * The sampleCache1 from manager3 is added to the rmiUrls list for manager1 and manager2
43           */
44          CacheManagerPeerProvider peerProvider = manager3.getCacheManagerPeerProvider();
45          peerProvider.registerPeer("//localhost:40001/sampleCache1");
46          peerProvider.registerPeer("//localhost:40002/sampleCache1");
47  
48          //Allow cluster setup
49          Thread.sleep(100);
50      }
51  
52  
53  
54  }