// Path: ormlite-content-provider-library-test/src/com/tojc/ormlite/android/test/provider/AccountContract.java
// public final class AccountContract implements BaseColumns {
// 
//     private AccountContract() {
//         // utility constructor
//     }
// 
//     public static final String AUTHORITY = "com.tojc.ormlite.android.test";
// 
//     public static final String CONTENT_URI_PATH = "accounts";
// 
//     public static final String MIMETYPE_TYPE = "accounts";
//     public static final String MIMETYPE_NAME = "com.tojc.ormlite.android.test.provider";
// 
//     public static final Uri CONTENT_URI = new Uri.Builder().scheme(ContentResolver.SCHEME_CONTENT).authority(AUTHORITY).appendPath(CONTENT_URI_PATH).build();
// 
//     public static final String NAME = "name";
// }
// 
// Path: ormlite-content-provider-library-test/src/com/tojc/ormlite/android/test/provider/SampleHelper.java
// public class SampleHelper extends OrmLiteSqliteOpenHelper {
// 
//     /* package-private */static final Class<?>[] CLASS_LIST = new Class<?>[] {Account.class, Membership.class};
// 
//     public SampleHelper(Context context) {
//         super(context, "MyDatabase", null, 1);
//     }
// 
//     @Override
//     public void onCreate(SQLiteDatabase database, ConnectionSource connectionSource) {
//         try {
//             resetAllTables();
//         } catch (SQLException e) {
//             e.printStackTrace();
//         }
//     }
// 
//     @Override
//     public void onUpgrade(SQLiteDatabase database, ConnectionSource connectionSource, int oldVersion, int newVersion) {
//         try {
//             resetAllTables();
//         } catch (SQLException e) {
//             e.printStackTrace();
//         }
//     }
// 
//     public void resetAllTables() throws SQLException {
//         for (Class<?> clazz : CLASS_LIST) {
//             TableUtils.dropTable(connectionSource, clazz, true);
//             TableUtils.createTable(connectionSource, clazz);
//         }
//     }
// }
// 
// Path: ormlite-content-provider-library-test/src/com/tojc/ormlite/android/test/provider/UnderTestSampleProvider.java
// public class UnderTestSampleProvider extends OrmLiteSimpleContentProvider<SampleHelper> {
//     @Override
//     protected Class<SampleHelper> getHelperClass() {
//         return SampleHelper.class;
//     }
// 
//     @Override
//     public boolean onCreate() {
//         int patternCode = 1;
//         setMatcherController(new MatcherController()//
//                 .add(Account.class, SubType.DIRECTORY, "", patternCode++)//
//                 .add(Account.class, SubType.ITEM, "#", patternCode++)//
//                 .add(Membership.class, SubType.DIRECTORY, "", patternCode++)//
//                 .add(Membership.class, SubType.ITEM, "#", patternCode++));
//         return true;
//     }
// }


import android.provider.BaseColumns;
import android.test.InstrumentationTestCase;
import android.test.mock.MockContentResolver;
import android.test.suitebuilder.annotation.MediumTest;
import com.j256.ormlite.dao.RuntimeExceptionDao;
import com.tojc.ormlite.android.test.model.Account;
import com.tojc.ormlite.android.test.provider.AccountContract;
import com.tojc.ormlite.android.test.provider.SampleHelper;
import com.tojc.ormlite.android.test.provider.UnderTestSampleProvider;
import java.util.ArrayList;
import java.util.List;
import android.content.ContentProviderClient;
import android.content.ContentProviderOperation;
import android.content.ContentValues;
import android.content.OperationApplicationException;
import android.database.Cursor;
import android.os.RemoteException;
        // when
        this.resolver.bulkInsert(AccountContract.CONTENT_URI, contentValues);

        // then
        RuntimeExceptionDao<Account, Integer> simpleDao = getHelper().getRuntimeExceptionDao(Account.class);
        List<Account> accountList = simpleDao.queryForAll();
        assertEquals(testAccountCount, accountList.size());
        int accountIndex = 0;
        for (Account account : accountList) {
            assertEquals(TEST_NAME_1 + accountIndex++, account.getName());
        }
    }

    public void testApplyBatch() throws RemoteException, OperationApplicationException {
        // given
        ArrayList<ContentProviderOperation> operations = new ArrayList<ContentProviderOperation>();
        operations.add(ContentProviderOperation.newInsert(AccountContract.CONTENT_URI).withValue(AccountContract.NAME, TEST_NAME_1).build());
        operations.add(ContentProviderOperation.newInsert(AccountContract.CONTENT_URI).withValue(AccountContract.NAME, TEST_NAME_2).build());

        // when
        this.resolver.applyBatch(AccountContract.AUTHORITY, operations);

        // then
        RuntimeExceptionDao<Account, Integer> simpleDao = getHelper().getRuntimeExceptionDao(Account.class);
        List<Account> accountList = simpleDao.queryForAll();
        assertEquals(2, accountList.size());
        assertEquals(TEST_NAME_1, accountList.get(0).getName());
        assertEquals(TEST_NAME_2, accountList.get(1).getName());
    }

