Skip to content
This repository was archived by the owner on Mar 26, 2024. It is now read-only.

Commit 34ee682

Browse files
committed
Merged release-0.8 into master
2 parents 30a8a1b + 254a4f1 commit 34ee682

File tree

655 files changed

+10923
-2002
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

655 files changed

+10923
-2002
lines changed

.travis.yml

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ language: android
33
jdk: oraclejdk8
44
compiler: gcc
55

6+
addons:
7+
sonarqube:
8+
branches:
9+
- master
10+
- develop
11+
612
env:
713
matrix:
814
- ANDROID_TARGET=android-22 ANDROID_ABI=armeabi-v7a
@@ -31,9 +37,9 @@ install:
3137

3238
before_script:
3339
# Compile OpenCV and set it to path
34-
- wget https://github.com/opencv/opencv/archive/3.1.0.zip
35-
- unzip 3.1.0.zip >/dev/null
36-
- mv opencv-3.1.0 opencv
40+
- wget https://github.com/opencv/opencv/archive/3.2.0.zip
41+
- unzip 3.2.0.zip >/dev/null
42+
- mv opencv-3.2.0 opencv
3743
- cd opencv
3844
- mkdir build
3945
- cd build
@@ -42,7 +48,7 @@ before_script:
4248
- sudo make -j8 install >/dev/null
4349
- cd ../..
4450
- mkdir opencv_lib
45-
- cp opencv/build/lib/libopencv_java310.so opencv_lib/libopencv_java310.so
51+
- cp opencv/build/lib/libopencv_java320.so opencv_lib/libopencv_java320.so
4652
- export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/opencv_lib/
4753
- chmod +x gradlew
4854
# Create gradle.properties with fake credentials
@@ -53,6 +59,8 @@ script:
5359
- ./gradlew assembleDebug lint
5460
# Run test coverage report
5561
- ./gradlew jacocoTestMockDebugUnitTestReport
62+
# Run SonarQube analysis
63+
- ./gradlew sonarqube
5664
# Build test app
5765
# ./gradlew assembleAndroidTest
5866
# Create and lunch emulator
@@ -67,4 +75,7 @@ after_success:
6775

