michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: package org.mozilla.gecko.background.sync.helpers; michael@0: michael@0: import java.util.HashMap; michael@0: michael@0: import org.mozilla.gecko.sync.repositories.domain.Record; michael@0: michael@0: public class ExpectFetchDelegate extends DefaultFetchDelegate { michael@0: private HashMap expect = new HashMap(); michael@0: michael@0: public ExpectFetchDelegate(Record[] records) { michael@0: for(int i = 0; i < records.length; i++) { michael@0: expect.put(records[i].guid, records[i]); michael@0: } michael@0: } michael@0: michael@0: @Override michael@0: public void onFetchedRecord(Record record) { michael@0: this.records.add(record); michael@0: } michael@0: michael@0: @Override michael@0: public void onFetchCompleted(final long fetchEnd) { michael@0: super.onDone(this.records, this.expect, fetchEnd); michael@0: } michael@0: michael@0: public Record recordAt(int i) { michael@0: return this.records.get(i); michael@0: } michael@0: }