Skip to content
This repository has been archived by the owner on Feb 19, 2020. It is now read-only.

Commit

Permalink
Merge pull request #325 from bitstadium/release/5.0.4
Browse files Browse the repository at this point in the history
Release/5.0.4
  • Loading branch information
Benjamin Scholtysik (Reimold) authored Nov 21, 2017
2 parents b216501 + 775a212 commit db4c38a
Show file tree
Hide file tree
Showing 46 changed files with 265 additions and 225 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[![Build Status](https://www.bitrise.io/app/562949a18404dad6/status.svg?token=IZE4w-D2xii7QjqvJVc51A&branch=master)](https://www.bitrise.io/app/562949a18404dad6)
[![Slack Status](https://slack.hockeyapp.net/badge.svg)](https://slack.hockeyapp.net)

## Version 5.0.3
## Version 5.0.4

HockeySDK-Android implements support for using HockeyApp in your Android applications.

Expand All @@ -26,7 +26,7 @@ It is super easy to use HockeyApp in your Android app. Have a look at our [docum

Please visit [our landing page](https://support.hockeyapp.net/kb/client-integration-android) as a starting point for all of our documentation.

Please check out our [getting started documentation](https://support.hockeyapp.net/kb/client-integration-android/hockeyapp-for-android-sdk), [change log](https://github.com/bitstadium/HockeySDK-Android/releases/tag/5.0.3), [java doc](https://www.hockeyapp.net/help/sdk/android/5.0.3/index.html) as well as our [troubleshooting section](https://support.hockeyapp.net/kb/client-integration-android/hockeyapp-for-android-sdk#troubleshooting).
Please check out our [getting started documentation](https://support.hockeyapp.net/kb/client-integration-android/hockeyapp-for-android-sdk), [change log](https://github.com/bitstadium/HockeySDK-Android/releases/tag/5.0.4), [java doc](https://www.hockeyapp.net/help/sdk/android/5.0.4/index.html) as well as our [troubleshooting section](https://support.hockeyapp.net/kb/client-integration-android/hockeyapp-for-android-sdk#troubleshooting).

## 3. Contributing

Expand Down
9 changes: 5 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.android.tools.build:gradle:3.0.0'
classpath 'com.novoda:bintray-release:0.5.0'
}
}

allprojects {
repositories {
jcenter()
google()
}

tasks.withType(Javadoc) {
Expand All @@ -35,14 +37,13 @@ allprojects {

ext {
ARTIFACT_ID = 'HockeySDK'
VERSION_NAME = '5.0.3'
VERSION_CODE = 17
VERSION_NAME = '5.0.4'
VERSION_CODE = 18
SITE_URL = 'https://github.com/bitstadium/hockeysdk-android'
GIT_URL = 'https://github.com/bitstadium/HockeySDK-Android.git'
BINTRAY_USER = HOCKEYAPP_BINTRAY_USER
GROUP_NAME = 'net.hockeyapp.android'
COMPILE_SDK = 26
BUILD_TOOLS = '26.0.1'
IS_UPLOADING = project.getGradle().startParameter.taskNames.any{it.contains('bintrayUpload')}
DESCRIPTION = 'HockeySDK-Android implements support for using HockeyApp in your Android application. The following features are currently supported:\n' +
'\n' +
Expand Down
22 changes: 9 additions & 13 deletions hockeysdk/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ apply plugin: 'com.novoda.bintray-release' // must be applied after your artifac

android {
compileSdkVersion COMPILE_SDK
buildToolsVersion BUILD_TOOLS

defaultConfig {
minSdkVersion 15
Expand Down Expand Up @@ -51,19 +50,16 @@ publish {

dependencies {
// Mocking
androidTestCompile 'org.mockito:mockito-core:1.10.19'
androidTestCompile 'com.crittercism.dexmaker:dexmaker:1.4'
androidTestCompile 'com.crittercism.dexmaker:dexmaker-dx:1.4'
androidTestCompile 'com.crittercism.dexmaker:dexmaker-mockito:1.4'
androidTestImplementation 'com.linkedin.dexmaker:dexmaker-mockito:2.2.0'

testCompile 'org.powermock:powermock-api-mockito:1.6.6'
testCompile 'org.powermock:powermock-module-junit4:1.6.6'
testCompile 'org.powermock:powermock-module-junit4-rule-agent:1.6.6'
testImplementation 'org.powermock:powermock-api-mockito:1.6.6'
testImplementation 'org.powermock:powermock-module-junit4:1.6.6'
testImplementation 'org.powermock:powermock-module-junit4-rule-agent:1.6.6'

androidTestCompile 'org.hamcrest:hamcrest-core:1.3'
androidTestCompile 'org.hamcrest:hamcrest-library:1.3'
testCompile 'junit:junit:4.12'
androidTestImplementation 'org.hamcrest:hamcrest-core:1.3'
androidTestImplementation 'org.hamcrest:hamcrest-library:1.3'
testImplementation 'junit:junit:4.12'

androidTestCompile 'com.android.support.test:runner:0.5'
androidTestCompile 'com.android.support.test:rules:0.5'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test:rules:1.0.1'
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.hockeyapp.android.util;
package net.hockeyapp.android;


import android.support.test.InstrumentationRegistry;
Expand All @@ -19,6 +19,8 @@ public class ConstantsTest {
@Test
public void testLoadingConstantsWorks() throws Exception {
Constants.loadFromContext(InstrumentationRegistry.getContext());
Constants.LOADING_LATCH.await();

assertNotNull(Constants.BASE_URL);
assertEquals("https://sdk.hockeyapp.net/", Constants.BASE_URL);
assertNotNull(Constants.SDK_NAME);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,15 @@

public class CrashManagerHelper {

public static void reset(Context context) {
public static void loadConstants(Context context) throws InterruptedException {
Constants.loadFromContext(context);
Constants.LOADING_LATCH.await();
}

// Needed to get directory to write fake crashes
public static void reset(Context context) {
CrashManager.weakContext = new WeakReference<>(context);
CrashManager.latch = new CountDownLatch(1);
CrashManager.stackTracesCount = 0;
}

public static File cleanFiles(Context context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ private File lastCrashReportFile() {

@Before
public void setUp() throws Exception {
Constants.loadFromContext(InstrumentationRegistry.getTargetContext());
CrashManagerHelper.loadConstants(InstrumentationRegistry.getTargetContext());
CrashManagerHelper.reset(InstrumentationRegistry.getTargetContext());
filesDirectory = CrashManagerHelper.cleanFiles(InstrumentationRegistry.getTargetContext());
}
Expand All @@ -61,6 +61,7 @@ public void registerCrashManagerWorks() throws Exception {

// verify that there were no crashes in the last session
assertFalse(CrashManager.didCrashInLastSession().get());
assertEquals(0, CrashManager.stackTracesCount);
}

@Test
Expand All @@ -71,6 +72,7 @@ public void crashInLastSessionRecognized() throws Exception {

assertTrue(CrashManager.didCrashInLastSession().get());
assertNotNull(CrashManager.getLastCrashDetails(InstrumentationRegistry.getTargetContext()).get());
assertEquals(1, CrashManager.stackTracesCount);
}

@Test
Expand All @@ -80,8 +82,8 @@ public void crashDetailsInLastSessionCorrect() throws Exception {
CrashManager.register(InstrumentationRegistry.getTargetContext(), DUMMY_APP_IDENTIFIER);

CrashDetails crashDetails = CrashManager.getLastCrashDetails(InstrumentationRegistry.getTargetContext()).get();

assertNotNull(crashDetails);
assertEquals(1, CrashManager.stackTracesCount);

File lastStackTrace = lastCrashReportFile();
assertNotNull(lastStackTrace);
Expand All @@ -94,8 +96,8 @@ public void crashDetailsInLastSessionCorrect() throws Exception {
fakeCrashReport();

crashDetails = CrashManager.getLastCrashDetails(InstrumentationRegistry.getTargetContext()).get();

assertNotNull(crashDetails);
assertEquals(4, CrashManager.stackTracesCount);

lastStackTrace = lastCrashReportFile();
assertNotNull(lastStackTrace);
Expand All @@ -113,6 +115,7 @@ public void xamarinCrashCorrect() throws Exception {

CrashDetails crashDetails = CrashManager.getLastCrashDetails(InstrumentationRegistry.getTargetContext()).get();
assertNotNull(crashDetails);
assertEquals(2, CrashManager.stackTracesCount);
assertEquals(crashDetails.getFormat(), "Xamarin");
String throwableStackTrace = crashDetails.getThrowableStackTrace();
Boolean containsCausedByXamarin = throwableStackTrace.contains("Xamarin caused by:");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,40 @@
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;

import junit.framework.TestCase;

import org.junit.Test;
import org.junit.runner.RunWith;

import java.io.File;

import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

/**
* <h3>Description</h3>
*
* This class provides testing for the environment features, such as the SDK wide constants.
*/
@RunWith(AndroidJUnit4.class)
public class EnvironmentTest extends TestCase {
public class EnvironmentTest {

/*
* This test is disabled since it is always failing on emulators with API under 18. The problem
* is that emulators start with external storage being in removed state and necessary directory
* can not be created.
*
* TODO: Uncomment test in case emulators with API under 18 start supporting external storage
*/
/**
* Test to verify basic creation of the external storage directory works.
*/
@Test
//@Test
public void basicStorageDirTest() {
File storageDir = Constants.getHockeyAppStorageDir(InstrumentationRegistry.getTargetContext());

assertNotNull(storageDir);
assertTrue(storageDir.exists());
}

@Test
public void dummyTestMethod() {}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package net.hockeyapp.android;

import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;

Expand All @@ -10,6 +11,7 @@
import org.junit.runner.RunWith;

import java.io.File;
import java.lang.ref.WeakReference;

import static org.junit.Assert.*;

Expand All @@ -20,12 +22,11 @@ public class ExceptionHandlerTest {

@Before
public void setUp() throws Exception {
Constants.loadFromContext(InstrumentationRegistry.getTargetContext());
CrashManagerHelper.loadConstants(InstrumentationRegistry.getTargetContext());
CrashManagerHelper.reset(InstrumentationRegistry.getTargetContext());
filesDirectory = CrashManagerHelper.cleanFiles(InstrumentationRegistry.getTargetContext());
}

@SuppressWarnings("ThrowableInstanceNeverThrown")
@Test
public void saveExceptionTest() {

Expand All @@ -41,6 +42,40 @@ public void saveExceptionTest() {
assertEquals(3, files.length);
}

@Test
public void maxFilesTest() {
WeakReference<Context> weakContext = new WeakReference<>(InstrumentationRegistry.getTargetContext());
String[] files;
for (int i = 0; i < CrashManager.MAX_NUMBER_OF_CRASHFILES; i++) {
files = CrashManager.searchForStackTraces(weakContext);
assertNotNull(files);
assertEquals(i, files.length);
assertEquals(i, CrashManager.stackTracesCount);

fakeCrashReport();
}

files = CrashManager.searchForStackTraces(weakContext);
assertNotNull(files);
assertEquals(CrashManager.MAX_NUMBER_OF_CRASHFILES, files.length);
assertEquals(CrashManager.MAX_NUMBER_OF_CRASHFILES, CrashManager.stackTracesCount);

fakeCrashReport();

files = CrashManager.searchForStackTraces(weakContext);
assertNotNull(files);
assertEquals(CrashManager.MAX_NUMBER_OF_CRASHFILES, files.length);
assertEquals(CrashManager.MAX_NUMBER_OF_CRASHFILES, CrashManager.stackTracesCount);

fakeCrashReport();
fakeCrashReport();

files = CrashManager.searchForStackTraces(weakContext);
assertNotNull(files);
assertEquals(CrashManager.MAX_NUMBER_OF_CRASHFILES, files.length);
assertEquals(CrashManager.MAX_NUMBER_OF_CRASHFILES, CrashManager.stackTracesCount);
}

@SuppressWarnings("ThrowableInstanceNeverThrown")
@Test
public void saveExceptionCustomListenerTest() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public void setUp() throws Exception {
* will write to a different preferences key than the test tracking module
*/
Constants.loadFromContext(mActivityRule.getActivity());
Constants.LOADING_LATCH.await();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class CrashDetailsTest {

@Before
public void setUp() throws Exception {
Constants.loadFromContext(InstrumentationRegistry.getTargetContext());
CrashManagerHelper.loadConstants(InstrumentationRegistry.getTargetContext());
CrashManagerHelper.reset(InstrumentationRegistry.getTargetContext());
filesDirectory = CrashManagerHelper.cleanFiles(InstrumentationRegistry.getTargetContext());

Expand Down
2 changes: 1 addition & 1 deletion hockeysdk/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="18" />
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />

<application>
<application android:supportsRtl="true">

<activity android:name=".UpdateActivity" />
<activity android:name=".FeedbackActivity" android:windowSoftInputMode="adjustResize|stateVisible" />
Expand Down
Loading

0 comments on commit db4c38a

Please sign in to comment.