Skip to content

Commit

Permalink
Merge pull request #366 from openxc/next
Browse files Browse the repository at this point in the history
v7.1 release
  • Loading branch information
pjt0620 authored May 5, 2020
2 parents 8ae62b0 + c6e207e commit 6d6f6fd
Show file tree
Hide file tree
Showing 107 changed files with 2,212 additions and 1,801 deletions.
15 changes: 12 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,23 @@ jdk:
- openjdk8
android:
components:
- platform-tools
- tools
- platform-tools
- build-tools-28.0.3
- android-28
- android-29
- android-22
- extra-android-support
- extra-android-m2repository
- sys-img-armeabi-v7a-android-22
before_script:
- echo no | android create avd --force -n test -t android-22 --abi armeabi-v7a -c 100M
- emulator -avd test -no-boot-anim -no-window &
- android-wait-for-emulator
- adb shell input keyevent 82 &
script:
- ' ./gradlew build test && ./gradlew testDebug'
- './gradlew build test && ./gradlew testDebug'
- './gradlew connectedCheck'
deploy:
- provider: releases
overwrite: true
Expand Down Expand Up @@ -42,4 +51,4 @@ env:
- secure: VHn45y17v68I/VNhIBCNue9eRMdaRurHBSu8cGO3NLcjZFpJqYehqKnwhjIS2eP1SDHEM++LFz6XpANpU4KwdjnYaP5qEU4b2zEVqvc+9GZK37kFIaeSaOrvoRGYVrzp+oeU8ehG6MjsgXWjIwE4QNLVc8dinILjuqWXY5zxqGs=
- GRADLE_OPTS="-Xmx1024m -XX:MaxPermSize=1024m"
after_success:
- scripts/push-javadoc.sh
- scripts/push-javadoc.sh
7 changes: 6 additions & 1 deletion CHANGELOG.mkd
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# OpenXC Android Library Changelog

## v7.1.0

* Android 10 support
* Updated multi-frame read support
* Bug fixes
* SonarQube suggested refactors

## v7.0.8

Expand All @@ -12,7 +18,6 @@
* Improvement: Tracefile playing disable while recording is on and vice versa
* Improvement: Updated the protobuf version


## v7.0.0

