}
private void checkSplitPloints(File origSplitPoints, File fragmentsFile)
throws Exception {
JSONObject jsPoints = new JSONObject(stringContent(fragmentsFile));
final JSONArray initSeq = (JSONArray) jsPoints.opt(EntityRecorder.INITIAL_SEQUENCE);
if (initSeq != null) {
// Considering stable order on "initial sequence". May be this is too strict, in that case,
// we need to store the elements in a list and provide a search method
JSONArray fragments = (JSONArray) jsPoints.get(EntityRecorder.FRAGMENTS);
final Map<Integer, JSONObject> fragmentById = Maps.newHashMap();
for (int i = 0; i < fragments.length(); i++) {
JSONObject spoint = fragments.getJSONObject(i);
fragmentById.put(spoint.getInt(EntityRecorder.FRAGMENT_ID), spoint);
}
SAXParserFactory.newInstance().newSAXParser().parse(
new GZIPInputStream(new FileInputStream(origSplitPoints)),
new DefaultHandler() {
int isIdx = 0;
@Override
public void startElement(String uri, String localName, String qName, Attributes attributes)
throws SAXException {
super.startElement(uri, localName, qName, attributes);
try {
if (localName.equals("splipoint")) {
JSONArray runAsyncs = fragmentById
.get(Integer.parseInt(attributes.getValue("id")))
.getJSONArray(EntityRecorder.FRAGMENT_POINTS);
boolean present = false;
String runAsync = attributes.getValue("location");
for (int i = 0; i < runAsyncs.length(); i++) {
if (runAsyncs.getString(i).equals(runAsync)) {
present = true;
break;
}
}
assertTrue(present);