Skip to content

Commit

Permalink
Merge pull request #405
Browse files Browse the repository at this point in the history
MTKs
  • Loading branch information
gthea authored Aug 8, 2022
2 parents 8f2d249 + 8cce95e commit 5817c76
Show file tree
Hide file tree
Showing 68 changed files with 3,208 additions and 233 deletions.
312 changes: 312 additions & 0 deletions schemas/io.split.android.client.storage.db.SplitRoomDatabase/4.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,312 @@
{
"formatVersion": 1,
"database": {
"version": 4,
"identityHash": "a996d1e0f5e8da089a69b3bfe5fa8a1f",
"entities": [
{
"tableName": "my_segments",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`user_key` TEXT NOT NULL, `segment_list` TEXT NOT NULL, `updated_at` INTEGER NOT NULL, PRIMARY KEY(`user_key`))",
"fields": [
{
"fieldPath": "userKey",
"columnName": "user_key",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "segmentList",
"columnName": "segment_list",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "updatedAt",
"columnName": "updated_at",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"columnNames": [
"user_key"
],
"autoGenerate": false
},
"indices": [],
"foreignKeys": []
},
{
"tableName": "splits",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`name` TEXT NOT NULL, `body` TEXT NOT NULL, `updated_at` INTEGER NOT NULL, PRIMARY KEY(`name`))",
"fields": [
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "body",
"columnName": "body",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "updatedAt",
"columnName": "updated_at",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"columnNames": [
"name"
],
"autoGenerate": false
},
"indices": [],
"foreignKeys": []
},
{
"tableName": "events",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `body` TEXT NOT NULL, `created_at` INTEGER NOT NULL, `status` INTEGER NOT NULL)",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "body",
"columnName": "body",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "createdAt",
"columnName": "created_at",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "status",
"columnName": "status",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"columnNames": [
"id"
],
"autoGenerate": true
},
"indices": [],
"foreignKeys": []
},
{
"tableName": "impressions",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `test_name` TEXT NOT NULL, `body` TEXT NOT NULL, `created_at` INTEGER NOT NULL, `status` INTEGER NOT NULL)",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "testName",
"columnName": "test_name",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "body",
"columnName": "body",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "createdAt",
"columnName": "created_at",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "status",
"columnName": "status",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"columnNames": [
"id"
],
"autoGenerate": true
},
"indices": [],
"foreignKeys": []
},
{
"tableName": "general_info",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`name` TEXT NOT NULL, `stringValue` TEXT, `longValue` INTEGER NOT NULL, `updated_at` INTEGER NOT NULL, PRIMARY KEY(`name`))",
"fields": [
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "stringValue",
"columnName": "stringValue",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "longValue",
"columnName": "longValue",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "updatedAt",
"columnName": "updated_at",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"columnNames": [
"name"
],
"autoGenerate": false
},
"indices": [],
"foreignKeys": []
},
{
"tableName": "impressions_count",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `body` TEXT NOT NULL, `created_at` INTEGER NOT NULL, `status` INTEGER NOT NULL)",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "body",
"columnName": "body",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "createdAt",
"columnName": "created_at",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "status",
"columnName": "status",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"columnNames": [
"id"
],
"autoGenerate": true
},
"indices": [],
"foreignKeys": []
},
{
"tableName": "attributes",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`user_key` TEXT NOT NULL, `attributes` TEXT, `updated_at` INTEGER NOT NULL, PRIMARY KEY(`user_key`))",
"fields": [
{
"fieldPath": "userKey",
"columnName": "user_key",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "attributes",
"columnName": "attributes",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "updatedAt",
"columnName": "updated_at",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"columnNames": [
"user_key"
],
"autoGenerate": false
},
"indices": [],
"foreignKeys": []
},
{
"tableName": "unique_keys",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `user_key` TEXT NOT NULL, `feature_list` TEXT, `created_at` INTEGER NOT NULL, `status` INTEGER NOT NULL)",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "userKey",
"columnName": "user_key",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "featureList",
"columnName": "feature_list",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "createdAt",
"columnName": "created_at",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "status",
"columnName": "status",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"columnNames": [
"id"
],
"autoGenerate": true
},
"indices": [],
"foreignKeys": []
}
],
"views": [],
"setupQueries": [
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'a996d1e0f5e8da089a69b3bfe5fa8a1f')"
]
}
}
2 changes: 0 additions & 2 deletions src/androidTest/java/fake/HttpResponseMockDispatcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import java.net.URI;

import io.split.android.client.network.HttpMethod;
import io.split.android.client.network.HttpResponse;
import io.split.android.client.network.HttpStreamResponse;
import io.split.sharedtest.fake.HttpStreamResponseMock;

public interface HttpResponseMockDispatcher {
Expand Down
3 changes: 0 additions & 3 deletions src/androidTest/java/fake/HttpStreamRequestMock.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
package fake;

import java.io.BufferedReader;
import java.io.IOException;

import io.split.android.client.network.HttpException;
import io.split.android.client.network.HttpStreamRequest;
import io.split.android.client.network.HttpStreamResponse;
Expand Down
7 changes: 6 additions & 1 deletion src/androidTest/java/helper/IntegrationHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,12 @@ public static HttpResponseMockDispatcher buildDispatcher(Map<String, ResponseClo
return new HttpResponseMockDispatcher() {
@Override
public HttpResponseMock getResponse(URI uri, HttpMethod method, String body) {
String path = uri.getPath().replace("/api/", "");
String path = uri.getPath()
.replace("sdk.split.io/api", "")
.replace("telemetry.split.io/api", "")
.replace("/api/", "");

Logger.d("path is %s", path);
if (responses.containsKey(path)) {
return responses.get(path).onResponse(uri, method, body);
} else {
Expand Down
16 changes: 15 additions & 1 deletion src/androidTest/java/helper/TestableSplitConfigBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ public class TestableSplitConfigBuilder {
private int mOfflineRefreshRate = 10;
private boolean mSyncEnabled = true;
private int mLogLevel = SplitLogLevel.NONE;
private int mMtkPerPush = 30000;
private int mMtkRefreshRate = 1800;

public TestableSplitConfigBuilder() {
mServiceEndpoints = ServiceEndpoints.builder().build();
Expand Down Expand Up @@ -242,6 +244,16 @@ public TestableSplitConfigBuilder syncEnabled(boolean syncEnabled) {
return this;
}

public TestableSplitConfigBuilder mtkPerPush(int mtkPerPush) {
this.mMtkPerPush = mtkPerPush;
return this;
}

public TestableSplitConfigBuilder mtkRefreshRate(int mtkRefreshRate) {
this.mMtkRefreshRate = mtkRefreshRate;
return this;
}

public SplitClientConfig build() {
Constructor constructor = SplitClientConfig.class.getDeclaredConstructors()[0];
constructor.setAccessible(true);
Expand Down Expand Up @@ -293,7 +305,9 @@ public SplitClientConfig build() {
mTelemetryRefreshRate,
mShouldRecordTelemetry,
mSyncEnabled,
mLogLevel);
mLogLevel,
mMtkPerPush,
mMtkRefreshRate);
return config;
} catch (Exception e) {
Logger.e("Error creating Testable Split client builder: "
Expand Down
Loading

0 comments on commit 5817c76

Please sign in to comment.