/*
 * Copyright (C) 2013  Ohm Data
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU Affero General Public License as
 *  published by the Free Software Foundation, either version 3 of the
 *  License, or (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Affero General Public License for more details.
 *
 *  You should have received a copy of the GNU Affero General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package c5db.client;

import c5db.MiniClusterBase;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.client.ResultScanner;
import org.apache.hadoop.hbase.util.Bytes;
import org.junit.Test;

import java.io.IOException;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeoutException;

import static junit.framework.TestCase.assertFalse;

public class TestInOrderScanTest extends MiniClusterBase {

  private final byte[] cf = Bytes.toBytes("cf");

  @Test
  public void testInOrderScan() throws IOException, InterruptedException, TimeoutException, ExecutionException {
    Result result = null;
    ResultScanner scanner;

    scanner = table.getScanner(cf);
    byte[] previousRow = {};
    do {
      if (result != null) {
        previousRow = result.getRow();
      }
      result = scanner.next();
      if (result != null) assertFalse(Bytes.compareTo(result.getRow(), previousRow) < 1);
    } while (result != null);
  }
}

@@ -1052,16 +1052,65 @@
 ption;%0A%0A
+import static c5db.client.DataHelper.putRowInDB;%0A
 import s
@@ -1437,16 +1437,339 @@
 scanner;
+%0A    putRowInDB(table, row);%0A    row = Bytes.add(row, row);%0A    putRowInDB(table, row);%0A    row = Bytes.add(row, row);%0A    putRowInDB(table, row);%0A    row = Bytes.add(row, row);%0A    putRowInDB(table, row);%0A    row = Bytes.add(row, row);%0A    putRowInDB(table, row);%0A    row = Bytes.add(row, row);%0A    putRowInDB(table, row);
 %0A%0A    sc

Make sure to actually put some data in the database for the tests