Skip to content
This repository has been archived by the owner on Mar 10, 2022. It is now read-only.

Commit

Permalink
Rename CBLite to CouchbaseLite
Browse files Browse the repository at this point in the history
  • Loading branch information
bmeike committed Mar 19, 2019
1 parent fcc86ce commit 038ddbc
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

import junit.framework.TestCase;
import org.json.JSONObject;
import org.junit.After;
import org.junit.Before;
Expand Down Expand Up @@ -104,7 +103,7 @@ public void setUp() throws Exception {

final Context ctxt = InstrumentationRegistry.getTargetContext();

CBLite.init(ctxt);
CouchbaseLite.init(ctxt);
try {
config = new Config(openTestPropertiesFile());
}
Expand All @@ -124,7 +123,7 @@ public void setUp() throws Exception {
}

private InputStream openTestPropertiesFile() throws IOException {
final AssetManager assets = CBLite.getContext().getAssets();
final AssetManager assets = CouchbaseLite.getContext().getAssets();
try {
return assets.open(Config.EE_TEST_PROPERTIES_FILE);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,10 @@ public void testConfigurationIsCopiedWhenGetSet() throws CouchbaseLiteException
@Test
public void testDatabaseConfigurationWithAndroidContect() throws CouchbaseLiteException {
DatabaseConfiguration config = new DatabaseConfiguration();
assertEquals(config.getDirectory(), CBLite.getContext().getFilesDir().getAbsolutePath());
assertEquals(config.getDirectory(), CouchbaseLite.getContext().getFilesDir().getAbsolutePath());
Database db = new Database("db", config);
try {
String expectedPath = CBLite.getContext().getFilesDir().getAbsolutePath();
String expectedPath = CouchbaseLite.getContext().getFilesDir().getAbsolutePath();
assertTrue(new File(db.getPath()).getAbsolutePath().contains(expectedPath));
}
finally {
Expand Down Expand Up @@ -258,7 +258,7 @@ public void testCreateWithCustomDirectory() throws CouchbaseLiteException {

String dbName = "db";

File dir = new File(CBLite.getContext().getFilesDir(), "CouchbaseLite");
File dir = new File(CouchbaseLite.getContext().getFilesDir(), "CouchbaseLite");
try {
Database.delete(dbName, dir);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public void testPrepareDB() throws CouchbaseLiteException {
// TODO: 1.x DB's attachment is not automatically ditected as blob
@Test
public void testOpenExsitingDBv1x() throws Exception {
final Context ctxt = CBLite.getContext();
final Context ctxt = CouchbaseLite.getContext();
// https://github.com/couchbase/couchbase-lite-android/issues/1237

// if db exist, delete it
Expand Down Expand Up @@ -93,7 +93,7 @@ public void testOpenExsitingDBv1x() throws Exception {

@Test
public void testOpenExsitingDBv1xNoAttachment() throws Exception {
final Context ctxt = CBLite.getContext();
final Context ctxt = CouchbaseLite.getContext();

// https://github.com/couchbase/couchbase-lite-android/issues/1237

Expand All @@ -120,7 +120,7 @@ public void testOpenExsitingDBv1xNoAttachment() throws Exception {

@Test
public void testOpenExsitingDB() throws Exception {
final Context ctxt = CBLite.getContext();
final Context ctxt = CouchbaseLite.getContext();

// if db exist, delete it
deleteDB("android-sqlite", ctxt.getFilesDir());
Expand Down Expand Up @@ -149,7 +149,7 @@ public void testOpenExsitingDB() throws Exception {

// if db exist, delete it
private void deleteDB(String name, File dir) throws CouchbaseLiteException {
final Context ctxt = CBLite.getContext();
final Context ctxt = CouchbaseLite.getContext();

// database exist, delete it
if (Database.exists(name, ctxt.getFilesDir())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,20 @@
import java.lang.ref.SoftReference;


public final class CBLite {
public final class CouchbaseLite {
private static SoftReference<Context> context;

private CBLite() {}
private CouchbaseLite() {}

public static void init(@NonNull Context ctxt) {
CBLite.context = new SoftReference<>(ctxt.getApplicationContext());
CouchbaseLite.context = new SoftReference<>(ctxt.getApplicationContext());
}

@NonNull
static Context getContext() {
final Context ctxt = (context == null) ? null : context.get();
if (ctxt == null) {
throw new IllegalStateException("Null context. Did you forget to call CBLite.init()?");
throw new IllegalStateException("Null context. Did you forget to call CouchbaseLite.init()?");
}
return ctxt;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public void onReceive(Context context, Intent intent) {

NetworkReachabilityManager() {
this.receiver = new NetworkReceiver();
this.context = CBLite.getContext();
this.context = CouchbaseLite.getContext();

this.listening = false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ abstract class AbstractDatabaseConfiguration {
//---------------------------------------------

protected AbstractDatabaseConfiguration() {
this(false, CBLite.getDbDirectoryPath());
this(false, CouchbaseLite.getDbDirectoryPath());
}

protected AbstractDatabaseConfiguration(@NonNull AbstractDatabaseConfiguration config) {
Expand Down Expand Up @@ -113,7 +113,7 @@ void setTempDir() {
*/
private String getTempDir() {
return (!customDir)
? CBLite.getTmpDirectory(TEMP_DIR_NAME)
: CBLite.getTmpDirectory(directory, TEMP_DIR_NAME);
? CouchbaseLite.getTmpDirectory(TEMP_DIR_NAME)
: CouchbaseLite.getTmpDirectory(directory, TEMP_DIR_NAME);
}
}

0 comments on commit 038ddbc

Please sign in to comment.