Skip to content

Commit

Permalink
Merge pull request #907 from dhis2/hotbugfixing
Browse files Browse the repository at this point in the history
fix: [HOTBUGFIXING] Version 0.17.1
  • Loading branch information
vgarciabnz authored Jul 11, 2019
2 parents 0f7b112 + bbb2882 commit 9217c69
Show file tree
Hide file tree
Showing 1,382 changed files with 9,500 additions and 6,671 deletions.
7 changes: 4 additions & 3 deletions .buildscript/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@

SLUG="dhis2/dhis2-android-sdk"
JDK="oraclejdk8"
BRANCH="master"
MASTER_BRANCH="master"
MASTERDEV_BRANCH="master-dev"

set -e

Expand All @@ -17,8 +18,8 @@ elif [ "$TRAVIS_JDK_VERSION" != "$JDK" ]; then
echo "Skipping snapshot deployment: wrong JDK. Expected '$JDK' but was '$TRAVIS_JDK_VERSION'."
elif [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
echo "Skipping snapshot deployment: was pull request."
elif [ "$TRAVIS_BRANCH" != "$BRANCH" ]; then
echo "Skipping snapshot deployment: wrong branch. Expected '$BRANCH' but was '$TRAVIS_BRANCH'."
elif [ "$TRAVIS_BRANCH" != "$MASTER_BRANCH" ] && [ "$TRAVIS_BRANCH" != "$MASTERDEV_BRANCH" ]; then
echo "Skipping snapshot deployment: wrong branch. Expected '$MASTER_BRANCH' or '$MASTERDEV_BRANCH' but was '$TRAVIS_BRANCH'."
else
echo "Deploying snapshot..."
./gradlew uploadArchives -PNEXUS_USERNAME="${NEXUS_USERNAME}" -PNEXUS_PASSWORD="${NEXUS_PASSWORD}"
Expand Down
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ branches:
- master
- develop
- master-sms
- master-dev

script:
- travis_wait 70 "./build.sh"
Expand Down
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
PROJECT_DIR=$DIR/

# This will: compile the project, run lint, run tests under JVM, package apk, check the code quality and run tests on the device/emulator.
"$PROJECT_DIR"/gradlew clean build --scan connectedAndroidTest
"$PROJECT_DIR"/gradlew clean checkstyleDebug findbugsDebug pmdDebug lintDebug testDebug connectedDebugAndroidTest --scan
6 changes: 3 additions & 3 deletions core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ ext {
buildToolsVersion: "28.0.3",
minSdkVersion : 19,
targetSdkVersion : 28,
versionCode : 135,
versionName : "0.16.4-SNAPSHOT"
versionCode : 171,
versionName : "0.17.1-SNAPSHOT"
]

libraries = [
Expand Down Expand Up @@ -193,7 +193,7 @@ dependencies {
api "joda-time:joda-time:2.9.9"

// sms compression library
api 'com.github.eHealthAfrica:dhis2-sms-compression:0.0.9'
api 'com.github.eHealthAfrica:dhis2-sms-compression:0.0.12'

// Extension which generates mappers for work with cursor and content values
api "com.gabrielittner.auto.value:auto-value-cursor-annotations:${libraries.autovaluecursor}"
Expand Down
4 changes: 2 additions & 2 deletions core/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
# Properties which are consumed by plugins/gradle-mvn-push.gradle plugin.
# They are used for publishing artifact to snapshot repository.

VERSION_NAME=0.16.4-SNAPSHOT
VERSION_CODE=135
VERSION_NAME=0.17.1-SNAPSHOT
VERSION_CODE=171

GROUP=org.hisp.dhis

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
package org.hisp.dhis.android.core;

import org.hisp.dhis.android.core.event.Event;
import org.hisp.dhis.android.core.event.EventStore;
import org.hisp.dhis.android.core.event.EventStoreImpl;
import org.hisp.dhis.android.core.event.internal.EventStore;
import org.hisp.dhis.android.core.event.internal.EventStoreImpl;
import org.hisp.dhis.android.core.utils.integration.mock.BaseMockIntegrationTestMetadataEnqueable;
import org.hisp.dhis.android.core.utils.runner.D2JunitRunner;
import org.junit.Test;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,17 @@

package org.hisp.dhis.android.core;

import org.hisp.dhis.android.core.common.D2Factory;
import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest;
import android.util.Log;

import org.hisp.dhis.android.core.d2manager.D2Factory;
import org.hisp.dhis.android.core.data.server.RealServerMother;
import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest;
import org.junit.Before;

import java.io.IOException;

import io.reactivex.schedulers.Schedulers;

public class MetadataCallRealIntegrationShould extends BaseRealIntegrationTest {
/**
* A quick integration test that is probably flaky, but will help with finding bugs related to
Expand Down Expand Up @@ -73,9 +77,9 @@ make a debugger break point where desired (after sync complete)
//Uncomment in order to quickly test changes vs a real server, but keep it uncommented after.
//@Test
public void response_successful_on_sync_meta_data_once() throws Exception {
d2.userModule().logIn("android", "Android123").call();
d2.userModule().logIn("android", "Android123").blockingGet();

d2.syncMetaData().call();
d2.syncMetaData().blockingSubscribe();

//TODO: add aditional sync + break point.
//when debugger stops at the new break point manually change metadata online & resume.
Expand All @@ -84,32 +88,42 @@ public void response_successful_on_sync_meta_data_once() throws Exception {
// adding a new program..etc.
}

//@Test
public void download_metadata_in_io_scheduler() throws Exception {
d2.userModule().logIn("android", "Android123")
.flatMapObservable(user -> d2.syncMetaData())
.subscribeOn(Schedulers.io())
.subscribe(progress -> Log.i("META", progress.lastCall()));

Thread.sleep(60000);
}

//@Test
public void response_successful_on_sync_meta_data_two_times() throws Exception {
d2.userModule().logIn("android", "Android123").call();
d2.userModule().logIn("android", "Android123").blockingGet();

//first sync:
d2.syncMetaData().call();
d2.syncMetaData().blockingSubscribe();

//second sync:
d2.syncMetaData().call();
d2.syncMetaData().blockingSubscribe();
}

//@Test
public void response_successful_on_login_wipe_db_and_login() throws Exception {
d2.userModule().logIn("android", "Android123").call();
d2.userModule().logIn("android", "Android123").blockingGet();

d2.wipeModule().wipeEverything();

d2.userModule().logIn("android", "Android123").call();
d2.userModule().logIn("android", "Android123").blockingGet();
}

//@Test
public void response_successful_on_login_logout_and_login() throws Exception {
d2.userModule().logIn("android", "Android123").call();
d2.userModule().logIn("android", "Android123").blockingGet();

d2.userModule().logOut().call();
d2.userModule().logOut().blockingAwait();

d2.userModule().logIn("android", "Android123").call();
d2.userModule().logIn("android", "Android123").blockingGet();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@
import android.util.Log;

import org.hisp.dhis.android.core.arch.call.D2Progress;
import org.hisp.dhis.android.core.common.D2Factory;
import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest;
import org.hisp.dhis.android.core.d2manager.D2Factory;
import org.hisp.dhis.android.core.data.server.RealServerMother;
import org.hisp.dhis.android.core.trackedentity.TrackedEntityInstanceStoreImpl;
import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest;
import org.junit.Before;

import java.io.IOException;
Expand All @@ -57,12 +57,11 @@ public void setUp() throws IOException {

//@Test
public void download_tracked_entity_instances() throws Exception {
d2.userModule().logIn("android", "Android123").call();
d2.userModule().logIn("android", "Android123").blockingGet();

d2.syncMetaData().call();
d2.syncMetaData().blockingSubscribe();

TestObserver<D2Progress> testObserver = d2.trackedEntityModule().downloadTrackedEntityInstances(5, false, false)
.asObservable()
.doOnEach(e -> Log.w("EVENT", e.toString()))
.test();

Expand All @@ -71,5 +70,7 @@ public void download_tracked_entity_instances() throws Exception {
int count = TrackedEntityInstanceStoreImpl.create(databaseAdapter()).count();

assertThat(count >= 5).isTrue();

testObserver.dispose();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@

package org.hisp.dhis.android.core;

import org.hisp.dhis.android.core.common.D2Factory;
import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest;
import org.hisp.dhis.android.core.d2manager.D2Factory;
import org.hisp.dhis.android.core.data.server.RealServerMother;
import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest;
import org.junit.Before;

import java.io.IOException;
Expand All @@ -49,35 +49,35 @@ public void setUp() throws IOException {

//@Test
public void not_wipe_after_second_login_with_same_user() throws Exception {
d2.userModule().logIn("android", "Android123").call();
d2.userModule().logIn("android", "Android123").blockingGet();

d2.syncMetaData().call();
d2.syncMetaData().blockingSubscribe();

d2.userModule().logOut().call();
d2.userModule().logIn("android", "Android123").call();
d2.userModule().logOut().blockingAwait();
d2.userModule().logIn("android", "Android123").blockingGet();
}

//@Test
public void wipe_after_second_login_with_different_user() throws Exception {
d2.userModule().logIn("android", "Android123").call();
d2.userModule().logIn("android", "Android123").blockingGet();

d2.syncMetaData().call();
d2.syncMetaData().blockingSubscribe();

d2.userModule().logOut().call();
d2.userModule().logIn("admin", "district").call();
d2.userModule().logOut().blockingAwait();
d2.userModule().logIn("admin", "district").blockingGet();
}

//@Test
public void wipe_after_second_login_with_equivalent_user_in_different_server() throws Exception {
d2 = D2Factory.create("https://play.dhis2.org/2.29/api/", databaseAdapter());

d2.userModule().logIn("android", "Android123").call();
d2.userModule().logIn("android", "Android123").blockingGet();

d2.syncMetaData().call();
d2.syncMetaData().blockingSubscribe();

d2 = D2Factory.create("https://play.dhis2.org/android-current/api/", databaseAdapter());

d2.userModule().logOut().call();
d2.userModule().logIn("android", "Android123").call();
d2.userModule().logOut().blockingAwait();
d2.userModule().logIn("android", "Android123").blockingGet();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@

import com.jraska.livedata.TestObserver;

import org.hisp.dhis.android.core.arch.db.OrderByClauseBuilder;
import org.hisp.dhis.android.core.arch.db.querybuilders.internal.OrderByClauseBuilder;
import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectStore;
import org.hisp.dhis.android.core.arch.repositories.scope.RepositoryScope;
import org.hisp.dhis.android.core.category.CategoryOption;
import org.hisp.dhis.android.core.common.IdentifiableObjectStore;
import org.hisp.dhis.android.core.utils.integration.mock.BaseMockIntegrationTestFullDispatcher;
import org.hisp.dhis.android.core.utils.runner.D2JunitRunner;
import org.junit.Before;
Expand All @@ -42,7 +42,6 @@
import org.junit.rules.TestRule;
import org.junit.runner.RunWith;

import java.util.Collections;
import java.util.List;

import androidx.arch.core.executor.testing.InstantTaskExecutorRule;
Expand All @@ -57,7 +56,8 @@ public class PagingMockIntegrationShould extends BaseMockIntegrationTestFullDisp

private IdentifiableObjectStore<CategoryOption> store;
private List<CategoryOption> allValues;
private String orderByClause = OrderByClauseBuilder.orderByFromItems(Collections.emptyList());
private RepositoryScope empty = RepositoryScope.empty();
private String orderByClause = OrderByClauseBuilder.orderByFromItems(empty.orderBy(), empty.pagingKey());

@Before
public void setUp() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

package org.hisp.dhis.android.core.arch.repositories.collection;

import org.hisp.dhis.android.core.arch.handlers.SyncHandler;
import org.hisp.dhis.android.core.arch.handlers.internal.Handler;
import org.hisp.dhis.android.core.data.relationship.RelationshipTypeSamples;
import org.hisp.dhis.android.core.relationship.RelationshipType;
import org.hisp.dhis.android.core.relationship.RelationshipTypeCollectionRepository;
Expand Down Expand Up @@ -59,7 +59,7 @@ public static void setUpClass() throws Exception {

typeMap = RelationshipTypeSamples.typeMap();

SyncHandler<RelationshipType> handler = objects.d2DIComponent.relationshipTypeHandler();
Handler<RelationshipType> handler = objects.d2DIComponent.relationshipTypeHandler();

handler.handle(RELATIONSHIP_TYPE_1);
handler.handle(RELATIONSHIP_TYPE_2);
Expand All @@ -68,7 +68,7 @@ public static void setUpClass() throws Exception {
}

@Test
public void get_all_relationship_types_without_children_when_calling_get_set() {
public void get_all_relationship_types_without_children_when_calling_get() {
List<RelationshipType> types = relationshipTypeCollectionRepository.get();
assertThat(types.size()).isEqualTo(2);

Expand All @@ -79,7 +79,18 @@ public void get_all_relationship_types_without_children_when_calling_get_set() {
}

@Test
public void get_all_relationship_types_with_children_when_calling_get_set_with_children() {
public void get_all_relationship_types_without_children_when_calling_get_async() {
List<RelationshipType> types = relationshipTypeCollectionRepository.getAsync().blockingGet();
assertThat(types.size()).isEqualTo(2);

for (RelationshipType targetType: types) {
RelationshipType referenceType = typeMap.get(targetType.uid());
assertTypesWithoutConstraints(targetType, referenceType);
}
}

@Test
public void get_all_relationship_types_with_children_when_calling_get_with_children() {
List<RelationshipType> types = relationshipTypeCollectionRepository.withAllChildren().get();
assertThat(types.size()).isEqualTo(2);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

package org.hisp.dhis.android.core.arch.repositories.collection;

import org.hisp.dhis.android.core.arch.handlers.SyncHandler;
import org.hisp.dhis.android.core.arch.handlers.internal.Handler;
import org.hisp.dhis.android.core.arch.repositories.object.ReadOnlyOneObjectRepositoryFinalImpl;
import org.hisp.dhis.android.core.relationship.RelationshipType;
import org.hisp.dhis.android.core.relationship.RelationshipTypeCollectionRepository;
Expand All @@ -54,7 +54,7 @@ public class ReadOnlyIdentifiableCollectionRepositoryImplIntegrationShould exten
public static void setUpClass() throws Exception {
BaseMockIntegrationTestEmptyDispatcher.setUpClass();

SyncHandler<RelationshipType> handler = objects.d2DIComponent.relationshipTypeHandler();
Handler<RelationshipType> handler = objects.d2DIComponent.relationshipTypeHandler();

handler.handle(RELATIONSHIP_TYPE_1);
handler.handle(RELATIONSHIP_TYPE_2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@

package org.hisp.dhis.android.core.arch.repositories.collection;

import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest;
import org.hisp.dhis.android.core.relationship.RelationshipType;
import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest;

import static com.google.common.truth.Truth.assertThat;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

package org.hisp.dhis.android.core.category;
package org.hisp.dhis.android.core.category.internal;

import org.hisp.dhis.android.core.category.CategoryCategoryComboLink;
import org.hisp.dhis.android.core.category.CategoryCategoryComboLinkTableInfo;
import org.hisp.dhis.android.core.category.internal.CategoryCategoryComboLinkStore;
import org.hisp.dhis.android.core.data.category.CategoryCategoryComboLinkSamples;
import org.hisp.dhis.android.core.data.database.LinkModelStoreAbstractIntegrationShould;
import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory;
Expand Down
Loading

0 comments on commit 9217c69

Please sign in to comment.