* New Feature: Now supports sending control commands on-demand
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ ext {
targetSdkVersion = 28

versionMajor = 7
versionMinor = 0
versionPatch = 8
versionMinor = 1
versionPatch = 0

versionCode = versionMajor * 1000000 + versionMinor * 1000 + versionPatch
versionName = "${versionMajor}.${versionMinor}.${versionPatch}"
Expand Down
10 changes: 7 additions & 3 deletions enabler/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ android {
versionCode rootProject.ext.versionCode
versionName rootProject.ext.versionName
multiDexEnabled true
testInstrumentationRunner "android.test.InstrumentationTestRunner"

}

Expand Down Expand Up @@ -59,6 +60,7 @@ android {

lintOptions {
abortOnError false
disable 'LongLogTag'
}

packagingOptions {
Expand All @@ -73,6 +75,9 @@ android {
serviceAccountCredentials = file("../secret.json")
track = 'beta'
}

useLibrary 'android.test.base'
useLibrary 'android.test.runner'
}

dependencies {
Expand All @@ -81,11 +86,10 @@ dependencies {
implementation 'com.bugsnag:bugsnag-android:4.3.2'
implementation 'com.microsoft.appcenter:appcenter-analytics:2.3.0'
implementation 'com.microsoft.appcenter:appcenter-crashes:2.3.0'
implementation "commons-io:commons-io:2.6"


androidTestImplementation 'junit:junit:4.12'
androidTestImplementation 'org.hamcrest:hamcrest-library:1.3'
androidTestImplementation 'org.mockito:mockito-core:2.23.0'
androidTestImplementation 'com.google.dexmaker:dexmaker:1.2'
androidTestImplementation 'com.google.dexmaker:dexmaker-mockito:1.2'
androidTestImplementation 'com.linkedin.dexmaker:dexmaker-mockito:2.25.1'
}
14 changes: 9 additions & 5 deletions enabler/src/androidTest/java/com/openxc/TestUtils.java
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
package com.openxc;

import static org.junit.Assert.*;
import android.content.Context;

import org.apache.commons.io.FileUtils;

import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;

import org.apache.commons.io.FileUtils;

import android.content.Context;
import static org.junit.Assert.fail;

public class TestUtils {
public static void pause(int millis) {
//libraries such as Awaitility instead of thread sleep
try {
Thread.sleep(millis);
} catch(InterruptedException e) {}
} catch(InterruptedException e) {

}

}

public static URI copyToStorage(Context context, int resource,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import android.content.Intent;
import android.test.ServiceTestCase;
import android.test.suitebuilder.annotation.MediumTest;
import android.test.suitebuilder.annotation.SmallTest;

public class VehicleServiceTest extends ServiceTestCase<VehicleService> {
Intent startIntent;
Expand All @@ -20,15 +19,6 @@ protected void setUp() throws Exception {
VehicleService.sIsUnderTest = true;
}

@SmallTest
public void testPreconditions() {
}

@SmallTest
public void testStartable() {
startService(startIntent);
}

@MediumTest
public void testUsingUsbSource() {
assertNotNull(bindService(startIntent));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,111 +1,115 @@
//package com.openxc.sources.trace;
//
//import java.net.MalformedURLException;
//import java.net.URI;
//import java.net.URISyntaxException;
//import java.net.URL;
//
//import android.test.AndroidTestCase;
//import android.test.suitebuilder.annotation.SmallTest;
//
//import com.openxc.TestUtils;
//import com.openxc.messages.SimpleVehicleMessage;
//import com.openxc.messages.VehicleMessage;
//import com.openxc.sources.DataSourceException;
//import com.openxc.sources.SourceCallback;
//import com.openxc.sources.VehicleDataSource;
//import com.openxcplatform.enabler.R;
//
//public class TraceVehicleDataSourceTest extends AndroidTestCase {
// URI traceUri;
// URI malformedTraceUri;
// TraceVehicleDataSource source;
// Thread thread;
// SourceCallback callback;
// boolean receivedNumericalCallback;
// boolean receivedBooleanCallback;;
//
// @Override
// protected void setUp() {
// traceUri = TestUtils.copyToStorage(getContext(), R.raw.tracejson,
// "trace.json");
// malformedTraceUri = TestUtils.copyToStorage(getContext(),
// R.raw.tracetxt, "malformed-trace.json");
// callback = new SourceCallback() {
// public void receive(VehicleMessage message) {
// SimpleVehicleMessage simpleMessage = (SimpleVehicleMessage) message;
// if(simpleMessage.getValue().getClass() == Boolean.class) {
// receivedBooleanCallback = true;
// } else if(simpleMessage.getValue().getClass() == Double.class) {
// receivedNumericalCallback = true;
// }
// }
//
// public void sourceDisconnected(VehicleDataSource source) { }
//
// public void sourceConnected(VehicleDataSource source) { }
// };
// }
//
// @Override
// protected void tearDown() throws Exception {
// if(source != null) {
// source.stop();
// }
// if(thread != null) {
// try {
// thread.join();
// } catch(InterruptedException e) {}
// }
// super.tearDown();
// }
//
// private void startTrace(TraceVehicleDataSource source) {
// thread = new Thread(source);
// thread.start();
// try {
// Thread.sleep(500);
// } catch(InterruptedException e){ }
// }
//
// @SmallTest
// public void testPlaybackFile() throws InterruptedException,
// DataSourceException {
// receivedNumericalCallback = false;
// receivedBooleanCallback = false;
// source = new TraceVehicleDataSource(callback, getContext(), traceUri);
// startTrace(source);
// assertTrue(receivedNumericalCallback);
// assertTrue(receivedBooleanCallback);
// }
//
// @SmallTest
// public void testMalformedJson() throws InterruptedException ,
// DataSourceException {
// receivedNumericalCallback = false;
// receivedBooleanCallback = false;
// source = new TraceVehicleDataSource(callback, getContext(),
// malformedTraceUri);
// startTrace(source);
// assertFalse(receivedNumericalCallback);
// source.stop();
// }
//
// @SmallTest
// public void testMissingFile() throws MalformedURLException,
// InterruptedException, DataSourceException,
// URISyntaxException {
// receivedNumericalCallback = false;
// receivedBooleanCallback = false;
// source = new TraceVehicleDataSource(callback, getContext(),
// new URL("file:///foo").toURI());
// startTrace(source);
// assertFalse(receivedNumericalCallback);
// }
//
// @SmallTest
// public void testConstructWithCallbackAndFile()
// throws DataSourceException {
// source = new TraceVehicleDataSource(callback, getContext(), traceUri);
// }
//}
package com.openxc.sources.trace;

import android.test.AndroidTestCase;
import android.test.suitebuilder.annotation.SmallTest;

import com.openxc.TestUtils;
import com.openxc.messages.SimpleVehicleMessage;
import com.openxc.messages.VehicleMessage;
import com.openxc.sources.DataSourceException;
import com.openxc.sources.SourceCallback;
import com.openxc.sources.VehicleDataSource;
import com.openxcplatform.enabler.R;

import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;

public class TraceVehicleDataSourceTest extends AndroidTestCase {
URI traceUri;
URI malformedTraceUri;
TraceVehicleDataSource source;
Thread thread;
SourceCallback callback;
boolean receivedNumericalCallback;
boolean receivedBooleanCallback;;

@Override
protected void setUp() throws Exception {
super.setUp();
traceUri = TestUtils.copyToStorage(getContext(), R.raw.tracejson,
"trace.json");
malformedTraceUri = TestUtils.copyToStorage(getContext(),
R.raw.tracetxt, "malformed-trace.json");
callback = new SourceCallback() {
public void receive(VehicleMessage message) {
SimpleVehicleMessage simpleMessage = (SimpleVehicleMessage) message;
if(simpleMessage.getValue().getClass() == Boolean.class) {
receivedBooleanCallback = true;
} else if(simpleMessage.getValue().getClass() == Double.class) {
receivedNumericalCallback = true;
}
}

public void sourceDisconnected(VehicleDataSource source) { }

public void sourceConnected(VehicleDataSource source) { }
};
}

@Override
protected void tearDown() throws Exception {
if(source != null) {
source.stop();
}
if(thread != null) {
try {
thread.join();
} catch(InterruptedException e) {}
}
super.tearDown();
}

private void startTrace(TraceVehicleDataSource source) {
thread = new Thread(source);
thread.start();
try {
Thread.sleep(500);
} catch(InterruptedException e) {}
// SystemClock.sleep(500);
}

@SmallTest
public void testPlaybackFile() throws InterruptedException,
DataSourceException {
receivedNumericalCallback = false;
receivedBooleanCallback = false;
source = new TraceVehicleDataSource(callback, getContext(), traceUri);
startTrace(source);
assertTrue(receivedNumericalCallback);
assertTrue(receivedBooleanCallback);
}

@SmallTest
public void testMalformedJson() throws InterruptedException ,
DataSourceException {
receivedNumericalCallback = false;
receivedBooleanCallback = false;
source = new TraceVehicleDataSource(callback, getContext(),
malformedTraceUri);
startTrace(source);
assertFalse(receivedNumericalCallback);
source.stop();
}

@SmallTest
public void testMissingFile() throws MalformedURLException,
InterruptedException, DataSourceException,
URISyntaxException {
receivedNumericalCallback = false;
receivedBooleanCallback = false;
source = new TraceVehicleDataSource(callback, getContext(),
new URL("file:///foo").toURI());
startTrace(source);
assertFalse(receivedNumericalCallback);
}

@SmallTest
public void testConstructWithCallbackAndFile()
throws DataSourceException {
receivedNumericalCallback = false;
source = new TraceVehicleDataSource(callback, getContext(), traceUri);
assertFalse(receivedNumericalCallback);
}
}
Loading

0 comments on commit 6d6f6fd

Please sign in to comment.