Search in sources :

Example 1 with StoppableWaitCriterion

use of org.apache.geode.test.dunit.StoppableWaitCriterion in project geode by apache.

the class DSObjectLocalOnly method verifyDataSerializers.

public static void verifyDataSerializers(final int numOfDataSerializers, final boolean allowNonLocal) {
    WaitCriterion wc = new StoppableWaitCriterion() {

        String excuse;

        private DataSerializer[] getSerializers() {
            allowNonLocalTL.set(allowNonLocal);
            try {
                return InternalDataSerializer.getSerializers();
            } finally {
                allowNonLocalTL.remove();
            }
        }

        public boolean done() {
            return getSerializers().length == numOfDataSerializers;
        }

        public String description() {
            return "expected " + numOfDataSerializers + " but got this " + InternalDataSerializer.getSerializers().length + " serializers=" + java.util.Arrays.toString(getSerializers());
        }

        public boolean stopWaiting() {
            return getSerializers().length > numOfDataSerializers;
        }
    };
    Wait.waitForCriterion(wc, 60 * 1000, 1000, true);
}
Also used : StoppableWaitCriterion(org.apache.geode.test.dunit.StoppableWaitCriterion) WaitCriterion(org.apache.geode.test.dunit.WaitCriterion) StoppableWaitCriterion(org.apache.geode.test.dunit.StoppableWaitCriterion) DataSerializer(org.apache.geode.DataSerializer) TestDataSerializer(org.apache.geode.TestDataSerializer) InternalDataSerializer(org.apache.geode.internal.InternalDataSerializer)

Aggregations

DataSerializer (org.apache.geode.DataSerializer)1 TestDataSerializer (org.apache.geode.TestDataSerializer)1 InternalDataSerializer (org.apache.geode.internal.InternalDataSerializer)1 StoppableWaitCriterion (org.apache.geode.test.dunit.StoppableWaitCriterion)1 WaitCriterion (org.apache.geode.test.dunit.WaitCriterion)1