// Path: ormlite-content-provider-library-test/src/com/tojc/ormlite/android/test/provider/AccountContract.java
// public final class AccountContract implements BaseColumns {
// 
//     private AccountContract() {
//         // utility constructor
//     }
// 
//     public static final String AUTHORITY = "com.tojc.ormlite.android.test";
// 
//     public static final String CONTENT_URI_PATH = "accounts";
// 
//     public static final String MIMETYPE_TYPE = "accounts";
//     public static final String MIMETYPE_NAME = "com.tojc.ormlite.android.test.provider";
// 
//     public static final Uri CONTENT_URI = new Uri.Builder().scheme(ContentResolver.SCHEME_CONTENT).authority(AUTHORITY).appendPath(CONTENT_URI_PATH).build();
// 
//     public static final String NAME = "name";
// }
// 
// Path: ormlite-content-provider-library-test/src/com/tojc/ormlite/android/test/provider/SampleHelper.java
// public class SampleHelper extends OrmLiteSqliteOpenHelper {
// 
//     /* package-private */static final Class<?>[] CLASS_LIST = new Class<?>[] {Account.class, Membership.class};
// 
//     public SampleHelper(Context context) {
//         super(context, "MyDatabase", null, 1);
//     }
// 
//     @Override
//     public void onCreate(SQLiteDatabase database, ConnectionSource connectionSource) {
//         try {
//             resetAllTables();
//         } catch (SQLException e) {
//             e.printStackTrace();
//         }
//     }
// 
//     @Override
//     public void onUpgrade(SQLiteDatabase database, ConnectionSource connectionSource, int oldVersion, int newVersion) {
//         try {
//             resetAllTables();
//         } catch (SQLException e) {
//             e.printStackTrace();
//         }
//     }
// 
//     public void resetAllTables() throws SQLException {
//         for (Class<?> clazz : CLASS_LIST) {
//             TableUtils.dropTable(connectionSource, clazz, true);
//             TableUtils.createTable(connectionSource, clazz);
//         }
//     }
// }
// 
// Path: ormlite-content-provider-library-test/src/com/tojc/ormlite/android/test/provider/UnderTestSampleProvider.java
// public class UnderTestSampleProvider extends OrmLiteSimpleContentProvider<SampleHelper> {
//     @Override
//     protected Class<SampleHelper> getHelperClass() {
//         return SampleHelper.class;
//     }
// 
//     @Override
//     public boolean onCreate() {
//         int patternCode = 1;
//         setMatcherController(new MatcherController()//
//                 .add(Account.class, SubType.DIRECTORY, "", patternCode++)//
//                 .add(Account.class, SubType.ITEM, "#", patternCode++)//
//                 .add(Membership.class, SubType.DIRECTORY, "", patternCode++)//
//                 .add(Membership.class, SubType.ITEM, "#", patternCode++));
//         return true;
//     }
// }


// Path: ormlite-content-provider-library-test/src/com/tojc/ormlite/android/TestOrmLiteSimpleProvider.java
import android.provider.BaseColumns;
import android.test.InstrumentationTestCase;
import android.test.mock.MockContentResolver;
import android.test.suitebuilder.annotation.MediumTest;
import com.j256.ormlite.dao.RuntimeExceptionDao;
import com.tojc.ormlite.android.test.model.Account;
import com.tojc.ormlite.android.test.provider.AccountContract;
import com.tojc.ormlite.android.test.provider.SampleHelper;
import com.tojc.ormlite.android.test.provider.UnderTestSampleProvider;
import java.util.ArrayList;
import java.util.List;
import android.content.ContentProviderClient;
import android.content.ContentProviderOperation;
import android.content.ContentValues;
import android.content.OperationApplicationException;
import android.database.Cursor;
import android.os.RemoteException;

        // when
        this.resolver.bulkInsert(AccountContract.CONTENT_URI, contentValues);

        // then
        RuntimeExceptionDao<Account, Integer> simpleDao = getHelper().getRuntimeExceptionDao(Account.class);
        List<Account> accountList = simpleDao.queryForAll();
        assertEquals(testAccountCount, accountList.size());
        int accountIndex = 0;
        for (Account account : accountList) {
            assertEquals(TEST_NAME_1 + accountIndex++, account.getName());
        }
    }

    public void testApplyBatch() throws RemoteException, OperationApplicationException {
        // given
        ArrayList<ContentProviderOperation> operations = new ArrayList<ContentProviderOperation>();
        operations.add(ContentProviderOperation.newInsert(AccountContract.CONTENT_URI).withValue(AccountContract.NAME, TEST_NAME_1).build());
        operations.add(ContentProviderOperation.newInsert(AccountContract.CONTENT_URI).withValue(AccountContract.NAME, TEST_NAME_2).build());

        // when
        this.resolver.applyBatch(AccountContract.AUTHORITY, operations);

        // then
        RuntimeExceptionDao<Account, Integer> simpleDao = getHelper().getRuntimeExceptionDao(Account.class);
        List<Account> accountList = simpleDao.queryForAll();
        assertEquals(2, accountList.size());
        assertEquals(TEST_NAME_1, accountList.get(0).getName());
        assertEquals(TEST_NAME_2, accountList.get(1).getName());
    }

    private SampleHelper getHelper() {