text:
layout: post
title: Swisher's AOL.com, 15 years later
comments: true
permalink: aol.html
analysis: ■
---

[Kara Swisher](http://en.wikipedia.org/wiki/Kara_Swisher) wrote her book [AOL.com](http://www.amazon.com/AOL-com-Kara-Swisher/dp/0812931912/ref=sr_1_3?ie=UTF8&qid=1391237040&sr=8-3&keywords=aol.com) in 1998.

In those days, the industry faced an epistemological crisis. The consumer Internet was new and ill-understood. A company worth billions at that time might have been worth nothing a year later. There was simply a limitation to what could be known. Neither the critics nor the advocates really had a good platform for justfying their behavior.

What's poignant is how little has changed. Consider, for example, the very first paragraphs in the very first chapter, which might as well be about Instagram or Snapchat:

> ### Chapter 1: the canary in the coal mine
>
> The truth is: nobody knows.
>
> And, because most often they do not know that they do not know, no one will ever tell you that truth.
>
> Some people don't know because they are too hopeful and sometimes because they are very greedy. Some are profoundly stupid or are a little too smart.
>
> But in the spanking new world of the Internet, nobody knows because everyone and everything has just been born.
>
> Which is why Steve Case found himself on May 8, 1997 cruising on the calm waters of Lake Washington in Seattle on a boat carrying him and more than 100 other chief executives toward the 20,000-square-foot, $40 million home of Bill Gates.
>
> Case was definitely not supposed to be there--if you had paid heed over the years to a variety of learned Wall Street pundits, savvy journalists, pontificating technology consultants, and waspish naysayers in Silicon Valley. And the computer online service, America Online Inc., which he had built into the world's largest, was just one tiny step away from falling right over the precipice.
>
> The dirge had been endless: AOL was nothing. AOL was history. AOL was dead.
>
> Yet there Case stood--perhaps the liveliest corporate corpse one might ever meet--chatting with American Airlines head Robert Crandall, kibitzing with a cadre of Microsoft's top executives, and joking with Vice President Al Gore.

The company names might have shifted, but the thrust of the question is the same: what does success mean if a company worth billions today can be worth literally nothing tomorrow? Even 15 years on, it's hard to say.


text:
var autoDecreasePerSecond = 0.5;
var maxWidth = 240;
var juicyStarCount = 15;
var maxMagicLevel = 5;

var constants = require('../GameConsts');

function FunBar() {
    this.element = new createjs.Container();
    this.element.x = constants.GAME_WIDTH / 2 - 95;
	this.element.y = 10;
    this.current = 0;
	this.lastIncrease = 0;
    this.border = new createjs.Shape();
    this.border.graphics.beginFill("#333").drawRect(0, 0, 250, 50);
    this.element.addChild(this.border);

	this.maxFunValue = 0;
	this.funTime = 0;

    this.fill = new createjs.Shape();
    this.drawFill();
    this.element.addChild(this.fill);

	this.isFunTime = false;
	this.isFunTimeReset = true;

	this.funText = new createjs.Text("Fun", "24px Komika", "#fff");
	this.funText.x = -60;
	this.funText.y = 3;
	this.element.addChild(this.funText);

	this.funBarText = new createjs.Text("0.0", "25px Komika", '#fff');
	this.funBarText.x = 90;
	this.funBarText.y = 1;
	this.element.addChild(this.funBarText);
}

FunBar.prototype.registerEvents = function(emitter) {
    emitter.on('hit', this.onHit.bind(this));
    emitter.on('combo', this.onCombo.bind(this));
	emitter.on('force-fun', this.onForceFun.bind(this));
	emitter.on('change-level', this.onChangeLevel.bind(this));

	this.emitter = emitter;
};

FunBar.prototype.onHit = function(event) {
    if (event.hitTarget == 'player') {
        return;
    }

	this.increase(1);
};

FunBar.prototype.onCombo = function(event) {
    this.increase(event.level);
	this.spawnComboMessage(event.level);
};

FunBar.prototype.increase = function(value) {
	this.current += value;
	if (this.current >= this.maxFunValue && this.isFunTime == false) {
		this.canFunTime = true;
		this.emitter.emit('fun', {status: 1});
	}

	this.current = Math.min(this.current, this.maxFunValue);

	this.lastIncrease = new Date().getTime();

	for (var i = 0; i < juicyStarCount + 1; i++) {
		this.spawnJuicyStar(5 + this.getMaxOffsetOnBar() / juicyStarCount * i - 20 + 40 * Math.random(), 50 * Math.random(), 40);
	}

	var magicLevel = Math.min(maxMagicLevel, value);
	createjs.Sound.play('magic' + magicLevel);
};

FunBar.prototype.onForceFun = function() {
	this.increase(this.maxFunValue);
};

FunBar.prototype.tick = function(event) {
    if (this.current > 0) {
		if (this.isFunTime && event.timeStamp < this.funTimeEnd) {
			this.spawnJuicyStar(5 + this.getMaxOffsetOnBar() * Math.random() - 20 + 40 * Math.random(), 50 * Math.random(), 40);
		} else {
			this.isFunTime = false;

			if (!this.isFunTimeReset) {
				this.current = 0;
				this.isFunTimeReset = true;
				this.emitter.emit('fun', {status: 0});
			}

			this.current -= (event.delta / 1000) * autoDecreasePerSecond;
			this.current = Math.max(this.current, 0);

			var lastIncreaseDiff = event.timeStamp - this.lastIncrease;
			if (lastIncreaseDiff < 1000) {
				// fade from rgb(255, 0, 255) to rgb(255, 255, 0)
				this.drawFill('rgb(255, ' + Math.round(255 / 1000 * lastIncreaseDiff) + ', ' + Math.round(255 - 255 / 1000 * lastIncreaseDiff) + ')');
			} else {
				this.drawFill();
			}
		}
    }

	this.funBarText.text = (Math.round(this.current * 10) / 10).toFixed(1) + '/' + this.maxFunValue;

	if (this.canFunTime) {
		this.isFunTime = true;
		this.canFunTime = false;
		this.isFunTimeReset = false;
		this.funTimeEnd = event.timeStamp + this.funTime;
	}
};

FunBar.prototype.getMaxOffsetOnBar = function() {
	return (this.current / this.maxFunValue) * maxWidth;
};

FunBar.prototype.drawFill = function(color) {
	color = (color === undefined) ? '#ff0' : color;
    this.fill.graphics.clear().beginFill(color).drawRect(5, 5, (this.current / this.maxFunValue) * maxWidth, 40);
};

FunBar.prototype.spawnJuicyStar = function(x, y, size) {
	size *= (0.8 + 0.4 * Math.random());

	var star = new createjs.Shape();
	star.x = x;
	star.y = y;
	star.rotation = parseInt(Math.random() * 360);
	star.graphics.beginStroke("#f0f").beginFill('#ff0').setStrokeStyle(2).drawPolyStar(0, 0, size / 2 - 15, 5, 0.6).closePath();
	this.element.addChild(star);

	createjs.Tween.get(star)
		.to({y: y + 200, alpha: 0, rotation: star.rotation + 180}, 500 + 500 * Math.random(), createjs.Ease.linear)
		.call(function() {
			this.element.removeChild(star);
		}.bind(this));
};

FunBar.prototype.spawnComboMessage = function(level) {
	var message = new createjs.Text(level + 'x Combo', '30px Komika', "#fff");
	message.x = 95 - message.getMeasuredWidth() / 2;
	message.y = 150;
	this.element.addChild(message);

	createjs.Tween.get(message)
		.to({y: 0, alpha: 0}, 1500, createjs.Ease.linear)
		.call(function() {
			this.element.removeChild(message);
		}.bind(this));
};

FunBar.prototype.onChangeLevel = function(level) {
	this.maxFunValue = level.maxFunValue;
	this.funTime = level.funTime;
};

module.exports = FunBar;

redpajama_set_name: RedPajamaGithub


text:
package com.getbase.android.db.provider;

import android.net.Uri;

public interface UriDecorator {
  Uri decorate(Uri uri);
}


text:
/**
 * \file
 * \brief x86 machine check architecture initialisation / "driver"
 */

/*
 * Copyright (c) 2010, ETH Zurich.
 * All rights reserved.
 *
 * This file is distributed under the terms in the attached LICENSE file.
 * If you do not find this file, copies can be found by writing to:
 * ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group.
 */

#include <kernel.h>
#include <x86.h>
#include <arch/x86/mcheck.h>
#include <dev/ia32_dev.h>
#include <dev/amd64_dev.h>

/**
 * \brief Enable machine check reporting, if supported
 *
 * Intel SDM vol 3 sec 14.6 p14-15 "Machine-check initialization" pseudocode
 */
void mcheck_init(void)
{
    // use CPUID to check for support and get processor family
    uint32_t eax, edx;
    cpuid(1, &eax, NULL, NULL, &edx);

    bool mca_supported = (edx & (1 << 14)) != 0;
    bool mce_supported = (edx & (1 << 7)) != 0;

    uint8_t proc_family = (eax >> 8) & 0xf;

    // if MCE unsupported, skip this entirely
    if (!mce_supported) {
        return;
    }

    debug(SUBSYS_STARTUP, "Machine-check exceptions supported\n");

    if (mca_supported) {
        debug(SUBSYS_STARTUP, "Machine-check architecture supported, "
                              "family 0x%x\n", proc_family);

        // if the ctl register is present, enable all MCA features
        ia32_mcg_cap_t mcg_cap = ia32_mcg_cap_rd(NULL);

	int num_banks = ia32_mcg_cap_count_extract(mcg_cap);

        if (ia32_mcg_cap_ctl_p_extract(mcg_cap)) {
            ia32_mcg_ctl_wr(NULL, ia32_mc_enable);
        }

        if (proc_family == 0x6) {
            // enable logging of all errors except for mc0_ctl register
            for (int i = 1; i < num_banks; i++) {
                ia32_mc_ctl_wr(NULL, i, ia32_mc_enable);
            }

            // clear all errors
            for (int i = 0; i < num_banks; i++) {
                ia32_mc_status_wr(NULL, i, 0UL);
            }
        } else if (proc_family == 0xf) { // any processor extended family
            // enable logging of all errors including mc0_ctl
            for (int i = 0; i < num_banks; i++) {
                ia32_mc_ctl_wr(NULL, i, ia32_mc_enable);
            }

            // clear all errors
            for (int i = 0; i < num_banks; i++) {
                ia32_mc_status_wr(NULL, i, 0UL);
            }
        }
    }

    // enable machine-check exceptions
    amd64_cr4_mce_wrf(NULL,1);
}


text:
from django.db import models
from djangocms_text_ckeditor import fields
from cms.models.pluginmodel import CMSPlugin
from filer.fields.image import FilerImageField

COLOR_CHOICES = (
    ("bg-primary", "blue"),
    ("bg-danger", "red"),
    ("bg-success", "green"),
    ("bg-info", "light-blue"),
    ("bg-warning", "yellow"),

)

LIST_TYPES = (
    ('list-questions', 'list-questions'),
    ('list_numeric', 'list_numeric'),
    ('list-checklist', 'list-checklist'),
    ('list-header', 'list-header')
)

SLIDE_SHARE_BACK = (
    ('gray', 'section-2-cols-bg'),
    ('none', ''),
)

class AbstractPlugin(CMSPlugin):
    """
    Abstract Base Class for all Plugins.
    """
    hidden = models.BooleanField(default=False)

    class Meta:
        abstract = True

class LandingPlugin(AbstractPlugin):
    """
    Plugin provide widget main page
    """
    title = models.CharField(max_length=200, null=True, blank=True)
    description = fields.HTMLField(null=True, blank=True)
    list_description = fields.HTMLField(null=True, blank=True)
    link_button = models.URLField(null=True, blank=True)
    text_button = models.CharField(null=True, max_length=70, blank=True)
    block_color = models.CharField(max_length=20, choices=COLOR_CHOICES, default='bg-primary')

class BannerPlugin(AbstractPlugin):
    """
    Plugin make banner with description and button to go
    """
    title = models.CharField(max_length=200, blank=True)
    description = fields.HTMLField(blank=True)
    link_button = models.URLField(blank=True)
    text_button = models.CharField(max_length=70, blank=True)
    sponsors_text = models.CharField(max_length=200, blank=True)

class ActiveLearningRatesPlugin(AbstractPlugin):
    """
    Plugin provide ability to edit Active learting block.
    """
    title = models.CharField(max_length=200, blank=True)
    description = fields.HTMLField(blank=True)
    fig_alt = models.CharField(max_length=200, blank=True)
    fig_caption = models.CharField(max_length=200, blank=True)
    list_text = fields.HTMLField()

class ListPlugin(AbstractPlugin):
    """
    General plugin for adding list
    of tesises with the title and <li> element class.
    """
    title = models.CharField(max_length=200, blank=True)
    list_type = models.CharField(max_length=20, choices=LIST_TYPES, default='list-questions')
    list_text = fields.HTMLField()

class ChildPersonalGuidesPlugin(AbstractPlugin):
    """
    Plugin for personal guides block.
    """
    image = FilerImageField(related_name="personal_guides_image", on_delete=models.CASCADE)
    title = models.CharField(max_length=200, blank=True)
    description = fields.HTMLField()

class SocialProofsPlugin(AbstractPlugin):
    """
    Plugin for Social Proofs block.
    """
    title = models.CharField(max_length=200, blank=True)
    post_description = fields.HTMLField()
    more_proofs_link = models.URLField(null=True, blank=True)

class ProofPlugin(AbstractPlugin):
    """
    Plugin for proof.
    """
    proof_icon = FilerImageField(related_name="proof_icon", blank=True, null=True, on_delete=models.CASCADE)
    title = models.CharField(max_length=200, blank=True)
    description = fields.HTMLField()

class KeyNotesSetPlugin(AbstractPlugin):
    """
    Plugin for KeyNotes block.
    """
    title = models.CharField(max_length=200, blank=True)
    description = fields.HTMLField()

class KeyNotePlugin(AbstractPlugin):
    """
    Plugin for KeyNote.
    """
    button_text = models.CharField(max_length=200, blank=True)
    uid = models.SlugField(max_length=8, blank=False)
    title = models.CharField(max_length=200, blank=True)
    description = fields.HTMLField()

class ParentPersonalGuidesPlugin(AbstractPlugin):
    """
    Parent plugin for Personal Guides.
    """
    title = models.CharField(max_length=200, blank=True)

class WorkshopDescriptionPlugin(AbstractPlugin):
    """
    Parent plugin Workshop description.
    """
    title = models.CharField(max_length=200, blank=True)
    description = fields.HTMLField(blank=True)

class BenefitsItemPlugin(AbstractPlugin):
    """
    Item of benefils
    """
    title = models.CharField(max_length=200, blank=True)
    description = fields.HTMLField(blank=True)
    image = FilerImageField(null=True, blank=True, on_delete=models.CASCADE)

class BenefitsPlugin(AbstractPlugin):
    """
    Base plugin for benefits
    """
    title = models.CharField(max_length=200, blank=True)
    description = fields.HTMLField(blank=True)

class FooterPlugin(AbstractPlugin):
    """
    Plugin for the footer part of landing page.
    """
    footer_text = models.CharField(max_length=100, blank=True)
    footer_link = models.CharField(max_length=200, blank=True)

class SocialPlugin(AbstractPlugin):
    title = models.CharField(max_length=200, blank=True)

class FAQPlugin(AbstractPlugin):
    title = models.CharField(max_length=200, blank=True)

class FAQItemPlugin(AbstractPlugin):
    question = models.TextField(blank=True)
    answer = models.TextField(blank=True)

class MiscItemPlugin(AbstractPlugin):
    title = models.CharField(max_length=200, blank=True)
    description_header = fields.HTMLField(blank=True)
    list_type = models.CharField(max_length=20, choices=LIST_TYPES, default='list-checklist')
    list_text = fields.HTMLField()
    description_footer = fields.HTMLField(blank=True)
    header_type_text = models.CharField(max_length=200, blank=True)

class InterestedPlugin(AbstractPlugin):
    title = models.CharField(max_length=200, default="I'm Interested in the hackathon")
    description = models.TextField(
        default="Get on our mailing list and we'll contact you about the next hackathon.")
    name_field = models.CharField(max_length=200, default="Name")
    email_field = models.CharField(max_length=200, default="Email")
    organization_field = models.CharField(max_length=200, default="Institution/Organization")

    role_field = models.CharField(max_length=200, default=" Title/Role")

    name_error_msg = models.CharField(max_length=200, default="Please enter your name")
    organization_error_msg = models.CharField(max_length=200, default="Please enter your Institute/Organization")
    email_error_msg = models.CharField(max_length=200, default="Please enter your email")
    role_error_msg = models.CharField(max_length=200, default="Please enter your Title/Role")

    email_to = models.EmailField(default='dummy@mail.com')

    btn_text = models.CharField(max_length=70, default='Schedule to demo')
    bg_image = FilerImageField(null=True, blank=True, on_delete=models.CASCADE)

class InterestedForm(models.Model):
    """
    Model for save interested form answer and do some later
    """
    name = models.CharField(max_length=200, blank=True)
    organization = models.CharField(max_length=200, blank=True)
    role = models.CharField(max_length=100, blank=True)
    email = models.EmailField(blank=True)

class DetailsChildPlugin(AbstractPlugin):
    title = models.CharField(max_length=200, blank=True)

class DetailsVideoPlugin(AbstractPlugin):
    video_url = models.URLField()
    description = models.CharField(max_length=200, blank=True)

class DetailsQuotePlugin(AbstractPlugin):
    quote_text = models.CharField(max_length=200)
    quote_small = models.CharField(max_length=200)

class SlideSharePlugin(AbstractPlugin):
    title = models.CharField(max_length=200)
    description = fields.HTMLField()
    background = models.CharField(default='grey', max_length=70, choices=SLIDE_SHARE_BACK)

class SlideShareItemPlugin(AbstractPlugin):
    title = models.CharField(max_length=200, blank=True)
    slideshare_code = models.TextField()

class BecomeInstructorPlugin(AbstractPlugin):
    error_name = models.CharField(max_length=200, blank=True)
    agreement_text = models.TextField(blank=True)

class HelpCenterModel(AbstractPlugin):
    title = models.CharField(max_length=200, blank=True)
    description = models.TextField(blank=True)
    link_text = models.CharField(max_length=200)
    link_url = models.URLField()

class IntercomArticleModel(AbstractPlugin):
    title = models.CharField(max_length=200, blank=True)
    short_description = models.TextField(blank=True)
    link_text = models.CharField(max_length=200)
    link_url = models.URLField()

class Hero1Model(AbstractPlugin):
    title = models.CharField(max_length=200, blank=True)
    description = models.TextField(blank=True)
    best_prattices_text = models.CharField(max_length=200)
    best_prattices_link = models.URLField()
    bp1_text = models.CharField(max_length=200)
    bp1_link = models.URLField()
    video_url = models.URLField()

class Hero2Model(AbstractPlugin):
    title = models.CharField(max_length=200, blank=True)
    description = models.TextField(blank=True)
    best_prattices_text = models.CharField(max_length=200)
    best_prattices_link = models.URLField()
    bp2_text = models.CharField(max_length=200)
    bp2_link = models.URLField()
    video_url = models.URLField()


text:
package com.gemstone.gemfire.internal.cache.partitioned.fixed;

import java.util.ArrayList;
import java.util.List;

import com.gemstone.gemfire.cache.FixedPartitionAttributes;

import dunit.AsyncInvocation;
import dunit.Host;

public class FixedPartitioningWithColocationAndPersistenceDUnitTest extends
    FixedPartitioningTestBase {

  public FixedPartitioningWithColocationAndPersistenceDUnitTest(String name) {
    super(name);
  }

  private static final long serialVersionUID = 1L;

  public void setUp() throws Exception {
    super.setUp();
    final Host host = Host.getHost(0);
    member1 = host.getVM(0);
    member2 = host.getVM(1);
    member3 = host.getVM(2);
    member4 = host.getVM(3);

  }

  public void tearDown2() throws Exception {
    super.tearDown2();
  }

  /**
   * This tests validates that in colocation of FPRs child region cannot specify
   * FixedPartitionAttributes
   *
   */

  public void testColocation_WithFPROnChildRegion() {
    try {
      member1.invoke(FixedPartitioningTestBase.class, "createCacheOnMember");
      FixedPartitionAttributes fpa1 = FixedPartitionAttributes
          .createFixedPartition("Customer100", true, 2);
      List<FixedPartitionAttributes> fpaList = new ArrayList<FixedPartitionAttributes>();
      fpaList.add(fpa1);
      member1.invoke(FixedPartitioningTestBase.class,
          "createRegionWithPartitionAttributes", new Object[] { "Customer",
              fpaList, 0, 40, 8, null, null, false });

      fpa1 = FixedPartitionAttributes.createFixedPartition("Order100", true, 2);
      fpaList = new ArrayList<FixedPartitionAttributes>();
      fpaList.add(fpa1);
      member1.invoke(FixedPartitioningTestBase.class,
          "createRegionWithPartitionAttributes", new Object[] { "Order",
              fpaList, 0, 40, 8, null, "Customer", false });
      fail("IllegalStateException expected");
    }
    catch (Exception illegal) {
      if (!((illegal.getCause() instanceof IllegalStateException) && (illegal
          .getCause().getMessage()
          .contains("not be specified in PartitionAttributesFactory if colocated-with is specified")))) {
        fail("Expected IllegalStateException ", illegal);
      }
    }
  }

  /**
   * This tests validates that in Customer-Order-shipment colocation, Order and
   * shipment have the FixedPartitionAttributes of the parent region Customer.
   *
   * Put happens for all 3 regions. Colocation of the data is achieved by using
   * a partition-resolver
   * {@link CustomerFixedPartitionResolver#getRoutingObject(com.gemstone.gemfire.cache.EntryOperation)}
   * Also the Fixed Partitioning is achieved using same partition-resolver
   * {@link CustomerFixedPartitionResolver#getPartitionName(com.gemstone.gemfire.cache.EntryOperation, java.util.Set)}
   *
   * Validation are done for the same number of the buckets Validation are done
   * for the same buckets on particular member for all 3 regions.
   *
   */

  public void testColocation_FPRs_ChildUsingAttributesOfParent() {
    try {
      member1.invoke(FixedPartitioningTestBase.class, "createCacheOnMember");
      member2.invoke(FixedPartitioningTestBase.class, "createCacheOnMember");
      member3.invoke(FixedPartitioningTestBase.class, "createCacheOnMember");
      member4.invoke(FixedPartitioningTestBase.class, "createCacheOnMember");

      FixedPartitionAttributes fpa1 = FixedPartitionAttributes
          .createFixedPartition("10", true, 5);
      FixedPartitionAttributes fpa2 = FixedPartitionAttributes
          .createFixedPartition("30", false, 5);
      FixedPartitionAttributes fpa3 = FixedPartitionAttributes
          .createFixedPartition("40", false, 5);
      List<FixedPartitionAttributes> fpaList = new ArrayList<FixedPartitionAttributes>();
      fpaList.add(fpa1);
      fpaList.add(fpa2);
      fpaList.add(fpa3);
      member1.invoke(FixedPartitioningTestBase.class,
          "createRegionWithPartitionAttributes", new Object[] { "Customer",
              fpaList, 2, 50, 20, new CustomerFixedPartitionResolver(), null,
              false });

      fpa1 = FixedPartitionAttributes.createFixedPartition("20", true, 5);
      fpa2 = FixedPartitionAttributes.createFixedPartition("30", false, 5);
      fpa3 = FixedPartitionAttributes.createFixedPartition("40", false, 5);
      fpaList = new ArrayList<FixedPartitionAttributes>();
      fpaList.add(fpa1);
      fpaList.add(fpa2);
      fpaList.add(fpa3);
      member2.invoke(FixedPartitioningTestBase.class,
          "createRegionWithPartitionAttributes", new Object[] { "Customer",
              fpaList, 2, 50, 20, new CustomerFixedPartitionResolver(), null,
              false });

      fpa1 = FixedPartitionAttributes.createFixedPartition("30", true, 5);
      fpa2 = FixedPartitionAttributes.createFixedPartition("10", false, 5);
      fpa3 = FixedPartitionAttributes.createFixedPartition("20", false, 5);
      fpaList = new ArrayList<FixedPartitionAttributes>();
      fpaList.add(fpa1);
      fpaList.add(fpa2);
      fpaList.add(fpa3);
      member3.invoke(FixedPartitioningTestBase.class,
          "createRegionWithPartitionAttributes", new Object[] { "Customer",
              fpaList, 2, 50, 20, new CustomerFixedPartitionResolver(), null,
              false });

      fpa1 = FixedPartitionAttributes.createFixedPartition("40", true, 5);
      fpa2 = FixedPartitionAttributes.createFixedPartition("10", false, 5);
      fpa3 = FixedPartitionAttributes.createFixedPartition("20", false, 5);
      fpaList = new ArrayList<FixedPartitionAttributes>();
      fpaList.add(fpa1);
      fpaList.add(fpa2);
      fpaList.add(fpa3);
      member4.invoke(FixedPartitioningTestBase.class,
          "createRegionWithPartitionAttributes", new Object[] { "Customer",
              fpaList, 2, 50, 20, new CustomerFixedPartitionResolver(), null,
              false });

      member1.invoke(FixedPartitioningTestBase.class,
          "createRegionWithPartitionAttributes", new Object[] { "Order", null,
              2, 50, 20, new CustomerFixedPartitionResolver(), "Customer",
              false });
      member2.invoke(FixedPartitioningTestBase.class,
          "createRegionWithPartitionAttributes", new Object[] { "Order", null,
              2, 50, 20, new CustomerFixedPartitionResolver(), "Customer",
              false });
      member3.invoke(FixedPartitioningTestBase.class,
          "createRegionWithPartitionAttributes", new Object[] { "Order", null,
              2, 50, 20, new CustomerFixedPartitionResolver(), "Customer",
              false });
      member4.invoke(FixedPartitioningTestBase.class,
          "createRegionWithPartitionAttributes", new Object[] { "Order", null,
              2, 50, 20, new CustomerFixedPartitionResolver(), "Customer",
              false });

      member1.invoke(FixedPartitioningTestBase.class,
          "createRegionWithPartitionAttributes", new Object[] { "Shipment",
              null, 2, 50, 20, new CustomerFixedPartitionResolver(), "Order",
              false });
      member2.invoke(FixedPartitioningTestBase.class,
          "createRegionWithPartitionAttributes", new Object[] { "Shipment",
              null, 2, 50, 20, new CustomerFixedPartitionResolver(), "Order",
              false });
      member3.invoke(FixedPartitioningTestBase.class,
          "createRegionWithPartitionAttributes", new Object[] { "Shipment",
              null, 2, 50, 20, new CustomerFixedPartitionResolver(), "Order",
              false });
      member4.invoke(FixedPartitioningTestBase.class,
          "createRegionWithPartitionAttributes", new Object[] { "Shipment",
              null, 2, 50, 20, new CustomerFixedPartitionResolver(), "Order",
              false });

      member1.invoke(FixedPartitioningTestBase.class, "checkFPR",
          new Object[] { "Order" });
      member1.invoke(FixedPartitioningTestBase.class, "checkFPR",
          new Object[] { "Shipment" });
      member2.invoke(FixedPartitioningTestBase.class, "checkFPR",
          new Object[] { "Order" });
      member2.invoke(FixedPartitioningTestBase.class, "checkFPR",
          new Object[] { "Shipment" });
      member3.invoke(FixedPartitioningTestBase.class, "checkFPR",
          new Object[] { "Order" });
      member3.invoke(FixedPartitioningTestBase.class, "checkFPR",
          new Object[] { "Shipment" });
      member4.invoke(FixedPartitioningTestBase.class, "checkFPR",
          new Object[] { "Order" });
      member4.invoke(FixedPartitioningTestBase.class, "checkFPR",
          new Object[] { "Shipment" });

      member1.invoke(FixedPartitioningTestBase.class,
          "putOrderPartitionedRegion", new Object[] { "Order" });

      member1.invoke(FixedPartitioningTestBase.class,
          "putCustomerPartitionedRegion", new Object[] { "Customer" });

      member1.invoke(FixedPartitioningTestBase.class,
          "putShipmentPartitionedRegion", new Object[] { "Shipment" });

      member1.invoke(FixedPartitioningTestBase.class,
          "validateAfterPutPartitionedRegion", new Object[] { "Customer",
              "Order", "Shipment" });

      member1.invoke(FixedPartitioningTestBase.class,
          "checkPrimaryBucketsForColocation", new Object[] { 15, 5, "Customer",
              "Order", "Shipment" });
      member2.invoke(FixedPartitioningTestBase.class,
          "checkPrimaryBucketsForColocation", new Object[] { 15, 5, "Customer",
              "Order", "Shipment" });
      member3.invoke(FixedPartitioningTestBase.class,
          "checkPrimaryBucketsForColocation", new Object[] { 15, 5, "Customer",
              "Order", "Shipment" });
      member4.invoke(FixedPartitioningTestBase.class,
          "checkPrimaryBucketsForColocation", new Object[] { 15, 5, "Customer",
              "Order", "Shipment" });

    }
    catch (Exception e) {
      fail("Unexpected Exception ", e);
    }
  }

  public void testColocation_FPR_Persistence_ChildUsingAttributesOfParent() {
    try {
      member1.invoke(FixedPartitioningTestBase.class, "createCacheOnMember");
      member2.invoke(FixedPartitioningTestBase.class, "createCacheOnMember");
      member3.invoke(FixedPartitioningTestBase.class, "createCacheOnMember");
      member4.invoke(FixedPartitioningTestBase.class, "createCacheOnMember");

      FixedPartitionAttributes fpa1 = FixedPartitionAttributes
          .createFixedPartition("10", true, 5);
      FixedPartitionAttributes fpa2 = FixedPartitionAttributes
          .createFixedPartition("30", false, 5);
      FixedPartitionAttributes fpa3 = FixedPartitionAttributes
          .createFixedPartition("40", false, 5);
      List<FixedPartitionAttributes> fpaList = new ArrayList<FixedPartitionAttributes>();
      fpaList.add(fpa1);
      fpaList.add(fpa2);
      fpaList.add(fpa3);
      member1.invoke(FixedPartitioningTestBase.class,
          "createRegionWithPartitionAttributes", new Object[] { "Customer",
              fpaList, 2, 50, 20, new CustomerFixedPartitionResolver(), null,
              true });

      fpa1 = FixedPartitionAttributes.createFixedPartition("20", true, 5);
      fpa2 = FixedPartitionAttributes.createFixedPartition("30", false, 5);
      fpa3 = FixedPartitionAttributes.createFixedPartition("40", false, 5);
      fpaList = new ArrayList<FixedPartitionAttributes>();
      fpaList.add(fpa1);
      fpaList.add(fpa2);
      fpaList.add(fpa3);
      member2.invoke(FixedPartitioningTestBase.class,
          "createRegionWithPartitionAttributes", new Object[] { "Customer",
              fpaList, 2, 50, 20, new CustomerFixedPartitionResolver(), null,
              true });

      fpa1 = FixedPartitionAttributes.createFixedPartition("30", true, 5);
      fpa2 = FixedPartitionAttributes.createFixedPartition("10", false, 5);
      fpa3 = FixedPartitionAttributes.createFixedPartition("20", false, 5);
      fpaList = new ArrayList<FixedPartitionAttributes>();
      fpaList.add(fpa1);
      fpaList.add(fpa2);
      fpaList.add(fpa3);
      member3.invoke(FixedPartitioningTestBase.class,
          "createRegionWithPartitionAttributes", new Object[] { "Customer",
              fpaList, 2, 50, 20, new CustomerFixedPartitionResolver(), null,
              true });

      fpa1 = FixedPartitionAttributes.createFixedPartition("40", true, 5);
      fpa2 = FixedPartitionAttributes.createFixedPartition("10", false, 5);
      fpa3 = FixedPartitionAttributes.createFixedPartition("20", false, 5);
      fpaList = new ArrayList<FixedPartitionAttributes>();
      fpaList.add(fpa1);
      fpaList.add(fpa2);
      fpaList.add(fpa3);
      member4.invoke(FixedPartitioningTestBase.class,
          "createRegionWithPartitionAttributes", new Object[] { "Customer",
              fpaList, 2, 50, 20, new CustomerFixedPartitionResolver(), null,
              true });

      member1.invoke(FixedPartitioningTestBase.class,
          "createRegionWithPartitionAttributes", new Object[] { "Order", null,
              2, 50, 20, new CustomerFixedPartitionResolver(), "Customer",
              false });
      member2.invoke(FixedPartitioningTestBase.class,
          "createRegionWithPartitionAttributes", new Object[] { "Order", null,
              2, 50, 20, new CustomerFixedPartitionResolver(), "Customer",
              false });
      member3.invoke(FixedPartitioningTestBase.class,
          "createRegionWithPartitionAttributes", new Object[] { "Order", null,
              2, 50, 20, new CustomerFixedPartitionResolver(), "Customer",
              false });
      member4.invoke(FixedPartitioningTestBase.class,
          "createRegionWithPartitionAttributes", new Object[] { "Order", null,
              2, 50, 20, new CustomerFixedPartitionResolver(), "Customer",
              false });

      member1.invoke(FixedPartitioningTestBase.class,
          "createRegionWithPartitionAttributes", new Object[] { "Shipment",
              null, 2, 50, 20, new CustomerFixedPartitionResolver(), "Order",
              false });
      member2.invoke(FixedPartitioningTestBase.class,
          "createRegionWithPartitionAttributes", new Object[] { "Shipment",
              null, 2, 50, 20, new CustomerFixedPartitionResolver(), "Order",
              false });
      member3.invoke(FixedPartitioningTestBase.class,
          "createRegionWithPartitionAttributes", new Object[] { "Shipment",
              null, 2, 50, 20, new CustomerFixedPartitionResolver(), "Order",
              false });
      member4.invoke(FixedPartitioningTestBase.class,
          "createRegionWithPartitionAttributes", new Object[] { "Shipment",
              null, 2, 50, 20, new CustomerFixedPartitionResolver(), "Order",
              false });

      member1.invoke(FixedPartitioningTestBase.class, "checkFPR",
          new Object[] { "Order" });
      member1.invoke(FixedPartitioningTestBase.class, "checkFPR",
          new Object[] { "Shipment" });
      member2.invoke(FixedPartitioningTestBase.class, "checkFPR",
          new Object[] { "Order" });
      member2.invoke(FixedPartitioningTestBase.class, "checkFPR",
          new Object[] { "Shipment" });
      member3.invoke(FixedPartitioningTestBase.class, "checkFPR",
          new Object[] { "Order" });
      member3.invoke(FixedPartitioningTestBase.class, "checkFPR",
          new Object[] { "Shipment" });
      member4.invoke(FixedPartitioningTestBase.class, "checkFPR",
          new Object[] { "Order" });
      member4.invoke(FixedPartitioningTestBase.class, "checkFPR",
          new Object[] { "Shipment" });

      member1.invoke(FixedPartitioningTestBase.class,
          "putOrderPartitionedRegion", new Object[] { "Order" });

      member1.invoke(FixedPartitioningTestBase.class,
          "putCustomerPartitionedRegion", new Object[] { "Customer" });

      member1.invoke(FixedPartitioningTestBase.class,
          "putShipmentPartitionedRegion", new Object[] { "Shipment" });

      member1.invoke(FixedPartitioningTestBase.class,
          "validateAfterPutPartitionedRegion", new Object[] { "Customer",
              "Order", "Shipment" });

      member1.invoke(FixedPartitioningTestBase.class,
          "checkPrimaryBucketsForColocation", new Object[] { 15, 5, "Customer",
              "Order", "Shipment" });
      member2.invoke(FixedPartitioningTestBase.class,
          "checkPrimaryBucketsForColocation", new Object[] { 15, 5, "Customer",
              "Order", "Shipment" });
      member3.invoke(FixedPartitioningTestBase.class,
          "checkPrimaryBucketsForColocation", new Object[] { 15, 5, "Customer",
              "Order", "Shipment" });
      member4.invoke(FixedPartitioningTestBase.class,
          "checkPrimaryBucketsForColocation", new Object[] { 15, 5, "Customer",
              "Order", "Shipment" });

    }
    catch (Exception e) {
      fail("Unexpected Exception ", e);
    }
  }

  /**
   * This tests validates that Customer-Order-shipment colocation with failover
   * scenario,
   */

  public void testColocation_FPRs_ChildUsingAttributesOfParent_HA() {
    try {
      member1.invoke(FixedPartitioningTestBase.class, "createCacheOnMember");
      member2.invoke(FixedPartitioningTestBase.class, "createCacheOnMember");
      member3.invoke(FixedPartitioningTestBase.class, "createCacheOnMember");

      FixedPartitionAttributes fpa1 = FixedPartitionAttributes
          .createFixedPartition("10", true, 5);
      FixedPartitionAttributes fpa2 = FixedPartitionAttributes
          .createFixedPartition("30", false, 5);
      FixedPartitionAttributes fpa3 = FixedPartitionAttributes
          .createFixedPartition("40", false, 5);
      List<FixedPartitionAttributes> fpaList = new ArrayList<FixedPartitionAttributes>();
      fpaList.add(fpa1);
      fpaList.add(fpa2);
      fpaList.add(fpa3);
      member1.invoke(FixedPartitioningTestBase.class,
          "createRegionWithPartitionAttributes", new Object[] { "Customer",
              fpaList, 2, 50, 20, new CustomerFixedPartitionResolver(), null,
              false });

      fpa1 = FixedPartitionAttributes.createFixedPartition("20", true, 5);
      fpa2 = FixedPartitionAttributes.createFixedPartition("30", false, 5);
      fpa3 = FixedPartitionAttributes.createFixedPartition("40", false, 5);
      fpaList = new ArrayList<FixedPartitionAttributes>();
      fpaList.add(fpa1);
      fpaList.add(fpa2);
      fpaList.add(fpa3);
      member2.invoke(FixedPartitioningTestBase.class,
          "createRegionWithPartitionAttributes", new Object[] { "Customer",
              fpaList, 2, 50, 20, new CustomerFixedPartitionResolver(), null,
              false });

      fpa1 = FixedPartitionAttributes.createFixedPartition("30", true, 5);
      fpa2 = FixedPartitionAttributes.createFixedPartition("40", true, 5);
      fpa3 = FixedPartitionAttributes.createFixedPartition("10", false, 5);
      FixedPartitionAttributes fpa4 = FixedPartitionAttributes
          .createFixedPartition("20", false, 5);
      fpaList = new ArrayList<FixedPartitionAttributes>();
      fpaList.add(fpa1);
      fpaList.add(fpa2);
      fpaList.add(fpa3);
      fpaList.add(fpa4);
      member3.invoke(FixedPartitioningTestBase.class,
          "createRegionWithPartitionAttributes", new Object[] { "Customer",
              fpaList, 2, 50, 20, new CustomerFixedPartitionResolver(), null,
              false });

      member1.invoke(FixedPartitioningTestBase.class,
          "createRegionWithPartitionAttributes", new Object[] { "Order", null,
              2, 50, 20, new CustomerFixedPartitionResolver(), "Customer",
              false });
      member2.invoke(FixedPartitioningTestBase.class,
          "createRegionWithPartitionAttributes", new Object[] { "Order", null,
              2, 50, 20, new CustomerFixedPartitionResolver(), "Customer",
              false });
      member3.invoke(FixedPartitioningTestBase.class,
          "createRegionWithPartitionAttributes", new Object[] { "Order", null,
              2, 50, 20, new CustomerFixedPartitionResolver(), "Customer",
              false });

      member1.invoke(FixedPartitioningTestBase.class,
          "createRegionWithPartitionAttributes", new Object[] { "Shipment",
              null, 2, 50, 20, new CustomerFixedPartitionResolver(), "Order",
              false });
      member2.invoke(FixedPartitioningTestBase.class,
          "createRegionWithPartitionAttributes", new Object[] { "Shipment",
              null, 2, 50, 20, new CustomerFixedPartitionResolver(), "Order",
              false });
      member3.invoke(FixedPartitioningTestBase.class,
          "createRegionWithPartitionAttributes", new Object[] { "Shipment",
              null, 2, 50, 20, new CustomerFixedPartitionResolver(), "Order",
              false });

      member1.invoke(FixedPartitioningTestBase.class, "checkFPR",
          new Object[] { "Order" });
      member1.invoke(FixedPartitioningTestBase.class, "checkFPR",
          new Object[] { "Shipment" });
      member2.invoke(FixedPartitioningTestBase.class, "checkFPR",
          new Object[] { "Order" });
      member2.invoke(FixedPartitioningTestBase.class, "checkFPR",
          new Object[] { "Shipment" });
      member3.invoke(FixedPartitioningTestBase.class, "checkFPR",
          new Object[] { "Order" });
      member3.invoke(FixedPartitioningTestBase.class, "checkFPR",
          new Object[] { "Shipment" });

      member1.invoke(FixedPartitioningTestBase.class,
          "putCustomerPartitionedRegion", new Object[] { "Customer" });
      member1.invoke(FixedPartitioningTestBase.class,
          "putOrderPartitionedRegion", new Object[] { "Order" });
      member1.invoke(FixedPartitioningTestBase.class,
          "putShipmentPartitionedRegion", new Object[] { "Shipment" });

      member1.invoke(FixedPartitioningTestBase.class,
          "validateAfterPutPartitionedRegion", new Object[] { "Customer",
              "Order", "Shipment" });

      member1.invoke(FixedPartitioningTestBase.class,
          "checkPrimaryBucketsForColocation", new Object[] { 15, 5, "Customer",
              "Order", "Shipment" });
      member2.invoke(FixedPartitioningTestBase.class,
          "checkPrimaryBucketsForColocation", new Object[] { 15, 5, "Customer",
              "Order", "Shipment" });
      member3.invoke(FixedPartitioningTestBase.class,
          "checkPrimaryBucketsForColocation", new Object[] { 20, 10,
              "Customer", "Order", "Shipment" });

      member3.invoke(FixedPartitioningTestBase.class, "closeCache");
      pause(4000);

      member1.invoke(FixedPartitioningTestBase.class,
          "checkPrimaryBucketsForColocationAfterCacheClosed", new Object[] {
              15, 5, "Customer", "Order", "Shipment" });
      member2.invoke(FixedPartitioningTestBase.class,
          "checkPrimaryBucketsForColocationAfterCacheClosed", new Object[] {
              15, 5, "Customer", "Order", "Shipment" });

      member3.invoke(FixedPartitioningTestBase.class, "createCacheOnMember");
      fpa1 = FixedPartitionAttributes.createFixedPartition("30", true, 5);
      fpa2 = FixedPartitionAttributes.createFixedPartition("10", false, 5);
      fpa3 = FixedPartitionAttributes.createFixedPartition("20", false, 5);
      fpaList = new ArrayList<FixedPartitionAttributes>();
      fpaList.add(fpa1);
      fpaList.add(fpa2);
      fpaList.add(fpa3);
      member3.invoke(FixedPartitioningTestBase.class,
          "createRegionWithPartitionAttributes", new Object[] { "Customer",
              fpaList, 2, 50, 20, new CustomerFixedPartitionResolver(), null,
              false });
      member3.invoke(FixedPartitioningTestBase.class,
          "createRegionWithPartitionAttributes", new Object[] { "Order", null,
              2, 50, 20, new CustomerFixedPartitionResolver(), "Customer",
              false });
      member3.invoke(FixedPartitioningTestBase.class,
          "createRegionWithPartitionAttributes", new Object[] { "Shipment",
              null, 2, 50, 20, new CustomerFixedPartitionResolver(), "Order",
              false });

      pause(4000);

      member1.invoke(FixedPartitioningTestBase.class,
          "validateAfterPutPartitionedRegion", new Object[] { "Customer",
              "Order", "Shipment" });

      member3.invoke(FixedPartitioningTestBase.class,
          "checkPrimaryBucketsForColocation", new Object[] { 15, 5, "Customer",
              "Order", "Shipment" });

      member4.invoke(FixedPartitioningTestBase.class, "createCacheOnMember");
      fpa1 = FixedPartitionAttributes.createFixedPartition("40", true, 5);
      fpa2 = FixedPartitionAttributes.createFixedPartition("10", false, 5);
      fpa3 = FixedPartitionAttributes.createFixedPartition("20", false, 5);
      fpaList = new ArrayList<FixedPartitionAttributes>();
      fpaList.add(fpa1);
      fpaList.add(fpa2);
      fpaList.add(fpa3);
      member4.invoke(FixedPartitioningTestBase.class,
          "createRegionWithPartitionAttributes", new Object[] { "Customer",
              fpaList, 2, 50, 20, new CustomerFixedPartitionResolver(), null,
              false });
      member4.invoke(FixedPartitioningTestBase.class,
          "createRegionWithPartitionAttributes", new Object[] { "Order", null,
              2, 50, 20, new CustomerFixedPartitionResolver(), "Customer",
              false });
      member4.invoke(FixedPartitioningTestBase.class,
          "createRegionWithPartitionAttributes", new Object[] { "Shipment",
              null, 2, 50, 20, new CustomerFixedPartitionResolver(), "Order",
              false });

      pause(4000);

      member1.invoke(FixedPartitioningTestBase.class,
          "validateAfterPutPartitionedRegion", new Object[] { "Customer",
              "Order", "Shipment" });

      member1.invoke(FixedPartitioningTestBase.class,
          "checkPrimaryBucketsForColocation", new Object[] { 15, 5, "Customer",
              "Order", "Shipment" });
      member2.invoke(FixedPartitioningTestBase.class,
          "checkPrimaryBucketsForColocation", new Object[] { 15, 5, "Customer",
              "Order", "Shipment" });
      member3.invoke(FixedPartitioningTestBase.class,
          "checkPrimaryBucketsForColocation", new Object[] { 15, 5, "Customer",
              "Order", "Shipment" });
      member4.invoke(FixedPartitioningTestBase.class,
          "checkPrimaryBucketsForColocation", new Object[] { 15, 5, "Customer",
              "Order", "Shipment" });

    }
    catch (Exception e) {
      fail("Unexpected Exception ", e);
    }
  }

  public void testColocation_FPR_Persistence_ChildUsingAttributesOfParent_HA() {
    try {
      member1.invoke(FixedPartitioningTestBase.class, "createCacheOnMember");
      member2.invoke(FixedPartitioningTestBase.class, "createCacheOnMember");
      member3.invoke(FixedPartitioningTestBase.class, "createCacheOnMember");

      FixedPartitionAttributes fpa1 = FixedPartitionAttributes
          .createFixedPartition("10", true, 5);
      FixedPartitionAttributes fpa2 = FixedPartitionAttributes
          .createFixedPartition("30", false, 5);
      FixedPartitionAttributes fpa3 = FixedPartitionAttributes
          .createFixedPartition("40", false, 5);
      List<FixedPartitionAttributes> fpaList = new ArrayList<FixedPartitionAttributes>();
      fpaList.add(fpa1);
      fpaList.add(fpa2);
      fpaList.add(fpa3);
      member1.invoke(FixedPartitioningTestBase.class,
          "createRegionWithPartitionAttributes", new Object[] { "Customer",
              fpaList, 2, 50, 20, new CustomerFixedPartitionResolver(), null,
              true });

      fpa1 = FixedPartitionAttributes.createFixedPartition("20", true, 5);
      fpa2 = FixedPartitionAttributes.createFixedPartition("30", false, 5);
      fpa3 = FixedPartitionAttributes.createFixedPartition("40", false, 5);
      fpaList = new ArrayList<FixedPartitionAttributes>();
      fpaList.add(fpa1);
      fpaList.add(fpa2);
      fpaList.add(fpa3);
      member2.invoke(FixedPartitioningTestBase.class,
          "createRegionWithPartitionAttributes", new Object[] { "Customer",
              fpaList, 2, 50, 20, new CustomerFixedPartitionResolver(), null,
              true });

      fpa1 = FixedPartitionAttributes.createFixedPartition("30", true, 5);
      fpa2 = FixedPartitionAttributes.createFixedPartition("40", true, 5);
      fpa3 = FixedPartitionAttributes.createFixedPartition("10", false, 5);
      FixedPartitionAttributes fpa4 = FixedPartitionAttributes
          .createFixedPartition("20", false, 5);
      fpaList = new ArrayList<FixedPartitionAttributes>();
      fpaList.add(fpa1);
      fpaList.add(fpa2);
      fpaList.add(fpa3);
      fpaList.add(fpa4);
      member3.invoke(FixedPartitioningTestBase.class,
          "createRegionWithPartitionAttributes", new Object[] { "Customer",
              fpaList, 2, 50, 20, new CustomerFixedPartitionResolver(), null,
              true });

      member1.invoke(FixedPartitioningTestBase.class,
          "createRegionWithPartitionAttributes", new Object[] { "Order", null,
              2, 50, 20, new CustomerFixedPartitionResolver(), "Customer",
              false });
      member2.invoke(FixedPartitioningTestBase.class,
          "createRegionWithPartitionAttributes", new Object[] { "Order", null,
              2, 50, 20, new CustomerFixedPartitionResolver(), "Customer",
              false });
      member3.invoke(FixedPartitioningTestBase.class,
          "createRegionWithPartitionAttributes", new Object[] { "Order", null,
              2, 50, 20, new CustomerFixedPartitionResolver(), "Customer",
              false });

      member1.invoke(FixedPartitioningTestBase.class,
          "createRegionWithPartitionAttributes", new Object[] { "Shipment",
              null, 2, 50, 20, new CustomerFixedPartitionResolver(), "Order",
              false });
      member2.invoke(FixedPartitioningTestBase.class,
          "createRegionWithPartitionAttributes", new Object[] { "Shipment",
              null, 2, 50, 20, new CustomerFixedPartitionResolver(), "Order",
              false });
      member3.invoke(FixedPartitioningTestBase.class,
          "createRegionWithPartitionAttributes", new Object[] { "Shipment",
              null, 2, 50, 20, new CustomerFixedPartitionResolver(), "Order",
              false });

      member1.invoke(FixedPartitioningTestBase.class, "checkFPR",
          new Object[] { "Order" });
      member1.invoke(FixedPartitioningTestBase.class, "checkFPR",
          new Object[] { "Shipment" });
      member2.invoke(FixedPartitioningTestBase.class, "checkFPR",
          new Object[] { "Order" });
      member2.invoke(FixedPartitioningTestBase.class, "checkFPR",
          new Object[] { "Shipment" });
      member3.invoke(FixedPartitioningTestBase.class, "checkFPR",
          new Object[] { "Order" });
      member3.invoke(FixedPartitioningTestBase.class, "checkFPR",
          new Object[] { "Shipment" });

      member1.invoke(FixedPartitioningTestBase.class,
          "putCustomerPartitionedRegion", new Object[] { "Customer" });
      member1.invoke(FixedPartitioningTestBase.class,
          "putOrderPartitionedRegion", new Object[] { "Order" });
      member1.invoke(FixedPartitioningTestBase.class,
          "putShipmentPartitionedRegion", new Object[] { "Shipment" });

      member1.invoke(FixedPartitioningTestBase.class,
          "validateAfterPutPartitionedRegion", new Object[] { "Customer",
              "Order", "Shipment" });

      member1.invoke(FixedPartitioningTestBase.class,
          "checkPrimaryBucketsForColocation", new Object[] { 15, 5, "Customer",
              "Order", "Shipment" });
      member2.invoke(FixedPartitioningTestBase.class,
          "checkPrimaryBucketsForColocation", new Object[] { 15, 5, "Customer",
              "Order", "Shipment" });
      member3.invoke(FixedPartitioningTestBase.class,
          "checkPrimaryBucketsForColocation", new Object[] { 20, 10,
              "Customer", "Order", "Shipment" });

      member3.invoke(FixedPartitioningTestBase.class, "closeCache");
      pause(4000);

      member1.invoke(FixedPartitioningTestBase.class,
          "checkPrimaryBucketsForColocationAfterCacheClosed", new Object[] {
              15, 5, "Customer", "Order", "Shipment" });
      member2.invoke(FixedPartitioningTestBase.class,
          "checkPrimaryBucketsForColocationAfterCacheClosed", new Object[] {
              15, 5, "Customer", "Order", "Shipment" });

      member3.invoke(FixedPartitioningTestBase.class, "createCacheOnMember");
      fpa1 = FixedPartitionAttributes.createFixedPartition("30", true, 5);
      fpa2 = FixedPartitionAttributes.createFixedPartition("10", false, 5);
      fpa3 = FixedPartitionAttributes.createFixedPartition("20", false, 5);
      fpaList = new ArrayList<FixedPartitionAttributes>();
      fpaList.add(fpa1);
      fpaList.add(fpa2);
      fpaList.add(fpa3);
      member3.invoke(FixedPartitioningTestBase.class,
          "createRegionWithPartitionAttributes", new Object[] { "Customer",
              fpaList, 2, 50, 20, new CustomerFixedPartitionResolver(), null,
              false });
      member3.invoke(FixedPartitioningTestBase.class,
          "createRegionWithPartitionAttributes", new Object[] { "Order", null,
              2, 50, 20, new CustomerFixedPartitionResolver(), "Customer",
              false });
      member3.invoke(FixedPartitioningTestBase.class,
          "createRegionWithPartitionAttributes", new Object[] { "Shipment",
              null, 2, 50, 20, new CustomerFixedPartitionResolver(), "Order",
              false });

      pause(4000);

      member1.invoke(FixedPartitioningTestBase.class,
          "validateAfterPutPartitionedRegion", new Object[] { "Customer",
              "Order", "Shipment" });

      member3.invoke(FixedPartitioningTestBase.class,
          "checkPrimaryBucketsForColocation", new Object[] { 15, 5, "Customer",
              "Order", "Shipment" });

      member4.invoke(FixedPartitioningTestBase.class, "createCacheOnMember");
      fpa1 = FixedPartitionAttributes.createFixedPartition("40", true, 5);
      fpa2 = FixedPartitionAttributes.createFixedPartition("10", false, 5);
      fpa3 = FixedPartitionAttributes.createFixedPartition("20", false, 5);
      fpaList = new ArrayList<FixedPartitionAttributes>();
      fpaList.add(fpa1);
      fpaList.add(fpa2);
      fpaList.add(fpa3);
      member4.invoke(FixedPartitioningTestBase.class,
          "createRegionWithPartitionAttributes", new Object[] { "Customer",
              fpaList, 2, 50, 20, new CustomerFixedPartitionResolver(), null,
              false });
      member4.invoke(FixedPartitioningTestBase.class,
          "createRegionWithPartitionAttributes", new Object[] { "Order", null,
              2, 50, 20, new CustomerFixedPartitionResolver(), "Customer",
              false });
      member4.invoke(FixedPartitioningTestBase.class,
          "createRegionWithPartitionAttributes", new Object[] { "Shipment",
              null, 2, 50, 20, new CustomerFixedPartitionResolver(), "Order",
              false });

      pause(4000);

      member1.invoke(FixedPartitioningTestBase.class,
          "validateAfterPutPartitionedRegion", new Object[] { "Customer",
              "Order", "Shipment" });

      member1.invoke(FixedPartitioningTestBase.class,
          "checkPrimaryBucketsForColocation", new Object[] { 15, 5, "Customer",
              "Order", "Shipment" });
      member2.invoke(FixedPartitioningTestBase.class,
          "checkPrimaryBucketsForColocation", new Object[] { 15, 5, "Customer",
              "Order", "Shipment" });
      member3.invoke(FixedPartitioningTestBase.class,
          "checkPrimaryBucketsForColocation", new Object[] { 15, 5, "Customer",
              "Order", "Shipment" });
      member4.invoke(FixedPartitioningTestBase.class,
          "checkPrimaryBucketsForColocation", new Object[] { 15, 5, "Customer",
              "Order", "Shipment" });

    }
    catch (Exception e) {
      fail("Unexpected Exception ", e);
    }
  }

  /**
   * Create bucket on an empty FPR and see if and check if it gets created or
   * exceptions are thrown. IllegalArguementException is expected for bucketId
   * which is out of range or doesn't belong to the FPR node.
   *
   */
  public void testPartitionManagerWithFPR_NoBucketsCreatedYet() {
    member1.invoke(FixedPartitioningTestBase.class, "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.class,
        "createRegionWithPartitionAttributes", new Object[] { "Quarter",
            fpaList, 1, 40, 6, new QuarterPartitionResolver(), null, false });

    member2.invoke(FixedPartitioningTestBase.class, "createCacheOnMember");
    fpa1 = FixedPartitionAttributes.createFixedPartition(Quarter2, true, 3);
    fpa2 = FixedPartitionAttributes.createFixedPartition(Quarter1, false, 3);
    fpaList = new ArrayList<FixedPartitionAttributes>();
    fpaList.add(fpa1);
    fpaList.add(fpa2);
    member2.invoke(FixedPartitioningTestBase.class,
        "createRegionWithPartitionAttributes", new Object[] { "Quarter",
            fpaList, 1, 40, 6, new QuarterPartitionResolver(), null, false });

    // create primary buckets belonging to this partition
    member1.invoke(FixedPartitioningTestBase.class,
        "createPrimaryBucketsBelongingToThisPartition", new Object[] {
            "Quarter", Boolean.FALSE, Boolean.FALSE });

    // create primary buckets not belonging to this partition
    member1.invoke(FixedPartitioningTestBase.class,
        "createPrimaryBucketsBelongingToOtherPartition", new Object[] {
            "Quarter", Boolean.FALSE, Boolean.FALSE });

    // try creating out of range primary buckets
    final int outOfRangeBucketId = 13;
    member1.invoke(FixedPartitioningTestBase.class,
        "createOutOfRangePrimaryBucketUsingPartitionManager", new Object[] {
            "Quarter", outOfRangeBucketId, Boolean.FALSE, Boolean.FALSE });
  }

  /**
   * Create bucket on FPR for which buckets are created and see if it gets
   * created
   */

  public void testPartitionManagerWithFPR_BucketsAlreadyCreated() {
    member1.invoke(FixedPartitioningTestBase.class, "createCacheOnMember");
    FixedPartitionAttributes fpa1 = FixedPartitionAttributes
        .createFixedPartition(Quarter1, true, 3);
    List<FixedPartitionAttributes> fpaList = new ArrayList<FixedPartitionAttributes>();

    fpaList.add(fpa1);
    member1.invoke(FixedPartitioningTestBase.class,
        "createRegionWithPartitionAttributes", new Object[] { "Quarter",
            fpaList, 1, 40, 12, new QuarterPartitionResolver(), null, false });

    member2.invoke(FixedPartitioningTestBase.class, "createCacheOnMember");
    fpa1 = FixedPartitionAttributes.createFixedPartition(Quarter2, true, 3);
    fpaList = new ArrayList<FixedPartitionAttributes>();
    fpaList.add(fpa1);
    member2.invoke(FixedPartitioningTestBase.class,
        "createRegionWithPartitionAttributes", new Object[] { "Quarter",
            fpaList, 1, 40, 12, new QuarterPartitionResolver(), null, false });

    member3.invoke(FixedPartitioningTestBase.class, "createCacheOnMember");
    fpa1 = FixedPartitionAttributes.createFixedPartition(Quarter3, true, 3);
    fpaList = new ArrayList<FixedPartitionAttributes>();
    fpaList.add(fpa1);
    member3.invoke(FixedPartitioningTestBase.class,
        "createRegionWithPartitionAttributes", new Object[] { "Quarter",
            fpaList, 1, 40, 12, new QuarterPartitionResolver(), null, false });

    member4.invoke(FixedPartitioningTestBase.class, "createCacheOnMember");
    fpa1 = FixedPartitionAttributes.createFixedPartition(Quarter4, true, 3);
    fpaList = new ArrayList<FixedPartitionAttributes>();
    fpaList.add(fpa1);
    member4.invoke(FixedPartitioningTestBase.class,
        "createRegionWithPartitionAttributes", new Object[] { "Quarter",
            fpaList, 1, 40, 12, new QuarterPartitionResolver(), null, false });

    member1.invoke(FixedPartitioningTestBase.class, "putThroughDataStore",
        new Object[] { "Quarter" });

    // create primary buckets belonging to this partition
    member1.invoke(FixedPartitioningTestBase.class,
        "createPrimaryBucketsBelongingToThisPartition", new Object[] {
            "Quarter", Boolean.FALSE, Boolean.TRUE });

    member1.invoke(FixedPartitioningTestBase.class,
        "checkPrimaryBucketsForQuarter", new Object[] { 3, 3 });
    member2.invoke(FixedPartitioningTestBase.class,
        "checkPrimaryBucketsForQuarter", new Object[] { 3, 3 });
    member3.invoke(FixedPartitioningTestBase.class,
        "checkPrimaryBucketsForQuarter", new Object[] { 3, 3 });
    member4.invoke(FixedPartitioningTestBase.class,
        "checkPrimaryBucketsForQuarter", new Object[] { 3, 3 });

  }

  /**
   * Tests validate the behavior of FPR with persistence when one member is kept
   * alive and other members goes down and come up
   */
  public void testFPR_Persistence_OneMemberAlive() {
    member1.invoke(FixedPartitioningTestBase.class, "createCacheOnMember");
    FixedPartitionAttributes fpa1 = FixedPartitionAttributes
        .createFixedPartition(Quarter1, true, 3);
    List<FixedPartitionAttributes> fpaList = new ArrayList<FixedPartitionAttributes>();
    fpaList.add(fpa1);
    member1.invoke(FixedPartitioningTestBase.class,
        "createRegionWithPartitionAttributes", new Object[] { "Quarter",
            fpaList, 0, 40, 12, new QuarterPartitionResolver(), null, true });

    member2.invoke(FixedPartitioningTestBase.class, "createCacheOnMember");
    fpa1 = FixedPartitionAttributes.createFixedPartition(Quarter2, true, 3);
    fpaList = new ArrayList<FixedPartitionAttributes>();
    fpaList.add(fpa1);
    member2.invoke(FixedPartitioningTestBase.class,
        "createRegionWithPartitionAttributes", new Object[] { "Quarter",
            fpaList, 0, 40, 12, new QuarterPartitionResolver(), null, true });

    member1.invoke(FixedPartitioningTestBase.class, "putForQuarter",
        new Object[] { "Quarter", "Q1" });
    member1.invoke(FixedPartitioningTestBase.class, "putForQuarter",
        new Object[] { "Quarter", "Q2" });

    member2.invoke(FixedPartitioningTestBase.class, "closeCache");

    pause(1000);

    member2.invoke(FixedPartitioningTestBase.class, "createCacheOnMember");
    fpa1 = FixedPartitionAttributes.createFixedPartition(Quarter2, true, 3);
    fpaList = new ArrayList<FixedPartitionAttributes>();
    fpaList.add(fpa1);
    member2.invoke(FixedPartitioningTestBase.class,
        "createRegionWithPartitionAttributes", new Object[] { "Quarter",
            fpaList, 0, 40, 12, new QuarterPartitionResolver(), null, true });

    member2.invoke(FixedPartitioningTestBase.class, "getForQuarter",
        new Object[] { "Quarter", "Q2" });

    member3.invoke(FixedPartitioningTestBase.class, "createCacheOnMember");
    fpa1 = FixedPartitionAttributes.createFixedPartition(Quarter3, true, 3);
    fpaList = new ArrayList<FixedPartitionAttributes>();
    fpaList.add(fpa1);
    member3.invoke(FixedPartitioningTestBase.class,
        "createRegionWithPartitionAttributes", new Object[] { "Quarter",
            fpaList, 0, 40, 12, new QuarterPartitionResolver(), null, true });

    member4.invoke(FixedPartitioningTestBase.class, "createCacheOnMember");
    fpa1 = FixedPartitionAttributes.createFixedPartition(Quarter4, true, 3);
    fpaList = new ArrayList<FixedPartitionAttributes>();
    fpaList.add(fpa1);
    member4.invoke(FixedPartitioningTestBase.class,
        "createRegionWithPartitionAttributes", new Object[] { "Quarter",
            fpaList, 0, 40, 12, new QuarterPartitionResolver(), null, true });

    member1.invoke(FixedPartitioningTestBase.class, "putThroughDataStore",
        new Object[] { "Quarter" });

    member1.invoke(FixedPartitioningTestBase.class, "checkPrimaryData",
        new Object[] { Quarter1 });
    member2.invoke(FixedPartitioningTestBase.class, "checkPrimaryData",
        new Object[] { Quarter2 });
    member3.invoke(FixedPartitioningTestBase.class, "checkPrimaryData",
        new Object[] { Quarter3 });
    member4.invoke(FixedPartitioningTestBase.class, "checkPrimaryData",
        new Object[] { Quarter4 });

    member1.invoke(FixedPartitioningTestBase.class,
        "checkPrimaryBucketsForQuarter", new Object[] { 3, 3 });
    member2.invoke(FixedPartitioningTestBase.class,
        "checkPrimaryBucketsForQuarter", new Object[] { 3, 3 });
    member3.invoke(FixedPartitioningTestBase.class,
        "checkPrimaryBucketsForQuarter", new Object[] { 3, 3 });
    member4.invoke(FixedPartitioningTestBase.class,
        "checkPrimaryBucketsForQuarter", new Object[] { 3, 3 });

  }

  /**
   * Tests validate the behavior of FPR with persistence when all members goes
   * down and comes up.
   *
   */
  public void testFPR_Persistence() {
    member1.invoke(FixedPartitioningTestBase.class, "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.class,
        "createRegionWithPartitionAttributes", new Object[] { "Quarter",
            fpaList, 1, 40, 12, new QuarterPartitionResolver(), null, true });

    member2.invoke(FixedPartitioningTestBase.class, "createCacheOnMember");
    fpa1 = FixedPartitionAttributes.createFixedPartition(Quarter2, true, 3);
    fpa2 = FixedPartitionAttributes.createFixedPartition(Quarter1, false, 3);
    fpaList = new ArrayList<FixedPartitionAttributes>();
    fpaList.add(fpa1);
    fpaList.add(fpa2);
    member2.invoke(FixedPartitioningTestBase.class,
        "createRegionWithPartitionAttributes", new Object[] { "Quarter",
            fpaList, 1, 40, 12, new QuarterPartitionResolver(), null, true });

    member1.invoke(FixedPartitioningTestBase.class, "putForQuarter",
        new Object[] { "Quarter", "Q1" });
    member1.invoke(FixedPartitioningTestBase.class, "putForQuarter",
        new Object[] { "Quarter", "Q2" });

    member1.invoke(FixedPartitioningTestBase.class,
        "checkPrimaryDataPersistence", new Object[] { Quarter1 });
    member2.invoke(FixedPartitioningTestBase.class,
        "checkPrimaryDataPersistence", new Object[] { Quarter2 });

    member1.invoke(FixedPartitioningTestBase.class,
        "checkPrimaryBucketsForQuarter", new Object[] { 6, 3 });
    member2.invoke(FixedPartitioningTestBase.class,
        "checkPrimaryBucketsForQuarter", new Object[] { 6, 3 });

    member1.invoke(FixedPartitioningTestBase.class, "closeCache");
    member2.invoke(FixedPartitioningTestBase.class, "closeCache");

    member2.invoke(FixedPartitioningTestBase.class, "createCacheOnMember");
    fpa1 = FixedPartitionAttributes.createFixedPartition(Quarter2, true, 3);
    fpa2 = FixedPartitionAttributes.createFixedPartition(Quarter1, false, 3);
    fpaList = new ArrayList<FixedPartitionAttributes>();
    fpaList.add(fpa1);
    fpaList.add(fpa2);
    member2.invoke(FixedPartitioningTestBase.class,
        "createRegionWithPartitionAttributes", new Object[] { "Quarter",
            fpaList, 1, 40, 12, new QuarterPartitionResolver(), null, true });

    pause(4000);
    member2.invoke(FixedPartitioningTestBase.class, "getForQuarter",
        new Object[] { "Quarter", Quarter1 });
    member2.invoke(FixedPartitioningTestBase.class, "getForQuarter",
        new Object[] { "Quarter", Quarter2 });
    member2.invoke(FixedPartitioningTestBase.class,
        "checkPrimaryDataPersistence", new Object[] { Quarter2 });
    pause(2000);
    member2.invoke(FixedPartitioningTestBase.class,
        "checkPrimaryBucketsForQuarter", new Object[] { 6, 6 });

    member1.invoke(FixedPartitioningTestBase.class, "createCacheOnMember");
    fpa1 = FixedPartitionAttributes.createFixedPartition(Quarter1, true, 3);
    fpa2 = FixedPartitionAttributes.createFixedPartition(Quarter2, false, 3);
    fpaList = new ArrayList<FixedPartitionAttributes>();
    fpaList.add(fpa1);
    fpaList.add(fpa2);
    member1.invoke(FixedPartitioningTestBase.class,
        "createRegionWithPartitionAttributes", new Object[] { "Quarter",
            fpaList, 1, 40, 12, new QuarterPartitionResolver(), null, true });

    pause(4000);

    member1.invoke(FixedPartitioningTestBase.class,
        "checkPrimaryDataPersistence", new Object[] { Quarter1 });
    member2.invoke(FixedPartitioningTestBase.class,
        "checkPrimaryDataPersistence", new Object[] { Quarter2 });
    member1.invoke(FixedPartitioningTestBase.class,
        "checkPrimaryBucketsForQuarter", new Object[] { 6, 3 });
    member2.invoke(FixedPartitioningTestBase.class,
        "checkPrimaryBucketsForQuarter", new Object[] { 6, 3 });

    member1.invoke(FixedPartitioningTestBase.class, "getForQuarter",
        new Object[] { "Quarter", Quarter1 });

    member2.invoke(FixedPartitioningTestBase.class, "getForQuarter",
        new Object[] { "Quarter", Quarter2 });
  }

  /**
   * Tests validate the behavior of FPR with persistence and with colocation
   * when one member is kept alive and other members goes down and come up
   */
  public void testColocation_FPR_Persistence_Colocation_OneMemberAlive() {
    try {
      member1.invoke(FixedPartitioningTestBase.class, "createCacheOnMember");
      member2.invoke(FixedPartitioningTestBase.class, "createCacheOnMember");

      FixedPartitionAttributes fpa1 = FixedPartitionAttributes
          .createFixedPartition("10", true, 5);
      FixedPartitionAttributes fpa2 = FixedPartitionAttributes
          .createFixedPartition("20", false, 5);
      List<FixedPartitionAttributes> fpaList = new ArrayList<FixedPartitionAttributes>();
      fpaList.add(fpa1);
      fpaList.add(fpa2);
      member1.invoke(FixedPartitioningTestBase.class,
          "createRegionWithPartitionAttributes", new Object[] { "Customer",
              fpaList, 1, 50, 20, new CustomerFixedPartitionResolver(), null,
              true });

      fpa1 = FixedPartitionAttributes.createFixedPartition("20", true, 5);
      fpa2 = FixedPartitionAttributes.createFixedPartition("10", false, 5);
      fpaList = new ArrayList<FixedPartitionAttributes>();
      fpaList.add(fpa1);
      fpaList.add(fpa2);
      member2.invoke(FixedPartitioningTestBase.class,
          "createRegionWithPartitionAttributes", new Object[] { "Customer",
              fpaList, 1, 50, 20, new CustomerFixedPartitionResolver(), null,
              true });

      member1.invoke(FixedPartitioningTestBase.class,
          "createRegionWithPartitionAttributes", new Object[] { "Order", null,
              1, 50, 20, new CustomerFixedPartitionResolver(), "Customer",
              false });
      member2.invoke(FixedPartitioningTestBase.class,
          "createRegionWithPartitionAttributes", new Object[] { "Order", null,
              1, 50, 20, new CustomerFixedPartitionResolver(), "Customer",
              false });

      member1.invoke(FixedPartitioningTestBase.class,
          "createRegionWithPartitionAttributes", new Object[] { "Shipment",
              null, 1, 50, 20, new CustomerFixedPartitionResolver(), "Order",
              false });
      member2.invoke(FixedPartitioningTestBase.class,
          "createRegionWithPartitionAttributes", new Object[] { "Shipment",
              null, 1, 50, 20, new CustomerFixedPartitionResolver(), "Order",
              false });

      member1.invoke(FixedPartitioningTestBase.class, "checkFPR",
          new Object[] { "Order" });
      member1.invoke(FixedPartitioningTestBase.class, "checkFPR",
          new Object[] { "Shipment" });
      member2.invoke(FixedPartitioningTestBase.class, "checkFPR",
          new Object[] { "Order" });
      member2.invoke(FixedPartitioningTestBase.class, "checkFPR",
          new Object[] { "Shipment" });

      member1.invoke(FixedPartitioningTestBase.class,
          "putCustomerPartitionedRegion_Persistence1",
          new Object[] { "Customer" });
      member1.invoke(FixedPartitioningTestBase.class,
          "putOrderPartitionedRegion_Persistence1", new Object[] { "Order" });
      member1.invoke(FixedPartitioningTestBase.class,
          "putShipmentPartitionedRegion_Persistence1",
          new Object[] { "Shipment" });

      member1.invoke(FixedPartitioningTestBase.class,
          "validateAfterPutPartitionedRegion", new Object[] { "Customer",
              "Order", "Shipment" });

      member1.invoke(FixedPartitioningTestBase.class,
          "checkPrimaryBucketsForColocation", new Object[] { 10, 5, "Customer",
              "Order", "Shipment" });
      member2.invoke(FixedPartitioningTestBase.class,
          "checkPrimaryBucketsForColocation", new Object[] { 10, 5, "Customer",
              "Order", "Shipment" });

      member2.invoke(FixedPartitioningTestBase.class, "closeCache");
      member1.invoke(FixedPartitioningTestBase.class,
          "putCustomerPartitionedRegion_Persistence2",
          new Object[] { "Customer" });
      member1.invoke(FixedPartitioningTestBase.class,
          "putOrderPartitionedRegion_Persistence2", new Object[] { "Order" });
      member1.invoke(FixedPartitioningTestBase.class,
          "putShipmentPartitionedRegion_Persistence2",
          new Object[] { "Shipment" });

      member1.invoke(FixedPartitioningTestBase.class,
          "validateAfterPutPartitionedRegion", new Object[] { "Customer",
              "Order", "Shipment" });

      member1.invoke(FixedPartitioningTestBase.class,
          "checkPrimaryBucketsForColocation", new Object[] { 10, 10,
              "Customer", "Order", "Shipment" });

      member2.invoke(FixedPartitioningTestBase.class, "createCacheOnMember");
      fpa1 = FixedPartitionAttributes.createFixedPartition("20", true, 5);
      fpa2 = FixedPartitionAttributes.createFixedPartition("10", false, 5);
      fpaList = new ArrayList<FixedPartitionAttributes>();
      fpaList.add(fpa1);
      fpaList.add(fpa2);
      AsyncInvocation[] async = new AsyncInvocation[2];
      member2.invoke(FixedPartitioningTestBase.class,
          "createRegionWithPartitionAttributes", new Object[] { "Customer",
              fpaList, 1, 50, 20, new CustomerFixedPartitionResolver(), null,
              true });
      member2.invoke(FixedPartitioningTestBase.class,
          "createRegionWithPartitionAttributes", new Object[] { "Order", null,
              1, 50, 20, new CustomerFixedPartitionResolver(), "Customer",
              false });
      member2.invoke(FixedPartitioningTestBase.class,
          "createRegionWithPartitionAttributes", new Object[] { "Shipment",
              null, 1, 50, 20, new CustomerFixedPartitionResolver(), "Order",
              false });

      pause(4000);
      member1.invoke(FixedPartitioningTestBase.class,
          "checkPrimaryBucketsForColocation", new Object[] { 10, 5, "Customer",
              "Order", "Shipment" });
      member2.invoke(FixedPartitioningTestBase.class,
          "checkPrimaryBucketsForColocation", new Object[] { 10, 5, "Customer",
              "Order", "Shipment" });
      member1.invoke(FixedPartitioningTestBase.class,
          "validateAfterPutPartitionedRegion", new Object[] { "Customer",
              "Order", "Shipment" });
      member2.invoke(FixedPartitioningTestBase.class,
          "validateAfterPutPartitionedRegion", new Object[] { "Customer",
              "Order", "Shipment" });

    }
    catch (Exception e) {
      fail("Unexpected Exception ", e);
    }
  }

  /**
   * Tests validate the behavior of FPR with persistence and with colocation
   * when all members goes down and comes up.
   *
   */

  public void testColocation_FPR_Persistence_Colocation() {
    try {
      member1.invoke(FixedPartitioningTestBase.class, "createCacheOnMember");
      member2.invoke(FixedPartitioningTestBase.class, "createCacheOnMember");

      FixedPartitionAttributes fpa1 = FixedPartitionAttributes
          .createFixedPartition("10", true, 5);
      FixedPartitionAttributes fpa2 = FixedPartitionAttributes
          .createFixedPartition("20", false, 5);
      List<FixedPartitionAttributes> fpaList = new ArrayList<FixedPartitionAttributes>();
      fpaList.add(fpa1);
      fpaList.add(fpa2);
      member1.invoke(FixedPartitioningTestBase.class,
          "createRegionWithPartitionAttributes", new Object[] { "Customer",
              fpaList, 1, 50, 20, new CustomerFixedPartitionResolver(), null,
              true });

      fpa1 = FixedPartitionAttributes.createFixedPartition("20", true, 5);
      fpa2 = FixedPartitionAttributes.createFixedPartition("10", false, 5);
      fpaList = new ArrayList<FixedPartitionAttributes>();
      fpaList.add(fpa1);
      fpaList.add(fpa2);
      member2.invoke(FixedPartitioningTestBase.class,
          "createRegionWithPartitionAttributes", new Object[] { "Customer",
              fpaList, 1, 50, 20, new CustomerFixedPartitionResolver(), null,
              true });

      member1.invoke(FixedPartitioningTestBase.class,
          "createRegionWithPartitionAttributes", new Object[] { "Order", null,
              1, 50, 20, new CustomerFixedPartitionResolver(), "Customer",
              false });
      member2.invoke(FixedPartitioningTestBase.class,
          "createRegionWithPartitionAttributes", new Object[] { "Order", null,
              1, 50, 20, new CustomerFixedPartitionResolver(), "Customer",
              false });

      member1.invoke(FixedPartitioningTestBase.class,
          "createRegionWithPartitionAttributes", new Object[] { "Shipment",
              null, 1, 50, 20, new CustomerFixedPartitionResolver(), "Order",
              false });
      member2.invoke(FixedPartitioningTestBase.class,
          "createRegionWithPartitionAttributes", new Object[] { "Shipment",
              null, 1, 50, 20, new CustomerFixedPartitionResolver(), "Order",
              false });

      member1.invoke(FixedPartitioningTestBase.class, "checkFPR",
          new Object[] { "Order" });
      member1.invoke(FixedPartitioningTestBase.class, "checkFPR",
          new Object[] { "Shipment" });
      member2.invoke(FixedPartitioningTestBase.class, "checkFPR",
          new Object[] { "Order" });
      member2.invoke(FixedPartitioningTestBase.class, "checkFPR",
          new Object[] { "Shipment" });

      member1.invoke(FixedPartitioningTestBase.class,
          "putCustomerPartitionedRegion_Persistence",
          new Object[] { "Customer" });
      member1.invoke(FixedPartitioningTestBase.class,
          "putOrderPartitionedRegion_Persistence", new Object[] { "Order" });
      member1.invoke(FixedPartitioningTestBase.class,
          "putShipmentPartitionedRegion_Persistence",
          new Object[] { "Shipment" });

      member1.invoke(FixedPartitioningTestBase.class,
          "validateAfterPutPartitionedRegion", new Object[] { "Customer",
              "Order", "Shipment" });

      member1.invoke(FixedPartitioningTestBase.class,
          "checkPrimaryBucketsForColocation", new Object[] { 10, 5, "Customer",
              "Order", "Shipment" });
      member2.invoke(FixedPartitioningTestBase.class,
          "checkPrimaryBucketsForColocation", new Object[] { 10, 5, "Customer",
              "Order", "Shipment" });

      member1.invoke(FixedPartitioningTestBase.class, "closeCache");
      member2.invoke(FixedPartitioningTestBase.class, "closeCache");

      member2.invoke(FixedPartitioningTestBase.class, "createCacheOnMember");
      fpa1 = FixedPartitionAttributes.createFixedPartition("20", true, 5);
      fpa2 = FixedPartitionAttributes.createFixedPartition("10", false, 5);
      fpaList = new ArrayList<FixedPartitionAttributes>();
      fpaList.add(fpa1);
      fpaList.add(fpa2);
      member2.invoke(FixedPartitioningTestBase.class,
          "createRegionWithPartitionAttributes", new Object[] { "Customer",
              fpaList, 1, 50, 20, new CustomerFixedPartitionResolver(), null,
              true });

      pause(4000);
      member2.invoke(FixedPartitioningTestBase.class, "getForColocation",
          new Object[] { "Customer", "Order", "Shipment" });

    }
    catch (Exception e) {
      fail("Unexpected Exception ", e);
    }
  }

  public void testFPR_Persistence2() {
    member1.invoke(FixedPartitioningTestBase.class, "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.class,
        "createRegionWithPartitionAttributes", new Object[] { "Quarter",
            fpaList, 0, 40, 12, new QuarterPartitionResolver(), null, true });

    member2.invoke(FixedPartitioningTestBase.class, "createCacheOnMember");
    fpa1 = FixedPartitionAttributes.createFixedPartition(Quarter3, true, 3);
    fpa2 = FixedPartitionAttributes.createFixedPartition(Quarter4, true, 3);
    fpaList = new ArrayList<FixedPartitionAttributes>();
    fpaList.add(fpa1);
    fpaList.add(fpa2);
    member2.invoke(FixedPartitioningTestBase.class,
        "createRegionWithPartitionAttributes", new Object[] { "Quarter",
            fpaList, 0, 40, 12, new QuarterPartitionResolver(), null, true });

    member1.invoke(FixedPartitioningTestBase.class, "putThroughDataStore",
        new Object[] { "Quarter" });

    member1.invoke(FixedPartitioningTestBase.class,
        "checkPrimarySecondaryData", new Object[] { Quarter1, false });
    member2.invoke(FixedPartitioningTestBase.class,
        "checkPrimarySecondaryData", new Object[] { Quarter3, false });

    member1.invoke(FixedPartitioningTestBase.class,
        "checkPrimaryBucketsForQuarter", new Object[] { 6, 6 });
    member2.invoke(FixedPartitioningTestBase.class,
        "checkPrimaryBucketsForQuarter", new Object[] { 6, 6 });

    member1.invoke(FixedPartitioningTestBase.class, "closeCache");
    member2.invoke(FixedPartitioningTestBase.class, "closeCache");

    member2.invoke(FixedPartitioningTestBase.class, "createCacheOnMember");
    fpa1 = FixedPartitionAttributes.createFixedPartition(Quarter3, true, 3);
    fpa2 = FixedPartitionAttributes.createFixedPartition(Quarter4, true, 3);
    fpaList = new ArrayList<FixedPartitionAttributes>();
    fpaList.add(fpa1);
    fpaList.add(fpa2);
    member2.invokeAsync(FixedPartitioningTestBase.class,
        "createRegionWithPartitionAttributes", new Object[] { "Quarter",
            fpaList, 0, 40, 12, new QuarterPartitionResolver(), null, true });

    member1.invoke(FixedPartitioningTestBase.class, "createCacheOnMember");
    fpa1 = FixedPartitionAttributes.createFixedPartition(Quarter1, true, 3);
    fpa2 = FixedPartitionAttributes.createFixedPartition(Quarter2, true, 3);
    fpaList = new ArrayList<FixedPartitionAttributes>();
    fpaList.add(fpa1);
    fpaList.add(fpa2);
    member1.invokeAsync(FixedPartitioningTestBase.class,
        "createRegionWithPartitionAttributes", new Object[] { "Quarter",
            fpaList, 0, 40, 12, new QuarterPartitionResolver(), null, true });

    pause(4000);
    member2.invoke(FixedPartitioningTestBase.class,
        "checkPrimarySecondaryData", new Object[] { Quarter3, false });

    member2.invoke(FixedPartitioningTestBase.class,
        "checkPrimaryBucketsForQuarter", new Object[] { 6, 6 });

    member1.invoke(FixedPartitioningTestBase.class,
        "checkPrimarySecondaryData", new Object[] { Quarter1, false });
    member2.invoke(FixedPartitioningTestBase.class,
        "checkPrimarySecondaryData", new Object[] { Quarter3, false });

    member1.invoke(FixedPartitioningTestBase.class,
        "checkPrimaryBucketsForQuarter", new Object[] { 6, 6 });
    member2.invoke(FixedPartitioningTestBase.class,
        "checkPrimaryBucketsForQuarter", new Object[] { 6, 6 });
  }

  public void testFPR_Persistence3() {
    member1.invoke(FixedPartitioningTestBase.class, "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.class,
        "createRegionWithPartitionAttributes", new Object[] { "Quarter",
            fpaList, 1, 40, 12, new QuarterPartitionResolver(), null, true });

    member2.invoke(FixedPartitioningTestBase.class, "createCacheOnMember");
    fpa1 = FixedPartitionAttributes.createFixedPartition(Quarter2, true, 3);
    fpa2 = FixedPartitionAttributes.createFixedPartition(Quarter3, false, 3);
    fpaList = new ArrayList<FixedPartitionAttributes>();
    fpaList.add(fpa1);
    fpaList.add(fpa2);
    member2.invoke(FixedPartitioningTestBase.class,
        "createRegionWithPartitionAttributes", new Object[] { "Quarter",
            fpaList, 1, 40, 12, new QuarterPartitionResolver(), null, true });

    member3.invoke(FixedPartitioningTestBase.class, "createCacheOnMember");
    fpa1 = FixedPartitionAttributes.createFixedPartition(Quarter3, true, 3);
    fpa2 = FixedPartitionAttributes.createFixedPartition(Quarter4, false, 3);
    fpaList = new ArrayList<FixedPartitionAttributes>();
    fpaList.add(fpa1);
    fpaList.add(fpa2);
    member3.invoke(FixedPartitioningTestBase.class,
        "createRegionWithPartitionAttributes", new Object[] { "Quarter",
            fpaList, 1, 40, 12, new QuarterPartitionResolver(), null, true });

    member4.invoke(FixedPartitioningTestBase.class, "createCacheOnMember");
    fpa1 = FixedPartitionAttributes.createFixedPartition(Quarter4, true, 3);
    fpa2 = FixedPartitionAttributes.createFixedPartition(Quarter1, false, 3);
    fpaList = new ArrayList<FixedPartitionAttributes>();
    fpaList.add(fpa1);
    fpaList.add(fpa2);
    member4.invoke(FixedPartitioningTestBase.class,
        "createRegionWithPartitionAttributes", new Object[] { "Quarter",
            fpaList, 1, 40, 12, new QuarterPartitionResolver(), null, true });

    member1.invoke(FixedPartitioningTestBase.class, "putThroughDataStore",
        new Object[] { "Quarter" });

    member1.invoke(FixedPartitioningTestBase.class,
        "checkPrimarySecondaryData", new Object[] { Quarter1, false });
    member2.invoke(FixedPartitioningTestBase.class,
        "checkPrimarySecondaryData", new Object[] { Quarter2, false });
    member3.invoke(FixedPartitioningTestBase.class,
        "checkPrimarySecondaryData", new Object[] { Quarter3, false });
    member4.invoke(FixedPartitioningTestBase.class,
        "checkPrimarySecondaryData", new Object[] { Quarter4, false });

    member1.invoke(FixedPartitioningTestBase.class,
        "checkPrimaryBucketsForQuarter", new Object[] { 6, 3 });
    member2.invoke(FixedPartitioningTestBase.class,
        "checkPrimaryBucketsForQuarter", new Object[] { 6, 3 });
    member3.invoke(FixedPartitioningTestBase.class,
        "checkPrimaryBucketsForQuarter", new Object[] { 6, 3 });
    member4.invoke(FixedPartitioningTestBase.class,
        "checkPrimaryBucketsForQuarter", new Object[] { 6, 3 });

    member1.invoke(FixedPartitioningTestBase.class, "closeCache");
    member2.invoke(FixedPartitioningTestBase.class, "closeCache");
    member3.invoke(FixedPartitioningTestBase.class, "closeCache");
    member4.invoke(FixedPartitioningTestBase.class, "closeCache");

    member4.invoke(FixedPartitioningTestBase.class, "createCacheOnMember");
    fpa1 = FixedPartitionAttributes.createFixedPartition(Quarter4, true, 3);
    fpa2 = FixedPartitionAttributes.createFixedPartition(Quarter1, false, 3);
    fpaList = new ArrayList<FixedPartitionAttributes>();
    fpaList.add(fpa1);
    fpaList.add(fpa2);
    member4.invokeAsync(FixedPartitioningTestBase.class,
        "createRegionWithPartitionAttributes", new Object[] { "Quarter",
            fpaList, 1, 40, 12, new QuarterPartitionResolver(), null, true });

    member3.invoke(FixedPartitioningTestBase.class, "createCacheOnMember");
    fpa1 = FixedPartitionAttributes.createFixedPartition(Quarter3, true, 3);
    fpa2 = FixedPartitionAttributes.createFixedPartition(Quarter4, false, 3);
    fpaList = new ArrayList<FixedPartitionAttributes>();
    fpaList.add(fpa1);
    fpaList.add(fpa2);
    member3.invokeAsync(FixedPartitioningTestBase.class,
        "createRegionWithPartitionAttributes", new Object[] { "Quarter",
            fpaList, 1, 40, 12, new QuarterPartitionResolver(), null, true });

    member2.invoke(FixedPartitioningTestBase.class, "createCacheOnMember");
    fpa1 = FixedPartitionAttributes.createFixedPartition(Quarter2, true, 3);
    fpa2 = FixedPartitionAttributes.createFixedPartition(Quarter3, false, 3);
    fpaList = new ArrayList<FixedPartitionAttributes>();
    fpaList.add(fpa1);
    fpaList.add(fpa2);
    member2.invokeAsync(FixedPartitioningTestBase.class,
        "createRegionWithPartitionAttributes", new Object[] { "Quarter",
            fpaList, 1, 40, 12, new QuarterPartitionResolver(), null, true });

    member1.invoke(FixedPartitioningTestBase.class, "createCacheOnMember");
    fpa1 = FixedPartitionAttributes.createFixedPartition(Quarter1, true, 3);
    fpa2 = FixedPartitionAttributes.createFixedPartition(Quarter2, false, 3);
    fpaList = new ArrayList<FixedPartitionAttributes>();
    fpaList.add(fpa1);
    fpaList.add(fpa2);
    member1.invokeAsync(FixedPartitioningTestBase.class,
        "createRegionWithPartitionAttributes", new Object[] { "Quarter",
            fpaList, 1, 40, 12, new QuarterPartitionResolver(), null, true });

    pause(4000);
    member4.invoke(FixedPartitioningTestBase.class,
        "checkPrimarySecondaryData", new Object[] { Quarter4, false });

    member4.invoke(FixedPartitioningTestBase.class,
        "checkPrimaryBucketsForQuarter", new Object[] { 6, 3 });

    member3.invoke(FixedPartitioningTestBase.class,
        "checkPrimarySecondaryData", new Object[] { Quarter3, false });

    member3.invoke(FixedPartitioningTestBase.class,
        "checkPrimaryBucketsForQuarter", new Object[] { 6, 3 });

    member2.invoke(FixedPartitioningTestBase.class,
        "checkPrimarySecondaryData", new Object[] { Quarter2, false });

    member2.invoke(FixedPartitioningTestBase.class,
        "checkPrimaryBucketsForQuarter", new Object[] { 6, 3 });

    member1.invoke(FixedPartitioningTestBase.class,
        "checkPrimarySecondaryData", new Object[] { Quarter1, false });

    member1.invoke(FixedPartitioningTestBase.class,
        "checkPrimaryBucketsForQuarter", new Object[] { 6, 3 });

  }

  /**
   * Test validate a normal PR's persistence behavior. normal PR region is
   * created on member1 and member2. Put is done on this PR Member1 and Meber2's
   * cache is closed respectively. Member2 is brought back and persisted data is
   * verified.
   */
  public void testPR_Persistence() {
    member1.invoke(FixedPartitioningTestBase.class, "createCacheOnMember");
    member1.invoke(FixedPartitioningTestBase.class,
        "createRegionWithPartitionAttributes", new Object[] { "Quarter", null,
            1, 40, 12, new QuarterPartitionResolver(), null, true });

    member2.invoke(FixedPartitioningTestBase.class, "createCacheOnMember");
    member2.invoke(FixedPartitioningTestBase.class,
        "createRegionWithPartitionAttributes", new Object[] { "Quarter", null,
            1, 40, 12, new QuarterPartitionResolver(), null, true });

    member1.invoke(FixedPartitioningTestBase.class, "putThroughDataStore",
        new Object[] { "Quarter" });

    member1.invoke(FixedPartitioningTestBase.class, "closeCache");
    member2.invoke(FixedPartitioningTestBase.class, "closeCache");

    pause(1000);

    member2.invoke(FixedPartitioningTestBase.class, "createCacheOnMember");
    member2.invoke(FixedPartitioningTestBase.class,
        "createRegionWithPartitionAttributes", new Object[] { "Quarter", null,
            1, 40, 12, new QuarterPartitionResolver(), null, true });

    member2.invoke(FixedPartitioningTestBase.class, "getThroughDataStore",
        new Object[] { "Quarter" });
  }

}


text:
package com.google.copybara.action;

import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.copybara.config.SkylarkUtil.convertFromNoneable;
import static com.google.copybara.exception.ValidationException.checkCondition;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.copybara.SkylarkContext;
import com.google.copybara.config.SkylarkUtil;
import com.google.copybara.effect.DestinationEffect;
import com.google.copybara.effect.DestinationEffect.DestinationRef;
import com.google.copybara.exception.ValidationException;
import com.google.copybara.revision.OriginRef;
import com.google.copybara.transform.SkylarkConsole;
import com.google.copybara.util.console.Console;
import java.util.ArrayList;
import java.util.List;
import net.starlark.java.annot.Param;
import net.starlark.java.annot.ParamType;
import net.starlark.java.annot.StarlarkMethod;
import net.starlark.java.eval.Dict;
import net.starlark.java.eval.EvalException;
import net.starlark.java.eval.NoneType;
import net.starlark.java.eval.Sequence;
import net.starlark.java.eval.StarlarkValue;

/**
 * A StarlarkContext for running Actions.
 */
public abstract class ActionContext<T extends SkylarkContext<T>> implements SkylarkContext<T>,
    StarlarkValue {

  protected final List<DestinationEffect> newDestinationEffects = new ArrayList<>();
  protected final Action action;
  protected final SkylarkConsole console;
  protected final ImmutableMap<String, String> labels;
  private final Dict<?, ?> params;
  private ActionResult actionResult;

  public ActionContext(Action action, SkylarkConsole console, ImmutableMap<String, String> labels,
      Dict<?, ?> params) {
    this.action = checkNotNull(action);
    this.console = checkNotNull(console);
    this.labels = checkNotNull(labels);
    this.params = checkNotNull(params);
  }

  @StarlarkMethod(
      name = "action_name",
      doc = "The name of the current action.",
      structField = true)
  public String getActionName() {
    return action.getName();
  }

  @StarlarkMethod(name = "console", doc = "Get an instance of the console to report errors or"
      + " warnings", structField = true)
  public Console getConsole() {
    return console;
  }

  @StarlarkMethod(
      name = "params",
      doc = "Parameters for the function if created with" + " core.action",
      structField = true)
  public Dict<?, ?> getParams() {
    return params;
  }

  @StarlarkMethod(name = "success", doc = "Returns a successful action result.")
  public ActionResult success() {
    return ActionResult.success();
  }

  @StarlarkMethod(
      name = "noop",
      doc = "Returns a no op action result with an optional message.",
      parameters = {
          @Param(
              name = "msg",
              allowedTypes = {
                  @ParamType(type = String.class),
                  @ParamType(type = NoneType.class),
              },
              doc = "The no op message",
              defaultValue = "None"),
      })
  public ActionResult noop(Object noopMsg) {
    return ActionResult.noop(convertFromNoneable(noopMsg, /*defaultMsg*/ null));
  }

  @StarlarkMethod(
      name = "error",
      doc = "Returns an error action result.",
      parameters = {
          @Param(name = "msg", doc = "The error message"),
      })
  public ActionResult error(String errorMsg) {
    return ActionResult.error(errorMsg);
  }

  /**
   * Return the new {@link DestinationEffect}s created by this context.
   */
  public ImmutableList<DestinationEffect> getNewDestinationEffects() {
    return ImmutableList.copyOf(newDestinationEffects);
  }

  @StarlarkMethod(
      name = "cli_labels",
      doc = "Access labels that a user passes through flag '--labels'. "
          + "For example: --labels=foo:value1,bar:value2. Then it can access in this way:"
          + "cli_labels['foo'].",
      structField = true)
  public Dict<String, String> getCliLabels() {
    return Dict.copyOf(null, labels);
  }

  @StarlarkMethod(
      name = "record_effect",
      doc = "Records an effect of the current action.",
      parameters = {
          @Param(name = "summary", doc = "The summary of this effect", named = true),
          @Param(
              name = "origin_refs",
              allowedTypes = {
                  @ParamType(type = Sequence.class, generic1 = OriginRef.class),
              },
              doc = "The origin refs",
              named = true),
          @Param(name = "destination_ref", doc = "The destination ref", named = true),
          @Param(
              name = "errors",
              allowedTypes = {@ParamType(type = Sequence.class, generic1 = String.class)},
              defaultValue = "[]",
              doc = "An optional list of errors",
              named = true),
          @Param(
              name = "type",
              doc =
                  "The type of migration effect:
"
                      + "
"
                      + "
'CREATED': A new review or change was created.
"
                      + "
'UPDATED': An existing review or change was updated.
"
                      + "
'NOOP': The change was a noop.
"
                      + "
'NOOP_AGAINST_PENDING_CHANGE': The change was a noop, relative"
                      + "to an existing pending change.
"
                      + "
'INSUFFICIENT_APPROVALS': The effect couldn't happen because "
                      + "the change doesn't have enough approvals.
"
                      + "
'ERROR': A user attributable error happened that prevented "
                      + "the destination from creating/updating the change. "
                      + "
'STARTED': The initial effect of a migration that depends on a "
                      + "previous one. This allows to have 'dependant' migrations defined by users.\n"
                      + "An example of this: a workflow migrates code from a Gerrit review to a "
                      + "GitHub PR, and a feedback migration migrates the test results from a CI in "
                      + "GitHub back to the Gerrit change.\n"
                      + "This effect would be created on the former one.
"
                      + "
",
              defaultValue = "\"UPDATED\"",
              named = true)
      })
  public void recordEffect(
      String summary,
      Sequence<?> originRefs, // <OriginRef>
      DestinationRef destinationRef,
      Sequence<?> errors, // <String>
      String typeStr)
      throws EvalException {
    DestinationEffect.Type type =
        SkylarkUtil.stringToEnum("type", typeStr, DestinationEffect.Type.class);
    newDestinationEffects.add(
        new DestinationEffect(
            type,
            summary,
            Sequence.cast(originRefs, OriginRef.class, "origin_refs"),
            destinationRef,
            Sequence.cast(errors, String.class, "errors")));
  }

  @Override
  public void onFinish(Object result, SkylarkContext<T> context) throws ValidationException {
    checkCondition(
        result != null,
        "Actions must return a result via built-in functions: success(), "
            + "error(), noop() return, but '%s' returned: None", action.getName());
    checkCondition(result instanceof ActionResult,
        "Actions must return a result via built-in functions: success(), "
            + "error(), noop() return, but '%s' returned: %s", action.getName(), result);
    this.actionResult = (ActionResult) result;
    switch (actionResult.getResult()) {
      case ERROR:
        console.errorFmt(
            "Action '%s' returned error: %s", action.getName(), actionResult.getMsg());
        break;
      case NO_OP:
        console.infoFmt(
            "Action '%s' returned noop: %s", action.getName(), actionResult.getMsg());
        break;
      case SUCCESS:
        console.infoFmt("Action '%s' returned success", action.getName());
        break;
    }
    // Populate effects registered in the action context. This is required because SkylarkAction
    // makes a copy of the context to inject the parameters, but that instance is not visible from
    // the caller
    this.newDestinationEffects.addAll(((ActionContext<T>) context).newDestinationEffects);
  }

  public ActionResult getActionResult() {
    return actionResult;
  }
}