use of org.apache.geode.cache.FixedPartitionAttributes in project geode by apache.
the class FixedPartitioningWithColocationAndPersistenceDUnitTest method testFPR_Persistence3.
@Test
public void testFPR_Persistence3() {
member1.invoke(() -> FixedPartitioningTestBase.createCacheOnMember());
FixedPartitionAttributes fpa1 = FixedPartitionAttributes.createFixedPartition(Quarter1, true, 3);
FixedPartitionAttributes fpa2 = FixedPartitionAttributes.createFixedPartition(Quarter2, false, 3);
List<FixedPartitionAttributes> fpaList = new ArrayList<FixedPartitionAttributes>();
fpaList.add(fpa1);
fpaList.add(fpa2);
member1.invoke(() -> FixedPartitioningTestBase.createRegionWithPartitionAttributes("Quarter", fpaList, 1, 40, 12, new QuarterPartitionResolver(), null, true));
member2.invoke(() -> FixedPartitioningTestBase.createCacheOnMember());
fpa1 = FixedPartitionAttributes.createFixedPartition(Quarter2, true, 3);
fpa2 = FixedPartitionAttributes.createFixedPartition(Quarter3, false, 3);
fpaList.clear();
fpaList.add(fpa1);
fpaList.add(fpa2);
member2.invoke(() -> FixedPartitioningTestBase.createRegionWithPartitionAttributes("Quarter", fpaList, 1, 40, 12, new QuarterPartitionResolver(), null, true));
member3.invoke(() -> FixedPartitioningTestBase.createCacheOnMember());
fpa1 = FixedPartitionAttributes.createFixedPartition(Quarter3, true, 3);
fpa2 = FixedPartitionAttributes.createFixedPartition(Quarter4, false, 3);
fpaList.clear();
fpaList.add(fpa1);
fpaList.add(fpa2);
member3.invoke(() -> FixedPartitioningTestBase.createRegionWithPartitionAttributes("Quarter", fpaList, 1, 40, 12, new QuarterPartitionResolver(), null, true));
member4.invoke(() -> FixedPartitioningTestBase.createCacheOnMember());
fpa1 = FixedPartitionAttributes.createFixedPartition(Quarter4, true, 3);
fpa2 = FixedPartitionAttributes.createFixedPartition(Quarter1, false, 3);
fpaList.clear();
fpaList.add(fpa1);
fpaList.add(fpa2);
member4.invoke(() -> FixedPartitioningTestBase.createRegionWithPartitionAttributes("Quarter", fpaList, 1, 40, 12, new QuarterPartitionResolver(), null, true));
member1.invoke(() -> FixedPartitioningTestBase.putThroughDataStore("Quarter"));
member1.invoke(() -> FixedPartitioningTestBase.checkPrimarySecondaryData(Quarter1, false));
member2.invoke(() -> FixedPartitioningTestBase.checkPrimarySecondaryData(Quarter2, false));
member3.invoke(() -> FixedPartitioningTestBase.checkPrimarySecondaryData(Quarter3, false));
member4.invoke(() -> FixedPartitioningTestBase.checkPrimarySecondaryData(Quarter4, false));
member1.invoke(() -> FixedPartitioningTestBase.checkPrimaryBucketsForQuarter(6, 3));
member2.invoke(() -> FixedPartitioningTestBase.checkPrimaryBucketsForQuarter(6, 3));
member3.invoke(() -> FixedPartitioningTestBase.checkPrimaryBucketsForQuarter(6, 3));
member4.invoke(() -> FixedPartitioningTestBase.checkPrimaryBucketsForQuarter(6, 3));
member1.invoke(() -> FixedPartitioningTestBase.closeCache());
member2.invoke(() -> FixedPartitioningTestBase.closeCache());
member3.invoke(() -> FixedPartitioningTestBase.closeCache());
member4.invoke(() -> FixedPartitioningTestBase.closeCache());
member4.invoke(() -> FixedPartitioningTestBase.createCacheOnMember());
fpa1 = FixedPartitionAttributes.createFixedPartition(Quarter4, true, 3);
fpa2 = FixedPartitionAttributes.createFixedPartition(Quarter1, false, 3);
fpaList.clear();
fpaList.add(fpa1);
fpaList.add(fpa2);
member4.invokeAsync(() -> FixedPartitioningTestBase.createRegionWithPartitionAttributes("Quarter", fpaList, 1, 40, 12, new QuarterPartitionResolver(), null, true));
member3.invoke(() -> FixedPartitioningTestBase.createCacheOnMember());
fpa1 = FixedPartitionAttributes.createFixedPartition(Quarter3, true, 3);
fpa2 = FixedPartitionAttributes.createFixedPartition(Quarter4, false, 3);
fpaList.clear();
fpaList.add(fpa1);
fpaList.add(fpa2);
member3.invokeAsync(() -> FixedPartitioningTestBase.createRegionWithPartitionAttributes("Quarter", fpaList, 1, 40, 12, new QuarterPartitionResolver(), null, true));
member2.invoke(() -> FixedPartitioningTestBase.createCacheOnMember());
fpa1 = FixedPartitionAttributes.createFixedPartition(Quarter2, true, 3);
fpa2 = FixedPartitionAttributes.createFixedPartition(Quarter3, false, 3);
fpaList.clear();
fpaList.add(fpa1);
fpaList.add(fpa2);
member2.invokeAsync(() -> FixedPartitioningTestBase.createRegionWithPartitionAttributes("Quarter", fpaList, 1, 40, 12, new QuarterPartitionResolver(), null, true));
member1.invoke(() -> FixedPartitioningTestBase.createCacheOnMember());
fpa1 = FixedPartitionAttributes.createFixedPartition(Quarter1, true, 3);
fpa2 = FixedPartitionAttributes.createFixedPartition(Quarter2, false, 3);
fpaList.clear();
fpaList.add(fpa1);
fpaList.add(fpa2);
member1.invokeAsync(() -> FixedPartitioningTestBase.createRegionWithPartitionAttributes("Quarter", fpaList, 1, 40, 12, new QuarterPartitionResolver(), null, true));
Wait.pause(4000);
member4.invoke(() -> FixedPartitioningTestBase.checkPrimarySecondaryData(Quarter4, false));
member4.invoke(() -> FixedPartitioningTestBase.checkPrimaryBucketsForQuarter(6, 3));
member3.invoke(() -> FixedPartitioningTestBase.checkPrimarySecondaryData(Quarter3, false));
member3.invoke(() -> FixedPartitioningTestBase.checkPrimaryBucketsForQuarter(6, 3));
member2.invoke(() -> FixedPartitioningTestBase.checkPrimarySecondaryData(Quarter2, false));
member2.invoke(() -> FixedPartitioningTestBase.checkPrimaryBucketsForQuarter(6, 3));
member1.invoke(() -> FixedPartitioningTestBase.checkPrimarySecondaryData(Quarter1, false));
member1.invoke(() -> FixedPartitioningTestBase.checkPrimaryBucketsForQuarter(6, 3));
}
use of org.apache.geode.cache.FixedPartitionAttributes in project geode by apache.
the class FixedPartitioningWithColocationAndPersistenceDUnitTest method testFPR_Persistence2.
@Test
public void testFPR_Persistence2() {
member1.invoke(() -> FixedPartitioningTestBase.createCacheOnMember());
FixedPartitionAttributes fpa1 = FixedPartitionAttributes.createFixedPartition(Quarter1, true, 3);
FixedPartitionAttributes fpa2 = FixedPartitionAttributes.createFixedPartition(Quarter2, true, 3);
List<FixedPartitionAttributes> fpaList = new ArrayList<FixedPartitionAttributes>();
fpaList.add(fpa1);
fpaList.add(fpa2);
member1.invoke(() -> FixedPartitioningTestBase.createRegionWithPartitionAttributes("Quarter", fpaList, 0, 40, 12, new QuarterPartitionResolver(), null, true));
member2.invoke(() -> FixedPartitioningTestBase.createCacheOnMember());
fpa1 = FixedPartitionAttributes.createFixedPartition(Quarter3, true, 3);
fpa2 = FixedPartitionAttributes.createFixedPartition(Quarter4, true, 3);
fpaList.clear();
fpaList.add(fpa1);
fpaList.add(fpa2);
member2.invoke(() -> FixedPartitioningTestBase.createRegionWithPartitionAttributes("Quarter", fpaList, 0, 40, 12, new QuarterPartitionResolver(), null, true));
member1.invoke(() -> FixedPartitioningTestBase.putThroughDataStore("Quarter"));
member1.invoke(() -> FixedPartitioningTestBase.checkPrimarySecondaryData(Quarter1, false));
member2.invoke(() -> FixedPartitioningTestBase.checkPrimarySecondaryData(Quarter3, false));
member1.invoke(() -> FixedPartitioningTestBase.checkPrimaryBucketsForQuarter(6, 6));
member2.invoke(() -> FixedPartitioningTestBase.checkPrimaryBucketsForQuarter(6, 6));
member1.invoke(() -> FixedPartitioningTestBase.closeCache());
member2.invoke(() -> FixedPartitioningTestBase.closeCache());
member2.invoke(() -> FixedPartitioningTestBase.createCacheOnMember());
fpa1 = FixedPartitionAttributes.createFixedPartition(Quarter3, true, 3);
fpa2 = FixedPartitionAttributes.createFixedPartition(Quarter4, true, 3);
fpaList.clear();
fpaList.add(fpa1);
fpaList.add(fpa2);
member2.invokeAsync(() -> FixedPartitioningTestBase.createRegionWithPartitionAttributes("Quarter", fpaList, 0, 40, 12, new QuarterPartitionResolver(), null, true));
member1.invoke(() -> FixedPartitioningTestBase.createCacheOnMember());
fpa1 = FixedPartitionAttributes.createFixedPartition(Quarter1, true, 3);
fpa2 = FixedPartitionAttributes.createFixedPartition(Quarter2, true, 3);
fpaList.clear();
fpaList.add(fpa1);
fpaList.add(fpa2);
member1.invokeAsync(() -> FixedPartitioningTestBase.createRegionWithPartitionAttributes("Quarter", fpaList, 0, 40, 12, new QuarterPartitionResolver(), null, true));
Wait.pause(4000);
member2.invoke(() -> FixedPartitioningTestBase.checkPrimarySecondaryData(Quarter3, false));
member2.invoke(() -> FixedPartitioningTestBase.checkPrimaryBucketsForQuarter(6, 6));
member1.invoke(() -> FixedPartitioningTestBase.checkPrimarySecondaryData(Quarter1, false));
member2.invoke(() -> FixedPartitioningTestBase.checkPrimarySecondaryData(Quarter3, false));
member1.invoke(() -> FixedPartitioningTestBase.checkPrimaryBucketsForQuarter(6, 6));
member2.invoke(() -> FixedPartitioningTestBase.checkPrimaryBucketsForQuarter(6, 6));
}
use of org.apache.geode.cache.FixedPartitionAttributes in project geode by apache.
the class FixedPartitioningWithColocationAndPersistenceDUnitTest method testFPR_Persistence_OneMemberAlive.
/**
* Tests validate the behavior of FPR with persistence when one member is kept alive and other
* members goes down and come up
*/
@Test
public void testFPR_Persistence_OneMemberAlive() {
member1.invoke(() -> FixedPartitioningTestBase.createCacheOnMember());
FixedPartitionAttributes fpa1 = FixedPartitionAttributes.createFixedPartition(Quarter1, true, 3);
List<FixedPartitionAttributes> fpaList = new ArrayList<FixedPartitionAttributes>();
fpaList.add(fpa1);
member1.invoke(() -> FixedPartitioningTestBase.createRegionWithPartitionAttributes("Quarter", fpaList, 0, 40, 12, new QuarterPartitionResolver(), null, true));
member2.invoke(() -> FixedPartitioningTestBase.createCacheOnMember());
fpa1 = FixedPartitionAttributes.createFixedPartition(Quarter2, true, 3);
fpaList.clear();
fpaList.add(fpa1);
member2.invoke(() -> FixedPartitioningTestBase.createRegionWithPartitionAttributes("Quarter", fpaList, 0, 40, 12, new QuarterPartitionResolver(), null, true));
member1.invoke(() -> FixedPartitioningTestBase.putForQuarter("Quarter", "Q1"));
member1.invoke(() -> FixedPartitioningTestBase.putForQuarter("Quarter", "Q2"));
member2.invoke(() -> FixedPartitioningTestBase.closeCache());
Wait.pause(1000);
member2.invoke(() -> FixedPartitioningTestBase.createCacheOnMember());
fpa1 = FixedPartitionAttributes.createFixedPartition(Quarter2, true, 3);
fpaList.clear();
fpaList.add(fpa1);
member2.invoke(() -> FixedPartitioningTestBase.createRegionWithPartitionAttributes("Quarter", fpaList, 0, 40, 12, new QuarterPartitionResolver(), null, true));
member2.invoke(() -> FixedPartitioningTestBase.getForQuarter("Quarter", "Q2"));
member3.invoke(() -> FixedPartitioningTestBase.createCacheOnMember());
fpa1 = FixedPartitionAttributes.createFixedPartition(Quarter3, true, 3);
fpaList.clear();
fpaList.add(fpa1);
member3.invoke(() -> FixedPartitioningTestBase.createRegionWithPartitionAttributes("Quarter", fpaList, 0, 40, 12, new QuarterPartitionResolver(), null, true));
member4.invoke(() -> FixedPartitioningTestBase.createCacheOnMember());
fpa1 = FixedPartitionAttributes.createFixedPartition(Quarter4, true, 3);
fpaList.clear();
fpaList.add(fpa1);
member4.invoke(() -> FixedPartitioningTestBase.createRegionWithPartitionAttributes("Quarter", fpaList, 0, 40, 12, new QuarterPartitionResolver(), null, true));
member1.invoke(() -> FixedPartitioningTestBase.putThroughDataStore("Quarter"));
member1.invoke(() -> FixedPartitioningTestBase.checkPrimaryData(Quarter1));
member2.invoke(() -> FixedPartitioningTestBase.checkPrimaryData(Quarter2));
member3.invoke(() -> FixedPartitioningTestBase.checkPrimaryData(Quarter3));
member4.invoke(() -> FixedPartitioningTestBase.checkPrimaryData(Quarter4));
member1.invoke(() -> FixedPartitioningTestBase.checkPrimaryBucketsForQuarter(3, 3));
member2.invoke(() -> FixedPartitioningTestBase.checkPrimaryBucketsForQuarter(3, 3));
member3.invoke(() -> FixedPartitioningTestBase.checkPrimaryBucketsForQuarter(3, 3));
member4.invoke(() -> FixedPartitioningTestBase.checkPrimaryBucketsForQuarter(3, 3));
}
Aggregations