Skip to content

Commit

Permalink
IGNITE-701 - Fixed test.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexey Goncharuk committed Apr 8, 2015
1 parent ada2bde commit a3fe2e4
Showing 1 changed file with 7 additions and 8 deletions.
Expand Up @@ -18,7 +18,6 @@
package org.apache.ignite; package org.apache.ignite;


import org.apache.ignite.cache.*; import org.apache.ignite.cache.*;
import org.apache.ignite.cache.affinity.*;
import org.apache.ignite.cache.affinity.fair.*; import org.apache.ignite.cache.affinity.fair.*;
import org.apache.ignite.cache.affinity.rendezvous.*; import org.apache.ignite.cache.affinity.rendezvous.*;
import org.apache.ignite.cluster.*; import org.apache.ignite.cluster.*;
Expand All @@ -35,7 +34,7 @@ public class GridCacheAffinityBackupsSelfTest extends GridCommonAbstractTest {
private int backups; private int backups;


/** Affinity function. */ /** Affinity function. */
private AffinityFunction func; private int funcType;


/** */ /** */
private int nodesCnt = 5; private int nodesCnt = 5;
Expand All @@ -48,7 +47,7 @@ public class GridCacheAffinityBackupsSelfTest extends GridCommonAbstractTest {


ccfg.setCacheMode(CacheMode.PARTITIONED); ccfg.setCacheMode(CacheMode.PARTITIONED);
ccfg.setBackups(backups); ccfg.setBackups(backups);
ccfg.setAffinity(func); ccfg.setAffinity(funcType == 0 ? new FairAffinityFunction() : new RendezvousAffinityFunction());


cfg.setCacheConfiguration(ccfg); cfg.setCacheConfiguration(ccfg);


Expand All @@ -60,25 +59,25 @@ public class GridCacheAffinityBackupsSelfTest extends GridCommonAbstractTest {
*/ */
public void testRendezvousBackups() throws Exception { public void testRendezvousBackups() throws Exception {
for (int i = 0; i < nodesCnt; i++) for (int i = 0; i < nodesCnt; i++)
checkBackups(i, new RendezvousAffinityFunction()); checkBackups(i, 1);
} }


/** /**
* @throws Exception If failed. * @throws Exception If failed.
*/ */
public void testFairBackups() throws Exception { public void testFairBackups() throws Exception {
for (int i = 0; i < nodesCnt; i++) for (int i = 0; i < nodesCnt; i++)
checkBackups(i, new FairAffinityFunction()); checkBackups(i, 0);
} }


/** /**
* @param backups Number of backups. * @param backups Number of backups.
* @param func Affinity function. * @param funcType Affinity function type.
* @throws Exception If failed. * @throws Exception If failed.
*/ */
private void checkBackups(int backups, AffinityFunction func) throws Exception { private void checkBackups(int backups, int funcType) throws Exception {
this.backups = backups; this.backups = backups;
this.func = func; this.funcType = funcType;


startGrids(nodesCnt); startGrids(nodesCnt);


Expand Down

0 comments on commit a3fe2e4

Please sign in to comment.