Skip to content

Commit

Permalink
Merge pull request #1794 from dhis2/develop
Browse files Browse the repository at this point in the history
fix: [DEVELOP] Update version to 1.6.1
  • Loading branch information
vgarciabnz authored Jun 6, 2022
2 parents 60f5b67 + f32315e commit 4570de5
Show file tree
Hide file tree
Showing 91 changed files with 2,046 additions and 977 deletions.
3 changes: 1 addition & 2 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 4 additions & 5 deletions core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ ext {
buildToolsVersion: "30.0.2",
minSdkVersion : 21,
targetSdkVersion : 31,
versionCode : 260,
versionName : "1.6.0"
versionCode : 261,
versionName : "1.6.1"
]

libraries = [
Expand Down Expand Up @@ -125,6 +125,7 @@ android {
lintOptions {
// casting 'InvalidPackage' error to warning
warning "InvalidPackage"
disable 'MissingTranslation'

// Fail early.
abortOnError true
Expand All @@ -138,13 +139,11 @@ android {
}

sourceSets {
String sharedTestDir = 'src/sharedTest/java'
test {
java.srcDir sharedTestDir
resources.srcDirs += ['src/sharedTest/resources']
}
androidTest {
java.srcDirs sharedTestDir
java.srcDirs += ['src/sharedTest/java']
resources.srcDirs += ['src/sharedTest/resources']
}

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=1.6.0
VERSION_CODE=260
VERSION_NAME=1.6.1
VERSION_CODE=261

GROUP=org.hisp.dhis

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
/*
* Copyright (c) 2004-2022, University of Oslo
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* Neither the name of the HISP project nor the names of its contributors may
* be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

package org.hisp.dhis.android.core.analytics.aggregated.internal.evaluator

import com.google.common.truth.Truth.assertThat
import org.hisp.dhis.android.core.analytics.aggregated.DimensionItem
import org.hisp.dhis.android.core.common.RelativePeriod
import org.hisp.dhis.android.core.utils.integration.mock.BaseMockIntegrationTestFullDispatcher
import org.junit.Test

class AnalyticsRepositoryIntegrationShould : BaseMockIntegrationTestFullDispatcher() {

@Test
fun order_periods() {
val result = d2.analyticsModule().analytics()
.withDimension(DimensionItem.DataItem.DataElementItem("g9eOBujte1U"))
.withDimension(DimensionItem.PeriodItem.Absolute("2022"))
.withDimension(DimensionItem.PeriodItem.Absolute("202105"))
.withDimension(DimensionItem.PeriodItem.Absolute("2021"))
.blockingEvaluate()
.getOrThrow()

val valuePeriods = result.values.map { it.dimensions.last() }
assertThat(valuePeriods.size).isEqualTo(3)
assertThat(valuePeriods[0]).isEqualTo("202105")
assertThat(valuePeriods[1]).isEqualTo("2021")
assertThat(valuePeriods[2]).isEqualTo("2022")
}

@Test
fun order_relative_periods() {
val result = d2.analyticsModule().analytics()
.withDimension(DimensionItem.DataItem.DataElementItem("g9eOBujte1U"))
.withDimension(DimensionItem.PeriodItem.Relative(RelativePeriod.LAST_3_MONTHS))
.blockingEvaluate()
.getOrThrow()

val valuePeriods = result.values.map { it.dimensions.last() }
assertThat(valuePeriods.size).isEqualTo(3)
assertThat(valuePeriods[0]).isEqualTo("201909")
assertThat(valuePeriods[1]).isEqualTo("201910")
assertThat(valuePeriods[2]).isEqualTo("201911")
}

@Test
fun remove_duplicate_periods() {
val result = d2.analyticsModule().analytics()
.withDimension(DimensionItem.DataItem.DataElementItem("g9eOBujte1U"))
.withDimension(DimensionItem.PeriodItem.Absolute("2021"))
.withDimension(DimensionItem.PeriodItem.Absolute("2022"))
.withDimension(DimensionItem.PeriodItem.Absolute("2022"))
.withDimension(DimensionItem.PeriodItem.Absolute("2021"))
.blockingEvaluate()
.getOrThrow()

val valuePeriods = result.values.map { it.dimensions.last() }
assertThat(valuePeriods.size).isEqualTo(2)
assertThat(valuePeriods[0]).isEqualTo("2021")
assertThat(valuePeriods[1]).isEqualTo("2022")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ class AnalyticsVisualizationRepositoryIntegrationShould : BaseMockIntegrationTes

assertThat(result.dimensions.columns.size).isEqualTo(1)
assertThat(result.dimensions.rows.size).isEqualTo(1)
assertThat(result.dimensionItems[Dimension.Data]!!.size).isEqualTo(1)
assertThat(result.dimensionItems[Dimension.Data]!!.size).isEqualTo(2)
assertThat(result.dimensionItems[Dimension.OrganisationUnit]!!.size).isEqualTo(1)
assertThat(result.dimensionItems[Dimension.Period]!!.size).isEqualTo(3)
assertThat(result.metadata).isNotEmpty()
assertThat(result.values.size).isEqualTo(3)
}

@Test
fun evaluate_visualization_wit_periods() {
fun evaluate_visualization_with_periods() {
val result = d2.analyticsModule().visualizations()
.withVisualization(visualizationUid)
.withPeriods(listOf(DimensionItem.PeriodItem.Absolute("2018")))
Expand All @@ -65,7 +65,7 @@ class AnalyticsVisualizationRepositoryIntegrationShould : BaseMockIntegrationTes

assertThat(result.dimensions.columns.size).isEqualTo(1)
assertThat(result.dimensions.rows.size).isEqualTo(1)
assertThat(result.dimensionItems[Dimension.Data]!!.size).isEqualTo(1)
assertThat(result.dimensionItems[Dimension.Data]!!.size).isEqualTo(2)
assertThat(result.dimensionItems[Dimension.OrganisationUnit]!!.size).isEqualTo(1)
assertThat(result.dimensionItems[Dimension.Period]).isEqualTo(
listOf(
Expand All @@ -77,7 +77,30 @@ class AnalyticsVisualizationRepositoryIntegrationShould : BaseMockIntegrationTes
}

@Test
fun evaluate_visualization_wit_organisation_units() {
fun evaluate_visualization_with_unordered_periods() {
val result = d2.analyticsModule().visualizations()
.withVisualization(visualizationUid)
.withPeriods(
listOf(
DimensionItem.PeriodItem.Absolute("2022"),
DimensionItem.PeriodItem.Absolute("2022"),
DimensionItem.PeriodItem.Absolute("2021")
)
)
.blockingEvaluate()
.getOrThrow()

assertThat(result.dimensionItems[Dimension.Period]).isEqualTo(
listOf(
DimensionItem.PeriodItem.Absolute("2021"),
DimensionItem.PeriodItem.Absolute("2022")
)
)
assertThat(result.values.size).isEqualTo(2)
}

@Test
fun evaluate_visualization_with_organisation_units() {
val result = d2.analyticsModule().visualizations()
.withVisualization(visualizationUid)
.withOrganisationUnits(
Expand All @@ -90,7 +113,7 @@ class AnalyticsVisualizationRepositoryIntegrationShould : BaseMockIntegrationTes

assertThat(result.dimensions.columns.size).isEqualTo(1)
assertThat(result.dimensions.rows.size).isEqualTo(1)
assertThat(result.dimensionItems[Dimension.Data]!!.size).isEqualTo(1)
assertThat(result.dimensionItems[Dimension.Data]!!.size).isEqualTo(2)
assertThat(result.dimensionItems[Dimension.OrganisationUnit]).isEqualTo(
listOf(
DimensionItem.OrganisationUnitItem.Relative(RelativeOrganisationUnit.USER_ORGUNIT)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,13 @@ public void create_period_in_database_if_not_exist() throws ParseException {

@Test
public void get_periods() {
assertThat(d2.periodModule().periods().blockingCount()).isEqualTo(203);
assertThat(d2.periodModule().periods().blockingCount()).isEqualTo(206);
}

@Test
public void ensure_future_periods_are_downloaded() {
int MONTHLY_PERIODS = 11; // Copy from ParentPeriodGeneratorImpl to keep it private
assertThat(d2.periodModule().periods().byPeriodType().eq(PeriodType.Monthly).blockingCount())
.isEqualTo(MONTHLY_PERIODS + 3);
.isEqualTo(MONTHLY_PERIODS + 4);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,31 +26,21 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

package org.hisp.dhis.android.core.visualization;
package org.hisp.dhis.android.core.program.internal

import org.hisp.dhis.android.core.common.BaseObjectShould;
import org.hisp.dhis.android.core.common.ObjectShould;
import org.hisp.dhis.android.core.data.visualization.VisualizationSamples;
import org.junit.Test;
import com.google.common.truth.Truth
import org.hisp.dhis.android.core.utils.integration.mock.BaseMockIntegrationTestFullDispatcher
import org.hisp.dhis.android.core.utils.runner.D2JunitRunner
import org.junit.Test
import org.junit.runner.RunWith

import java.io.IOException;
import java.text.ParseException;

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

public class VisualizationSimplifiedShould extends BaseObjectShould implements ObjectShould {

public VisualizationSimplifiedShould() {
super("visualization/visualization_simplified.json");
}

@Override
@RunWith(D2JunitRunner::class)
class ProgramIndicatorUidsSeekerMockIntegrationShould : BaseMockIntegrationTestFullDispatcher() {
@Test
public void map_from_json_string() throws IOException, ParseException {
Visualization jsonVisualization = objectMapper.readValue(jsonStream, Visualization.class)
.toBuilder().id(null).build();
Visualization expectedVisualization = VisualizationSamples.visualization()
.toBuilder().id(null).build();
assertThat(jsonVisualization).isEqualTo(expectedVisualization);
fun seek_programIndicator_uids() {
val programIndicatorsUids = ProgramIndicatorUidsSeeker(databaseAdapter).seekUids()
Truth.assertThat(programIndicatorsUids.size).isEqualTo(2)
Truth.assertThat(programIndicatorsUids.contains("p2Zxg0wcPQ3")).isTrue()
Truth.assertThat(programIndicatorsUids.contains("GSae40Fyppf")).isTrue()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class ForeignKeyViolationCollectionRepositoryMockIntegrationShould extend
@Test
public void find_all() {
List<ForeignKeyViolation> foreignKeyViolations = d2.maintenanceModule().foreignKeyViolations().blockingGet();
assertThat(foreignKeyViolations.size()).isEqualTo(3);
assertThat(foreignKeyViolations.size()).isEqualTo(4);
}

@Test
Expand Down Expand Up @@ -74,7 +74,7 @@ public void filter_by_to_table() {
public void filter_by_to_column() {
List<ForeignKeyViolation> foreignKeyViolations = d2.maintenanceModule().foreignKeyViolations()
.byToColumn().eq("uid").blockingGet();
assertThat(foreignKeyViolations.size()).isEqualTo(2);
assertThat(foreignKeyViolations.size()).isEqualTo(3);
}

@Test
Expand Down Expand Up @@ -102,6 +102,6 @@ public void filter_by_from_object_row() {
public void filter_by_created() throws ParseException {
List<ForeignKeyViolation> foreignKeyViolations = d2.maintenanceModule().foreignKeyViolations()
.byCreated().after(BaseIdentifiableObject.parseDate("2019-01-15T08:14:06.767")).blockingGet();
assertThat(foreignKeyViolations.size()).isEqualTo(3);
assertThat(foreignKeyViolations.size()).isEqualTo(4);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public class MaintenanceMockIntegrationShould extends BaseMockIntegrationTestFul
@Test
public void allow_access_to_foreign_key_violations() {
List<ForeignKeyViolation> violations = d2.maintenanceModule().foreignKeyViolations().blockingGet();
assertThat(violations.size()).isEqualTo(3);
assertThat(violations.size()).isEqualTo(4);

ForeignKeyViolation categoryOptionComboViolation = ForeignKeyViolation.builder()
.toTable(CategoryOptionTableInfo.TABLE_INFO.name())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public void filter_by_expression() {
List<ProgramIndicator> indicators =
d2.programModule().programIndicators()
.byExpression()
.eq("d2:yearsBetween(A{iESIqZ0R0R0},V{event_date})")
.eq("1")
.blockingGet();

assertThat(indicators.size()).isEqualTo(1);
Expand Down Expand Up @@ -153,10 +153,10 @@ public void include_legend_sets_as_children() {
public void include_analytics_period_boundaries_as_children() {
ProgramIndicator programIndicators = d2.programModule().programIndicators()
.withAnalyticsPeriodBoundaries().one().blockingGet();
assertThat(programIndicators.analyticsPeriodBoundaries().size()).isEqualTo(3);
assertThat(programIndicators.analyticsPeriodBoundaries().size()).isEqualTo(2);
assertThat(programIndicators.analyticsPeriodBoundaries().get(0).offsetPeriodType()).
isEqualTo(PeriodType.SixMonthly);
assertThat(programIndicators.analyticsPeriodBoundaries().get(1).analyticsPeriodBoundaryType())
.isEqualTo(AnalyticsPeriodBoundaryType.BEFORE_START_OF_REPORTING_PERIOD);
.isEqualTo(AnalyticsPeriodBoundaryType.BEFORE_END_OF_REPORTING_PERIOD);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* Copyright (c) 2004-2022, University of Oslo
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* Neither the name of the HISP project nor the names of its contributors may
* be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.hisp.dhis.android.testapp.trackedentity.search

import com.google.common.truth.Truth.assertThat
import org.hisp.dhis.android.core.utils.integration.mock.BaseMockIntegrationTestMetadataEnqueable
import org.hisp.dhis.android.core.utils.runner.D2JunitRunner
import org.junit.Test
import org.junit.runner.RunWith

@RunWith(D2JunitRunner::class)
class TrackedEntityInstanceQueryCollectionRepositoryMockEnqueableIntegrationShould :
BaseMockIntegrationTestMetadataEnqueable() {

@Test
fun find_online_blocking() {
dhis2MockServer.enqueueMockResponse("trackedentity/search_grid.json")

val trackedEntityInstances = d2.trackedEntityModule().trackedEntityInstanceQuery()
.onlineOnly()
.blockingGet()

assertThat(trackedEntityInstances.size).isEqualTo(2)
}
}
Loading

0 comments on commit 4570de5

Please sign in to comment.