6876
cache:
6977
directories:
70-
- $HOME/.gradle
78+
- '$HOME/.m2/repository'
79+
- '$HOME/.sonar/cache'
80+
- '$HOME/.gradle'
81+
- '.gradle'

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
![header](https://cloud.githubusercontent.com/assets/6546265/19186791/3e4ee522-8c88-11e6-8074-a4c9219871fc.png)
1+
![header](https://cloud.githubusercontent.com/assets/6546265/22174630/785cdf04-dfe3-11e6-8cf4-024e8dc1c051.png)
22

3-
[![ZenHub](https://raw.githubusercontent.com/ZenHubIO/support/master/zenhub-badge.png)](https://zenhub.com)
43
[![GitHub Issues](https://img.shields.io/github/issues/davidmigloz/go-bees.svg)](https://github.com/davidmigloz/go-bees/issues)
54
[![Build Status](https://travis-ci.org/davidmigloz/go-bees.svg?branch=master)](https://travis-ci.org/davidmigloz/go-bees)
65
[![codecov](https://codecov.io/gh/davidmigloz/go-bees/branch/master/graph/badge.svg)](https://codecov.io/gh/davidmigloz/go-bees)
76
[![Code Climate](https://codeclimate.com/github/davidmigloz/go-bees/badges/gpa.svg)](https://codeclimate.com/github/davidmigloz/go-bees)
7+
[![SonarQube](https://sonarqube.com/api/badges/gate?key=go-bees%3Amaster)](https://sonarqube.com/dashboard/index/go-bees%3Amaster)
88
[![Dependency Status](https://www.versioneye.com/user/projects/57f7b19e823b88004e06ad33/badge.svg?style=flat-square)](https://www.versioneye.com/user/projects/57f7b19e823b88004e06ad33)
99
[![Documentation Status](https://readthedocs.org/projects/go-bees/badge/?version=develop)](http://go-bees.readthedocs.io/es/develop/?badge=develop)
1010

app/build.gradle

Lines changed: 30 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,15 @@ apply plugin: 'realm-android'
2323
android {
2424
compileSdkVersion 25
2525
buildToolsVersion '25.0.0'
26-
2726
defaultConfig {
2827
applicationId "com.davidmiguel.gobees"
2928
minSdkVersion 19
3029
targetSdkVersion 25
31-
versionCode 7
32-
versionName "v0.7"
30+
versionCode 10
31+
versionName "v1.0"
3332

3433
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
3534
}
36-
3735
buildTypes {
3836
debug {
3937
testCoverageEnabled true
@@ -50,12 +48,10 @@ android {
5048
testProguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguardTest-rules.pro'
5149
}
5250
}
53-
5451
buildTypes.each {
5552
// OpenWeatherMap key (stored in [USER_HOME]/.gradle/gradle.properties)
5653
it.buildConfigField 'String', 'OPEN_WEATHER_MAP_API_KEY', OpenWeatherMapApiKey
5754
}
58-
5955
// Mock: stubs out the service layer completely and returns a fake dataset
6056
// Prod: production version
6157
productFlavors {
@@ -66,26 +62,27 @@ android {
6662

6763
}
6864
}
69-
7065
// Remove mockRelease as it's not needed.
7166
android.variantFilter { variant ->
7267
if (variant.buildType.name.equals('release')
7368
&& variant.getFlavors().get(0).name.equals('mock')) {
7469
variant.setIgnore(true);
7570
}
7671
}
77-
7872
// android.jar methods return either null or zero, not throw exceptions
7973
testOptions {
8074
unitTests.returnDefaultValues = true
8175
}
82-
8376
// Always show the result of every unit test, even if it passes
8477
testOptions.unitTests.all {
8578
testLogging {
8679
events 'passed', 'skipped', 'failed', 'standardOut', 'standardError'
8780
}
8881
}
82+
// Lint checks
83+
lintOptions {
84+
disable 'SetJavaScriptEnabled', 'MissingTranslation'
85+
}
8986
}
9087

9188
sourceSets {
@@ -95,41 +92,39 @@ sourceSets {
9592
}
9693

9794
dependencies {
95+
9896
// App's dependencies, including test
9997
compile 'com.android.support:recyclerview-v7:25.1.0'
10098
compile 'com.android.support:appcompat-v7:25.1.0'
10199
compile 'com.android.support:design:25.1.0'
102100
compile 'com.android.support:cardview-v7:25.1.0'
103101
compile 'com.android.support:support-v4:25.1.0'
104-
compile 'com.github.davidmigloz:opencv-android-gradle-repo:3.1.0'
102+
compile 'com.github.davidmigloz:opencv-android-gradle-repo:3.2.0'
105103
compile 'com.google.android.gms:play-services-location:10.0.1'
106104
compile 'com.google.guava:guava:20.0'
107105
compile 'com.makeramen:roundedimageview:2.3.0'
108106
compile 'com.github.PhilJay:MPAndroidChart:v3.0.1'
109107
compile 'com.vanniktech:vntnumberpickerpreference:1.0.0'
110108
compile 'rebus:permission-utils:1.0.6'
111-
112109
// Dependencies for local unit tests
113110
testCompile 'junit:junit:4.12'
114111
testCompile 'org.mockito:mockito-all:2.0.2-beta'
112+
testCompile 'org.powermock:powermock-module-junit4:1.6.6'
113+
testCompile 'org.powermock:powermock-api-mockito:1.6.6'
115114
testCompile 'org.slf4j:slf4j-api:1.7.22'
116115
testCompile 'org.slf4j:slf4j-log4j12:1.7.22'
117116
testCompile 'log4j:log4j:1.2.17'
118117
testCompile 'org.json:json:20160810'
119-
120118
// Android Testing Support Library's runner and rules
121119
androidTestCompile 'com.android.support.test:runner:0.5'
122120
androidTestCompile 'com.android.support.test:rules:0.5'
123-
124121
// Dependencies for Android unit tests
125122
androidTestCompile 'junit:junit:4.12'
126-
androidTestCompile 'org.mockito:mockito-core:2.5.5'
127-
123+
androidTestCompile 'org.mockito:mockito-core:2.6.2'
128124
// Espresso UI Testing
129125
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
130126
androidTestCompile 'com.android.support.test.espresso:espresso-contrib:2.2.2'
131127
androidTestCompile 'com.android.support.test.espresso:espresso-intents:2.2.2'
132-
133128
// Resolve conflicts between main and test APK:
134129
androidTestCompile 'com.android.support:support-annotations:25.1.0'
135130
androidTestCompile 'com.android.support:support-v4:25.1.0'
@@ -155,7 +150,7 @@ configurations.compile.dependencies.each { compileDependency ->
155150
Copy test resources directory (test/mock/debug).
156151
*/
157152
task copyResDirectoryToTestMockDebugClasses(type: Copy) {
158-
from "${projectDir}/src/test/res"
153+
from "${projectDir}/src/testMock/res"
159154
into "${buildDir}/intermediates/classes/test/mock/debug/res"
160155
}
161156

@@ -165,3 +160,21 @@ Run copy test resources directory tasks before build.
165160
afterEvaluate {
166161
preBuild.dependsOn(copyResDirectoryToTestMockDebugClasses)
167162
}
163+
164+
/*
165+
SonarQube configuration.
166+
167+
*/
168+
sonarqube {
169+
properties {
170+
property "sonar.projectName", "GoBees"
171+
property "sonar.projectKey", "com.davidmiguel.gobees"
172+
property "sonar.projectVersion", versionName
173+
property "sonar.exclusions", "**/*.png,**/*.jpg"
174+
property "sonar.android.lint.report", "./build/outputs/lint-results-mockDebug.xml"
175+
property "sonar.junit.reportsPath", "./build/test-results/mockDebug"
176+
property "sonar.jacoco.reportPath", "./build/jacoco/testMockDebugUnitTest.exec"
177+
property "sonar.java.coveragePlugin", "jacoco"
178+
property "sonar.jacoco.reportMissing.force.zero", true
179+
}
180+
}

app/proguard-rules.pro

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,6 @@
4848
# Guava 19.0
4949
-dontwarn java.lang.ClassValue
5050
-dontwarn com.google.j2objc.annotations.Weak
51-
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
51+
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
52+
# RecyclerView
53+
-keep class android.support.v7.widget.RecyclerView { *; }

app/proguardTest-rules.pro

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,6 @@
4141
# Guava 19.0
4242
-dontwarn java.lang.ClassValue
4343
-dontwarn com.google.j2objc.annotations.Weak
44-
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
44+
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
45+
# RecyclerView
46+
-keep class android.support.v7.widget.RecyclerView { *; }
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
/*
2+
* GoBees
3+
* Copyright (c) 2016 - 2017 David Miguel Lozano
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
14+
* or implied. See the License for the specific language governing
15+
* permissions and limitations under the License.
16+
*/
17+
18+
package com.davidmiguel.gobees.about;
19+
20+
21+
import android.support.test.espresso.ViewInteraction;
22+
import android.support.test.rule.ActivityTestRule;
23+
import android.support.test.runner.AndroidJUnit4;
24+
import android.support.test.filters.LargeTest;
25+
import android.view.View;
26+
import android.view.ViewGroup;
27+
import android.view.ViewParent;
28+
29+
import com.davidmiguel.gobees.R;
30+
import com.davidmiguel.gobees.splash.SplashActivity;
31+
32+
import org.hamcrest.Description;
33+
import org.hamcrest.Matcher;
34+
import org.hamcrest.TypeSafeMatcher;
35+
import org.junit.Rule;
36+
import org.junit.Test;
37+
import org.junit.runner.RunWith;
38+
39+
import static android.support.test.espresso.Espresso.onView;
40+
import static android.support.test.espresso.action.ViewActions.click;
41+
import static android.support.test.espresso.assertion.ViewAssertions.matches;
42+
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
43+
import static android.support.test.espresso.matcher.ViewMatchers.withContentDescription;
44+
import static android.support.test.espresso.matcher.ViewMatchers.withId;
45+
import static android.support.test.espresso.matcher.ViewMatchers.withParent;
46+
import static android.support.test.espresso.matcher.ViewMatchers.withText;
47+
import static org.hamcrest.Matchers.allOf;
48+
49+
/**
50+
* About GoBees test.
51+
*/
52+
@LargeTest
53+
@RunWith(AndroidJUnit4.class)
54+
public class AboutTest {
55+
56+
@Rule
57+
public ActivityTestRule<SplashActivity> mActivityTestRule =
58+
new ActivityTestRule<>(SplashActivity.class);
59+
60+
private static Matcher<View> childAtPosition(
61+
final Matcher<View> parentMatcher, final int position) {
62+
63+
return new TypeSafeMatcher<View>() {
64+
@Override
65+
public void describeTo(Description description) {
66+
description.appendText("Child at position " + position + " in parent ");
67+
parentMatcher.describeTo(description);
68+
}
69+
70+
@Override
71+
public boolean matchesSafely(View view) {
72+
ViewParent parent = view.getParent();
73+
return parent instanceof ViewGroup && parentMatcher.matches(parent)
74+
&& view.equals(((ViewGroup) parent).getChildAt(position));
75+
}
76+
};
77+
}
78+
79+
@Test
80+
public void aboutTest() {
81+
ViewInteraction appCompatImageButton = onView(
82+
allOf(withContentDescription("Navigate up"),
83+
withParent(withId(R.id.toolbar)),
84+
isDisplayed()));
85+
appCompatImageButton.perform(click());
86+
87+
ViewInteraction appCompatCheckedTextView = onView(
88+
allOf(withId(R.id.design_menu_item_text), withText("About GoBees"), isDisplayed()));
89+
appCompatCheckedTextView.perform(click());
90+
91+
ViewInteraction textView = onView(
92+
allOf(withId(R.id.app_name), withText("GoBees App"),
93+
childAtPosition(
94+
allOf(withId(R.id.linear_layout),
95+
childAtPosition(
96+
withId(R.id.contentFrame),
97+
0)),
98+
1),
99+
isDisplayed()));
100+
textView.check(matches(withText("GoBees App")));
101+
102+
ViewInteraction button = onView(
103+
allOf(withId(R.id.website_btn),
104+
childAtPosition(
105+
childAtPosition(
106+
withId(R.id.linear_layout),
107+
3),
108+
0),
109+
isDisplayed()));
110+
button.check(matches(isDisplayed()));
111+
112+
ViewInteraction button2 = onView(
113+
allOf(withId(R.id.license_btn),
114+
childAtPosition(
115+
childAtPosition(
116+
withId(R.id.linear_layout),
117+
3),
118+
1),
119+
isDisplayed()));
120+
button2.check(matches(isDisplayed()));
121+
122+
ViewInteraction button3 = onView(
123+
allOf(withId(R.id.changelog_btn),
124+
childAtPosition(
125+
childAtPosition(
126+
withId(R.id.linear_layout),
127+
3),
128+
2),
129+
isDisplayed()));
130+
button3.check(matches(isDisplayed()));
131+
}
132+
}

0 commit comments

Comments
 (0)