Skip to content

Commit

Permalink
Merge pull request #25 from kissmetrics/edt/domain-name-update
Browse files Browse the repository at this point in the history
Updating for new kissmetrics.io domain name and new tracking server n…
  • Loading branch information
NathanielWroblewski authored Jun 17, 2020
2 parents 024e9cb + 89ee917 commit d22327e
Show file tree
Hide file tree
Showing 11 changed files with 31 additions and 31 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
This workspace is not the SDK. The KISSmetricsSDK project is intended to build the SDK as a jar.
The source files included here are not intended to be used directly in your app.

For implementation details please see: http://support.kissmetrics.com/article/show/android-sdk
For implementation details please see: https://support.kissmetrics.io/reference#android

## Requirements

Expand All @@ -16,7 +16,7 @@ your `build.gradle`:

```groovy
dependencies {
compile 'com.kissmetrics.sdk:KISSmetricsSDK:2.2.2'
compile 'com.kissmetrics.sdk:KISSmetricsSDK:2.3.0'
}
```

Expand Down
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ buildscript {
classpath 'com.github.dcendents:android-maven-plugin:1.2'
}

version '2.2.2'
version '2.3.0'
group 'com.kissmetrics.sdk'
}

Expand All @@ -22,7 +22,7 @@ android {
defaultConfig {
minSdkVersion 8
targetSdkVersion 22
versionCode 3
versionCode 4
versionName project.version
}

Expand Down Expand Up @@ -103,4 +103,4 @@ task sourcesJar(type: Jar) {
task javadocsJar(type: Jar, dependsOn: javadocs) {
classifier 'javadoc'
from "${project.buildDir}/docs/javadoc"
}
}
6 changes: 3 additions & 3 deletions releasing.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ to do a little more work. First generate the pom file:
gradle install
```

The `KISSmetricsSDK-2.2.2.pom` file will be placed under
The `KISSmetricsSDK-2.3.0.pom` file will be placed under
`~/.m2/repository/com/kissmetrics/sdk/KISSmetricsSDK/$VERSION` where `$VERSION` is
the new version number (i.e. 2.2.2).
the new version number (i.e. 2.3.0).

Create a new version of the package in Bintray. Upload the files in Step 4 and
`KISSmetricsSDK-2.2.2.pom` to Bintray.
`KISSmetricsSDK-2.3.0.pom` to Bintray.
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ public final void testDefaultSettings() {

// Define the expected default map
HashMap<String, Object> expectedMap = new HashMap<String, Object>();
expectedMap.put("baseUrl", "https://trk.kissmetrics.com");
expectedMap.put("baseUrl", "https://trc.kissmetrics.io");
expectedMap.put("verification_exp_date", 0L);
expectedMap.put("hasGenericIdentity", false);
expectedMap.put("doSend", false);
Expand Down Expand Up @@ -1178,7 +1178,7 @@ public final void testClearSavedProperties() {
public final void testArchiveData() {

List<String> expectedSendQueue = this.uth_getSendQueue();
expectedSendQueue.add("https://trk.kissmetrics.com/a?_k=b8f68fe5004d29bcd21d3138b43ae755a16c12cf&_x=ios/2.0&_p=testnewuser%40example.com&_n=testolduser%40example.com");
expectedSendQueue.add("https://trc.kissmetrics.io/a?_k=b8f68fe5004d29bcd21d3138b43ae755a16c12cf&_x=ios/2.0&_p=testnewuser%40example.com&_n=testolduser%40example.com");

this.uth_archiveSendQueue();

Expand Down
12 changes: 6 additions & 6 deletions src/androidTest/java/com/kissmetrics/sdk/ConnectionImplTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ protected void setUp() throws Exception {
super.setUp();

try {
testUrl = new URL("http://www.kissmetrics.com/"); // <- Not special url required, just needs to be valid.
testUrl = new URL("https://www.kissmetrics.io/"); // <- Not special url required, just needs to be valid.
} catch (MalformedURLException e) {
e.printStackTrace();
}
Expand All @@ -81,7 +81,7 @@ public final void testConnectionResponseHeader200() {
connectionImpl.setHttpURLConnection(mockConnection);

// Method under test
connectionImpl.sendRecord("http://www.kissmetrics.com", this);
connectionImpl.sendRecord("https://www.kissmetrics.io", this);

// Assert values returned via callback
assertEquals("A 200 response is reported as successful", true, resultSuccess);
Expand All @@ -98,7 +98,7 @@ public final void testConnectionResponseHeader304() {
connectionImpl.setHttpURLConnection(mockConnection);

// Method under test
connectionImpl.sendRecord("http://www.kissmetrics.com", this);
connectionImpl.sendRecord("https://www.kissmetrics.io", this);

// Assert values returned via callback
assertEquals("A 304 response is reported as successful", true, resultSuccess);
Expand All @@ -115,7 +115,7 @@ public final void testConnectionResponseHeader404() {
connectionImpl.setHttpURLConnection(mockConnection);

// Method under test
connectionImpl.sendRecord("http://www.kissmetrics.com", this);
connectionImpl.sendRecord("https://www.kissmetrics.io", this);

// Assert values returned via callback
assertEquals("A 404 response is reported as unsuccessful", false, resultSuccess);
Expand All @@ -132,7 +132,7 @@ public final void testConnectionResponseHeader503() {
connectionImpl.setHttpURLConnection(mockConnection);

// Method under test
connectionImpl.sendRecord("http://www.kissmetrics.com", this);
connectionImpl.sendRecord("https://www.kissmetrics.io", this);

// Assert values returned via callback
assertEquals("A 503 response is reported as unsuccessful", false, resultSuccess);
Expand All @@ -147,7 +147,7 @@ public final void testMalformedURL() {
ConnectionImpl connectionImpl = new ConnectionImpl();

// Method under test
connectionImpl.sendRecord("htt.p://www.kissmetrics.com", this);
connectionImpl.sendRecord("https://www.kissmetrics.io", this);

// Assert values returned via callback
assertEquals("A malformedURL is not successful", false, resultSuccess);
Expand Down
10 changes: 5 additions & 5 deletions src/androidTest/java/com/kissmetrics/sdk/KISSmetricsAPITest.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ private MockHttpURLConnection mockConnection(String urlString, String inputStrea
URL url = null;

try {
url = new URL("http://www.kissmetrics.com/"); // <- No specific URL required
url = new URL("https://www.kissmetrics.io/"); // <- No specific URL required
} catch (MalformedURLException e) {
e.printStackTrace();
}
Expand All @@ -120,7 +120,7 @@ private MockHttpURLConnection mockConnection(String urlString, String inputStrea
}

private void mockResponse(String header) {
MockHttpURLConnection mockConnection = mockConnection("http://www.kissmetrics.com/", "", header, 0);
MockHttpURLConnection mockConnection = mockConnection("https://www.kissmetrics.io/", "", header, 0);

TestableConnectionImpl testableConnectionImpl = new TestableConnectionImpl();
testableConnectionImpl.setHttpURLConnection(mockConnection);
Expand All @@ -132,10 +132,10 @@ private void mockResponse(String header) {
}

private void mockVerificationResponse(String tracking) {
// Expected JSON payload = { "reason": "PRODUCT_SAMPLING", "tracking": false, "tracking_endpoint": "trk.kissmetrics.com"}
String mockJson = "{\"tracking\": " + tracking + ", \"tracking_endpoint\": \"trk.kissmetrics.com\" }";
// Expected JSON payload = { "reason": "PRODUCT_SAMPLING", "tracking": false, "tracking_endpoint": "trc.kissmetrics.io"}
String mockJson = "{\"tracking\": " + tracking + ", \"tracking_endpoint\": \"trc.kissmetrics.io\" }";
long expDate = dateForNow().getTime() + 86400000;
MockHttpURLConnection mockConnection = mockConnection("http://www.kissmetrics.com/", mockJson, "HTTP/1.1 200 OK", expDate);
MockHttpURLConnection mockConnection = mockConnection("https://www.kissmetrics.io/", mockJson, "HTTP/1.1 200 OK", expDate);

TestableVerificationImpl testableVerificationImpl = new TestableVerificationImpl();
testableVerificationImpl.setHttpURLConnection(mockConnection);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class QueryEncoderTest extends AndroidTestCase {
static String key = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
static String clientType = "mobile_app";
static String userAgent = "android+2.1.0";
static String baseUrl = "https://trk.kissmetrics.com";
static String baseUrl = "https://trc.kissmetrics.io";

static String reservedString = "!*'();:@&=+$,/?#[]";
static String encodedReservedString = "%21%2A%27%28%29%3B%3A%40%26%3D%2B%24%2C%2F%3F%23%5B%5D";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public final void testVerificationResponseFail() {
resultDoTrack = true;
resultBaseUrl = null;

String mockJson = "{\"reason\": \"PRODUCT_DISABLED\", \"tracking\": false, \"tracking_endpoint\": \"trk.kissmetrics.com\"}";
String mockJson = "{\"reason\": \"PRODUCT_DISABLED\", \"tracking\": false, \"tracking_endpoint\": \"trc.kissmetrics.io\"}";
mockConnection.setExpectedGetInputStream(new ByteArrayInputStream(mockJson.getBytes()));

mockConnection.setExpectedGetHeaderField("HTTP/1.1 404 Not Found");
Expand Down Expand Up @@ -106,7 +106,7 @@ public final void testVerificationResponseTrackingFalse() {
resultBaseUrl = "";
resultExpirationDate = 0L;

String mockJson = "{\"reason\": \"PRODUCT_DISABLED\", \"tracking\": false, \"tracking_endpoint\": \"trk.kissmetrics.com\"}";
String mockJson = "{\"reason\": \"PRODUCT_DISABLED\", \"tracking\": false, \"tracking_endpoint\": \"trc.kissmetrics.io\"}";
mockConnection.setExpectedGetInputStream(new ByteArrayInputStream(mockJson.getBytes()));

mockConnection.setExpectedGetHeaderField("HTTP/1.1 200 OK");
Expand All @@ -125,7 +125,7 @@ public final void testVerificationResponseTrackingFalse() {
// Assert values returned via callback
assertEquals("A 200 response is reported as successful", true, resultSuccess);
assertEquals("A tracking:false JSON body set doTrack to false", false, resultDoTrack);
assertEquals("A successful response provides a baseUrl tracking endpoint", "https://trk.kissmetrics.com", resultBaseUrl);
assertEquals("A successful response provides a baseUrl tracking endpoint", "https://trc.kissmetrics.io", resultBaseUrl);
assertEquals("A successful response sets an expiration at or less than 30 days", expectedExpirationDate, resultExpirationDate);
}

Expand All @@ -137,7 +137,7 @@ public final void testVerificationResponseTrackingTrue() {
resultBaseUrl = "";
resultExpirationDate = 0L;

String mockJson = "{\"tracking\": true, \"tracking_endpoint\": \"trk.testing.kissmetrics.com\"}";
String mockJson = "{\"tracking\": true, \"tracking_endpoint\": \"trc.testing.kissmetrics.io\"}";
mockConnection.setExpectedGetInputStream(new ByteArrayInputStream(mockJson.getBytes()));

mockConnection.setExpectedGetHeaderField("HTTP/1.1 200 OK");
Expand All @@ -156,7 +156,7 @@ public final void testVerificationResponseTrackingTrue() {
// Assert values returned via callback
assertEquals("A 200 response is reported as successful", true, resultSuccess);
assertEquals("A tracking:false JSON body set doTrack to true", true, resultDoTrack);
assertEquals("A successful response provides a baseUrl tracking endpoint", "https://trk.testing.kissmetrics.com", resultBaseUrl);
assertEquals("A successful response provides a baseUrl tracking endpoint", "https://trc.testing.kissmetrics.io", resultBaseUrl);
assertEquals("Receives expected expiration from headers", expectedExpirationDate, resultExpirationDate);
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/kissmetrics/sdk/ArchiverImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public class ArchiverImpl implements Archiver {
private static final boolean HAS_GENERIC_IDENTITY_DEFAULT = false;
private static final boolean DO_TRACK_DEFAULT = true;
private static final boolean DO_SEND_DEFAULT = false;
private static final String BASE_URL_DEFAULT = "https://trk.kissmetrics.com";
private static final String BASE_URL_DEFAULT = "https://trc.kissmetrics.io";

private static ArchiverImpl sharedArchiver = null;

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/kissmetrics/sdk/Connection.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* Connection interface
*/
interface Connection {
public static final String USER_AGENT = "KISSmetrics-Android/2.2.2";
public static final String USER_AGENT = "KISSmetrics-Android/2.3.0";

/**
* Makes a request to the provided API query urlString.
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/kissmetrics/sdk/VerificationImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
*/
class VerificationImpl {
private static final Integer CONNECTION_TIMEOUT = 20;
private final String TRK_URL = "https://et.kissmetrics.com/m/trk";
private final String TRK_URL = "https://et.kissmetrics.io/m/trk";

private HttpURLConnection connection;

Expand Down Expand Up @@ -109,7 +109,7 @@ public void verifyTracking(String productKey, String installUuid, VerificationDe
}
br.close();

// Expected JSON payload = { "reason": "PRODUCT_SAMPLING", "tracking": false, "tracking_endpoint": "trk.kissmetrics.com"}
// Expected JSON payload = { "reason": "PRODUCT_SAMPLING", "tracking": false, "tracking_endpoint": "trc.kissmetrics.io"}
String jsonString = sb.toString();
JSONObject jsonObject = new JSONObject(jsonString);
doTrack = jsonObject.getBoolean("tracking");
Expand Down

0 comments on commit d22327e

Please sign in to comment.