1 package jgroup.arm.recovery;
2
3 import jgroup.arm.ReplicaCountTest;
4 import jgroup.core.ConfigManager;
5 import jgroup.core.ConfigurationException;
6 import jgroup.core.arm.DistributionScheme;
7 import jgroup.core.arm.GroupExistsException;
8 import jgroup.core.arm.RecoveryStrategy;
9 import jgroup.core.arm.RedundancyException;
10 import jgroup.relacs.config.AppConfig;
11 import jgroup.relacs.config.DistributedSystemConfig;
12 import jgroup.relacs.config.Domain;
13 import jgroup.relacs.config.DomainSet;
14 import jgroup.relacs.config.HostSet;
15 import junit.framework.TestCase;
16
17 public class KeepMinimalInPartitionTest extends TestCase
18 {
19
20 private RecoveryStrategy rs;
21 private AppConfig app;
22 private int gid = 200;
23 private DistributionScheme distScheme;
24
25 protected void setUp() throws Exception
26 {
27 super.setUp();
28 distScheme = ReplicaCountTest.getReplicaCount(gid);
29 app = AppConfig.getApplication(gid);
30 rs = new KeepMinimalInPartition();
31 testInitialize();
32 }
33
34
35
36
37 public final void testMultiFailure()
38 {
39
40 System.out.println("app: " + app);
41 try {
42 app.setRedundancy(2, 3);
43 } catch (ConfigurationException e) {
44 e.printStackTrace();
45 }
46 System.out.println("app: " + app);
47 DistributedSystemConfig dsc = ConfigManager.getDistributedSystem();
48 DomainSet domains = dsc.getDomainSet();
49 for (Domain domain : domains) {
50 System.out.println(domain.getHostSet());
51 }
52 try {
53 HostSet assigned = distScheme.assignReplicas(app);
54 System.out.println(assigned);
55 } catch (RedundancyException e) {
56 e.printStackTrace();
57 } catch (GroupExistsException e) {
58 e.printStackTrace();
59 }
60 }
61
62
63
64
65 public final void testRestartReplica()
66 {
67
68 }
69
70
71
72
73 public final void testRelocateReplica()
74 {
75
76 }
77
78
79
80
81 public final void testDeltaRedundancy()
82 {
83
84 }
85
86
87
88
89 public final void testInitialize()
90 {
91 rs.initialize(distScheme, app);
92 }
93
94
95
96
97 public final void testNeedsRecovery()
98 {
99 assertTrue(rs.needsRecovery());
100
101 }
102
103
104
105
106 public final void testPrepareRecovery()
107 {
108
109 }
110
111 }